palmier 1.1.21 → 1.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -19
- package/dist/agent-tools.d.ts +1 -1
- package/dist/agent-tools.js +36 -48
- package/dist/agents/agent-instructions.md +3 -1
- package/dist/agents/agent.d.ts +3 -8
- package/dist/agents/agent.js +0 -1
- package/dist/agents/aider.js +2 -7
- package/dist/agents/claude.js +2 -11
- package/dist/agents/cline.js +2 -7
- package/dist/agents/codex.js +2 -4
- package/dist/agents/copilot.js +2 -10
- package/dist/agents/cursor.js +2 -7
- package/dist/agents/deepagents.js +2 -7
- package/dist/agents/droid.js +2 -7
- package/dist/agents/goose.js +2 -4
- package/dist/agents/grok.js +2 -7
- package/dist/agents/hermes.js +2 -7
- package/dist/agents/kimi.js +2 -6
- package/dist/agents/kiro.js +2 -7
- package/dist/agents/openclaw.js +1 -1
- package/dist/agents/opencode.js +2 -7
- package/dist/agents/qoder.js +2 -7
- package/dist/agents/qwen.js +2 -4
- package/dist/agents/shared-prompt.js +3 -8
- package/dist/agents/wizard.js +0 -1
- package/dist/commands/pair.js +2 -4
- package/dist/commands/run.js +3 -15
- package/dist/commands/serve.js +5 -6
- package/dist/index.js +0 -22
- package/dist/nats-client.d.ts +1 -1
- package/dist/nats-client.js +1 -1
- package/dist/password-store.d.ts +1 -3
- package/dist/password-store.js +1 -7
- package/dist/pwa/assets/index-BPB3G_2J.css +1 -0
- package/dist/pwa/assets/{index-rqAuAC0q.js → index-De8hDN5I.js} +42 -46
- package/dist/pwa/assets/{web-ew6AFUex.js → web-BQ0rMZ_X.js} +1 -1
- package/dist/pwa/assets/{web-DQDmufih.js → web-miCfAJBc.js} +1 -1
- package/dist/pwa/assets/{web-Dp5Zj6HJ.js → web-o_D8jqAS.js} +1 -1
- package/dist/pwa/index.html +2 -2
- package/dist/rpc-handler.js +14 -15
- package/dist/task.d.ts +10 -0
- package/dist/task.js +42 -0
- package/dist/transports/http-transport.d.ts +1 -1
- package/dist/transports/http-transport.js +1 -3
- package/dist/transports/nats-transport.d.ts +1 -1
- package/dist/transports/nats-transport.js +3 -5
- package/dist/types.d.ts +0 -2
- package/package.json +2 -2
- package/dist/commands/passwords.d.ts +0 -3
- package/dist/commands/passwords.js +0 -25
- package/dist/pwa/assets/index-ByB7B0d2.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var lS=Object.defineProperty;var oS=(e,t,r)=>t in e?lS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var A=(e,t,r)=>oS(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
|
|
1
|
+
var lS=Object.defineProperty;var oS=(e,t,r)=>t in e?lS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var A=(e,t,r)=>oS(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:{}},bl={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ var lS=Object.defineProperty;var oS=(e,t,r)=>t in e?lS(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
|
|
9
|
+
*/var Zy;function uS(){if(Zy)return bl;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 bl.Fragment=t,bl.jsx=r,bl.jsxs=r,bl}var Wy;function cS(){return Wy||(Wy=1,hh.exports=uS()),hh.exports}var y=cS(),dh={exports:{}},Ze={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react.production.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ var lS=Object.defineProperty;var oS=(e,t,r)=>t in e?lS(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
|
|
17
|
+
*/var e0;function fS(){if(e0)return Ze;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"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function v(L){return L===null||typeof L!="object"?null:(L=x&&L[x]||L["@@iterator"],typeof L=="function"?L:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,D={};function M(L,X,N){this.props=L,this.context=X,this.refs=D,this.updater=N||S}M.prototype.isReactComponent={},M.prototype.setState=function(L,X){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,X,"setState")},M.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function R(){}R.prototype=M.prototype;function I(L,X,N){this.props=L,this.context=X,this.refs=D,this.updater=N||S}var ue=I.prototype=new R;ue.constructor=I,j(ue,M.prototype),ue.isPureReactComponent=!0;var B=Array.isArray;function P(){}var ee={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function H(L,X,N){var ve=N.ref;return{$$typeof:e,type:L,key:X,ref:ve!==void 0?ve:null,props:N}}function z(L,X){return H(L.type,X,L.props)}function K(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function F(L){var X={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(N){return X[N]})}var oe=/\/+/g;function te(L,X){return typeof L=="object"&&L!==null&&L.key!=null?F(""+L.key):X.toString(36)}function W(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(P,P):(L.status="pending",L.then(function(X){L.status==="pending"&&(L.status="fulfilled",L.value=X)},function(X){L.status==="pending"&&(L.status="rejected",L.reason=X)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function V(L,X,N,ve,Ae){var Ee=typeof L;(Ee==="undefined"||Ee==="boolean")&&(L=null);var le=!1;if(L===null)le=!0;else switch(Ee){case"bigint":case"string":case"number":le=!0;break;case"object":switch(L.$$typeof){case e:case t:le=!0;break;case b:return le=L._init,V(le(L._payload),X,N,ve,Ae)}}if(le)return Ae=Ae(L),le=ve===""?"."+te(L,0):ve,B(Ae)?(N="",le!=null&&(N=le.replace(oe,"$&/")+"/"),V(Ae,X,N,"",function(Fe){return Fe})):Ae!=null&&(K(Ae)&&(Ae=z(Ae,N+(Ae.key==null||L&&L.key===Ae.key?"":(""+Ae.key).replace(oe,"$&/")+"/")+le)),X.push(Ae)),1;le=0;var Re=ve===""?".":ve+":";if(B(L))for(var _e=0;_e<L.length;_e++)ve=L[_e],Ee=Re+te(ve,_e),le+=V(ve,X,N,Ee,Ae);else if(_e=v(L),typeof _e=="function")for(L=_e.call(L),_e=0;!(ve=L.next()).done;)ve=ve.value,Ee=Re+te(ve,_e++),le+=V(ve,X,N,Ee,Ae);else if(Ee==="object"){if(typeof L.then=="function")return V(W(L),X,N,ve,Ae);throw X=String(L),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return le}function J(L,X,N){if(L==null)return L;var ve=[],Ae=0;return V(L,ve,"","",function(Ee){return X.call(N,Ee,Ae++)}),ve}function ce(L){if(L._status===-1){var X=L._result;X=X(),X.then(function(N){(L._status===0||L._status===-1)&&(L._status=1,L._result=N)},function(N){(L._status===0||L._status===-1)&&(L._status=2,L._result=N)}),L._status===-1&&(L._status=0,L._result=X)}if(L._status===1)return L._result.default;throw L._result}var ke=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},C={map:J,forEach:function(L,X,N){J(L,function(){X.apply(this,arguments)},N)},count:function(L){var X=0;return J(L,function(){X++}),X},toArray:function(L){return J(L,function(X){return X})||[]},only:function(L){if(!K(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Ze.Activity=g,Ze.Children=C,Ze.Component=M,Ze.Fragment=r,Ze.Profiler=l,Ze.PureComponent=I,Ze.StrictMode=s,Ze.Suspense=d,Ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ee,Ze.__COMPILER_RUNTIME={__proto__:null,c:function(L){return ee.H.useMemoCache(L)}},Ze.cache=function(L){return function(){return L.apply(null,arguments)}},Ze.cacheSignal=function(){return null},Ze.cloneElement=function(L,X,N){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var ve=j({},L.props),Ae=L.key;if(X!=null)for(Ee in X.key!==void 0&&(Ae=""+X.key),X)!G.call(X,Ee)||Ee==="key"||Ee==="__self"||Ee==="__source"||Ee==="ref"&&X.ref===void 0||(ve[Ee]=X[Ee]);var Ee=arguments.length-2;if(Ee===1)ve.children=N;else if(1<Ee){for(var le=Array(Ee),Re=0;Re<Ee;Re++)le[Re]=arguments[Re+2];ve.children=le}return H(L.type,Ae,ve)},Ze.createContext=function(L){return L={$$typeof:c,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:o,_context:L},L},Ze.createElement=function(L,X,N){var ve,Ae={},Ee=null;if(X!=null)for(ve in X.key!==void 0&&(Ee=""+X.key),X)G.call(X,ve)&&ve!=="key"&&ve!=="__self"&&ve!=="__source"&&(Ae[ve]=X[ve]);var le=arguments.length-2;if(le===1)Ae.children=N;else if(1<le){for(var Re=Array(le),_e=0;_e<le;_e++)Re[_e]=arguments[_e+2];Ae.children=Re}if(L&&L.defaultProps)for(ve in le=L.defaultProps,le)Ae[ve]===void 0&&(Ae[ve]=le[ve]);return H(L,Ee,Ae)},Ze.createRef=function(){return{current:null}},Ze.forwardRef=function(L){return{$$typeof:f,render:L}},Ze.isValidElement=K,Ze.lazy=function(L){return{$$typeof:b,_payload:{_status:-1,_result:L},_init:ce}},Ze.memo=function(L,X){return{$$typeof:m,type:L,compare:X===void 0?null:X}},Ze.startTransition=function(L){var X=ee.T,N={};ee.T=N;try{var ve=L(),Ae=ee.S;Ae!==null&&Ae(N,ve),typeof ve=="object"&&ve!==null&&typeof ve.then=="function"&&ve.then(P,ke)}catch(Ee){ke(Ee)}finally{X!==null&&N.types!==null&&(X.types=N.types),ee.T=X}},Ze.unstable_useCacheRefresh=function(){return ee.H.useCacheRefresh()},Ze.use=function(L){return ee.H.use(L)},Ze.useActionState=function(L,X,N){return ee.H.useActionState(L,X,N)},Ze.useCallback=function(L,X){return ee.H.useCallback(L,X)},Ze.useContext=function(L){return ee.H.useContext(L)},Ze.useDebugValue=function(){},Ze.useDeferredValue=function(L,X){return ee.H.useDeferredValue(L,X)},Ze.useEffect=function(L,X){return ee.H.useEffect(L,X)},Ze.useEffectEvent=function(L){return ee.H.useEffectEvent(L)},Ze.useId=function(){return ee.H.useId()},Ze.useImperativeHandle=function(L,X,N){return ee.H.useImperativeHandle(L,X,N)},Ze.useInsertionEffect=function(L,X){return ee.H.useInsertionEffect(L,X)},Ze.useLayoutEffect=function(L,X){return ee.H.useLayoutEffect(L,X)},Ze.useMemo=function(L,X){return ee.H.useMemo(L,X)},Ze.useOptimistic=function(L,X){return ee.H.useOptimistic(L,X)},Ze.useReducer=function(L,X,N){return ee.H.useReducer(L,X,N)},Ze.useRef=function(L){return ee.H.useRef(L)},Ze.useState=function(L){return ee.H.useState(L)},Ze.useSyncExternalStore=function(L,X,N){return ee.H.useSyncExternalStore(L,X,N)},Ze.useTransition=function(){return ee.H.useTransition()},Ze.version="19.2.4",Ze}var t0;function Nd(){return t0||(t0=1,dh.exports=fS()),dh.exports}var E=Nd(),mh={exports:{}},xl={},ph={exports:{}},gh={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var lS=Object.defineProperty;var oS=(e,t,r)=>t in e?lS(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
|
|
25
|
+
*/var n0;function hS(){return n0||(n0=1,(function(e){function t(V,J){var ce=V.length;V.push(J);e:for(;0<ce;){var ke=ce-1>>>1,C=V[ke];if(0<l(C,J))V[ke]=J,V[ce]=C,ce=ke;else break e}}function r(V){return V.length===0?null:V[0]}function s(V){if(V.length===0)return null;var J=V[0],ce=V.pop();if(ce!==J){V[0]=ce;e:for(var ke=0,C=V.length,L=C>>>1;ke<L;){var X=2*(ke+1)-1,N=V[X],ve=X+1,Ae=V[ve];if(0>l(N,ce))ve<C&&0>l(Ae,N)?(V[ke]=Ae,V[ve]=ce,ke=ve):(V[ke]=N,V[X]=ce,ke=X);else if(ve<C&&0>l(Ae,ce))V[ke]=Ae,V[ve]=ce,ke=ve;else break e}}return J}function l(V,J){var ce=V.sortIndex-J.sortIndex;return ce!==0?ce:V.id-J.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=[],b=1,g=null,x=3,v=!1,S=!1,j=!1,D=!1,M=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function ue(V){for(var J=r(m);J!==null;){if(J.callback===null)s(m);else if(J.startTime<=V)s(m),J.sortIndex=J.expirationTime,t(d,J);else break;J=r(m)}}function B(V){if(j=!1,ue(V),!S)if(r(d)!==null)S=!0,P||(P=!0,F());else{var J=r(m);J!==null&&W(B,J.startTime-V)}}var P=!1,ee=-1,G=5,H=-1;function z(){return D?!0:!(e.unstable_now()-H<G)}function K(){if(D=!1,P){var V=e.unstable_now();H=V;var J=!0;try{e:{S=!1,j&&(j=!1,R(ee),ee=-1),v=!0;var ce=x;try{t:{for(ue(V),g=r(d);g!==null&&!(g.expirationTime>V&&z());){var ke=g.callback;if(typeof ke=="function"){g.callback=null,x=g.priorityLevel;var C=ke(g.expirationTime<=V);if(V=e.unstable_now(),typeof C=="function"){g.callback=C,ue(V),J=!0;break t}g===r(d)&&s(d),ue(V)}else s(d);g=r(d)}if(g!==null)J=!0;else{var L=r(m);L!==null&&W(B,L.startTime-V),J=!1}}break e}finally{g=null,x=ce,v=!1}J=void 0}}finally{J?F():P=!1}}}var F;if(typeof I=="function")F=function(){I(K)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,te=oe.port2;oe.port1.onmessage=K,F=function(){te.postMessage(null)}}else F=function(){M(K,0)};function W(V,J){ee=M(function(){V(e.unstable_now())},J)}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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(V){switch(x){case 1:case 2:case 3:var J=3;break;default:J=x}var ce=x;x=J;try{return V()}finally{x=ce}},e.unstable_requestPaint=function(){D=!0},e.unstable_runWithPriority=function(V,J){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var ce=x;x=V;try{return J()}finally{x=ce}},e.unstable_scheduleCallback=function(V,J,ce){var ke=e.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?ke+ce:ke):ce=ke,V){case 1:var C=-1;break;case 2:C=250;break;case 5:C=1073741823;break;case 4:C=1e4;break;default:C=5e3}return C=ce+C,V={id:b++,callback:J,priorityLevel:V,startTime:ce,expirationTime:C,sortIndex:-1},ce>ke?(V.sortIndex=ce,t(m,V),r(d)===null&&V===r(m)&&(j?(R(ee),ee=-1):j=!0,W(B,ce-ke))):(V.sortIndex=C,t(d,V),S||v||(S=!0,P||(P=!0,F()))),V},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(V){var J=x;return function(){var ce=x;x=J;try{return V.apply(this,arguments)}finally{x=ce}}}})(gh)),gh}var r0;function dS(){return r0||(r0=1,ph.exports=hS()),ph.exports}var yh={exports:{}},wn={};/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.js
|
|
28
28
|
*
|
|
@@ -30,7 +30,7 @@ var lS=Object.defineProperty;var oS=(e,t,r)=>t in e?lS(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
|
|
33
|
+
*/var i0;function mS(){if(i0)return wn;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 b=2;b<arguments.length;b++)m+="&args[]="+encodeURIComponent(arguments[b])}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,b){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:b}}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 wn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,wn.createPortal=function(d,m){var b=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,b)},wn.flushSync=function(d){var m=c.T,b=s.p;try{if(c.T=null,s.p=2,d)return d()}finally{c.T=m,s.p=b,s.d.f()}},wn.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))},wn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},wn.preinit=function(d,m){if(typeof d=="string"&&m&&typeof m.as=="string"){var b=m.as,g=f(b,m.crossOrigin),x=typeof m.integrity=="string"?m.integrity:void 0,v=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;b==="style"?s.d.S(d,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:v}):b==="script"&&s.d.X(d,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},wn.preinitModule=function(d,m){if(typeof d=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var b=f(m.as,m.crossOrigin);s.d.M(d,{crossOrigin:b,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)},wn.preload=function(d,m){if(typeof d=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var b=m.as,g=f(b,m.crossOrigin);s.d.L(d,b,{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})}},wn.preloadModule=function(d,m){if(typeof d=="string")if(m){var b=f(m.as,m.crossOrigin);s.d.m(d,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else s.d.m(d)},wn.requestFormReset=function(d){s.d.r(d)},wn.unstable_batchedUpdates=function(d,m){return d(m)},wn.useFormState=function(d,m,b){return c.H.useFormState(d,m,b)},wn.useFormStatus=function(){return c.H.useHostTransitionStatus()},wn.version="19.2.4",wn}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=mS(),yh.exports}/**
|
|
34
34
|
* @license React
|
|
35
35
|
* react-dom-client.production.js
|
|
36
36
|
*
|
|
@@ -38,15 +38,15 @@ var lS=Object.defineProperty;var oS=(e,t,r)=>t in e?lS(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
|
|
41
|
+
*/var a0;function pS(){if(a0)return xl;a0=1;var e=dS(),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 b(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n;for(n=n.child;n!==null;){if(i=b(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"),M=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),I=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function F(n){return n===null||typeof n!="object"?null:(n=K&&n[K]||n["@@iterator"],typeof n=="function"?n:null)}var oe=Symbol.for("react.client.reference");function te(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===oe?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case j:return"Fragment";case M:return"Profiler";case D:return"StrictMode";case B:return"Suspense";case P:return"SuspenseList";case H:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case S:return"Portal";case I:return n.displayName||"Context";case R:return(n._context.displayName||"Context")+".Consumer";case ue:var i=n.render;return n=n.displayName,n||(n=i.displayName||i.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ee:return i=n.displayName||null,i!==null?i:te(n.type)||"Memo";case G:i=n._payload,n=n._init;try{return te(n(i))}catch{}}return null}var W=Array.isArray,V=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},ke=[],C=-1;function L(n){return{current:n}}function X(n){0>C||(n.current=ke[C],ke[C]=null,C--)}function N(n,i){C++,ke[C]=n.current,n.current=i}var ve=L(null),Ae=L(null),Ee=L(null),le=L(null);function Re(n,i){switch(N(Ee,i),N(Ae,n),N(ve,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}}X(ve),N(ve,n)}function _e(){X(ve),X(Ae),X(Ee)}function Fe(n){n.memoizedState!==null&&N(le,n);var i=ve.current,a=Sy(i,n.type);i!==a&&(N(Ae,n),N(ve,a))}function Ht(n){Ae.current===n&&(X(ve),X(Ae)),le.current===n&&(X(le),ml._currentValue=ce)}var Rt,Qt;function zt(n){if(Rt===void 0)try{throw Error()}catch(a){var i=a.stack.trim().match(/\n( *(at )?)/);Rt=i&&i[1]||"",Qt=-1<a.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+
|
|
43
|
+
`+Rt+n+Qt}var tn=!1;function Yt(n,i){if(!n||tn)return"";tn=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(i){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(ae){var ie=ae}Reflect.construct(n,[],ye)}else{try{ye.call()}catch(ae){ie=ae}n.call(ye.prototype)}}else{try{throw Error()}catch(ae){ie=ae}(ye=n())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(ae){if(ae&&ie&&typeof ae.stack=="string")return[ae.stack,ie.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 q=w.split(`
|
|
44
44
|
`),re=_.split(`
|
|
45
45
|
`);for(h=u=0;u<q.length&&!q[u].includes("DetermineComponentFrameRoot");)u++;for(;h<re.length&&!re[h].includes("DetermineComponentFrameRoot");)h++;if(u===q.length||h===re.length)for(u=q.length-1,h=re.length-1;1<=u&&0<=h&&q[u]!==re[h];)h--;for(;1<=u&&0<=h;u--,h--)if(q[u]!==re[h]){if(u!==1||h!==1)do if(u--,h--,0>h||q[u]!==re[h]){var de=`
|
|
46
|
-
`+q[u].replace(" at new "," at ");return n.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",n.displayName)),de}while(1<=u&&0<=h);break}}}finally{
|
|
46
|
+
`+q[u].replace(" at new "," at ");return n.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",n.displayName)),de}while(1<=u&&0<=h);break}}}finally{tn=!1,Error.prepareStackTrace=a}return(a=n?n.displayName||n.name:"")?zt(a):""}function nn(n,i){switch(n.tag){case 26:case 27:case 5:return zt(n.type);case 16:return zt("Lazy");case 13:return n.child!==i&&i!==null?zt("Suspense Fallback"):zt("Suspense");case 19:return zt("SuspenseList");case 0:case 15:return Yt(n.type,!1);case 11:return Yt(n.type.render,!1);case 1:return Yt(n.type,!0);case 31:return zt("Activity");default:return""}}function Ke(n){try{var i="",a=null;do i+=nn(n,a),a=n,n=n.return;while(n);return i}catch(u){return`
|
|
47
47
|
Error generating stack: `+u.message+`
|
|
48
|
-
`+u.stack}}var tt=Object.prototype.hasOwnProperty,st=e.unstable_scheduleCallback,Mt=e.unstable_cancelCallback,kt=e.unstable_shouldYield,pn=e.unstable_requestPaint,at=e.unstable_now,or=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,Be=e.unstable_NormalPriority,Ke=e.unstable_LowPriority,Ie=e.unstable_IdlePriority,zt=e.log,Xt=e.unstable_setDisableYieldValue,Qt=null,mt=null;function Bt(n){if(typeof zt=="function"&&Xt(n),mt&&typeof mt.setStrictMode=="function")try{mt.setStrictMode(Qt,n)}catch{}}var ht=Math.clz32?Math.clz32:kr,gn=Math.log,ln=Math.LN2;function kr(n){return n>>>=0,n===0?32:31-(gn(n)/ln|0)|0}var ve=256,Xe=262144,Oe=4194304;function pt(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 on(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=pt(u):(w&=_,w!==0?h=pt(w):a||(a=_&~n,a!==0&&(h=pt(a))))):(_=u&~p,_!==0?h=pt(_):w!==0?h=pt(w):a||(a=u&~n,a!==0&&(h=pt(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 ur(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function Jr(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 Si(){var n=Oe;return Oe<<=1,(Oe&62914560)===0&&(Oe=4194304),n}function zr(n){for(var i=[],a=0;31>a;a++)i.push(n);return i}function Tn(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ur(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,q=n.expirationTimes,re=n.hiddenUpdates;for(a=w&~a;0<a;){var de=31-ht(a),ye=1<<de;_[de]=0,q[de]=-1;var ie=re[de];if(ie!==null)for(re[de]=null,de=0;de<ie.length;de++){var ae=ie[de];ae!==null&&(ae.lane&=-536870913)}a&=~ye}u!==0&&he(n,u,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(w&~i))}function he(n,i,a){n.pendingLanes|=i,n.suspendedLanes&=~i;var u=31-ht(i);n.entangledLanes|=i,n.entanglements[u]=n.entanglements[u]|1073741824|a&261930}function Ae(n,i){var a=n.entangledLanes|=i;for(n=n.entanglements;a;){var u=31-ht(a),h=1<<u;h&i|n[u]&i&&(n[u]|=i),a&=~h}}function De(n,i){var a=i&-i;return a=(a&42)!==0?1:Ge(a),(a&(n.suspendedLanes|i))!==0?0:a}function Ge(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 Ve(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function gt(){var n=K.p;return n!==0?n:(n=window.event,n===void 0?32:Yy(n.type))}function nt(n,i){var a=K.p;try{return K.p=n,i()}finally{K.p=a}}var He=Math.random().toString(36).slice(2),Ue="__reactFiber$"+He,rt="__reactProps$"+He,xt="__reactContainer$"+He,$t="__reactEvents$"+He,Un="__reactListeners$"+He,ns="__reactHandles$"+He,rs="__reactResources$"+He,Zt="__reactMarker$"+He;function Xr(n){delete n[Ue],delete n[rt],delete n[$t],delete n[Un],delete n[ns]}function C(n){var i=n[Ue];if(i)return i;for(var a=n.parentNode;a;){if(i=a[xt]||a[Ue]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(n=Ty(n);n!==null;){if(a=n[Ue])return a;n=Ty(n)}return i}n=a,a=n.parentNode}return null}function T(n){if(n=n[Ue]||n[xt]){var i=n.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return n}return null}function R(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n.stateNode;throw Error(s(33))}function U(n){var i=n[rs];return i||(i=n[rs]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function $(n){n[Zt]=!0}var Z=new Set,ge={};function xe(n,i){se(n,i),se(n+"Capture",i)}function se(n,i){for(ge[n]=i,n=0;n<i.length;n++)Z.add(i[n])}var pe=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]*$"),Le={},it={};function Ht(n){return tt.call(it,n)?!0:tt.call(Le,n)?!1:pe.test(n)?it[n]=!0:(Le[n]=!0,!1)}function kn(n,i,a){if(Ht(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 Er(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 Kr(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 cr(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function mm(n){var i=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function ev(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=mm(n)?"checked":"value";n._valueTracker=ev(n,i,""+n[i])}}function pm(n){if(!n)return!1;var i=n._valueTracker;if(!i)return!0;var a=i.getValue(),u="";return n&&(u=mm(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 tv=/[\n"\\]/g;function fr(n){return n.replace(tv,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=""+cr(i)):n.value!==""+cr(i)&&(n.value=""+cr(i)):w!=="submit"&&w!=="reset"||n.removeAttribute("value"),i!=null?ac(n,w,cr(i)):a!=null?ac(n,w,cr(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=""+cr(_):n.removeAttribute("name")}function gm(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?""+cr(a):"",i=i!=null?""+cr(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 As(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=""+cr(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 ym(n,i,a){if(i!=null&&(i=""+cr(i),i!==n.value&&(n.value=i),a==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=a!=null?""+cr(a):""}function bm(n,i,a,u){if(i==null){if(u!=null){if(a!=null)throw Error(s(92));if(W(u)){if(1<u.length)throw Error(s(93));u=u[0]}a=u}a==null&&(a=""),i=a}a=cr(i),n.defaultValue=a,u=n.textContent,u===a&&u!==""&&u!==null&&(n.value=u),ic(n)}function js(n,i){if(i){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=i;return}}n.textContent=i}var nv=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 xm(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||nv.has(i)?i==="float"?n.cssFloat=a:n[i]=(""+a).trim():n[i]=a+"px"}function vm(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&&xm(n,h,u)}else for(var p in i)i.hasOwnProperty(p)&&xm(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 rv=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"]]),iv=/^[\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 iv.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Qr(){}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 Ns=null,Ts=null;function wm(n){var i=T(n);if(i&&(n=i.stateNode)){var a=n[rt]||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="'+fr(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var u=a[i];if(u!==n&&u.form===n.form){var h=u[rt]||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&&pm(u)}break e;case"textarea":ym(n,a.value,a.defaultValue);break e;case"select":i=a.value,i!=null&&As(n,!!a.multiple,i,!1)}}}var cc=!1;function Sm(n,i,a){if(cc)return n(i,a);cc=!0;try{var u=n(i);return u}finally{if(cc=!1,(Ns!==null||Ts!==null)&&(Io(),Ns&&(i=Ns,n=Ts,Ts=Ns=null,wm(i),n)))for(i=0;i<n.length;i++)wm(n[i])}}function Oa(n,i){var a=n.stateNode;if(a===null)return null;var u=a[rt]||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 Zr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fc=!1;if(Zr)try{var Ra={};Object.defineProperty(Ra,"passive",{get:function(){fc=!0}}),window.addEventListener("test",Ra,Ra),window.removeEventListener("test",Ra,Ra)}catch{fc=!1}var _i=null,hc=null,to=null;function _m(){if(to)return to;var n,i=hc,a=i.length,u,h="value"in _i?_i.value:_i.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 km(){return!1}function Pn(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:km,this.isPropagationStopped=km,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 is={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},io=Pn(is),Ma=g({},is,{view:0,detail:0}),sv=Pn(Ma),dc,mc,Da,so=g({},Ma,{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!==Da&&(Da&&n.type==="mousemove"?(dc=n.screenX-Da.screenX,mc=n.screenY-Da.screenY):mc=dc=0,Da=n),dc)},movementY:function(n){return"movementY"in n?n.movementY:mc}}),Em=Pn(so),av=g({},so,{dataTransfer:0}),lv=Pn(av),ov=g({},Ma,{relatedTarget:0}),pc=Pn(ov),uv=g({},is,{animationName:0,elapsedTime:0,pseudoElement:0}),cv=Pn(uv),fv=g({},is,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),hv=Pn(fv),dv=g({},is,{data:0}),Cm=Pn(dv),mv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pv={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"},gv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yv(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=gv[n])?!!i[n]:!1}function gc(){return yv}var bv=g({},Ma,{key:function(n){if(n.key){var i=mv[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"?pv[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}}),xv=Pn(bv),vv=g({},so,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Am=Pn(vv),wv=g({},Ma,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),Sv=Pn(wv),_v=g({},is,{propertyName:0,elapsedTime:0,pseudoElement:0}),kv=Pn(_v),Ev=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}),Cv=Pn(Ev),Av=g({},is,{newState:0,oldState:0}),jv=Pn(Av),Nv=[9,13,27,32],yc=Zr&&"CompositionEvent"in window,La=null;Zr&&"documentMode"in document&&(La=document.documentMode);var Tv=Zr&&"TextEvent"in window&&!La,jm=Zr&&(!yc||La&&8<La&&11>=La),Nm=" ",Tm=!1;function Om(n,i){switch(n){case"keyup":return Nv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rm(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Os=!1;function Ov(n,i){switch(n){case"compositionend":return Rm(i);case"keypress":return i.which!==32?null:(Tm=!0,Nm);case"textInput":return n=i.data,n===Nm&&Tm?null:n;default:return null}}function Rv(n,i){if(Os)return n==="compositionend"||!yc&&Om(n,i)?(n=_m(),to=hc=_i=null,Os=!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 jm&&i.locale!=="ko"?null:i.data;default:return null}}var Mv={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 Mm(n){var i=n&&n.nodeName&&n.nodeName.toLowerCase();return i==="input"?!!Mv[n.type]:i==="textarea"}function Dm(n,i,a,u){Ns?Ts?Ts.push(u):Ts=[u]:Ns=u,i=Xo(i,"onChange"),0<i.length&&(a=new io("onChange","change",null,a,u),n.push({event:a,listeners:i}))}var za=null,Ua=null;function Dv(n){gy(n,0)}function ao(n){var i=R(n);if(pm(i))return n}function Lm(n,i){if(n==="change")return i}var zm=!1;if(Zr){var bc;if(Zr){var xc="oninput"in document;if(!xc){var Um=document.createElement("div");Um.setAttribute("oninput","return;"),xc=typeof Um.oninput=="function"}bc=xc}else bc=!1;zm=bc&&(!document.documentMode||9<document.documentMode)}function Pm(){za&&(za.detachEvent("onpropertychange",Bm),Ua=za=null)}function Bm(n){if(n.propertyName==="value"&&ao(Ua)){var i=[];Dm(i,Ua,n,uc(n)),Sm(Dv,i)}}function Lv(n,i,a){n==="focusin"?(Pm(),za=i,Ua=a,za.attachEvent("onpropertychange",Bm)):n==="focusout"&&Pm()}function zv(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ao(Ua)}function Uv(n,i){if(n==="click")return ao(i)}function Pv(n,i){if(n==="input"||n==="change")return ao(i)}function Bv(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var Gn=typeof Object.is=="function"?Object.is:Bv;function Pa(n,i){if(Gn(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(!tt.call(i,h)||!Gn(n[h],i[h]))return!1}return!0}function Hm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function qm(n,i){var a=Hm(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=Hm(a)}}function Im(n,i){return n&&i?n===i?!0:n&&n.nodeType===3?!1:i&&i.nodeType===3?Im(n,i.parentNode):"contains"in n?n.contains(i):n.compareDocumentPosition?!!(n.compareDocumentPosition(i)&16):!1:!1}function Fm(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 Hv=Zr&&"documentMode"in document&&11>=document.documentMode,Rs=null,wc=null,Ba=null,Sc=!1;function $m(n,i,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Sc||Rs==null||Rs!==Wl(u)||(u=Rs,"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}),Ba&&Pa(Ba,u)||(Ba=u,u=Xo(wc,"onSelect"),0<u.length&&(i=new io("onSelect","select",null,i,a),n.push({event:i,listeners:u}),i.target=Rs)))}function ss(n,i){var a={};return a[n.toLowerCase()]=i.toLowerCase(),a["Webkit"+n]="webkit"+i,a["Moz"+n]="moz"+i,a}var Ms={animationend:ss("Animation","AnimationEnd"),animationiteration:ss("Animation","AnimationIteration"),animationstart:ss("Animation","AnimationStart"),transitionrun:ss("Transition","TransitionRun"),transitionstart:ss("Transition","TransitionStart"),transitioncancel:ss("Transition","TransitionCancel"),transitionend:ss("Transition","TransitionEnd")},_c={},Vm={};Zr&&(Vm=document.createElement("div").style,"AnimationEvent"in window||(delete Ms.animationend.animation,delete Ms.animationiteration.animation,delete Ms.animationstart.animation),"TransitionEvent"in window||delete Ms.transitionend.transition);function as(n){if(_c[n])return _c[n];if(!Ms[n])return n;var i=Ms[n],a;for(a in i)if(i.hasOwnProperty(a)&&a in Vm)return _c[n]=i[a];return n}var Ym=as("animationend"),Gm=as("animationiteration"),Jm=as("animationstart"),qv=as("transitionrun"),Iv=as("transitionstart"),Fv=as("transitioncancel"),Xm=as("transitionend"),Km=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 Cr(n,i){Km.set(n,i),xe(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)},hr=[],Ds=0,Ec=0;function oo(){for(var n=Ds,i=Ec=Ds=0;i<n;){var a=hr[i];hr[i++]=null;var u=hr[i];hr[i++]=null;var h=hr[i];hr[i++]=null;var p=hr[i];if(hr[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&&Qm(a,h,p)}}function uo(n,i,a,u){hr[Ds++]=n,hr[Ds++]=i,hr[Ds++]=a,hr[Ds++]=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 ls(n,i){return uo(n,null,null,i),co(n)}function Qm(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-ht(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<ll)throw ll=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 Ls={};function $v(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 Jn(n,i,a,u){return new $v(n,i,a,u)}function Ac(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Wr(n,i){var a=n.alternate;return a===null?(a=Jn(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 Zm(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=Xw(n,a,be.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case B:return n=Jn(31,a,i,h),n.elementType=B,n.lanes=p,n;case N:return os(a.children,h,p,i);case D:w=8,h|=24;break;case M:return n=Jn(12,a,i,h|2),n.elementType=M,n.lanes=p,n;case H:return n=Jn(13,a,i,h),n.elementType=H,n.lanes=p,n;case O:return n=Jn(19,a,i,h),n.elementType=O,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 ue:w=11;break e;case ee:w=14;break e;case G:w=16,u=null;break e}w=29,a=Error(s(130,n===null?"null":typeof n,"")),u=null}return i=Jn(w,a,i,h),i.elementType=n,i.type=u,i.lanes=p,i}function os(n,i,a,u){return n=Jn(7,n,u,i),n.lanes=a,n}function jc(n,i,a){return n=Jn(6,n,null,i),n.lanes=a,n}function Wm(n){var i=Jn(18,null,null,0);return i.stateNode=n,i}function Nc(n,i,a){return i=Jn(4,n.children!==null?n.children:[],n.key,i),i.lanes=a,i.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},i}var ep=new WeakMap;function dr(n,i){if(typeof n=="object"&&n!==null){var a=ep.get(n);return a!==void 0?a:(i={value:n,source:i,stack:qe(i)},ep.set(n,i),i)}return{value:n,source:i,stack:qe(i)}}var zs=[],Us=0,ho=null,Ha=0,mr=[],pr=0,ki=null,Pr=1,Br="";function ei(n,i){zs[Us++]=Ha,zs[Us++]=ho,ho=n,Ha=i}function tp(n,i,a){mr[pr++]=Pr,mr[pr++]=Br,mr[pr++]=ki,ki=n;var u=Pr;n=Br;var h=32-ht(u)-1;u&=~(1<<h),a+=1;var p=32-ht(i)+h;if(30<p){var w=h-h%5;p=(u&(1<<w)-1).toString(32),u>>=w,h-=w,Pr=1<<32-ht(i)+h|a<<h|u,Br=p+n}else Pr=1<<p|a<<h|u,Br=n}function Tc(n){n.return!==null&&(ei(n,1),tp(n,1,0))}function Oc(n){for(;n===ho;)ho=zs[--Us],zs[Us]=null,Ha=zs[--Us],zs[Us]=null;for(;n===ki;)ki=mr[--pr],mr[pr]=null,Br=mr[--pr],mr[pr]=null,Pr=mr[--pr],mr[pr]=null}function np(n,i){mr[pr++]=Pr,mr[pr++]=Br,mr[pr++]=ki,Pr=i.id,Br=i.overflow,ki=n}var vn=null,qt=null,dt=!1,Ei=null,gr=!1,Rc=Error(s(519));function Ci(n){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qa(dr(i,n)),Rc}function rp(n){var i=n.stateNode,a=n.type,u=n.memoizedProps;switch(i[Ue]=n,i[rt]=u,a){case"dialog":ot("cancel",i),ot("close",i);break;case"iframe":case"object":case"embed":ot("load",i);break;case"video":case"audio":for(a=0;a<ul.length;a++)ot(ul[a],i);break;case"source":ot("error",i);break;case"img":case"image":case"link":ot("error",i),ot("load",i);break;case"details":ot("toggle",i);break;case"input":ot("invalid",i),gm(i,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":ot("invalid",i);break;case"textarea":ot("invalid",i),bm(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||vy(i.textContent,a)?(u.popover!=null&&(ot("beforetoggle",i),ot("toggle",i)),u.onScroll!=null&&ot("scroll",i),u.onScrollEnd!=null&&ot("scrollend",i),u.onClick!=null&&(i.onclick=Qr),i=!0):i=!1,i||Ci(n,!0)}function ip(n){for(vn=n.return;vn;)switch(vn.tag){case 5:case 31:case 13:gr=!1;return;case 27:case 3:gr=!0;return;default:vn=vn.return}}function Ps(n){if(n!==vn)return!1;if(!dt)return ip(n),dt=!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&&qt&&Ci(n),ip(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));qt=Ny(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));qt=Ny(n)}else i===27?(i=qt,Hi(n.type)?(n=nh,nh=null,qt=n):qt=i):qt=vn?br(n.stateNode.nextSibling):null;return!0}function us(){qt=vn=null,dt=!1}function Mc(){var n=Ei;return n!==null&&(In===null?In=n:In.push.apply(In,n),Ei=null),n}function qa(n){Ei===null?Ei=[n]:Ei.push(n)}var Dc=L(null),cs=null,ti=null;function Ai(n,i,a){j(Dc,i._currentValue),i._currentValue=a}function ni(n){n._currentValue=Dc.current,J(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 q=0;q<i.length;q++)if(_.context===i[q]){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 Bs(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;Gn(h.pendingProps.value,w.value)||(n!==null?n.push(_):n=[_])}}else if(h===oe.current){if(w=h.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(ml):n=[ml])}h=h.return}n!==null&&zc(i,n,a,u),i.flags|=262144}function mo(n){for(n=n.firstContext;n!==null;){if(!Gn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function fs(n){cs=n,ti=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function wn(n){return sp(cs,n)}function po(n,i){return cs===null&&fs(n),sp(n,i)}function sp(n,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},ti===null){if(n===null)throw Error(s(308));ti=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else ti=ti.next=i;return a}var Vv=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()})}},Yv=e.unstable_scheduleCallback,Gv=e.unstable_NormalPriority,un={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uc(){return{controller:new Vv,data:new Map,refCount:0}}function Ia(n){n.refCount--,n.refCount===0&&Yv(Gv,function(){n.controller.abort()})}var Fa=null,Pc=0,Hs=0,qs=null;function Jv(n,i){if(Fa===null){var a=Fa=[];Pc=0,Hs=If(),qs={status:"pending",value:void 0,then:function(u){a.push(u)}}}return Pc++,i.then(ap,ap),i}function ap(){if(--Pc===0&&Fa!==null){qs!==null&&(qs.status="fulfilled");var n=Fa;Fa=null,Hs=0,qs=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function Xv(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 lp=V.S;V.S=function(n,i){$g=at(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Jv(n,i),lp!==null&&lp(n,i)};var hs=L(null);function Bc(){var n=hs.current;return n!==null?n:Dt.pooledCache}function go(n,i){i===null?j(hs,hs.current):j(hs,i.pool)}function op(){var n=Bc();return n===null?null:{parent:un._currentValue,pool:n}}var Is=Error(s(460)),Hc=Error(s(474)),yo=Error(s(542)),bo={then:function(){}};function up(n){return n=n.status,n==="fulfilled"||n==="rejected"}function cp(n,i,a){switch(a=n[a],a===void 0?n.push(i):a!==i&&(i.then(Qr,Qr),i=a),i.status){case"fulfilled":return i.value;case"rejected":throw n=i.reason,hp(n),n;default:if(typeof i.status=="string")i.then(Qr,Qr);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,hp(n),n}throw ms=i,Is}}function ds(n){try{var i=n._init;return i(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ms=a,Is):a}}var ms=null;function fp(){if(ms===null)throw Error(s(459));var n=ms;return ms=null,n}function hp(n){if(n===Is||n===yo)throw Error(s(483))}var Fs=null,$a=0;function xo(n){var i=$a;return $a+=1,Fs===null&&(Fs=[]),cp(Fs,n,i)}function Va(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 dp(n){function i(Q,Y){if(n){var te=Q.deletions;te===null?(Q.deletions=[Y],Q.flags|=16):te.push(Y)}}function a(Q,Y){if(!n)return null;for(;Y!==null;)i(Q,Y),Y=Y.sibling;return null}function u(Q){for(var Y=new Map;Q!==null;)Q.key!==null?Y.set(Q.key,Q):Y.set(Q.index,Q),Q=Q.sibling;return Y}function h(Q,Y){return Q=Wr(Q,Y),Q.index=0,Q.sibling=null,Q}function p(Q,Y,te){return Q.index=te,n?(te=Q.alternate,te!==null?(te=te.index,te<Y?(Q.flags|=67108866,Y):te):(Q.flags|=67108866,Y)):(Q.flags|=1048576,Y)}function w(Q){return n&&Q.alternate===null&&(Q.flags|=67108866),Q}function _(Q,Y,te,me){return Y===null||Y.tag!==6?(Y=jc(te,Q.mode,me),Y.return=Q,Y):(Y=h(Y,te),Y.return=Q,Y)}function q(Q,Y,te,me){var $e=te.type;return $e===N?de(Q,Y,te.props.children,me,te.key):Y!==null&&(Y.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===G&&ds($e)===Y.type)?(Y=h(Y,te.props),Va(Y,te),Y.return=Q,Y):(Y=fo(te.type,te.key,te.props,null,Q.mode,me),Va(Y,te),Y.return=Q,Y)}function re(Q,Y,te,me){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==te.containerInfo||Y.stateNode.implementation!==te.implementation?(Y=Nc(te,Q.mode,me),Y.return=Q,Y):(Y=h(Y,te.children||[]),Y.return=Q,Y)}function de(Q,Y,te,me,$e){return Y===null||Y.tag!==7?(Y=os(te,Q.mode,me,$e),Y.return=Q,Y):(Y=h(Y,te),Y.return=Q,Y)}function ye(Q,Y,te){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=jc(""+Y,Q.mode,te),Y.return=Q,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:return te=fo(Y.type,Y.key,Y.props,null,Q.mode,te),Va(te,Y),te.return=Q,te;case S:return Y=Nc(Y,Q.mode,te),Y.return=Q,Y;case G:return Y=ds(Y),ye(Q,Y,te)}if(W(Y)||F(Y))return Y=os(Y,Q.mode,te,null),Y.return=Q,Y;if(typeof Y.then=="function")return ye(Q,xo(Y),te);if(Y.$$typeof===I)return ye(Q,po(Q,Y),te);vo(Q,Y)}return null}function ie(Q,Y,te,me){var $e=Y!==null?Y.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return $e!==null?null:_(Q,Y,""+te,me);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case v:return te.key===$e?q(Q,Y,te,me):null;case S:return te.key===$e?re(Q,Y,te,me):null;case G:return te=ds(te),ie(Q,Y,te,me)}if(W(te)||F(te))return $e!==null?null:de(Q,Y,te,me,null);if(typeof te.then=="function")return ie(Q,Y,xo(te),me);if(te.$$typeof===I)return ie(Q,Y,po(Q,te),me);vo(Q,te)}return null}function ae(Q,Y,te,me,$e){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return Q=Q.get(te)||null,_(Y,Q,""+me,$e);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case v:return Q=Q.get(me.key===null?te:me.key)||null,q(Y,Q,me,$e);case S:return Q=Q.get(me.key===null?te:me.key)||null,re(Y,Q,me,$e);case G:return me=ds(me),ae(Q,Y,te,me,$e)}if(W(me)||F(me))return Q=Q.get(te)||null,de(Y,Q,me,$e,null);if(typeof me.then=="function")return ae(Q,Y,te,xo(me),$e);if(me.$$typeof===I)return ae(Q,Y,te,po(Y,me),$e);vo(Y,me)}return null}function ze(Q,Y,te,me){for(var $e=null,vt=null,Pe=Y,We=Y=0,ft=null;Pe!==null&&We<te.length;We++){Pe.index>We?(ft=Pe,Pe=null):ft=Pe.sibling;var wt=ie(Q,Pe,te[We],me);if(wt===null){Pe===null&&(Pe=ft);break}n&&Pe&&wt.alternate===null&&i(Q,Pe),Y=p(wt,Y,We),vt===null?$e=wt:vt.sibling=wt,vt=wt,Pe=ft}if(We===te.length)return a(Q,Pe),dt&&ei(Q,We),$e;if(Pe===null){for(;We<te.length;We++)Pe=ye(Q,te[We],me),Pe!==null&&(Y=p(Pe,Y,We),vt===null?$e=Pe:vt.sibling=Pe,vt=Pe);return dt&&ei(Q,We),$e}for(Pe=u(Pe);We<te.length;We++)ft=ae(Pe,Q,We,te[We],me),ft!==null&&(n&&ft.alternate!==null&&Pe.delete(ft.key===null?We:ft.key),Y=p(ft,Y,We),vt===null?$e=ft:vt.sibling=ft,vt=ft);return n&&Pe.forEach(function(Vi){return i(Q,Vi)}),dt&&ei(Q,We),$e}function Je(Q,Y,te,me){if(te==null)throw Error(s(151));for(var $e=null,vt=null,Pe=Y,We=Y=0,ft=null,wt=te.next();Pe!==null&&!wt.done;We++,wt=te.next()){Pe.index>We?(ft=Pe,Pe=null):ft=Pe.sibling;var Vi=ie(Q,Pe,wt.value,me);if(Vi===null){Pe===null&&(Pe=ft);break}n&&Pe&&Vi.alternate===null&&i(Q,Pe),Y=p(Vi,Y,We),vt===null?$e=Vi:vt.sibling=Vi,vt=Vi,Pe=ft}if(wt.done)return a(Q,Pe),dt&&ei(Q,We),$e;if(Pe===null){for(;!wt.done;We++,wt=te.next())wt=ye(Q,wt.value,me),wt!==null&&(Y=p(wt,Y,We),vt===null?$e=wt:vt.sibling=wt,vt=wt);return dt&&ei(Q,We),$e}for(Pe=u(Pe);!wt.done;We++,wt=te.next())wt=ae(Pe,Q,We,wt.value,me),wt!==null&&(n&&wt.alternate!==null&&Pe.delete(wt.key===null?We:wt.key),Y=p(wt,Y,We),vt===null?$e=wt:vt.sibling=wt,vt=wt);return n&&Pe.forEach(function(aS){return i(Q,aS)}),dt&&ei(Q,We),$e}function Tt(Q,Y,te,me){if(typeof te=="object"&&te!==null&&te.type===N&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case v:e:{for(var $e=te.key;Y!==null;){if(Y.key===$e){if($e=te.type,$e===N){if(Y.tag===7){a(Q,Y.sibling),me=h(Y,te.props.children),me.return=Q,Q=me;break e}}else if(Y.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===G&&ds($e)===Y.type){a(Q,Y.sibling),me=h(Y,te.props),Va(me,te),me.return=Q,Q=me;break e}a(Q,Y);break}else i(Q,Y);Y=Y.sibling}te.type===N?(me=os(te.props.children,Q.mode,me,te.key),me.return=Q,Q=me):(me=fo(te.type,te.key,te.props,null,Q.mode,me),Va(me,te),me.return=Q,Q=me)}return w(Q);case S:e:{for($e=te.key;Y!==null;){if(Y.key===$e)if(Y.tag===4&&Y.stateNode.containerInfo===te.containerInfo&&Y.stateNode.implementation===te.implementation){a(Q,Y.sibling),me=h(Y,te.children||[]),me.return=Q,Q=me;break e}else{a(Q,Y);break}else i(Q,Y);Y=Y.sibling}me=Nc(te,Q.mode,me),me.return=Q,Q=me}return w(Q);case G:return te=ds(te),Tt(Q,Y,te,me)}if(W(te))return ze(Q,Y,te,me);if(F(te)){if($e=F(te),typeof $e!="function")throw Error(s(150));return te=$e.call(te),Je(Q,Y,te,me)}if(typeof te.then=="function")return Tt(Q,Y,xo(te),me);if(te.$$typeof===I)return Tt(Q,Y,po(Q,te),me);vo(Q,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,Y!==null&&Y.tag===6?(a(Q,Y.sibling),me=h(Y,te),me.return=Q,Q=me):(a(Q,Y),me=jc(te,Q.mode,me),me.return=Q,Q=me),w(Q)):a(Q,Y)}return function(Q,Y,te,me){try{$a=0;var $e=Tt(Q,Y,te,me);return Fs=null,$e}catch(Pe){if(Pe===Is||Pe===yo)throw Pe;var vt=Jn(29,Pe,null,Q.mode);return vt.lanes=me,vt.return=Q,vt}finally{}}}var ps=dp(!0),mp=dp(!1),ji=!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 Ni(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Ti(n,i,a){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(St&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),Qm(n,null,a),i}return uo(n,u,i,a),co(n)}function Ya(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,Ae(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 Ga(){if($c){var n=qs;if(n!==null)throw n}}function Ja(n,i,a,u){$c=!1;var h=n.updateQueue;ji=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,_=h.shared.pending;if(_!==null){h.shared.pending=null;var q=_,re=q.next;q.next=null,w===null?p=re:w.next=re,w=q;var de=n.alternate;de!==null&&(de=de.updateQueue,_=de.lastBaseUpdate,_!==w&&(_===null?de.firstBaseUpdate=re:_.next=re,de.lastBaseUpdate=q))}if(p!==null){var ye=h.baseState;w=0,de=re=q=null,_=p;do{var ie=_.lane&-536870913,ae=ie!==_.lane;if(ae?(ct&ie)===ie:(u&ie)===ie){ie!==0&&ie===Hs&&($c=!0),de!==null&&(de=de.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var ze=n,Je=_;ie=i;var Tt=a;switch(Je.tag){case 1:if(ze=Je.payload,typeof ze=="function"){ye=ze.call(Tt,ye,ie);break e}ye=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=Je.payload,ie=typeof ze=="function"?ze.call(Tt,ye,ie):ze,ie==null)break e;ye=g({},ye,ie);break e;case 2:ji=!0}}ie=_.callback,ie!==null&&(n.flags|=64,ae&&(n.flags|=8192),ae=h.callbacks,ae===null?h.callbacks=[ie]:ae.push(ie))}else ae={lane:ie,tag:_.tag,payload:_.payload,callback:_.callback,next:null},de===null?(re=de=ae,q=ye):de=de.next=ae,w|=ie;if(_=_.next,_===null){if(_=h.shared.pending,_===null)break;ae=_,_=ae.next,ae.next=null,h.lastBaseUpdate=ae,h.shared.pending=null}}while(!0);de===null&&(q=ye),h.baseState=q,h.firstBaseUpdate=re,h.lastBaseUpdate=de,p===null&&(h.shared.lanes=0),Li|=w,n.lanes=w,n.memoizedState=ye}}function pp(n,i){if(typeof n!="function")throw Error(s(191,n));n.call(i)}function gp(n,i){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)pp(a[n],i)}var $s=L(null),wo=L(0);function yp(n,i){n=fi,j(wo,n),j($s,i),fi=n|i.baseLanes}function Vc(){j(wo,fi),j($s,$s.current)}function Yc(){fi=wo.current,J($s),J(wo)}var Xn=L(null),yr=null;function Oi(n){var i=n.alternate;j(nn,nn.current&1),j(Xn,n),yr===null&&(i===null||$s.current!==null||i.memoizedState!==null)&&(yr=n)}function Gc(n){j(nn,nn.current),j(Xn,n),yr===null&&(yr=n)}function bp(n){n.tag===22?(j(nn,nn.current),j(Xn,n),yr===null&&(yr=n)):Ri()}function Ri(){j(nn,nn.current),j(Xn,Xn.current)}function Kn(n){J(Xn),yr===n&&(yr=null),J(nn)}var nn=L(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 ri=0,Ze=null,jt=null,cn=null,_o=!1,Vs=!1,gs=!1,ko=0,Xa=0,Ys=null,Kv=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(!Gn(n[a],i[a]))return!1;return!0}function Xc(n,i,a,u,h,p){return ri=p,Ze=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,V.H=n===null||n.memoizedState===null?tg:ff,gs=!1,p=a(u,h),gs=!1,Vs&&(p=vp(i,a,u,h)),xp(n),p}function xp(n){V.H=Za;var i=jt!==null&&jt.next!==null;if(ri=0,cn=jt=Ze=null,_o=!1,Xa=0,Ys=null,i)throw Error(s(300));n===null||fn||(n=n.dependencies,n!==null&&mo(n)&&(fn=!0))}function vp(n,i,a,u){Ze=n;var h=0;do{if(Vs&&(Ys=null),Xa=0,Vs=!1,25<=h)throw Error(s(301));if(h+=1,cn=jt=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}V.H=ng,p=i(a,u)}while(Vs);return p}function Qv(){var n=V.H,i=n.useState()[0];return i=typeof i.then=="function"?Ka(i):i,n=n.useState()[0],(jt!==null?jt.memoizedState:null)!==n&&(Ze.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}ri=0,cn=jt=Ze=null,Vs=!1,Xa=ko=0,Ys=null}function On(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cn===null?Ze.memoizedState=cn=n:cn=cn.next=n,cn}function rn(){if(jt===null){var n=Ze.alternate;n=n!==null?n.memoizedState:null}else n=jt.next;var i=cn===null?Ze.memoizedState:cn.next;if(i!==null)cn=i,jt=n;else{if(n===null)throw Ze.alternate===null?Error(s(467)):Error(s(310));jt=n,n={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},cn===null?Ze.memoizedState=cn=n:cn=cn.next=n}return cn}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ka(n){var i=Xa;return Xa+=1,Ys===null&&(Ys=[]),n=cp(Ys,n,i),i=Ze,(cn===null?i.memoizedState:cn.next)===null&&(i=i.alternate,V.H=i===null||i.memoizedState===null?tg:ff),n}function Co(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ka(n);if(n.$$typeof===I)return wn(n)}throw Error(s(438,String(n)))}function Wc(n){var i=null,a=Ze.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var u=Ze.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(),Ze.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]=z;return i.index++,a}function ii(n,i){return typeof i=="function"?i(n):i}function Ao(n){var i=rn();return ef(i,jt,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,q=null,re=i,de=!1;do{var ye=re.lane&-536870913;if(ye!==re.lane?(ct&ye)===ye:(ri&ye)===ye){var ie=re.revertLane;if(ie===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),ye===Hs&&(de=!0);else if((ri&ie)===ie){re=re.next,ie===Hs&&(de=!0);continue}else ye={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(_=q=ye,w=p):q=q.next=ye,Ze.lanes|=ie,Li|=ie;ye=re.action,gs&&a(p,ye),p=re.hasEagerState?re.eagerState:a(p,ye)}else ie={lane:ye,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(_=q=ie,w=p):q=q.next=ie,Ze.lanes|=ye,Li|=ye;re=re.next}while(re!==null&&re!==i);if(q===null?w=p:q.next=_,!Gn(p,n.memoizedState)&&(fn=!0,de&&(a=qs,a!==null)))throw a;n.memoizedState=p,n.baseState=w,n.baseQueue=q,u.lastRenderedState=p}return h===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function tf(n){var i=rn(),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);Gn(p,i.memoizedState)||(fn=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,u]}function wp(n,i,a){var u=Ze,h=rn(),p=dt;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var w=!Gn((jt||h).memoizedState,a);if(w&&(h.memoizedState=a,fn=!0),h=h.queue,sf(kp.bind(null,u,h,n),[n]),h.getSnapshot!==i||w||cn!==null&&cn.memoizedState.tag&1){if(u.flags|=2048,Gs(9,{destroy:void 0},_p.bind(null,u,h,a,i),null),Dt===null)throw Error(s(349));p||(ri&127)!==0||Sp(u,i,a)}return a}function Sp(n,i,a){n.flags|=16384,n={getSnapshot:i,value:a},i=Ze.updateQueue,i===null?(i=Eo(),Ze.updateQueue=i,i.stores=[n]):(a=i.stores,a===null?i.stores=[n]:a.push(n))}function _p(n,i,a,u){i.value=a,i.getSnapshot=u,Ep(i)&&Cp(n)}function kp(n,i,a){return a(function(){Ep(i)&&Cp(n)})}function Ep(n){var i=n.getSnapshot;n=n.value;try{var a=i();return!Gn(n,a)}catch{return!0}}function Cp(n){var i=ls(n,2);i!==null&&Fn(i,n,2)}function nf(n){var i=On();if(typeof n=="function"){var a=n;if(n=a(),gs){Bt(!0);try{a()}finally{Bt(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ii,lastRenderedState:n},i}function Ap(n,i,a,u){return n.baseState=a,ef(n,jt,typeof u=="function"?u:ii)}function Zv(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)}};V.T!==null?a(!0):p.isTransition=!1,u(p),a=i.pending,a===null?(p.next=i.pending=p,jp(i,p)):(p.next=a.next,i.pending=a.next=p)}}function jp(n,i){var a=i.action,u=i.payload,h=n.state;if(i.isTransition){var p=V.T,w={};V.T=w;try{var _=a(h,u),q=V.S;q!==null&&q(w,_),Np(n,i,_)}catch(re){rf(n,i,re)}finally{p!==null&&w.types!==null&&(p.types=w.types),V.T=p}}else try{p=a(h,u),Np(n,i,p)}catch(re){rf(n,i,re)}}function Np(n,i,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(u){Tp(n,i,u)},function(u){return rf(n,i,u)}):Tp(n,i,a)}function Tp(n,i,a){i.status="fulfilled",i.value=a,Op(i),n.state=a,i=n.pending,i!==null&&(a=i.next,a===i?n.pending=null:(a=a.next,i.next=a,jp(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,Op(i),i=i.next;while(i!==u)}n.action=null}function Op(n){n=n.listeners;for(var i=0;i<n.length;i++)(0,n[i])()}function Rp(n,i){return i}function Mp(n,i){if(dt){var a=Dt.formState;if(a!==null){e:{var u=Ze;if(dt){if(qt){t:{for(var h=qt,p=gr;h.nodeType!==8;){if(!p){h=null;break t}if(h=br(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){qt=br(h.nextSibling),u=h.data==="F!";break e}}Ci(u)}u=!1}u&&(i=a[0])}}return a=On(),a.memoizedState=a.baseState=i,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rp,lastRenderedState:i},a.queue=u,a=Zp.bind(null,Ze,u),u.dispatch=a,u=nf(!1),p=cf.bind(null,Ze,!1,u.queue),u=On(),h={state:i,dispatch:null,action:n,pending:null},u.queue=h,a=Zv.bind(null,Ze,h,p,a),h.dispatch=a,u.memoizedState=n,[i,a,!1]}function Dp(n){var i=rn();return Lp(i,jt,n)}function Lp(n,i,a){if(i=ef(n,i,Rp)[0],n=Ao(ii)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var u=Ka(i)}catch(w){throw w===Is?yo:w}else u=i;i=rn();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(Ze.flags|=2048,Gs(9,{destroy:void 0},Wv.bind(null,h,a),null)),[u,p,n]}function Wv(n,i){n.action=i}function zp(n){var i=rn(),a=jt;if(a!==null)return Lp(i,a,n);rn(),i=i.memoizedState,a=rn();var u=a.queue.dispatch;return a.memoizedState=n,[i,u,!1]}function Gs(n,i,a,u){return n={tag:n,create:a,deps:u,inst:i,next:null},i=Ze.updateQueue,i===null&&(i=Eo(),Ze.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 Up(){return rn().memoizedState}function jo(n,i,a,u){var h=On();Ze.flags|=n,h.memoizedState=Gs(1|i,{destroy:void 0},a,u===void 0?null:u)}function No(n,i,a,u){var h=rn();u=u===void 0?null:u;var p=h.memoizedState.inst;jt!==null&&u!==null&&Jc(u,jt.memoizedState.deps)?h.memoizedState=Gs(i,p,a,u):(Ze.flags|=n,h.memoizedState=Gs(1|i,p,a,u))}function Pp(n,i){jo(8390656,8,n,i)}function sf(n,i){No(2048,8,n,i)}function ew(n){Ze.flags|=4;var i=Ze.updateQueue;if(i===null)i=Eo(),Ze.updateQueue=i,i.events=[n];else{var a=i.events;a===null?i.events=[n]:a.push(n)}}function Bp(n){var i=rn().memoizedState;return ew({ref:i,nextImpl:n}),function(){if((St&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function Hp(n,i){return No(4,2,n,i)}function qp(n,i){return No(4,4,n,i)}function Ip(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 Fp(n,i,a){a=a!=null?a.concat([n]):null,No(4,4,Ip.bind(null,i,n),a)}function af(){}function $p(n,i){var a=rn();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 Vp(n,i){var a=rn();i=i===void 0?null:i;var u=a.memoizedState;if(i!==null&&Jc(i,u[1]))return u[0];if(u=n(),gs){Bt(!0);try{n()}finally{Bt(!1)}}return a.memoizedState=[u,i],u}function lf(n,i,a){return a===void 0||(ri&1073741824)!==0&&(ct&261930)===0?n.memoizedState=i:(n.memoizedState=a,n=Yg(),Ze.lanes|=n,Li|=n,a)}function Yp(n,i,a,u){return Gn(a,i)?a:$s.current!==null?(n=lf(n,a,u),Gn(n,i)||(fn=!0),n):(ri&42)===0||(ri&1073741824)!==0&&(ct&261930)===0?(fn=!0,n.memoizedState=a):(n=Yg(),Ze.lanes|=n,Li|=n,i)}function Gp(n,i,a,u,h){var p=K.p;K.p=p!==0&&8>p?p:8;var w=V.T,_={};V.T=_,cf(n,!1,i,a);try{var q=h(),re=V.S;if(re!==null&&re(_,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var de=Xv(q,u);Qa(n,i,de,Wn(n))}else Qa(n,i,u,Wn(n))}catch(ye){Qa(n,i,{then:function(){},status:"rejected",reason:ye},Wn())}finally{K.p=p,w!==null&&_.types!==null&&(w.types=_.types),V.T=w}}function tw(){}function of(n,i,a,u){if(n.tag!==5)throw Error(s(476));var h=Jp(n).queue;Gp(n,h,i,ce,a===null?tw:function(){return Xp(n),a(u)})}function Jp(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ii,lastRenderedState:ce},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ii,lastRenderedState:a},next:null},n.memoizedState=i,n=n.alternate,n!==null&&(n.memoizedState=i),i}function Xp(n){var i=Jp(n);i.next===null&&(i=n.alternate.memoizedState),Qa(n,i.next.queue,{},Wn())}function uf(){return wn(ml)}function Kp(){return rn().memoizedState}function Qp(){return rn().memoizedState}function nw(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var a=Wn();n=Ni(a);var u=Ti(i,n,a);u!==null&&(Fn(u,i,a),Ya(u,i,a)),i={cache:Uc()},n.payload=i;return}i=i.return}}function rw(n,i,a){var u=Wn();a={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},To(n)?Wp(i,a):(a=Cc(n,i,a,u),a!==null&&(Fn(a,n,u),eg(a,i,u)))}function Zp(n,i,a){var u=Wn();Qa(n,i,a,u)}function Qa(n,i,a,u){var h={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(To(n))Wp(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=_,Gn(_,w))return uo(n,i,h,0),Dt===null&&oo(),!1}catch{}finally{}if(a=Cc(n,i,h,u),a!==null)return Fn(a,n,u),eg(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&&Fn(i,n,2)}function To(n){var i=n.alternate;return n===Ze||i!==null&&i===Ze}function Wp(n,i){Vs=_o=!0;var a=n.pending;a===null?i.next=i:(i.next=a.next,a.next=i),n.pending=i}function eg(n,i,a){if((a&4194048)!==0){var u=i.lanes;u&=n.pendingLanes,a|=u,i.lanes=a,Ae(n,a)}}var Za={readContext:wn,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};Za.useEffectEvent=Wt;var tg={readContext:wn,use:Co,useCallback:function(n,i){return On().memoizedState=[n,i===void 0?null:i],n},useContext:wn,useEffect:Pp,useImperativeHandle:function(n,i,a){a=a!=null?a.concat([n]):null,jo(4194308,4,Ip.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=On();i=i===void 0?null:i;var u=n();if(gs){Bt(!0);try{n()}finally{Bt(!1)}}return a.memoizedState=[u,i],u},useReducer:function(n,i,a){var u=On();if(a!==void 0){var h=a(i);if(gs){Bt(!0);try{a(i)}finally{Bt(!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=rw.bind(null,Ze,n),[u.memoizedState,n]},useRef:function(n){var i=On();return n={current:n},i.memoizedState=n},useState:function(n){n=nf(n);var i=n.queue,a=Zp.bind(null,Ze,i);return i.dispatch=a,[n.memoizedState,a]},useDebugValue:af,useDeferredValue:function(n,i){var a=On();return lf(a,n,i)},useTransition:function(){var n=nf(!1);return n=Gp.bind(null,Ze,n.queue,!0,!1),On().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,a){var u=Ze,h=On();if(dt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),Dt===null)throw Error(s(349));(ct&127)!==0||Sp(u,i,a)}h.memoizedState=a;var p={value:a,getSnapshot:i};return h.queue=p,Pp(kp.bind(null,u,p,n),[n]),u.flags|=2048,Gs(9,{destroy:void 0},_p.bind(null,u,p,a,i),null),a},useId:function(){var n=On(),i=Dt.identifierPrefix;if(dt){var a=Br,u=Pr;a=(u&~(1<<32-ht(u)-1)).toString(32)+a,i="_"+i+"R_"+a,a=ko++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Kv++,i="_"+i+"r_"+a.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:uf,useFormState:Mp,useActionState:Mp,useOptimistic:function(n){var i=On();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,Ze,!0,a),a.dispatch=i,[n,i]},useMemoCache:Wc,useCacheRefresh:function(){return On().memoizedState=nw.bind(null,Ze)},useEffectEvent:function(n){var i=On(),a={impl:n};return i.memoizedState=a,function(){if((St&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},ff={readContext:wn,use:Co,useCallback:$p,useContext:wn,useEffect:sf,useImperativeHandle:Fp,useInsertionEffect:Hp,useLayoutEffect:qp,useMemo:Vp,useReducer:Ao,useRef:Up,useState:function(){return Ao(ii)},useDebugValue:af,useDeferredValue:function(n,i){var a=rn();return Yp(a,jt.memoizedState,n,i)},useTransition:function(){var n=Ao(ii)[0],i=rn().memoizedState;return[typeof n=="boolean"?n:Ka(n),i]},useSyncExternalStore:wp,useId:Kp,useHostTransitionStatus:uf,useFormState:Dp,useActionState:Dp,useOptimistic:function(n,i){var a=rn();return Ap(a,jt,n,i)},useMemoCache:Wc,useCacheRefresh:Qp};ff.useEffectEvent=Bp;var ng={readContext:wn,use:Co,useCallback:$p,useContext:wn,useEffect:sf,useImperativeHandle:Fp,useInsertionEffect:Hp,useLayoutEffect:qp,useMemo:Vp,useReducer:tf,useRef:Up,useState:function(){return tf(ii)},useDebugValue:af,useDeferredValue:function(n,i){var a=rn();return jt===null?lf(a,n,i):Yp(a,jt.memoizedState,n,i)},useTransition:function(){var n=tf(ii)[0],i=rn().memoizedState;return[typeof n=="boolean"?n:Ka(n),i]},useSyncExternalStore:wp,useId:Kp,useHostTransitionStatus:uf,useFormState:zp,useActionState:zp,useOptimistic:function(n,i){var a=rn();return jt!==null?Ap(a,jt,n,i):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:Wc,useCacheRefresh:Qp};ng.useEffectEvent=Bp;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=Wn(),h=Ni(u);h.payload=i,a!=null&&(h.callback=a),i=Ti(n,h,u),i!==null&&(Fn(i,n,u),Ya(i,n,u))},enqueueReplaceState:function(n,i,a){n=n._reactInternals;var u=Wn(),h=Ni(u);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=Ti(n,h,u),i!==null&&(Fn(i,n,u),Ya(i,n,u))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var a=Wn(),u=Ni(a);u.tag=2,i!=null&&(u.callback=i),i=Ti(n,u,a),i!==null&&(Fn(i,n,a),Ya(i,n,a))}};function rg(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?!Pa(a,u)||!Pa(h,p):!0}function ig(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 ys(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 sg(n){lo(n)}function ag(n){console.error(n)}function lg(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 og(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=Ni(a),a.tag=3,a.payload={element:null},a.callback=function(){Oo(n,i)},a}function ug(n){return n=Ni(n),n.tag=3,n}function cg(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(){og(i,a,u)}}var w=a.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(n.callback=function(){og(i,a,u),typeof h!="function"&&(zi===null?zi=new Set([this]):zi.add(this));var _=u.stack;this.componentDidCatch(u.value,{componentStack:_!==null?_:""})})}function iw(n,i,a,u,h){if(a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(i=a.alternate,i!==null&&Bs(i,a,h,!0),a=Xn.current,a!==null){switch(a.tag){case 31:case 13:return yr===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(dt)return i=Xn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,u!==Rc&&(n=Error(s(422),{cause:u}),qa(dr(n,a)))):(u!==Rc&&(i=Error(s(423),{cause:u}),qa(dr(i,a))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,u=dr(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=dr(p,a),al===null?al=[p]:al.push(p),en!==4&&(en=2),i===null)return!0;u=dr(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"&&(zi===null||!zi.has(p))))return a.flags|=65536,h&=-h,a.lanes|=h,h=ug(h),cg(h,n,a,u),Fc(a,h),!1}a=a.return}while(a!==null);return!1}var pf=Error(s(461)),fn=!1;function Sn(n,i,a,u){i.child=n===null?mp(i,null,a,u):ps(i,n.child,a,u)}function fg(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 fs(i),u=Xc(n,i,a,w,p,h),_=Kc(),n!==null&&!fn?(Qc(n,i,h),si(n,i,h)):(dt&&_&&Tc(i),i.flags|=1,Sn(n,i,u,h),i.child)}function hg(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,dg(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:Pa,a(w,u)&&n.ref===i.ref)return si(n,i,h)}return i.flags|=1,n=Wr(p,u),n.ref=i.ref,n.return=i,i.child=n}function dg(n,i,a,u,h){if(n!==null){var p=n.memoizedProps;if(Pa(p,u)&&n.ref===i.ref)if(fn=!1,i.pendingProps=u=p,_f(n,h))(n.flags&131072)!==0&&(fn=!0);else return i.lanes=n.lanes,si(n,i,h)}return gf(n,i,a,u,h)}function mg(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 pg(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?yp(i,p):Vc(),bp(i);else return u=i.lanes=536870912,pg(n,i,p!==null?p.baseLanes|a:a,a,u)}else p!==null?(go(i,p.cachePool),yp(i,p),Ri(),i.memoizedState=null):(n!==null&&go(i,null),Vc(),Ri());return Sn(n,i,h,a),i.child}function Wa(n,i){return n!==null&&n.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function pg(n,i,a,u,h){var p=Bc();return p=p===null?null:{parent:un._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},n!==null&&go(i,null),Vc(),bp(i),n!==null&&Bs(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 gg(n,i,a){return ps(i,n.child,null,a),n=Ro(i,i.pendingProps),n.flags|=2,Kn(i),i.memoizedState=null,n}function sw(n,i,a){var u=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(dt){if(u.mode==="hidden")return n=Ro(i,u),i.lanes=536870912,Wa(null,n);if(Gc(i),(n=qt)?(n=jy(n,gr),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:ki!==null?{id:Pr,overflow:Br}:null,retryLane:536870912,hydrationErrors:null},a=Wm(n),a.return=i,i.child=a,vn=i,qt=null)):n=null,n===null)throw Ci(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=gg(n,i,a);else if(i.memoizedState!==null)i.child=n.child,i.flags|=128,i=null;else throw Error(s(558));else if(fn||Bs(n,i,a,!1),h=(a&n.childLanes)!==0,fn||h){if(u=Dt,u!==null&&(w=De(u,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,ls(n,w),Fn(u,n,w),pf;Fo(),i=gg(n,i,a)}else n=p.treeContext,qt=br(w.nextSibling),vn=i,dt=!0,Ei=null,gr=!1,n!==null&&np(i,n),i=Ro(i,u),i.flags|=4096;return i}return n=Wr(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 fs(i),a=Xc(n,i,a,u,void 0,h),u=Kc(),n!==null&&!fn?(Qc(n,i,h),si(n,i,h)):(dt&&u&&Tc(i),i.flags|=1,Sn(n,i,a,h),i.child)}function yg(n,i,a,u,h,p){return fs(i),i.updateQueue=null,a=vp(i,u,a,h),xp(n),u=Kc(),n!==null&&!fn?(Qc(n,i,p),si(n,i,p)):(dt&&u&&Tc(i),i.flags|=1,Sn(n,i,a,p),i.child)}function bg(n,i,a,u,h){if(fs(i),i.stateNode===null){var p=Ls,w=a.contextType;typeof w=="object"&&w!==null&&(p=wn(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?wn(w):Ls,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),Ja(i,u,p,h),Ga(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),u=!0}else if(n===null){p=i.stateNode;var _=i.memoizedProps,q=ys(a,_);p.props=q;var re=p.context,de=a.contextType;w=Ls,typeof de=="object"&&de!==null&&(w=wn(de));var ye=a.getDerivedStateFromProps;de=typeof ye=="function"||typeof p.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,de||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(_||re!==w)&&ig(i,p,u,w),ji=!1;var ie=i.memoizedState;p.state=ie,Ja(i,u,p,h),Ga(),re=i.memoizedState,_||ie!==re||ji?(typeof ye=="function"&&(hf(i,a,ye,u),re=i.memoizedState),(q=ji||rg(i,a,q,u,ie,re,w))?(de||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=re),p.props=u,p.state=re,p.context=w,u=q):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),u=!1)}else{p=i.stateNode,Ic(n,i),w=i.memoizedProps,de=ys(a,w),p.props=de,ye=i.pendingProps,ie=p.context,re=a.contextType,q=Ls,typeof re=="object"&&re!==null&&(q=wn(re)),_=a.getDerivedStateFromProps,(re=typeof _=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ye||ie!==q)&&ig(i,p,u,q),ji=!1,ie=i.memoizedState,p.state=ie,Ja(i,u,p,h),Ga();var ae=i.memoizedState;w!==ye||ie!==ae||ji||n!==null&&n.dependencies!==null&&mo(n.dependencies)?(typeof _=="function"&&(hf(i,a,_,u),ae=i.memoizedState),(de=ji||rg(i,a,de,u,ie,ae,q)||n!==null&&n.dependencies!==null&&mo(n.dependencies))?(re||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(u,ae,q),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(u,ae,q)),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=u,i.memoizedState=ae),p.props=u,p.state=ae,p.context=q,u=de):(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),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=ps(i,n.child,null,h),i.child=ps(i,null,a,h)):Sn(n,i,a,h),i.memoizedState=p.state,n=i.child):n=si(n,i,h),n}function xg(n,i,a,u){return us(),i.flags|=256,Sn(n,i,a,u),i.child}var yf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bf(n){return{baseLanes:n,cachePool:op()}}function xf(n,i,a){return n=n!==null?n.childLanes&~a:0,i&&(n|=Zn),n}function vg(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:(nn.current&2)!==0),w&&(h=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,n===null){if(dt){if(h?Oi(i):Ri(),(n=qt)?(n=jy(n,gr),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:ki!==null?{id:Pr,overflow:Br}:null,retryLane:536870912,hydrationErrors:null},a=Wm(n),a.return=i,i.child=a,vn=i,qt=null)):n=null,n===null)throw Ci(i);return th(n)?i.lanes=32:i.lanes=536870912,null}var _=u.children;return u=u.fallback,h?(Ri(),h=i.mode,_=Do({mode:"hidden",children:_},h),u=os(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,Wa(null,u)):(Oi(i),vf(i,_))}var q=n.memoizedState;if(q!==null&&(_=q.dehydrated,_!==null)){if(p)i.flags&256?(Oi(i),i.flags&=-257,i=wf(n,i,a)):i.memoizedState!==null?(Ri(),i.child=n.child,i.flags|=128,i=null):(Ri(),_=u.fallback,h=i.mode,u=Do({mode:"visible",children:u.children},h),_=os(_,h,a,null),_.flags|=2,u.return=i,_.return=i,u.sibling=_,i.child=u,ps(i,n.child,null,a),u=i.child,u.memoizedState=bf(a),u.childLanes=xf(n,w,a),i.memoizedState=yf,i=Wa(null,u));else if(Oi(i),th(_)){if(w=_.nextSibling&&_.nextSibling.dataset,w)var re=w.dgst;w=re,u=Error(s(419)),u.stack="",u.digest=w,qa({value:u,source:null,stack:null}),i=wf(n,i,a)}else if(fn||Bs(n,i,a,!1),w=(a&n.childLanes)!==0,fn||w){if(w=Dt,w!==null&&(u=De(w,a),u!==0&&u!==q.retryLane))throw q.retryLane=u,ls(n,u),Fn(w,n,u),pf;eh(_)||Fo(),i=wf(n,i,a)}else eh(_)?(i.flags|=192,i.child=n.child,i=null):(n=q.treeContext,qt=br(_.nextSibling),vn=i,dt=!0,Ei=null,gr=!1,n!==null&&np(i,n),i=vf(i,u.children),i.flags|=4096);return i}return h?(Ri(),_=u.fallback,h=i.mode,q=n.child,re=q.sibling,u=Wr(q,{mode:"hidden",children:u.children}),u.subtreeFlags=q.subtreeFlags&65011712,re!==null?_=Wr(re,_):(_=os(_,h,a,null),_.flags|=2),_.return=i,u.return=i,u.sibling=_,i.child=u,Wa(null,u),u=i.child,_=n.child.memoizedState,_===null?_=bf(a):(h=_.cachePool,h!==null?(q=un._currentValue,h=h.parent!==q?{parent:q,pool:q}:h):h=op(),_={baseLanes:_.baseLanes|a,cachePool:h}),u.memoizedState=_,u.childLanes=xf(n,w,a),i.memoizedState=yf,Wa(n.child,u)):(Oi(i),a=n.child,n=a.sibling,a=Wr(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=Jn(22,n,null,i),n.lanes=0,n}function wf(n,i,a){return ps(i,n.child,null,a),n=vf(i,i.pendingProps.children),n.flags|=2,i.memoizedState=null,n}function wg(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 Sg(n,i,a){var u=i.pendingProps,h=u.revealOrder,p=u.tail;u=u.children;var w=nn.current,_=(w&2)!==0;if(_?(w=w&1|2,i.flags|=128):w&=1,j(nn,w),Sn(n,i,u,a),u=dt?Ha:0,!_&&n!==null&&(n.flags&128)!==0)e:for(n=i.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&wg(n,a,i);else if(n.tag===19)wg(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 si(n,i,a){if(n!==null&&(i.dependencies=n.dependencies),Li|=i.lanes,(a&i.childLanes)===0)if(n!==null){if(Bs(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=Wr(n,n.pendingProps),i.child=a,a.return=i;n.sibling!==null;)n=n.sibling,a=a.sibling=Wr(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 aw(n,i,a){switch(i.tag){case 3:Re(i,i.stateNode.containerInfo),Ai(i,un,n.memoizedState.cache),us();break;case 27:case 5:Fe(i);break;case 4:Re(i,i.stateNode.containerInfo);break;case 10:Ai(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?(Oi(i),i.flags|=128,null):(a&i.child.childLanes)!==0?vg(n,i,a):(Oi(i),n=si(n,i,a),n!==null?n.sibling:null);Oi(i);break;case 19:var h=(n.flags&128)!==0;if(u=(a&i.childLanes)!==0,u||(Bs(n,i,a,!1),u=(a&i.childLanes)!==0),h){if(u)return Sg(n,i,a);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),j(nn,nn.current),u)break;return null;case 22:return i.lanes=0,mg(n,i,a,i.pendingProps);case 24:Ai(i,un,n.memoizedState.cache)}return si(n,i,a)}function _g(n,i,a){if(n!==null)if(n.memoizedProps!==i.pendingProps)fn=!0;else{if(!_f(n,a)&&(i.flags&128)===0)return fn=!1,aw(n,i,a);fn=(n.flags&131072)!==0}else fn=!1,dt&&(i.flags&1048576)!==0&&tp(i,Ha,i.index);switch(i.lanes=0,i.tag){case 16:e:{var u=i.pendingProps;if(n=ds(i.elementType),i.type=n,typeof n=="function")Ac(n)?(u=ys(n,u),i.tag=1,i=bg(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===ue){i.tag=11,i=fg(null,i,n,u,a);break e}else if(h===ee){i.tag=14,i=hg(null,i,n,u,a);break e}}throw i=ne(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=ys(u,i.pendingProps),bg(n,i,u,h,a);case 3:e:{if(Re(i,i.stateNode.containerInfo),n===null)throw Error(s(387));u=i.pendingProps;var p=i.memoizedState;h=p.element,Ic(n,i),Ja(i,u,null,a);var w=i.memoizedState;if(u=w.cache,Ai(i,un,u),u!==p.cache&&zc(i,[un],a,!0),Ga(),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=xg(n,i,u,a);break e}else if(u!==h){h=dr(Error(s(424)),i),qa(h),i=xg(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(qt=br(n.firstChild),vn=i,dt=!0,Ei=null,gr=!0,a=mp(i,null,u,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(us(),u===h){i=si(n,i,a);break e}Sn(n,i,u,a)}i=i.child}return i;case 26:return Mo(n,i),n===null?(a=Dy(i.type,null,i.pendingProps,null))?i.memoizedState=a:dt||(a=i.type,n=i.pendingProps,u=Ko(Ce.current).createElement(a),u[Ue]=i,u[rt]=n,_n(u,a,n),$(u),i.stateNode=u):i.memoizedState=Dy(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return Fe(i),n===null&&dt&&(u=i.stateNode=Oy(i.type,i.pendingProps,Ce.current),vn=i,gr=!0,h=qt,Hi(i.type)?(nh=h,qt=br(u.firstChild)):qt=h),Sn(n,i,i.pendingProps.children,a),Mo(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&&dt&&((h=u=qt)&&(u=zw(u,i.type,i.pendingProps,gr),u!==null?(i.stateNode=u,vn=i,qt=br(u.firstChild),gr=!1,h=!0):h=!1),h||Ci(i)),Fe(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,Qv,null,null,a),ml._currentValue=h),Mo(n,i),Sn(n,i,u,a),i.child;case 6:return n===null&&dt&&((n=a=qt)&&(a=Uw(a,i.pendingProps,gr),a!==null?(i.stateNode=a,vn=i,qt=null,n=!0):n=!1),n||Ci(i)),null;case 13:return vg(n,i,a);case 4:return Re(i,i.stateNode.containerInfo),u=i.pendingProps,n===null?i.child=ps(i,null,u,a):Sn(n,i,u,a),i.child;case 11:return fg(n,i,i.type,i.pendingProps,a);case 7:return Sn(n,i,i.pendingProps,a),i.child;case 8:return Sn(n,i,i.pendingProps.children,a),i.child;case 12:return Sn(n,i,i.pendingProps.children,a),i.child;case 10:return u=i.pendingProps,Ai(i,i.type,u.value),Sn(n,i,u.children,a),i.child;case 9:return h=i.type._context,u=i.pendingProps.children,fs(i),h=wn(h),u=u(h),i.flags|=1,Sn(n,i,u,a),i.child;case 14:return hg(n,i,i.type,i.pendingProps,a);case 15:return dg(n,i,i.type,i.pendingProps,a);case 19:return Sg(n,i,a);case 31:return sw(n,i,a);case 22:return mg(n,i,a,i.pendingProps);case 24:return fs(i),u=wn(un),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),Ai(i,un,h)):((n.lanes&a)!==0&&(Ic(n,i),Ja(i,null,null,a),Ga()),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),Ai(i,un,u)):(u=p.cache,Ai(i,un,u),u!==h.cache&&zc(i,[un],a,!0))),Sn(n,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function ai(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(Kg())n.flags|=8192;else throw ms=bo,Hc}else n.flags&=-16777217}function kg(n,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!By(i))if(Kg())n.flags|=8192;else throw ms=bo,Hc}function Lo(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?Si():536870912,n.lanes|=i,Qs|=i)}function el(n,i){if(!dt)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 It(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 lw(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 It(i),null;case 1:return It(i),null;case 3:return a=i.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),ni(un),_e(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(Ps(i)?ai(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Mc())),It(i),null;case 26:var h=i.type,p=i.memoizedState;return n===null?(ai(i),p!==null?(It(i),kg(i,p)):(It(i),kf(i,h,null,u,a))):p?p!==n.memoizedState?(ai(i),It(i),kg(i,p)):(It(i),i.flags&=-16777217):(n=n.memoizedProps,n!==u&&ai(i),It(i),kf(i,h,n,u,a)),null;case 27:if(_t(i),a=Ce.current,h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==u&&ai(i);else{if(!u){if(i.stateNode===null)throw Error(s(166));return It(i),null}n=be.current,Ps(i)?rp(i):(n=Oy(h,u,a),i.stateNode=n,ai(i))}return It(i),null;case 5:if(_t(i),h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==u&&ai(i);else{if(!u){if(i.stateNode===null)throw Error(s(166));return It(i),null}if(p=be.current,Ps(i))rp(i);else{var w=Ko(Ce.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[Ue]=i,p[rt]=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(_n(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&&ai(i)}}return It(i),kf(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,a),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==u&&ai(i);else{if(typeof u!="string"&&i.stateNode===null)throw Error(s(166));if(n=Ce.current,Ps(i)){if(n=i.stateNode,a=i.memoizedProps,u=null,h=vn,h!==null)switch(h.tag){case 27:case 5:u=h.memoizedProps}n[Ue]=i,n=!!(n.nodeValue===a||u!==null&&u.suppressHydrationWarning===!0||vy(n.nodeValue,a)),n||Ci(i,!0)}else n=Ko(n).createTextNode(u),n[Ue]=i,i.stateNode=n}return It(i),null;case 31:if(a=i.memoizedState,n===null||n.memoizedState!==null){if(u=Ps(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[Ue]=i}else us(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;It(i),n=!1}else a=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return i.flags&256?(Kn(i),i):(Kn(i),null);if((i.flags&128)!==0)throw Error(s(558))}return It(i),null;case 13:if(u=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Ps(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[Ue]=i}else us(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;It(i),h=!1}else h=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Kn(i),i):(Kn(i),null)}return Kn(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),It(i),null);case 4:return _e(),n===null&&Yf(i.stateNode.containerInfo),It(i),null;case 10:return ni(i.type),It(i),null;case 19:if(J(nn),u=i.memoizedState,u===null)return It(i),null;if(h=(i.flags&128)!==0,p=u.rendering,p===null)if(h)el(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,el(u,!1),n=p.updateQueue,i.updateQueue=n,Lo(i,n),i.subtreeFlags=0,n=a,a=i.child;a!==null;)Zm(a,n),a=a.sibling;return j(nn,nn.current&1|2),dt&&ei(i,u.treeForkCount),i.child}n=n.sibling}u.tail!==null&&at()>Ho&&(i.flags|=128,h=!0,el(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),el(u,!0),u.tail===null&&u.tailMode==="hidden"&&!p.alternate&&!dt)return It(i),null}else 2*at()-u.renderingStartTime>Ho&&a!==536870912&&(i.flags|=128,h=!0,el(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=at(),n.sibling=null,a=nn.current,j(nn,h?a&1|2:a&1),dt&&ei(i,u.treeForkCount),n):(It(i),null);case 22:case 23:return Kn(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&&(It(i),i.subtreeFlags&6&&(i.flags|=8192)):It(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&&J(hs),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),ni(un),It(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function ow(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 ni(un),_e(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return _t(i),null;case 31:if(i.memoizedState!==null){if(Kn(i),i.alternate===null)throw Error(s(340));us()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(Kn(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(s(340));us()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return J(nn),null;case 4:return _e(),null;case 10:return ni(i.type),null;case 22:case 23:return Kn(i),Yc(),n!==null&&J(hs),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return ni(un),null;case 25:return null;default:return null}}function Eg(n,i){switch(Oc(i),i.tag){case 3:ni(un),_e();break;case 26:case 27:case 5:_t(i);break;case 4:_e();break;case 31:i.memoizedState!==null&&Kn(i);break;case 13:Kn(i);break;case 19:J(nn);break;case 10:ni(i.type);break;case 22:case 23:Kn(i),Yc(),n!==null&&J(hs);break;case 24:ni(un)}}function tl(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(_){At(i,i.return,_)}}function Mi(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 q=a,re=_;try{re()}catch(de){At(h,q,de)}}}u=u.next}while(u!==p)}}catch(de){At(i,i.return,de)}}function Cg(n){var i=n.updateQueue;if(i!==null){var a=n.stateNode;try{gp(i,a)}catch(u){At(n,n.return,u)}}}function Ag(n,i,a){a.props=ys(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(u){At(n,i,u)}}function nl(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){At(n,i,h)}}function Hr(n,i){var a=n.ref,u=n.refCleanup;if(a!==null)if(typeof u=="function")try{u()}catch(h){At(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){At(n,i,h)}else a.current=null}function jg(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){At(n,n.return,h)}}function Ef(n,i,a){try{var u=n.stateNode;Tw(u,n.type,a,i),u[rt]=i}catch(h){At(n,n.return,h)}}function Ng(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Hi(n.type)||n.tag===4}function Cf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Ng(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&&Hi(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=Qr));else if(u!==4&&(u===27&&Hi(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&&Hi(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 Tg(n){var i=n.stateNode,a=n.memoizedProps;try{for(var u=n.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);_n(i,u,a),i[Ue]=n,i[rt]=a}catch(p){At(n,n.return,p)}}var li=!1,hn=!1,jf=!1,Og=typeof WeakSet=="function"?WeakSet:Set,yn=null;function uw(n,i){if(n=n.containerInfo,Xf=ru,n=Fm(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,q=-1,re=0,de=0,ye=n,ie=null;t:for(;;){for(var ae;ye!==a||h!==0&&ye.nodeType!==3||(_=w+h),ye!==p||u!==0&&ye.nodeType!==3||(q=w+u),ye.nodeType===3&&(w+=ye.nodeValue.length),(ae=ye.firstChild)!==null;)ie=ye,ye=ae;for(;;){if(ye===n)break t;if(ie===a&&++re===h&&(_=w),ie===p&&++de===u&&(q=w),(ae=ye.nextSibling)!==null)break;ye=ie,ie=ye.parentNode}ye=ae}a=_===-1||q===-1?null:{start:_,end:q}}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 ze=ys(a.type,h);n=u.getSnapshotBeforeUpdate(ze,p),u.__reactInternalSnapshotBeforeUpdate=n}catch(Je){At(a,a.return,Je)}}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 Rg(n,i,a){var u=a.flags;switch(a.tag){case 0:case 11:case 15:ui(n,a),u&4&&tl(5,a);break;case 1:if(ui(n,a),u&4)if(n=a.stateNode,i===null)try{n.componentDidMount()}catch(w){At(a,a.return,w)}else{var h=ys(a.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(h,i,n.__reactInternalSnapshotBeforeUpdate)}catch(w){At(a,a.return,w)}}u&64&&Cg(a),u&512&&nl(a,a.return);break;case 3:if(ui(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{gp(n,i)}catch(w){At(a,a.return,w)}}break;case 27:i===null&&u&4&&Tg(a);case 26:case 5:ui(n,a),i===null&&u&4&&jg(a),u&512&&nl(a,a.return);break;case 12:ui(n,a);break;case 31:ui(n,a),u&4&&Lg(n,a);break;case 13:ui(n,a),u&4&&zg(n,a),u&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=bw.bind(null,a),Pw(n,a))));break;case 22:if(u=a.memoizedState!==null||li,!u){i=i!==null&&i.memoizedState!==null||hn,h=li;var p=hn;li=u,(hn=i)&&!p?ci(n,a,(a.subtreeFlags&8772)!==0):ui(n,a),li=h,hn=p}break;case 30:break;default:ui(n,a)}}function Mg(n){var i=n.alternate;i!==null&&(n.alternate=null,Mg(i)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(i=n.stateNode,i!==null&&Xr(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 Vt=null,Bn=!1;function oi(n,i,a){for(a=a.child;a!==null;)Dg(n,i,a),a=a.sibling}function Dg(n,i,a){if(mt&&typeof mt.onCommitFiberUnmount=="function")try{mt.onCommitFiberUnmount(Qt,a)}catch{}switch(a.tag){case 26:hn||Hr(a,i),oi(n,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:hn||Hr(a,i);var u=Vt,h=Bn;Hi(a.type)&&(Vt=a.stateNode,Bn=!1),oi(n,i,a),fl(a.stateNode),Vt=u,Bn=h;break;case 5:hn||Hr(a,i);case 6:if(u=Vt,h=Bn,Vt=null,oi(n,i,a),Vt=u,Bn=h,Vt!==null)if(Bn)try{(Vt.nodeType===9?Vt.body:Vt.nodeName==="HTML"?Vt.ownerDocument.body:Vt).removeChild(a.stateNode)}catch(p){At(a,i,p)}else try{Vt.removeChild(a.stateNode)}catch(p){At(a,i,p)}break;case 18:Vt!==null&&(Bn?(n=Vt,Cy(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),sa(n)):Cy(Vt,a.stateNode));break;case 4:u=Vt,h=Bn,Vt=a.stateNode.containerInfo,Bn=!0,oi(n,i,a),Vt=u,Bn=h;break;case 0:case 11:case 14:case 15:Mi(2,a,i),hn||Mi(4,a,i),oi(n,i,a);break;case 1:hn||(Hr(a,i),u=a.stateNode,typeof u.componentWillUnmount=="function"&&Ag(a,i,u)),oi(n,i,a);break;case 21:oi(n,i,a);break;case 22:hn=(u=hn)||a.memoizedState!==null,oi(n,i,a),hn=u;break;default:oi(n,i,a)}}function Lg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{sa(n)}catch(a){At(i,i.return,a)}}}function zg(n,i){if(i.memoizedState===null&&(n=i.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{sa(n)}catch(a){At(i,i.return,a)}}function cw(n){switch(n.tag){case 31:case 13:case 19:var i=n.stateNode;return i===null&&(i=n.stateNode=new Og),i;case 22:return n=n.stateNode,i=n._retryCache,i===null&&(i=n._retryCache=new Og),i;default:throw Error(s(435,n.tag))}}function Uo(n,i){var a=cw(n);i.forEach(function(u){if(!a.has(u)){a.add(u);var h=xw.bind(null,n,u);u.then(h,h)}})}function Hn(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(Hi(_.type)){Vt=_.stateNode,Bn=!1;break e}break;case 5:Vt=_.stateNode,Bn=!1;break e;case 3:case 4:Vt=_.stateNode.containerInfo,Bn=!0;break e}_=_.return}if(Vt===null)throw Error(s(160));Dg(p,w,h),Vt=null,Bn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Ug(i,n),i=i.sibling}var Ar=null;function Ug(n,i){var a=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Hn(i,n),qn(n),u&4&&(Mi(3,n,n.return),tl(3,n),Mi(5,n,n.return));break;case 1:Hn(i,n),qn(n),u&512&&(hn||a===null||Hr(a,a.return)),u&64&&li&&(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=Ar;if(Hn(i,n),qn(n),u&512&&(hn||a===null||Hr(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[Zt]||p[Ue]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(u),h.head.insertBefore(p,h.querySelector("head > title"))),_n(p,u,a),p[Ue]=n,$(p),u=p;break e;case"link":var w=Uy("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),_n(p,u,a),h.head.appendChild(p);break;case"meta":if(w=Uy("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),_n(p,u,a),h.head.appendChild(p);break;default:throw Error(s(468,u))}p[Ue]=n,$(p),u=p}n.stateNode=u}else Py(h,n.type,n.stateNode);else n.stateNode=zy(h,u,n.memoizedProps);else p!==u?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,u===null?Py(h,n.type,n.stateNode):zy(h,u,n.memoizedProps)):u===null&&n.stateNode!==null&&Ef(n,n.memoizedProps,a.memoizedProps)}break;case 27:Hn(i,n),qn(n),u&512&&(hn||a===null||Hr(a,a.return)),a!==null&&u&4&&Ef(n,n.memoizedProps,a.memoizedProps);break;case 5:if(Hn(i,n),qn(n),u&512&&(hn||a===null||Hr(a,a.return)),n.flags&32){h=n.stateNode;try{js(h,"")}catch(ze){At(n,n.return,ze)}}u&4&&n.stateNode!=null&&(h=n.memoizedProps,Ef(n,h,a!==null?a.memoizedProps:h)),u&1024&&(jf=!0);break;case 6:if(Hn(i,n),qn(n),u&4){if(n.stateNode===null)throw Error(s(162));u=n.memoizedProps,a=n.stateNode;try{a.nodeValue=u}catch(ze){At(n,n.return,ze)}}break;case 3:if(Wo=null,h=Ar,Ar=Qo(i.containerInfo),Hn(i,n),Ar=h,qn(n),u&4&&a!==null&&a.memoizedState.isDehydrated)try{sa(i.containerInfo)}catch(ze){At(n,n.return,ze)}jf&&(jf=!1,Pg(n));break;case 4:u=Ar,Ar=Qo(n.stateNode.containerInfo),Hn(i,n),qn(n),Ar=u;break;case 12:Hn(i,n),qn(n);break;case 31:Hn(i,n),qn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 13:Hn(i,n),qn(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bo=at()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 22:h=n.memoizedState!==null;var q=a!==null&&a.memoizedState!==null,re=li,de=hn;if(li=re||h,hn=de||q,Hn(i,n),hn=de,li=re,qn(n),u&8192)e:for(i=n.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||q||li||hn||bs(n)),a=null,i=n;;){if(i.tag===5||i.tag===26){if(a===null){q=a=i;try{if(p=q.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{_=q.stateNode;var ye=q.memoizedProps.style,ie=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;_.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(ze){At(q,q.return,ze)}}}else if(i.tag===6){if(a===null){q=i;try{q.stateNode.nodeValue=h?"":q.memoizedProps}catch(ze){At(q,q.return,ze)}}}else if(i.tag===18){if(a===null){q=i;try{var ae=q.stateNode;h?Ay(ae,!0):Ay(q.stateNode,!1)}catch(ze){At(q,q.return,ze)}}}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:Hn(i,n),qn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 30:break;case 21:break;default:Hn(i,n),qn(n)}}function qn(n){var i=n.flags;if(i&2){try{for(var a,u=n.return;u!==null;){if(Ng(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&&(js(w,""),a.flags&=-33);var _=Cf(n);zo(n,_,w);break;case 3:case 4:var q=a.stateNode.containerInfo,re=Cf(n);Af(n,re,q);break;default:throw Error(s(161))}}catch(de){At(n,n.return,de)}n.flags&=-3}i&4096&&(n.flags&=-4097)}function Pg(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var i=n;Pg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),n=n.sibling}}function ui(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Rg(n,i.alternate,i),i=i.sibling}function bs(n){for(n=n.child;n!==null;){var i=n;switch(i.tag){case 0:case 11:case 14:case 15:Mi(4,i,i.return),bs(i);break;case 1:Hr(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&Ag(i,i.return,a),bs(i);break;case 27:fl(i.stateNode);case 26:case 5:Hr(i,i.return),bs(i);break;case 22:i.memoizedState===null&&bs(i);break;case 30:bs(i);break;default:bs(i)}n=n.sibling}}function ci(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:ci(h,p,a),tl(4,p);break;case 1:if(ci(h,p,a),u=p,h=u.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(re){At(u,u.return,re)}if(u=p,h=u.updateQueue,h!==null){var _=u.stateNode;try{var q=h.shared.hiddenCallbacks;if(q!==null)for(h.shared.hiddenCallbacks=null,h=0;h<q.length;h++)pp(q[h],_)}catch(re){At(u,u.return,re)}}a&&w&64&&Cg(p),nl(p,p.return);break;case 27:Tg(p);case 26:case 5:ci(h,p,a),a&&u===null&&w&4&&jg(p),nl(p,p.return);break;case 12:ci(h,p,a);break;case 31:ci(h,p,a),a&&w&4&&Lg(h,p);break;case 13:ci(h,p,a),a&&w&4&&zg(h,p);break;case 22:p.memoizedState===null&&ci(h,p,a),nl(p,p.return);break;case 30:break;default:ci(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&&Ia(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&&Ia(n))}function jr(n,i,a,u){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Bg(n,i,a,u),i=i.sibling}function Bg(n,i,a,u){var h=i.flags;switch(i.tag){case 0:case 11:case 15:jr(n,i,a,u),h&2048&&tl(9,i);break;case 1:jr(n,i,a,u);break;case 3:jr(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&&Ia(n)));break;case 12:if(h&2048){jr(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(q){At(i,i.return,q)}}else jr(n,i,a,u);break;case 31:jr(n,i,a,u);break;case 13:jr(n,i,a,u);break;case 23:break;case 22:p=i.stateNode,w=i.alternate,i.memoizedState!==null?p._visibility&2?jr(n,i,a,u):rl(n,i):p._visibility&2?jr(n,i,a,u):(p._visibility|=2,Js(n,i,a,u,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Nf(w,i);break;case 24:jr(n,i,a,u),h&2048&&Tf(i.alternate,i);break;default:jr(n,i,a,u)}}function Js(n,i,a,u,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=n,w=i,_=a,q=u,re=w.flags;switch(w.tag){case 0:case 11:case 15:Js(p,w,_,q,h),tl(8,w);break;case 23:break;case 22:var de=w.stateNode;w.memoizedState!==null?de._visibility&2?Js(p,w,_,q,h):rl(p,w):(de._visibility|=2,Js(p,w,_,q,h)),h&&re&2048&&Nf(w.alternate,w);break;case 24:Js(p,w,_,q,h),h&&re&2048&&Tf(w.alternate,w);break;default:Js(p,w,_,q,h)}i=i.sibling}}function rl(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:rl(a,u),h&2048&&Nf(u.alternate,u);break;case 24:rl(a,u),h&2048&&Tf(u.alternate,u);break;default:rl(a,u)}i=i.sibling}}var il=8192;function Xs(n,i,a){if(n.subtreeFlags&il)for(n=n.child;n!==null;)Hg(n,i,a),n=n.sibling}function Hg(n,i,a){switch(n.tag){case 26:Xs(n,i,a),n.flags&il&&n.memoizedState!==null&&Kw(a,Ar,n.memoizedState,n.memoizedProps);break;case 5:Xs(n,i,a);break;case 3:case 4:var u=Ar;Ar=Qo(n.stateNode.containerInfo),Xs(n,i,a),Ar=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=il,il=16777216,Xs(n,i,a),il=u):Xs(n,i,a));break;default:Xs(n,i,a)}}function qg(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 sl(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,Fg(u,n)}qg(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ig(n),n=n.sibling}function Ig(n){switch(n.tag){case 0:case 11:case 15:sl(n),n.flags&2048&&Mi(9,n,n.return);break;case 3:sl(n);break;case 12:sl(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)):sl(n);break;default:sl(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,Fg(u,n)}qg(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:Mi(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 Fg(n,i){for(;yn!==null;){var a=yn;switch(a.tag){case 0:case 11:case 15:Mi(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:Ia(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(Mg(u),u===a){yn=null;break e}if(h!==null){h.return=p,yn=h;break e}yn=p}}}var fw={getCacheForType:function(n){var i=wn(un),a=i.data.get(n);return a===void 0&&(a=n(),i.data.set(n,a)),a},cacheSignal:function(){return wn(un).controller.signal}},hw=typeof WeakMap=="function"?WeakMap:Map,St=0,Dt=null,lt=null,ct=0,Ct=0,Qn=null,Di=!1,Ks=!1,Of=!1,fi=0,en=0,Li=0,xs=0,Rf=0,Zn=0,Qs=0,al=null,In=null,Mf=!1,Bo=0,$g=0,Ho=1/0,qo=null,zi=null,mn=0,Ui=null,Zs=null,hi=0,Df=0,Lf=null,Vg=null,ll=0,zf=null;function Wn(){return(St&2)!==0&&ct!==0?ct&-ct:V.T!==null?If():gt()}function Yg(){if(Zn===0)if((ct&536870912)===0||dt){var n=Xe;Xe<<=1,(Xe&3932160)===0&&(Xe=262144),Zn=n}else Zn=536870912;return n=Xn.current,n!==null&&(n.flags|=32),Zn}function Fn(n,i,a){(n===Dt&&(Ct===2||Ct===9)||n.cancelPendingCommit!==null)&&(Ws(n,0),Pi(n,ct,Zn,!1)),Tn(n,a),((St&2)===0||n!==Dt)&&(n===Dt&&((St&2)===0&&(xs|=a),en===4&&Pi(n,ct,Zn,!1)),qr(n))}function Gg(n,i,a){if((St&6)!==0)throw Error(s(327));var u=!a&&(i&127)===0&&(i&n.expiredLanes)===0||ur(n,i),h=u?pw(n,i):Pf(n,i,!0),p=u;do{if(h===0){Ks&&!u&&Pi(n,i,0,!1);break}else{if(a=n.current.alternate,p&&!dw(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=al;var q=_.current.memoizedState.isDehydrated;if(q&&(Ws(_,w).flags|=256),w=Pf(_,w,!1),w!==2){if(Of&&!q){_.errorRecoveryDisabledLanes|=p,xs|=p,h=4;break e}p=In,In=h,p!==null&&(In===null?In=p:In.push.apply(In,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Ws(n,0),Pi(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:Pi(u,i,Zn,!Di);break e;case 2:In=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Bo+300-at(),10<h)){if(Pi(u,i,Zn,!Di),on(u,0,!0)!==0)break e;hi=i,u.timeoutHandle=ky(Jg.bind(null,u,a,In,qo,Mf,i,Zn,xs,Qs,Di,p,"Throttled",-0,0),h);break e}Jg(u,a,In,qo,Mf,i,Zn,xs,Qs,Di,p,null,-0,0)}}break}while(!0);qr(n)}function Jg(n,i,a,u,h,p,w,_,q,re,de,ye,ie,ae){if(n.timeoutHandle=-1,ye=i.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qr},Hg(i,p,ye);var ze=(p&62914560)===p?Bo-at():(p&4194048)===p?$g-at():0;if(ze=Qw(ye,ze),ze!==null){hi=p,n.cancelPendingCommit=ze(ny.bind(null,n,i,p,a,u,h,w,_,q,de,ye,null,ie,ae)),Pi(n,p,w,!re);return}}ny(n,i,p,a,u,h,w,_,q)}function dw(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(!Gn(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 Pi(n,i,a,u){i&=~Rf,i&=~xs,n.suspendedLanes|=i,n.pingedLanes&=~i,u&&(n.warmLanes|=i),u=n.expirationTimes;for(var h=i;0<h;){var p=31-ht(h),w=1<<p;u[p]=-1,h&=~w}a!==0&&he(n,a,i)}function Io(){return(St&6)===0?(ol(0),!1):!0}function Uf(){if(lt!==null){if(Ct===0)var n=lt.return;else n=lt,ti=cs=null,Zc(n),Fs=null,$a=0,n=lt;for(;n!==null;)Eg(n.alternate,n),n=n.return;lt=null}}function Ws(n,i){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,Mw(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),hi=0,Uf(),Dt=n,lt=a=Wr(n.current,null),ct=i,Ct=0,Qn=null,Di=!1,Ks=ur(n,i),Of=!1,Qs=Zn=Rf=xs=Li=en=0,In=al=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-ht(u),p=1<<h;i|=n[h],u&=~p}return fi=i,oo(),a}function Xg(n,i){Ze=null,V.H=Za,i===Is||i===yo?(i=fp(),Ct=3):i===Hc?(i=fp(),Ct=4):Ct=i===pf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Qn=i,lt===null&&(en=1,Oo(n,dr(i,n.current)))}function Kg(){var n=Xn.current;return n===null?!0:(ct&4194048)===ct?yr===null:(ct&62914560)===ct||(ct&536870912)!==0?n===yr:!1}function Qg(){var n=V.H;return V.H=Za,n===null?Za:n}function Zg(){var n=V.A;return V.A=fw,n}function Fo(){en=4,Di||(ct&4194048)!==ct&&Xn.current!==null||(Ks=!0),(Li&134217727)===0&&(xs&134217727)===0||Dt===null||Pi(Dt,ct,Zn,!1)}function Pf(n,i,a){var u=St;St|=2;var h=Qg(),p=Zg();(Dt!==n||ct!==i)&&(qo=null,Ws(n,i)),i=!1;var w=en;e:do try{if(Ct!==0&<!==null){var _=lt,q=Qn;switch(Ct){case 8:Uf(),w=6;break e;case 3:case 2:case 9:case 6:Xn.current===null&&(i=!0);var re=Ct;if(Ct=0,Qn=null,ea(n,_,q,re),a&&Ks){w=0;break e}break;default:re=Ct,Ct=0,Qn=null,ea(n,_,q,re)}}mw(),w=en;break}catch(de){Xg(n,de)}while(!0);return i&&n.shellSuspendCounter++,ti=cs=null,St=u,V.H=h,V.A=p,lt===null&&(Dt=null,ct=0,oo()),w}function mw(){for(;lt!==null;)Wg(lt)}function pw(n,i){var a=St;St|=2;var u=Qg(),h=Zg();Dt!==n||ct!==i?(qo=null,Ho=at()+500,Ws(n,i)):Ks=ur(n,i);e:do try{if(Ct!==0&<!==null){i=lt;var p=Qn;t:switch(Ct){case 1:Ct=0,Qn=null,ea(n,i,p,1);break;case 2:case 9:if(up(p)){Ct=0,Qn=null,ey(i);break}i=function(){Ct!==2&&Ct!==9||Dt!==n||(Ct=7),qr(n)},p.then(i,i);break e;case 3:Ct=7;break e;case 4:Ct=5;break e;case 7:up(p)?(Ct=0,Qn=null,ey(i)):(Ct=0,Qn=null,ea(n,i,p,7));break;case 5:var w=null;switch(lt.tag){case 26:w=lt.memoizedState;case 5:case 27:var _=lt;if(w?By(w):_.stateNode.complete){Ct=0,Qn=null;var q=_.sibling;if(q!==null)lt=q;else{var re=_.return;re!==null?(lt=re,$o(re)):lt=null}break t}}Ct=0,Qn=null,ea(n,i,p,5);break;case 6:Ct=0,Qn=null,ea(n,i,p,6);break;case 8:Uf(),en=6;break e;default:throw Error(s(462))}}gw();break}catch(de){Xg(n,de)}while(!0);return ti=cs=null,V.H=u,V.A=h,St=a,lt!==null?0:(Dt=null,ct=0,oo(),en)}function gw(){for(;lt!==null&&!kt();)Wg(lt)}function Wg(n){var i=_g(n.alternate,n,fi);n.memoizedProps=n.pendingProps,i===null?$o(n):lt=i}function ey(n){var i=n,a=i.alternate;switch(i.tag){case 15:case 0:i=yg(a,i,i.pendingProps,i.type,void 0,ct);break;case 11:i=yg(a,i,i.pendingProps,i.type.render,i.ref,ct);break;case 5:Zc(i);default:Eg(a,i),i=lt=Zm(i,fi),i=_g(a,i,fi)}n.memoizedProps=n.pendingProps,i===null?$o(n):lt=i}function ea(n,i,a,u){ti=cs=null,Zc(i),Fs=null,$a=0;var h=i.return;try{if(iw(n,h,i,a,ct)){en=1,Oo(n,dr(a,n.current)),lt=null;return}}catch(p){if(h!==null)throw lt=h,p;en=1,Oo(n,dr(a,n.current)),lt=null;return}i.flags&32768?(dt||u===1?n=!0:Ks||(ct&536870912)!==0?n=!1:(Di=n=!0,(u===2||u===9||u===3||u===6)&&(u=Xn.current,u!==null&&u.tag===13&&(u.flags|=16384))),ty(i,n)):$o(i)}function $o(n){var i=n;do{if((i.flags&32768)!==0){ty(i,Di);return}n=i.return;var a=lw(i.alternate,i,fi);if(a!==null){lt=a;return}if(i=i.sibling,i!==null){lt=i;return}lt=i=n}while(i!==null);en===0&&(en=5)}function ty(n,i){do{var a=ow(n.alternate,n);if(a!==null){a.flags&=32767,lt=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(n=n.sibling,n!==null)){lt=n;return}lt=n=a}while(n!==null);en=6,lt=null}function ny(n,i,a,u,h,p,w,_,q){n.cancelPendingCommit=null;do Vo();while(mn!==0);if((St&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,Ur(n,a,p,w,_,q),n===Dt&&(lt=Dt=null,ct=0),Zs=i,Ui=n,hi=a,Df=p,Lf=h,Vg=u,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,vw(Be,function(){return ly(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,h=K.p,K.p=2,w=St,St|=4;try{uw(n,i,a)}finally{St=w,K.p=h,V.T=u}}mn=1,ry(),iy(),sy()}}function ry(){if(mn===1){mn=0;var n=Ui,i=Zs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=V.T,V.T=null;var u=K.p;K.p=2;var h=St;St|=4;try{Ug(i,n);var p=Kf,w=Fm(n.containerInfo),_=p.focusedElem,q=p.selectionRange;if(w!==_&&_&&_.ownerDocument&&Im(_.ownerDocument.documentElement,_)){if(q!==null&&vc(_)){var re=q.start,de=q.end;if(de===void 0&&(de=re),"selectionStart"in _)_.selectionStart=re,_.selectionEnd=Math.min(de,_.value.length);else{var ye=_.ownerDocument||document,ie=ye&&ye.defaultView||window;if(ie.getSelection){var ae=ie.getSelection(),ze=_.textContent.length,Je=Math.min(q.start,ze),Tt=q.end===void 0?Je:Math.min(q.end,ze);!ae.extend&&Je>Tt&&(w=Tt,Tt=Je,Je=w);var Q=qm(_,Je),Y=qm(_,Tt);if(Q&&Y&&(ae.rangeCount!==1||ae.anchorNode!==Q.node||ae.anchorOffset!==Q.offset||ae.focusNode!==Y.node||ae.focusOffset!==Y.offset)){var te=ye.createRange();te.setStart(Q.node,Q.offset),ae.removeAllRanges(),Je>Tt?(ae.addRange(te),ae.extend(Y.node,Y.offset)):(te.setEnd(Y.node,Y.offset),ae.addRange(te))}}}}for(ye=[],ae=_;ae=ae.parentNode;)ae.nodeType===1&&ye.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<ye.length;_++){var me=ye[_];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}ru=!!Xf,Kf=Xf=null}finally{St=h,K.p=u,V.T=a}}n.current=i,mn=2}}function iy(){if(mn===2){mn=0;var n=Ui,i=Zs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=V.T,V.T=null;var u=K.p;K.p=2;var h=St;St|=4;try{Rg(n,i.alternate,i)}finally{St=h,K.p=u,V.T=a}}mn=3}}function sy(){if(mn===4||mn===3){mn=0,pn();var n=Ui,i=Zs,a=hi,u=Vg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?mn=5:(mn=0,Zs=Ui=null,ay(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(zi=null),Ve(a),i=i.stateNode,mt&&typeof mt.onCommitFiberRoot=="function")try{mt.onCommitFiberRoot(Qt,i,void 0,(i.current.flags&128)===128)}catch{}if(u!==null){i=V.T,h=K.p,K.p=2,V.T=null;try{for(var p=n.onRecoverableError,w=0;w<u.length;w++){var _=u[w];p(_.value,{componentStack:_.stack})}}finally{V.T=i,K.p=h}}(hi&3)!==0&&Vo(),qr(n),h=n.pendingLanes,(a&261930)!==0&&(h&42)!==0?n===zf?ll++:(ll=0,zf=n):ll=0,ol(0)}}function ay(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Ia(i)))}function Vo(){return ry(),iy(),sy(),ly()}function ly(){if(mn!==5)return!1;var n=Ui,i=Df;Df=0;var a=Ve(hi),u=V.T,h=K.p;try{K.p=32>a?32:a,V.T=null,a=Lf,Lf=null;var p=Ui,w=hi;if(mn=0,Zs=Ui=null,hi=0,(St&6)!==0)throw Error(s(331));var _=St;if(St|=4,Ig(p.current),Bg(p,p.current,w,a),St=_,ol(0,!1),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(Qt,p)}catch{}return!0}finally{K.p=h,V.T=u,ay(n,i)}}function oy(n,i,a){i=dr(a,i),i=mf(n.stateNode,i,2),n=Ti(n,i,2),n!==null&&(Tn(n,2),qr(n))}function At(n,i,a){if(n.tag===3)oy(n,n,a);else for(;i!==null;){if(i.tag===3){oy(i,n,a);break}else if(i.tag===1){var u=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(zi===null||!zi.has(u))){n=dr(a,n),a=ug(2),u=Ti(i,a,2),u!==null&&(cg(a,u,i,n),Tn(u,2),qr(u));break}}i=i.return}}function Bf(n,i,a){var u=n.pingCache;if(u===null){u=n.pingCache=new hw;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=yw.bind(null,n,i,a),i.then(n,n))}function yw(n,i,a){var u=n.pingCache;u!==null&&u.delete(i),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,Dt===n&&(ct&a)===a&&(en===4||en===3&&(ct&62914560)===ct&&300>at()-Bo?(St&2)===0&&Ws(n,0):Rf|=a,Qs===ct&&(Qs=0)),qr(n)}function uy(n,i){i===0&&(i=Si()),n=ls(n,i),n!==null&&(Tn(n,i),qr(n))}function bw(n){var i=n.memoizedState,a=0;i!==null&&(a=i.retryLane),uy(n,a)}function xw(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),uy(n,a)}function vw(n,i){return st(n,i)}var Yo=null,ta=null,Hf=!1,Go=!1,qf=!1,Bi=0;function qr(n){n!==ta&&n.next===null&&(ta===null?Yo=ta=n:ta=ta.next=n),Go=!0,Hf||(Hf=!0,Sw())}function ol(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-ht(42|n)+1)-1,p&=h&~(w&~_),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,dy(u,p))}else p=ct,p=on(u,u===Dt?p:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(p&3)===0||ur(u,p)||(a=!0,dy(u,p));u=u.next}while(a);qf=!1}}function ww(){cy()}function cy(){Go=Hf=!1;var n=0;Bi!==0&&Rw()&&(n=Bi);for(var i=at(),a=null,u=Yo;u!==null;){var h=u.next,p=fy(u,i);p===0?(u.next=null,a===null?Yo=h:a.next=h,h===null&&(ta=a)):(a=u,(n!==0||(p&3)!==0)&&(Go=!0)),u=h}mn!==0&&mn!==5||ol(n),Bi!==0&&(Bi=0)}function fy(n,i){for(var a=n.suspendedLanes,u=n.pingedLanes,h=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var w=31-ht(p),_=1<<w,q=h[w];q===-1?((_&a)===0||(_&u)!==0)&&(h[w]=Jr(_,i)):q<=i&&(n.expiredLanes|=_),p&=~_}if(i=Dt,a=ct,a=on(n,n===i?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,a===0||n===i&&(Ct===2||Ct===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&Mt(u),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||ur(n,a)){if(i=a&-a,i===n.callbackPriority)return i;switch(u!==null&&Mt(u),Ve(a)){case 2:case 8:a=we;break;case 32:a=Be;break;case 268435456:a=Ie;break;default:a=Be}return u=hy.bind(null,n),a=st(a,u),n.callbackPriority=i,n.callbackNode=a,i}return u!==null&&u!==null&&Mt(u),n.callbackPriority=2,n.callbackNode=null,2}function hy(n,i){if(mn!==0&&mn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(Vo()&&n.callbackNode!==a)return null;var u=ct;return u=on(n,n===Dt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(Gg(n,u,i),fy(n,at()),n.callbackNode!=null&&n.callbackNode===a?hy.bind(null,n):null)}function dy(n,i){if(Vo())return null;Gg(n,i,!0)}function Sw(){Dw(function(){(St&6)!==0?st(fe,ww):cy()})}function If(){if(Bi===0){var n=Hs;n===0&&(n=ve,ve<<=1,(ve&261888)===0&&(ve=256)),Bi=n}return Bi}function my(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:eo(""+n)}function py(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 _w(n,i,a,u,h){if(i==="submit"&&a&&a.stateNode===h){var p=my((h[rt]||null).action),w=u.submitter;w&&(i=(i=w[rt]||null)?my(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(Bi!==0){var q=w?py(h,w):new FormData(h);of(a,{pending:!0,data:q,method:h.method,action:p},null,q)}}else typeof p=="function"&&(_.preventDefault(),q=w?py(h,w):new FormData(h),of(a,{pending:!0,data:q,method:h.method,action:p},p,q))},currentTarget:h}]})}}for(var Ff=0;Ff<kc.length;Ff++){var $f=kc[Ff],kw=$f.toLowerCase(),Ew=$f[0].toUpperCase()+$f.slice(1);Cr(kw,"on"+Ew)}Cr(Ym,"onAnimationEnd"),Cr(Gm,"onAnimationIteration"),Cr(Jm,"onAnimationStart"),Cr("dblclick","onDoubleClick"),Cr("focusin","onFocus"),Cr("focusout","onBlur"),Cr(qv,"onTransitionRun"),Cr(Iv,"onTransitionStart"),Cr(Fv,"onTransitionCancel"),Cr(Xm,"onTransitionEnd"),se("onMouseEnter",["mouseout","mouseover"]),se("onMouseLeave",["mouseout","mouseover"]),se("onPointerEnter",["pointerout","pointerover"]),se("onPointerLeave",["pointerout","pointerover"]),xe("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xe("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xe("onBeforeInput",["compositionend","keypress","textInput","paste"]),xe("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xe("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xe("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ul="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(" "),Cw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ul));function gy(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],q=_.instance,re=_.currentTarget;if(_=_.listener,q!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=re;try{p(h)}catch(de){lo(de)}h.currentTarget=null,p=q}else for(w=0;w<u.length;w++){if(_=u[w],q=_.instance,re=_.currentTarget,_=_.listener,q!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=re;try{p(h)}catch(de){lo(de)}h.currentTarget=null,p=q}}}}function ot(n,i){var a=i[$t];a===void 0&&(a=i[$t]=new Set);var u=n+"__bubble";a.has(u)||(yy(i,n,2,!1),a.add(u))}function Vf(n,i,a){var u=0;i&&(u|=4),yy(a,n,u,i)}var Jo="_reactListening"+Math.random().toString(36).slice(2);function Yf(n){if(!n[Jo]){n[Jo]=!0,Z.forEach(function(a){a!=="selectionchange"&&(Cw.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 yy(n,i,a,u){switch(Yy(i)){case 2:var h=eS;break;case 8:h=tS;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 q=w.tag;if((q===3||q===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;_!==null;){if(w=C(_),w===null)return;if(q=w.tag,q===5||q===6||q===26||q===27){u=p=w;continue e}_=_.parentNode}}u=u.return}Sm(function(){var re=p,de=uc(a),ye=[];e:{var ie=Km.get(n);if(ie!==void 0){var ae=io,ze=n;switch(n){case"keypress":if(no(a)===0)break e;case"keydown":case"keyup":ae=xv;break;case"focusin":ze="focus",ae=pc;break;case"focusout":ze="blur",ae=pc;break;case"beforeblur":case"afterblur":ae=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":ae=Em;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=lv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=Sv;break;case Ym:case Gm:case Jm:ae=cv;break;case Xm:ae=kv;break;case"scroll":case"scrollend":ae=sv;break;case"wheel":ae=Cv;break;case"copy":case"cut":case"paste":ae=hv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Am;break;case"toggle":case"beforetoggle":ae=jv}var Je=(i&4)!==0,Tt=!Je&&(n==="scroll"||n==="scrollend"),Q=Je?ie!==null?ie+"Capture":null:ie;Je=[];for(var Y=re,te;Y!==null;){var me=Y;if(te=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||te===null||Q===null||(me=Oa(Y,Q),me!=null&&Je.push(cl(Y,me,te))),Tt)break;Y=Y.return}0<Je.length&&(ie=new ae(ie,ze,null,a,de),ye.push({event:ie,listeners:Je}))}}if((i&7)===0){e:{if(ie=n==="mouseover"||n==="pointerover",ae=n==="mouseout"||n==="pointerout",ie&&a!==oc&&(ze=a.relatedTarget||a.fromElement)&&(C(ze)||ze[xt]))break e;if((ae||ie)&&(ie=de.window===de?de:(ie=de.ownerDocument)?ie.defaultView||ie.parentWindow:window,ae?(ze=a.relatedTarget||a.toElement,ae=re,ze=ze?C(ze):null,ze!==null&&(Tt=o(ze),Je=ze.tag,ze!==Tt||Je!==5&&Je!==27&&Je!==6)&&(ze=null)):(ae=null,ze=re),ae!==ze)){if(Je=Em,me="onMouseLeave",Q="onMouseEnter",Y="mouse",(n==="pointerout"||n==="pointerover")&&(Je=Am,me="onPointerLeave",Q="onPointerEnter",Y="pointer"),Tt=ae==null?ie:R(ae),te=ze==null?ie:R(ze),ie=new Je(me,Y+"leave",ae,a,de),ie.target=Tt,ie.relatedTarget=te,me=null,C(de)===re&&(Je=new Je(Q,Y+"enter",ze,a,de),Je.target=te,Je.relatedTarget=Tt,me=Je),Tt=me,ae&&ze)t:{for(Je=Aw,Q=ae,Y=ze,te=0,me=Q;me;me=Je(me))te++;me=0;for(var $e=Y;$e;$e=Je($e))me++;for(;0<te-me;)Q=Je(Q),te--;for(;0<me-te;)Y=Je(Y),me--;for(;te--;){if(Q===Y||Y!==null&&Q===Y.alternate){Je=Q;break t}Q=Je(Q),Y=Je(Y)}Je=null}else Je=null;ae!==null&&by(ye,ie,ae,Je,!1),ze!==null&&Tt!==null&&by(ye,Tt,ze,Je,!0)}}e:{if(ie=re?R(re):window,ae=ie.nodeName&&ie.nodeName.toLowerCase(),ae==="select"||ae==="input"&&ie.type==="file")var vt=Lm;else if(Mm(ie))if(zm)vt=Pv;else{vt=zv;var Pe=Lv}else ae=ie.nodeName,!ae||ae.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?re&&lc(re.elementType)&&(vt=Lm):vt=Uv;if(vt&&(vt=vt(n,re))){Dm(ye,vt,a,de);break e}Pe&&Pe(n,ie,re),n==="focusout"&&re&&ie.type==="number"&&re.memoizedProps.value!=null&&ac(ie,"number",ie.value)}switch(Pe=re?R(re):window,n){case"focusin":(Mm(Pe)||Pe.contentEditable==="true")&&(Rs=Pe,wc=re,Ba=null);break;case"focusout":Ba=wc=Rs=null;break;case"mousedown":Sc=!0;break;case"contextmenu":case"mouseup":case"dragend":Sc=!1,$m(ye,a,de);break;case"selectionchange":if(Hv)break;case"keydown":case"keyup":$m(ye,a,de)}var We;if(yc)e:{switch(n){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else Os?Om(n,a)&&(ft="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(ft="onCompositionStart");ft&&(jm&&a.locale!=="ko"&&(Os||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&Os&&(We=_m()):(_i=de,hc="value"in _i?_i.value:_i.textContent,Os=!0)),Pe=Xo(re,ft),0<Pe.length&&(ft=new Cm(ft,n,null,a,de),ye.push({event:ft,listeners:Pe}),We?ft.data=We:(We=Rm(a),We!==null&&(ft.data=We)))),(We=Tv?Ov(n,a):Rv(n,a))&&(ft=Xo(re,"onBeforeInput"),0<ft.length&&(Pe=new Cm("onBeforeInput","beforeinput",null,a,de),ye.push({event:Pe,listeners:ft}),Pe.data=We)),_w(ye,n,re,a,de)}gy(ye,i)})}function cl(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=Oa(n,a),h!=null&&u.unshift(cl(n,h,p)),h=Oa(n,i),h!=null&&u.push(cl(n,h,p))),n.tag===3)return u;n=n.return}return[]}function Aw(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function by(n,i,a,u,h){for(var p=i._reactName,w=[];a!==null&&a!==u;){var _=a,q=_.alternate,re=_.stateNode;if(_=_.tag,q!==null&&q===u)break;_!==5&&_!==26&&_!==27||re===null||(q=re,h?(re=Oa(a,p),re!=null&&w.unshift(cl(a,re,q))):h||(re=Oa(a,p),re!=null&&w.push(cl(a,re,q)))),a=a.return}w.length!==0&&n.push({event:i,listeners:w})}var jw=/\r\n?/g,Nw=/\u0000|\uFFFD/g;function xy(n){return(typeof n=="string"?n:""+n).replace(jw,`
|
|
49
|
-
`).replace(Nw,"")}function vy(n,i){return i=xy(i),xy(n)===i}function Nt(n,i,a,u,h,p){switch(a){case"children":typeof u=="string"?i==="body"||i==="textarea"&&u===""||js(n,u):(typeof u=="number"||typeof u=="bigint")&&i!=="body"&&js(n,""+u);break;case"className":Er(n,"class",u);break;case"tabIndex":Er(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Er(n,a,u);break;case"style":vm(n,u,p);break;case"data":if(i!=="object"){Er(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"&&Nt(n,i,"name",h.name,h,null),Nt(n,i,"formEncType",h.formEncType,h,null),Nt(n,i,"formMethod",h.formMethod,h,null),Nt(n,i,"formTarget",h.formTarget,h,null)):(Nt(n,i,"encType",h.encType,h,null),Nt(n,i,"method",h.method,h,null),Nt(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=Qr);break;case"onScroll":u!=null&&ot("scroll",n);break;case"onScrollEnd":u!=null&&ot("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":ot("beforetoggle",n),ot("toggle",n),kn(n,"popover",u);break;case"xlinkActuate":Kr(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Kr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Kr(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Kr(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Kr(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Kr(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Kr(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Kr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Kr(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":kn(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=rv.get(a)||a,kn(n,a,u))}}function Jf(n,i,a,u,h,p){switch(a){case"style":vm(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"?js(n,u):(typeof u=="number"||typeof u=="bigint")&&js(n,""+u);break;case"onScroll":u!=null&&ot("scroll",n);break;case"onScrollEnd":u!=null&&ot("scrollend",n);break;case"onClick":u!=null&&(n.onclick=Qr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ge.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[rt]||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,""):kn(n,a,u)}}}function _n(n,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ot("error",n),ot("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:Nt(n,i,p,w,a,null)}}h&&Nt(n,i,"srcSet",a.srcSet,a,null),u&&Nt(n,i,"src",a.src,a,null);return;case"input":ot("invalid",n);var _=p=w=h=null,q=null,re=null;for(u in a)if(a.hasOwnProperty(u)){var de=a[u];if(de!=null)switch(u){case"name":h=de;break;case"type":w=de;break;case"checked":q=de;break;case"defaultChecked":re=de;break;case"value":p=de;break;case"defaultValue":_=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(s(137,i));break;default:Nt(n,i,u,de,a,null)}}gm(n,p,_,q,re,w,h,!1);return;case"select":ot("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:Nt(n,i,h,_,a,null)}i=p,a=w,n.multiple=!!u,i!=null?As(n,!!u,i,!1):a!=null&&As(n,!!u,a,!0);return;case"textarea":ot("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:Nt(n,i,w,_,a,null)}bm(n,u,h,p);return;case"option":for(q in a)if(a.hasOwnProperty(q)&&(u=a[q],u!=null))switch(q){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Nt(n,i,q,u,a,null)}return;case"dialog":ot("beforetoggle",n),ot("toggle",n),ot("cancel",n),ot("close",n);break;case"iframe":case"object":ot("load",n);break;case"video":case"audio":for(u=0;u<ul.length;u++)ot(ul[u],n);break;case"image":ot("error",n),ot("load",n);break;case"details":ot("toggle",n);break;case"embed":case"source":case"link":ot("error",n),ot("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in a)if(a.hasOwnProperty(re)&&(u=a[re],u!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:Nt(n,i,re,u,a,null)}return;default:if(lc(i)){for(de in a)a.hasOwnProperty(de)&&(u=a[de],u!==void 0&&Jf(n,i,de,u,a,void 0));return}}for(_ in a)a.hasOwnProperty(_)&&(u=a[_],u!=null&&Nt(n,i,_,u,a,null))}function Tw(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,q=null,re=null,de=null;for(ae in a){var ye=a[ae];if(a.hasOwnProperty(ae)&&ye!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":q=ye;default:u.hasOwnProperty(ae)||Nt(n,i,ae,null,u,ye)}}for(var ie in u){var ae=u[ie];if(ye=a[ie],u.hasOwnProperty(ie)&&(ae!=null||ye!=null))switch(ie){case"type":p=ae;break;case"name":h=ae;break;case"checked":re=ae;break;case"defaultChecked":de=ae;break;case"value":w=ae;break;case"defaultValue":_=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(s(137,i));break;default:ae!==ye&&Nt(n,i,ie,ae,u,ye)}}sc(n,w,_,q,re,de,p,h);return;case"select":ae=w=_=ie=null;for(p in a)if(q=a[p],a.hasOwnProperty(p)&&q!=null)switch(p){case"value":break;case"multiple":ae=q;default:u.hasOwnProperty(p)||Nt(n,i,p,null,u,q)}for(h in u)if(p=u[h],q=a[h],u.hasOwnProperty(h)&&(p!=null||q!=null))switch(h){case"value":ie=p;break;case"defaultValue":_=p;break;case"multiple":w=p;default:p!==q&&Nt(n,i,h,p,u,q)}i=_,a=w,u=ae,ie!=null?As(n,!!a,ie,!1):!!u!=!!a&&(i!=null?As(n,!!a,i,!0):As(n,!!a,a?[]:"",!1));return;case"textarea":ae=ie=null;for(_ in a)if(h=a[_],a.hasOwnProperty(_)&&h!=null&&!u.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:Nt(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":ie=h;break;case"defaultValue":ae=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(s(91));break;default:h!==p&&Nt(n,i,w,h,u,p)}ym(n,ie,ae);return;case"option":for(var ze in a)if(ie=a[ze],a.hasOwnProperty(ze)&&ie!=null&&!u.hasOwnProperty(ze))switch(ze){case"selected":n.selected=!1;break;default:Nt(n,i,ze,null,u,ie)}for(q in u)if(ie=u[q],ae=a[q],u.hasOwnProperty(q)&&ie!==ae&&(ie!=null||ae!=null))switch(q){case"selected":n.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:Nt(n,i,q,ie,u,ae)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Je in a)ie=a[Je],a.hasOwnProperty(Je)&&ie!=null&&!u.hasOwnProperty(Je)&&Nt(n,i,Je,null,u,ie);for(re in u)if(ie=u[re],ae=a[re],u.hasOwnProperty(re)&&ie!==ae&&(ie!=null||ae!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:Nt(n,i,re,ie,u,ae)}return;default:if(lc(i)){for(var Tt in a)ie=a[Tt],a.hasOwnProperty(Tt)&&ie!==void 0&&!u.hasOwnProperty(Tt)&&Jf(n,i,Tt,void 0,u,ie);for(de in u)ie=u[de],ae=a[de],!u.hasOwnProperty(de)||ie===ae||ie===void 0&&ae===void 0||Jf(n,i,de,ie,u,ae);return}}for(var Q in a)ie=a[Q],a.hasOwnProperty(Q)&&ie!=null&&!u.hasOwnProperty(Q)&&Nt(n,i,Q,null,u,ie);for(ye in u)ie=u[ye],ae=a[ye],!u.hasOwnProperty(ye)||ie===ae||ie==null&&ae==null||Nt(n,i,ye,ie,u,ae)}function wy(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ow(){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&&_&&wy(w)){for(w=0,_=h.responseEnd,u+=1;u<a.length;u++){var q=a[u],re=q.startTime;if(re>_)break;var de=q.transferSize,ye=q.initiatorType;de&&wy(ye)&&(q=q.responseEnd,w+=de*(q<_?1:(_-re)/(q-re)))}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 Sy(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 _y(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 Rw(){var n=window.event;return n&&n.type==="popstate"?n===Zf?!1:(Zf=n,!0):(Zf=null,!1)}var ky=typeof setTimeout=="function"?setTimeout:void 0,Mw=typeof clearTimeout=="function"?clearTimeout:void 0,Ey=typeof Promise=="function"?Promise:void 0,Dw=typeof queueMicrotask=="function"?queueMicrotask:typeof Ey<"u"?function(n){return Ey.resolve(null).then(n).catch(Lw)}:ky;function Lw(n){setTimeout(function(){throw n})}function Hi(n){return n==="head"}function Cy(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),sa(i);return}u--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")u++;else if(a==="html")fl(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,fl(a);for(var p=a.firstChild;p;){var w=p.nextSibling,_=p.nodeName;p[Zt]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&fl(n.ownerDocument.body);a=h}while(a);sa(i)}function Ay(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),Xr(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function zw(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[Zt])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=br(n.nextSibling),n===null)break}return null}function Uw(n,i,a){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=br(n.nextSibling),n===null))return null;return n}function jy(n,i){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=br(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 Pw(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 br(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 Ny(n){n=n.nextSibling;for(var i=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(i===0)return br(n.nextSibling);i--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||i++}n=n.nextSibling}return null}function Ty(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 Oy(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 fl(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);Xr(n)}var xr=new Map,Ry=new Set;function Qo(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var di=K.d;K.d={f:Bw,r:Hw,D:qw,C:Iw,L:Fw,m:$w,X:Yw,S:Vw,M:Gw};function Bw(){var n=di.f(),i=Io();return n||i}function Hw(n){var i=T(n);i!==null&&i.tag===5&&i.type==="form"?Xp(i):di.r(n)}var na=typeof document>"u"?null:document;function My(n,i,a){var u=na;if(u&&typeof i=="string"&&i){var h=fr(i);h='link[rel="'+n+'"][href="'+h+'"]',typeof a=="string"&&(h+='[crossorigin="'+a+'"]'),Ry.has(h)||(Ry.add(h),n={rel:n,crossOrigin:a,href:i},u.querySelector(h)===null&&(i=u.createElement("link"),_n(i,"link",n),$(i),u.head.appendChild(i)))}}function qw(n){di.D(n),My("dns-prefetch",n,null)}function Iw(n,i){di.C(n,i),My("preconnect",n,i)}function Fw(n,i,a){di.L(n,i,a);var u=na;if(u&&n&&i){var h='link[rel="preload"][as="'+fr(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+fr(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+fr(a.imageSizes)+'"]')):h+='[href="'+fr(n)+'"]';var p=h;switch(i){case"style":p=ra(n);break;case"script":p=ia(n)}xr.has(p)||(n=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:n,as:i},a),xr.set(p,n),u.querySelector(h)!==null||i==="style"&&u.querySelector(hl(p))||i==="script"&&u.querySelector(dl(p))||(i=u.createElement("link"),_n(i,"link",n),$(i),u.head.appendChild(i)))}}function $w(n,i){di.m(n,i);var a=na;if(a&&n){var u=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+fr(u)+'"][href="'+fr(n)+'"]',p=h;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ia(n)}if(!xr.has(p)&&(n=g({rel:"modulepreload",href:n},i),xr.set(p,n),a.querySelector(h)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(dl(p)))return}u=a.createElement("link"),_n(u,"link",n),$(u),a.head.appendChild(u)}}}function Vw(n,i,a){di.S(n,i,a);var u=na;if(u&&n){var h=U(u).hoistableStyles,p=ra(n);i=i||"default";var w=h.get(p);if(!w){var _={loading:0,preload:null};if(w=u.querySelector(hl(p)))_.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":i},a),(a=xr.get(p))&&rh(n,a);var q=w=u.createElement("link");$(q),_n(q,"link",n),q._p=new Promise(function(re,de){q.onload=re,q.onerror=de}),q.addEventListener("load",function(){_.loading|=1}),q.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Zo(w,i,u)}w={type:"stylesheet",instance:w,count:1,state:_},h.set(p,w)}}}function Yw(n,i){di.X(n,i);var a=na;if(a&&n){var u=U(a).hoistableScripts,h=ia(n),p=u.get(h);p||(p=a.querySelector(dl(h)),p||(n=g({src:n,async:!0},i),(i=xr.get(h))&&ih(n,i),p=a.createElement("script"),$(p),_n(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function Gw(n,i){di.M(n,i);var a=na;if(a&&n){var u=U(a).hoistableScripts,h=ia(n),p=u.get(h);p||(p=a.querySelector(dl(h)),p||(n=g({src:n,async:!0,type:"module"},i),(i=xr.get(h))&&ih(n,i),p=a.createElement("script"),$(p),_n(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function Dy(n,i,a,u){var h=(h=Ce.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=ra(a.href),a=U(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=ra(a.href);var p=U(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(hl(n)))&&!p._p&&(w.instance=p,w.state.loading=5),xr.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},xr.set(n,a),p||Jw(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=ia(a),a=U(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 ra(n){return'href="'+fr(n)+'"'}function hl(n){return'link[rel="stylesheet"]['+n+"]"}function Ly(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function Jw(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}),_n(i,"link",a),$(i),n.head.appendChild(i))}function ia(n){return'[src="'+fr(n)+'"]'}function dl(n){return"script[async]"+n}function zy(n,i,a){if(i.count++,i.instance===null)switch(i.type){case"style":var u=n.querySelector('style[data-href~="'+fr(a.href)+'"]');if(u)return i.instance=u,$(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"),$(u),_n(u,"style",h),Zo(u,a.precedence,n),i.instance=u;case"stylesheet":h=ra(a.href);var p=n.querySelector(hl(h));if(p)return i.state.loading|=4,i.instance=p,$(p),p;u=Ly(a),(h=xr.get(h))&&rh(u,h),p=(n.ownerDocument||n).createElement("link"),$(p);var w=p;return w._p=new Promise(function(_,q){w.onload=_,w.onerror=q}),_n(p,"link",u),i.state.loading|=4,Zo(p,a.precedence,n),i.instance=p;case"script":return p=ia(a.src),(h=n.querySelector(dl(p)))?(i.instance=h,$(h),h):(u=a,(h=xr.get(p))&&(u=g({},a),ih(u,h)),n=n.ownerDocument||n,h=n.createElement("script"),$(h),_n(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 Uy(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[Zt]||p[Ue]||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 Py(n,i,a){n=n.ownerDocument||n,n.head.insertBefore(a,i==="title"?n.querySelector("head > title"):null)}function Xw(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 By(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Kw(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=ra(u.href),p=i.querySelector(hl(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,$(p);return}p=i.ownerDocument||i,u=Ly(u),(h=xr.get(h))&&rh(u,h),p=p.createElement("link"),$(p);var w=p;w._p=new Promise(function(_,q){w.onload=_,w.onerror=q}),_n(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 Qw(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*Ow());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(Zw,n),tu=null,eu.call(n))}function Zw(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 ml={$$typeof:I,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function Ww(n,i,a,u,h,p,w,_,q){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=zr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zr(0),this.hiddenUpdates=zr(null),this.identifierPrefix=u,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function Hy(n,i,a,u,h,p,w,_,q,re,de,ye){return n=new Ww(n,i,a,w,q,re,de,ye,_),i=1,p===!0&&(i|=24),p=Jn(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 qy(n){return n?(n=Ls,n):Ls}function Iy(n,i,a,u,h,p){h=qy(h),u.context===null?u.context=h:u.pendingContext=h,u=Ni(i),u.payload={element:a},p=p===void 0?null:p,p!==null&&(u.callback=p),a=Ti(n,u,i),a!==null&&(Fn(a,n,i),Ya(a,n,i))}function Fy(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){Fy(n,i),(n=n.alternate)&&Fy(n,i)}function $y(n){if(n.tag===13||n.tag===31){var i=ls(n,67108864);i!==null&&Fn(i,n,67108864),ah(n,67108864)}}function Vy(n){if(n.tag===13||n.tag===31){var i=Wn();i=Ge(i);var a=ls(n,i);a!==null&&Fn(a,n,i),ah(n,i)}}var ru=!0;function eS(n,i,a,u){var h=V.T;V.T=null;var p=K.p;try{K.p=2,lh(n,i,a,u)}finally{K.p=p,V.T=h}}function tS(n,i,a,u){var h=V.T;V.T=null;var p=K.p;try{K.p=8,lh(n,i,a,u)}finally{K.p=p,V.T=h}}function lh(n,i,a,u){if(ru){var h=oh(u);if(h===null)Gf(n,i,u,iu,a),Gy(n,u);else if(rS(h,n,i,a,u))u.stopPropagation();else if(Gy(n,u),i&4&&-1<nS.indexOf(n)){for(;h!==null;){var p=T(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=pt(p.pendingLanes);if(w!==0){var _=p;for(_.pendingLanes|=2,_.entangledLanes|=2;w;){var q=1<<31-ht(w);_.entanglements[1]|=q,w&=~q}qr(p),(St&6)===0&&(Ho=at()+500,ol(0))}}break;case 31:case 13:_=ls(p,2),_!==null&&Fn(_,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=C(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 Yy(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(or()){case fe:return 2;case we:return 8;case Be:case Ke:return 32;case Ie:return 268435456;default:return 32}default:return 32}}var ch=!1,qi=null,Ii=null,Fi=null,pl=new Map,gl=new Map,$i=[],nS="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 Gy(n,i){switch(n){case"focusin":case"focusout":qi=null;break;case"dragenter":case"dragleave":Ii=null;break;case"mouseover":case"mouseout":Fi=null;break;case"pointerover":case"pointerout":pl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":gl.delete(i.pointerId)}}function yl(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=T(i),i!==null&&$y(i)),n):(n.eventSystemFlags|=u,i=n.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),n)}function rS(n,i,a,u,h){switch(i){case"focusin":return qi=yl(qi,n,i,a,u,h),!0;case"dragenter":return Ii=yl(Ii,n,i,a,u,h),!0;case"mouseover":return Fi=yl(Fi,n,i,a,u,h),!0;case"pointerover":var p=h.pointerId;return pl.set(p,yl(pl.get(p)||null,n,i,a,u,h)),!0;case"gotpointercapture":return p=h.pointerId,gl.set(p,yl(gl.get(p)||null,n,i,a,u,h)),!0}return!1}function Jy(n){var i=C(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,nt(n.priority,function(){Vy(a)});return}}else if(i===31){if(i=f(a),i!==null){n.blockedOn=i,nt(n.priority,function(){Vy(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=T(a),i!==null&&$y(i),n.blockedOn=a,!1;i.shift()}return!0}function Xy(n,i,a){su(n)&&a.delete(i)}function iS(){ch=!1,qi!==null&&su(qi)&&(qi=null),Ii!==null&&su(Ii)&&(Ii=null),Fi!==null&&su(Fi)&&(Fi=null),pl.forEach(Xy),gl.forEach(Xy)}function au(n,i){n.blockedOn===i&&(n.blockedOn=null,ch||(ch=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,iS)))}var lu=null;function Ky(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=T(a);p!==null&&(n.splice(i,3),i-=3,of(p,{pending:!0,data:h,method:a.method,action:u},u,h))}}))}function sa(n){function i(q){return au(q,n)}qi!==null&&au(qi,n),Ii!==null&&au(Ii,n),Fi!==null&&au(Fi,n),pl.forEach(i),gl.forEach(i);for(var a=0;a<$i.length;a++){var u=$i[a];u.blockedOn===n&&(u.blockedOn=null)}for(;0<$i.length&&(a=$i[0],a.blockedOn===null);)Jy(a),a.blockedOn===null&&$i.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[rt]||null;if(typeof p=="function")w||Ky(a);else if(w){var _=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[rt]||null)_=w.formAction;else if(uh(h)!==null)continue}else _=w.action;typeof _=="function"?a[u+1]=_:(a.splice(u,3),u-=3),Ky(a)}}}function Qy(){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=Wn();Iy(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;Iy(n.current,2,null,n,null,null),Io(),i[xt]=null}};function ou(n){this._internalRoot=n}ou.prototype.unstable_scheduleHydration=function(n){if(n){var i=gt();n={blockedOn:null,target:n,priority:i};for(var a=0;a<$i.length&&i!==0&&i<$i[a].priority;a++);$i.splice(a,0,n),a===0&&Jy(n)}};var Zy=t.version;if(Zy!=="19.2.4")throw Error(s(527,Zy,"19.2.4"));K.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?b(n):null,n=n===null?null:n.stateNode,n};var sS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{Qt=uu.inject(sS),mt=uu}catch{}}return xl.createRoot=function(n,i){if(!l(n))throw Error(s(299));var a=!1,u="",h=sg,p=ag,w=lg;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=Hy(n,1,!1,null,null,a,u,null,h,p,w,Qy),n[xt]=i.current,Yf(n),new fh(i)},xl.hydrateRoot=function(n,i,a){if(!l(n))throw Error(s(299));var u=!1,h="",p=sg,w=ag,_=lg,q=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&&(q=a.formState)),i=Hy(n,1,!0,i,a??null,u,h,q,p,w,_,Qy),i.context=qy(null),a=i.current,u=Wn(),u=Ge(u),h=Ni(u),h.callback=null,Ti(a,h,u),a=u,i.current.lanes=a,Tn(i,a),qr(i),n[xt]=i.current,Yf(n),new ou(i)},xl.version="19.2.4",xl}var o0;function gS(){if(o0)return mh.exports;o0=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=pS(),mh.exports}var yS=gS();/**
|
|
48
|
+
`+u.stack}}var ht=Object.prototype.hasOwnProperty,dt=e.unstable_scheduleCallback,xt=e.unstable_cancelCallback,Gt=e.unstable_shouldYield,En=e.unstable_requestPaint,st=e.unstable_now,sr=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,we=e.unstable_UserBlockingPriority,He=e.unstable_NormalPriority,Qe=e.unstable_LowPriority,qe=e.unstable_IdlePriority,xe=e.log,Ie=e.unstable_setDisableYieldValue,je=null,Ge=null;function yt(n){if(typeof xe=="function"&&Ie(n),Ge&&typeof Ge.setStrictMode=="function")try{Ge.setStrictMode(je,n)}catch{}}var ut=Math.clz32?Math.clz32:wi,xn=Math.log,cn=Math.LN2;function wi(n){return n>>>=0,n===0?32:31-(xn(n)/cn|0)|0}var mn=256,vr=262144,Rr=4194304;function Cn(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 Vr(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=Cn(u):(w&=_,w!==0?h=Cn(w):a||(a=_&~n,a!==0&&(h=Cn(a))))):(_=u&~p,_!==0?h=Cn(_):w!==0?h=Cn(w):a||(a=u&~n,a!==0&&(h=Cn(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 Yr(n,i){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&i)===0}function Gr(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 Si(){var n=Rr;return Rr<<=1,(Rr&62914560)===0&&(Rr=4194304),n}function Mr(n){for(var i=[],a=0;31>a;a++)i.push(n);return i}function An(n,i){n.pendingLanes|=i,i!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Dr(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,q=n.expirationTimes,re=n.hiddenUpdates;for(a=w&~a;0<a;){var de=31-ut(a),ye=1<<de;_[de]=0,q[de]=-1;var ie=re[de];if(ie!==null)for(re[de]=null,de=0;de<ie.length;de++){var ae=ie[de];ae!==null&&(ae.lane&=-536870913)}a&=~ye}u!==0&&he(n,u,0),p!==0&&h===0&&n.tag!==0&&(n.suspendedLanes|=p&~(w&~i))}function he(n,i,a){n.pendingLanes|=i,n.suspendedLanes&=~i;var u=31-ut(i);n.entangledLanes|=i,n.entanglements[u]=n.entanglements[u]|1073741824|a&261930}function Ne(n,i){var a=n.entangledLanes|=i;for(n=n.entanglements;a;){var u=31-ut(a),h=1<<u;h&i|n[u]&i&&(n[u]|=i),a&=~h}}function De(n,i){var a=i&-i;return a=(a&42)!==0?1:Je(a),(a&(n.suspendedLanes|i))!==0?0:a}function Je(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 Ve(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function pt(){var n=J.p;return n!==0?n:(n=window.event,n===void 0?32:Vy(n.type))}function nt(n,i){var a=J.p;try{return J.p=n,i()}finally{J.p=a}}var Be=Math.random().toString(36).slice(2),Ue="__reactFiber$"+Be,rt="__reactProps$"+Be,vt="__reactContainer$"+Be,qt="__reactEvents$"+Be,Dn="__reactListeners$"+Be,ns="__reactHandles$"+Be,rs="__reactResources$"+Be,Jt="__reactMarker$"+Be;function Jr(n){delete n[Ue],delete n[rt],delete n[qt],delete n[Dn],delete n[ns]}function k(n){var i=n[Ue];if(i)return i;for(var a=n.parentNode;a;){if(i=a[vt]||a[Ue]){if(a=i.alternate,i.child!==null||a!==null&&a.child!==null)for(n=Ny(n);n!==null;){if(a=n[Ue])return a;n=Ny(n)}return i}n=a,a=n.parentNode}return null}function T(n){if(n=n[Ue]||n[vt]){var i=n.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return n}return null}function O(n){var i=n.tag;if(i===5||i===26||i===27||i===6)return n.stateNode;throw Error(s(33))}function U(n){var i=n[rs];return i||(i=n[rs]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function $(n){n[Jt]=!0}var Z=new Set,ge={};function be(n,i){se(n,i),se(n+"Capture",i)}function se(n,i){for(ge[n]=i,n=0;n<i.length;n++)Z.add(i[n])}var pe=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]*$"),Le={},it={};function Ut(n){return ht.call(it,n)?!0:ht.call(Le,n)?!1:pe.test(n)?it[n]=!0:(Le[n]=!0,!1)}function vn(n,i,a){if(Ut(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 wr(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 Xr(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 ar(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 ev(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=ev(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 tv=/[\n"\\]/g;function lr(n){return n.replace(tv,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=""+ar(i)):n.value!==""+ar(i)&&(n.value=""+ar(i)):w!=="submit"&&w!=="reset"||n.removeAttribute("value"),i!=null?ac(n,w,ar(i)):a!=null?ac(n,w,ar(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=""+ar(_):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?""+ar(a):"",i=i!=null?""+ar(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 As(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=""+ar(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=""+ar(i),i!==n.value&&(n.value=i),a==null)){n.defaultValue!==i&&(n.defaultValue=i);return}n.defaultValue=a!=null?""+ar(a):""}function ym(n,i,a,u){if(i==null){if(u!=null){if(a!=null)throw Error(s(92));if(W(u)){if(1<u.length)throw Error(s(93));u=u[0]}a=u}a==null&&(a=""),i=a}a=ar(i),n.defaultValue=a,u=n.textContent,u===a&&u!==""&&u!==null&&(n.value=u),ic(n)}function js(n,i){if(i){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=i;return}}n.textContent=i}var nv=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||nv.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 rv=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"]]),iv=/^[\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 iv.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Kr(){}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 Ns=null,Ts=null;function vm(n){var i=T(n);if(i&&(n=i.stateNode)){var a=n[rt]||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="'+lr(""+i)+'"][type="radio"]'),i=0;i<a.length;i++){var u=a[i];if(u!==n&&u.form===n.form){var h=u[rt]||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&&As(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,(Ns!==null||Ts!==null)&&(Io(),Ns&&(i=Ns,n=Ts,Ts=Ns=null,vm(i),n)))for(i=0;i<n.length;i++)vm(n[i])}}function Oa(n,i){var a=n.stateNode;if(a===null)return null;var u=a[rt]||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 Qr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fc=!1;if(Qr)try{var Ra={};Object.defineProperty(Ra,"passive",{get:function(){fc=!0}}),window.addEventListener("test",Ra,Ra),window.removeEventListener("test",Ra,Ra)}catch{fc=!1}var _i=null,hc=null,to=null;function Sm(){if(to)return to;var n,i=hc,a=i.length,u,h="value"in _i?_i.value:_i.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 Ln(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 is={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},io=Ln(is),Ma=g({},is,{view:0,detail:0}),sv=Ln(Ma),dc,mc,Da,so=g({},Ma,{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!==Da&&(Da&&n.type==="mousemove"?(dc=n.screenX-Da.screenX,mc=n.screenY-Da.screenY):mc=dc=0,Da=n),dc)},movementY:function(n){return"movementY"in n?n.movementY:mc}}),km=Ln(so),av=g({},so,{dataTransfer:0}),lv=Ln(av),ov=g({},Ma,{relatedTarget:0}),pc=Ln(ov),uv=g({},is,{animationName:0,elapsedTime:0,pseudoElement:0}),cv=Ln(uv),fv=g({},is,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),hv=Ln(fv),dv=g({},is,{data:0}),Em=Ln(dv),mv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pv={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"},gv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yv(n){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(n):(n=gv[n])?!!i[n]:!1}function gc(){return yv}var bv=g({},Ma,{key:function(n){if(n.key){var i=mv[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"?pv[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}}),xv=Ln(bv),vv=g({},so,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cm=Ln(vv),wv=g({},Ma,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),Sv=Ln(wv),_v=g({},is,{propertyName:0,elapsedTime:0,pseudoElement:0}),kv=Ln(_v),Ev=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}),Cv=Ln(Ev),Av=g({},is,{newState:0,oldState:0}),jv=Ln(Av),Nv=[9,13,27,32],yc=Qr&&"CompositionEvent"in window,La=null;Qr&&"documentMode"in document&&(La=document.documentMode);var Tv=Qr&&"TextEvent"in window&&!La,Am=Qr&&(!yc||La&&8<La&&11>=La),jm=" ",Nm=!1;function Tm(n,i){switch(n){case"keyup":return Nv.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 Os=!1;function Ov(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 Rv(n,i){if(Os)return n==="compositionend"||!yc&&Tm(n,i)?(n=Sm(),to=hc=_i=null,Os=!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 Mv={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"?!!Mv[n.type]:i==="textarea"}function Mm(n,i,a,u){Ns?Ts?Ts.push(u):Ts=[u]:Ns=u,i=Xo(i,"onChange"),0<i.length&&(a=new io("onChange","change",null,a,u),n.push({event:a,listeners:i}))}var za=null,Ua=null;function Dv(n){py(n,0)}function ao(n){var i=O(n);if(mm(i))return n}function Dm(n,i){if(n==="change")return i}var Lm=!1;if(Qr){var bc;if(Qr){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(){za&&(za.detachEvent("onpropertychange",Pm),Ua=za=null)}function Pm(n){if(n.propertyName==="value"&&ao(Ua)){var i=[];Mm(i,Ua,n,uc(n)),wm(Dv,i)}}function Lv(n,i,a){n==="focusin"?(Um(),za=i,Ua=a,za.attachEvent("onpropertychange",Pm)):n==="focusout"&&Um()}function zv(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ao(Ua)}function Uv(n,i){if(n==="click")return ao(i)}function Pv(n,i){if(n==="input"||n==="change")return ao(i)}function Bv(n,i){return n===i&&(n!==0||1/n===1/i)||n!==n&&i!==i}var $n=typeof Object.is=="function"?Object.is:Bv;function Pa(n,i){if($n(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(!ht.call(i,h)||!$n(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 Hv=Qr&&"documentMode"in document&&11>=document.documentMode,Rs=null,wc=null,Ba=null,Sc=!1;function Fm(n,i,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Sc||Rs==null||Rs!==Wl(u)||(u=Rs,"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}),Ba&&Pa(Ba,u)||(Ba=u,u=Xo(wc,"onSelect"),0<u.length&&(i=new io("onSelect","select",null,i,a),n.push({event:i,listeners:u}),i.target=Rs)))}function ss(n,i){var a={};return a[n.toLowerCase()]=i.toLowerCase(),a["Webkit"+n]="webkit"+i,a["Moz"+n]="moz"+i,a}var Ms={animationend:ss("Animation","AnimationEnd"),animationiteration:ss("Animation","AnimationIteration"),animationstart:ss("Animation","AnimationStart"),transitionrun:ss("Transition","TransitionRun"),transitionstart:ss("Transition","TransitionStart"),transitioncancel:ss("Transition","TransitionCancel"),transitionend:ss("Transition","TransitionEnd")},_c={},$m={};Qr&&($m=document.createElement("div").style,"AnimationEvent"in window||(delete Ms.animationend.animation,delete Ms.animationiteration.animation,delete Ms.animationstart.animation),"TransitionEvent"in window||delete Ms.transitionend.transition);function as(n){if(_c[n])return _c[n];if(!Ms[n])return n;var i=Ms[n],a;for(a in i)if(i.hasOwnProperty(a)&&a in $m)return _c[n]=i[a];return n}var Vm=as("animationend"),Ym=as("animationiteration"),Gm=as("animationstart"),qv=as("transitionrun"),Iv=as("transitionstart"),Fv=as("transitioncancel"),Jm=as("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 Sr(n,i){Xm.set(n,i),be(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)},or=[],Ds=0,Ec=0;function oo(){for(var n=Ds,i=Ec=Ds=0;i<n;){var a=or[i];or[i++]=null;var u=or[i];or[i++]=null;var h=or[i];or[i++]=null;var p=or[i];if(or[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){or[Ds++]=n,or[Ds++]=i,or[Ds++]=a,or[Ds++]=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 ls(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-ut(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<ll)throw ll=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 Ls={};function $v(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 Vn(n,i,a,u){return new $v(n,i,a,u)}function Ac(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Zr(n,i){var a=n.alternate;return a===null?(a=Vn(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=Xw(n,a,ve.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case H:return n=Vn(31,a,i,h),n.elementType=H,n.lanes=p,n;case j:return os(a.children,h,p,i);case D:w=8,h|=24;break;case M:return n=Vn(12,a,i,h|2),n.elementType=M,n.lanes=p,n;case B:return n=Vn(13,a,i,h),n.elementType=B,n.lanes=p,n;case P:return n=Vn(19,a,i,h),n.elementType=P,n.lanes=p,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:w=10;break e;case R:w=9;break e;case ue:w=11;break e;case ee:w=14;break e;case G:w=16,u=null;break e}w=29,a=Error(s(130,n===null?"null":typeof n,"")),u=null}return i=Vn(w,a,i,h),i.elementType=n,i.type=u,i.lanes=p,i}function os(n,i,a,u){return n=Vn(7,n,u,i),n.lanes=a,n}function jc(n,i,a){return n=Vn(6,n,null,i),n.lanes=a,n}function Zm(n){var i=Vn(18,null,null,0);return i.stateNode=n,i}function Nc(n,i,a){return i=Vn(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 ur(n,i){if(typeof n=="object"&&n!==null){var a=Wm.get(n);return a!==void 0?a:(i={value:n,source:i,stack:Ke(i)},Wm.set(n,i),i)}return{value:n,source:i,stack:Ke(i)}}var zs=[],Us=0,ho=null,Ha=0,cr=[],fr=0,ki=null,Lr=1,zr="";function Wr(n,i){zs[Us++]=Ha,zs[Us++]=ho,ho=n,Ha=i}function ep(n,i,a){cr[fr++]=Lr,cr[fr++]=zr,cr[fr++]=ki,ki=n;var u=Lr;n=zr;var h=32-ut(u)-1;u&=~(1<<h),a+=1;var p=32-ut(i)+h;if(30<p){var w=h-h%5;p=(u&(1<<w)-1).toString(32),u>>=w,h-=w,Lr=1<<32-ut(i)+h|a<<h|u,zr=p+n}else Lr=1<<p|a<<h|u,zr=n}function Tc(n){n.return!==null&&(Wr(n,1),ep(n,1,0))}function Oc(n){for(;n===ho;)ho=zs[--Us],zs[Us]=null,Ha=zs[--Us],zs[Us]=null;for(;n===ki;)ki=cr[--fr],cr[fr]=null,zr=cr[--fr],cr[fr]=null,Lr=cr[--fr],cr[fr]=null}function tp(n,i){cr[fr++]=Lr,cr[fr++]=zr,cr[fr++]=ki,Lr=i.id,zr=i.overflow,ki=n}var pn=null,Pt=null,mt=!1,Ei=null,hr=!1,Rc=Error(s(519));function Ci(n){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qa(ur(i,n)),Rc}function np(n){var i=n.stateNode,a=n.type,u=n.memoizedProps;switch(i[Ue]=n,i[rt]=u,a){case"dialog":lt("cancel",i),lt("close",i);break;case"iframe":case"object":case"embed":lt("load",i);break;case"video":case"audio":for(a=0;a<ul.length;a++)lt(ul[a],i);break;case"source":lt("error",i);break;case"img":case"image":case"link":lt("error",i),lt("load",i);break;case"details":lt("toggle",i);break;case"input":lt("invalid",i),pm(i,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":lt("invalid",i);break;case"textarea":lt("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&&(lt("beforetoggle",i),lt("toggle",i)),u.onScroll!=null&<("scroll",i),u.onScrollEnd!=null&<("scrollend",i),u.onClick!=null&&(i.onclick=Kr),i=!0):i=!1,i||Ci(n,!0)}function rp(n){for(pn=n.return;pn;)switch(pn.tag){case 5:case 31:case 13:hr=!1;return;case 27:case 3:hr=!0;return;default:pn=pn.return}}function Ps(n){if(n!==pn)return!1;if(!mt)return rp(n),mt=!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&&Pt&&Ci(n),rp(n),i===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Pt=jy(n)}else if(i===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Pt=jy(n)}else i===27?(i=Pt,Hi(n.type)?(n=nh,nh=null,Pt=n):Pt=i):Pt=pn?mr(n.stateNode.nextSibling):null;return!0}function us(){Pt=pn=null,mt=!1}function Mc(){var n=Ei;return n!==null&&(Bn===null?Bn=n:Bn.push.apply(Bn,n),Ei=null),n}function qa(n){Ei===null?Ei=[n]:Ei.push(n)}var Dc=L(null),cs=null,ei=null;function Ai(n,i,a){N(Dc,i._currentValue),i._currentValue=a}function ti(n){n._currentValue=Dc.current,X(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 q=0;q<i.length;q++)if(_.context===i[q]){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 Bs(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;$n(h.pendingProps.value,w.value)||(n!==null?n.push(_):n=[_])}}else if(h===le.current){if(w=h.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(n!==null?n.push(ml):n=[ml])}h=h.return}n!==null&&zc(i,n,a,u),i.flags|=262144}function mo(n){for(n=n.firstContext;n!==null;){if(!$n(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function fs(n){cs=n,ei=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function gn(n){return ip(cs,n)}function po(n,i){return cs===null&&fs(n),ip(n,i)}function ip(n,i){var a=i._currentValue;if(i={context:i,memoizedValue:a,next:null},ei===null){if(n===null)throw Error(s(308));ei=i,n.dependencies={lanes:0,firstContext:i},n.flags|=524288}else ei=ei.next=i;return a}var Vv=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()})}},Yv=e.unstable_scheduleCallback,Gv=e.unstable_NormalPriority,rn={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uc(){return{controller:new Vv,data:new Map,refCount:0}}function Ia(n){n.refCount--,n.refCount===0&&Yv(Gv,function(){n.controller.abort()})}var Fa=null,Pc=0,Hs=0,qs=null;function Jv(n,i){if(Fa===null){var a=Fa=[];Pc=0,Hs=If(),qs={status:"pending",value:void 0,then:function(u){a.push(u)}}}return Pc++,i.then(sp,sp),i}function sp(){if(--Pc===0&&Fa!==null){qs!==null&&(qs.status="fulfilled");var n=Fa;Fa=null,Hs=0,qs=null;for(var i=0;i<n.length;i++)(0,n[i])()}}function Xv(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=V.S;V.S=function(n,i){Fg=st(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Jv(n,i),ap!==null&&ap(n,i)};var hs=L(null);function Bc(){var n=hs.current;return n!==null?n:Mt.pooledCache}function go(n,i){i===null?N(hs,hs.current):N(hs,i.pool)}function lp(){var n=Bc();return n===null?null:{parent:rn._currentValue,pool:n}}var Is=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(Kr,Kr),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(Kr,Kr);else{if(n=Mt,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 ms=i,Is}}function ds(n){try{var i=n._init;return i(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ms=a,Is):a}}var ms=null;function cp(){if(ms===null)throw Error(s(459));var n=ms;return ms=null,n}function fp(n){if(n===Is||n===yo)throw Error(s(483))}var Fs=null,$a=0;function xo(n){var i=$a;return $a+=1,Fs===null&&(Fs=[]),up(Fs,n,i)}function Va(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(Q,Y){if(n){var ne=Q.deletions;ne===null?(Q.deletions=[Y],Q.flags|=16):ne.push(Y)}}function a(Q,Y){if(!n)return null;for(;Y!==null;)i(Q,Y),Y=Y.sibling;return null}function u(Q){for(var Y=new Map;Q!==null;)Q.key!==null?Y.set(Q.key,Q):Y.set(Q.index,Q),Q=Q.sibling;return Y}function h(Q,Y){return Q=Zr(Q,Y),Q.index=0,Q.sibling=null,Q}function p(Q,Y,ne){return Q.index=ne,n?(ne=Q.alternate,ne!==null?(ne=ne.index,ne<Y?(Q.flags|=67108866,Y):ne):(Q.flags|=67108866,Y)):(Q.flags|=1048576,Y)}function w(Q){return n&&Q.alternate===null&&(Q.flags|=67108866),Q}function _(Q,Y,ne,me){return Y===null||Y.tag!==6?(Y=jc(ne,Q.mode,me),Y.return=Q,Y):(Y=h(Y,ne),Y.return=Q,Y)}function q(Q,Y,ne,me){var $e=ne.type;return $e===j?de(Q,Y,ne.props.children,me,ne.key):Y!==null&&(Y.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===G&&ds($e)===Y.type)?(Y=h(Y,ne.props),Va(Y,ne),Y.return=Q,Y):(Y=fo(ne.type,ne.key,ne.props,null,Q.mode,me),Va(Y,ne),Y.return=Q,Y)}function re(Q,Y,ne,me){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ne.containerInfo||Y.stateNode.implementation!==ne.implementation?(Y=Nc(ne,Q.mode,me),Y.return=Q,Y):(Y=h(Y,ne.children||[]),Y.return=Q,Y)}function de(Q,Y,ne,me,$e){return Y===null||Y.tag!==7?(Y=os(ne,Q.mode,me,$e),Y.return=Q,Y):(Y=h(Y,ne),Y.return=Q,Y)}function ye(Q,Y,ne){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=jc(""+Y,Q.mode,ne),Y.return=Q,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:return ne=fo(Y.type,Y.key,Y.props,null,Q.mode,ne),Va(ne,Y),ne.return=Q,ne;case S:return Y=Nc(Y,Q.mode,ne),Y.return=Q,Y;case G:return Y=ds(Y),ye(Q,Y,ne)}if(W(Y)||F(Y))return Y=os(Y,Q.mode,ne,null),Y.return=Q,Y;if(typeof Y.then=="function")return ye(Q,xo(Y),ne);if(Y.$$typeof===I)return ye(Q,po(Q,Y),ne);vo(Q,Y)}return null}function ie(Q,Y,ne,me){var $e=Y!==null?Y.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return $e!==null?null:_(Q,Y,""+ne,me);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case v:return ne.key===$e?q(Q,Y,ne,me):null;case S:return ne.key===$e?re(Q,Y,ne,me):null;case G:return ne=ds(ne),ie(Q,Y,ne,me)}if(W(ne)||F(ne))return $e!==null?null:de(Q,Y,ne,me,null);if(typeof ne.then=="function")return ie(Q,Y,xo(ne),me);if(ne.$$typeof===I)return ie(Q,Y,po(Q,ne),me);vo(Q,ne)}return null}function ae(Q,Y,ne,me,$e){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return Q=Q.get(ne)||null,_(Y,Q,""+me,$e);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case v:return Q=Q.get(me.key===null?ne:me.key)||null,q(Y,Q,me,$e);case S:return Q=Q.get(me.key===null?ne:me.key)||null,re(Y,Q,me,$e);case G:return me=ds(me),ae(Q,Y,ne,me,$e)}if(W(me)||F(me))return Q=Q.get(ne)||null,de(Y,Q,me,$e,null);if(typeof me.then=="function")return ae(Q,Y,ne,xo(me),$e);if(me.$$typeof===I)return ae(Q,Y,ne,po(Y,me),$e);vo(Y,me)}return null}function ze(Q,Y,ne,me){for(var $e=null,wt=null,Pe=Y,et=Y=0,ft=null;Pe!==null&&et<ne.length;et++){Pe.index>et?(ft=Pe,Pe=null):ft=Pe.sibling;var St=ie(Q,Pe,ne[et],me);if(St===null){Pe===null&&(Pe=ft);break}n&&Pe&&St.alternate===null&&i(Q,Pe),Y=p(St,Y,et),wt===null?$e=St:wt.sibling=St,wt=St,Pe=ft}if(et===ne.length)return a(Q,Pe),mt&&Wr(Q,et),$e;if(Pe===null){for(;et<ne.length;et++)Pe=ye(Q,ne[et],me),Pe!==null&&(Y=p(Pe,Y,et),wt===null?$e=Pe:wt.sibling=Pe,wt=Pe);return mt&&Wr(Q,et),$e}for(Pe=u(Pe);et<ne.length;et++)ft=ae(Pe,Q,et,ne[et],me),ft!==null&&(n&&ft.alternate!==null&&Pe.delete(ft.key===null?et:ft.key),Y=p(ft,Y,et),wt===null?$e=ft:wt.sibling=ft,wt=ft);return n&&Pe.forEach(function(Vi){return i(Q,Vi)}),mt&&Wr(Q,et),$e}function Xe(Q,Y,ne,me){if(ne==null)throw Error(s(151));for(var $e=null,wt=null,Pe=Y,et=Y=0,ft=null,St=ne.next();Pe!==null&&!St.done;et++,St=ne.next()){Pe.index>et?(ft=Pe,Pe=null):ft=Pe.sibling;var Vi=ie(Q,Pe,St.value,me);if(Vi===null){Pe===null&&(Pe=ft);break}n&&Pe&&Vi.alternate===null&&i(Q,Pe),Y=p(Vi,Y,et),wt===null?$e=Vi:wt.sibling=Vi,wt=Vi,Pe=ft}if(St.done)return a(Q,Pe),mt&&Wr(Q,et),$e;if(Pe===null){for(;!St.done;et++,St=ne.next())St=ye(Q,St.value,me),St!==null&&(Y=p(St,Y,et),wt===null?$e=St:wt.sibling=St,wt=St);return mt&&Wr(Q,et),$e}for(Pe=u(Pe);!St.done;et++,St=ne.next())St=ae(Pe,Q,et,St.value,me),St!==null&&(n&&St.alternate!==null&&Pe.delete(St.key===null?et:St.key),Y=p(St,Y,et),wt===null?$e=St:wt.sibling=St,wt=St);return n&&Pe.forEach(function(aS){return i(Q,aS)}),mt&&Wr(Q,et),$e}function Nt(Q,Y,ne,me){if(typeof ne=="object"&&ne!==null&&ne.type===j&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case v:e:{for(var $e=ne.key;Y!==null;){if(Y.key===$e){if($e=ne.type,$e===j){if(Y.tag===7){a(Q,Y.sibling),me=h(Y,ne.props.children),me.return=Q,Q=me;break e}}else if(Y.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===G&&ds($e)===Y.type){a(Q,Y.sibling),me=h(Y,ne.props),Va(me,ne),me.return=Q,Q=me;break e}a(Q,Y);break}else i(Q,Y);Y=Y.sibling}ne.type===j?(me=os(ne.props.children,Q.mode,me,ne.key),me.return=Q,Q=me):(me=fo(ne.type,ne.key,ne.props,null,Q.mode,me),Va(me,ne),me.return=Q,Q=me)}return w(Q);case S:e:{for($e=ne.key;Y!==null;){if(Y.key===$e)if(Y.tag===4&&Y.stateNode.containerInfo===ne.containerInfo&&Y.stateNode.implementation===ne.implementation){a(Q,Y.sibling),me=h(Y,ne.children||[]),me.return=Q,Q=me;break e}else{a(Q,Y);break}else i(Q,Y);Y=Y.sibling}me=Nc(ne,Q.mode,me),me.return=Q,Q=me}return w(Q);case G:return ne=ds(ne),Nt(Q,Y,ne,me)}if(W(ne))return ze(Q,Y,ne,me);if(F(ne)){if($e=F(ne),typeof $e!="function")throw Error(s(150));return ne=$e.call(ne),Xe(Q,Y,ne,me)}if(typeof ne.then=="function")return Nt(Q,Y,xo(ne),me);if(ne.$$typeof===I)return Nt(Q,Y,po(Q,ne),me);vo(Q,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Y!==null&&Y.tag===6?(a(Q,Y.sibling),me=h(Y,ne),me.return=Q,Q=me):(a(Q,Y),me=jc(ne,Q.mode,me),me.return=Q,Q=me),w(Q)):a(Q,Y)}return function(Q,Y,ne,me){try{$a=0;var $e=Nt(Q,Y,ne,me);return Fs=null,$e}catch(Pe){if(Pe===Is||Pe===yo)throw Pe;var wt=Vn(29,Pe,null,Q.mode);return wt.lanes=me,wt.return=Q,wt}finally{}}}var ps=hp(!0),dp=hp(!1),ji=!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 Ni(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Ti(n,i,a){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(_t&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 Ya(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,Ne(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 Ga(){if($c){var n=qs;if(n!==null)throw n}}function Ja(n,i,a,u){$c=!1;var h=n.updateQueue;ji=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,_=h.shared.pending;if(_!==null){h.shared.pending=null;var q=_,re=q.next;q.next=null,w===null?p=re:w.next=re,w=q;var de=n.alternate;de!==null&&(de=de.updateQueue,_=de.lastBaseUpdate,_!==w&&(_===null?de.firstBaseUpdate=re:_.next=re,de.lastBaseUpdate=q))}if(p!==null){var ye=h.baseState;w=0,de=re=q=null,_=p;do{var ie=_.lane&-536870913,ae=ie!==_.lane;if(ae?(ct&ie)===ie:(u&ie)===ie){ie!==0&&ie===Hs&&($c=!0),de!==null&&(de=de.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var ze=n,Xe=_;ie=i;var Nt=a;switch(Xe.tag){case 1:if(ze=Xe.payload,typeof ze=="function"){ye=ze.call(Nt,ye,ie);break e}ye=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=Xe.payload,ie=typeof ze=="function"?ze.call(Nt,ye,ie):ze,ie==null)break e;ye=g({},ye,ie);break e;case 2:ji=!0}}ie=_.callback,ie!==null&&(n.flags|=64,ae&&(n.flags|=8192),ae=h.callbacks,ae===null?h.callbacks=[ie]:ae.push(ie))}else ae={lane:ie,tag:_.tag,payload:_.payload,callback:_.callback,next:null},de===null?(re=de=ae,q=ye):de=de.next=ae,w|=ie;if(_=_.next,_===null){if(_=h.shared.pending,_===null)break;ae=_,_=ae.next,ae.next=null,h.lastBaseUpdate=ae,h.shared.pending=null}}while(!0);de===null&&(q=ye),h.baseState=q,h.firstBaseUpdate=re,h.lastBaseUpdate=de,p===null&&(h.shared.lanes=0),Li|=w,n.lanes=w,n.memoizedState=ye}}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 $s=L(null),wo=L(0);function gp(n,i){n=ci,N(wo,n),N($s,i),ci=n|i.baseLanes}function Vc(){N(wo,ci),N($s,$s.current)}function Yc(){ci=wo.current,X($s),X(wo)}var Yn=L(null),dr=null;function Oi(n){var i=n.alternate;N(Zt,Zt.current&1),N(Yn,n),dr===null&&(i===null||$s.current!==null||i.memoizedState!==null)&&(dr=n)}function Gc(n){N(Zt,Zt.current),N(Yn,n),dr===null&&(dr=n)}function yp(n){n.tag===22?(N(Zt,Zt.current),N(Yn,n),dr===null&&(dr=n)):Ri()}function Ri(){N(Zt,Zt.current),N(Yn,Yn.current)}function Gn(n){X(Yn),dr===n&&(dr=null),X(Zt)}var Zt=L(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 ni=0,We=null,At=null,sn=null,_o=!1,Vs=!1,gs=!1,ko=0,Xa=0,Ys=null,Kv=0;function Xt(){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(!$n(n[a],i[a]))return!1;return!0}function Xc(n,i,a,u,h,p){return ni=p,We=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,V.H=n===null||n.memoizedState===null?eg:ff,gs=!1,p=a(u,h),gs=!1,Vs&&(p=xp(i,a,u,h)),bp(n),p}function bp(n){V.H=Za;var i=At!==null&&At.next!==null;if(ni=0,sn=At=We=null,_o=!1,Xa=0,Ys=null,i)throw Error(s(300));n===null||an||(n=n.dependencies,n!==null&&mo(n)&&(an=!0))}function xp(n,i,a,u){We=n;var h=0;do{if(Vs&&(Ys=null),Xa=0,Vs=!1,25<=h)throw Error(s(301));if(h+=1,sn=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)}V.H=tg,p=i(a,u)}while(Vs);return p}function Qv(){var n=V.H,i=n.useState()[0];return i=typeof i.then=="function"?Ka(i):i,n=n.useState()[0],(At!==null?At.memoizedState:null)!==n&&(We.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}ni=0,sn=At=We=null,Vs=!1,Xa=ko=0,Ys=null}function jn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sn===null?We.memoizedState=sn=n:sn=sn.next=n,sn}function Wt(){if(At===null){var n=We.alternate;n=n!==null?n.memoizedState:null}else n=At.next;var i=sn===null?We.memoizedState:sn.next;if(i!==null)sn=i,At=n;else{if(n===null)throw We.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},sn===null?We.memoizedState=sn=n:sn=sn.next=n}return sn}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ka(n){var i=Xa;return Xa+=1,Ys===null&&(Ys=[]),n=up(Ys,n,i),i=We,(sn===null?i.memoizedState:sn.next)===null&&(i=i.alternate,V.H=i===null||i.memoizedState===null?eg:ff),n}function Co(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ka(n);if(n.$$typeof===I)return gn(n)}throw Error(s(438,String(n)))}function Wc(n){var i=null,a=We.updateQueue;if(a!==null&&(i=a.memoCache),i==null){var u=We.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(),We.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]=z;return i.index++,a}function ri(n,i){return typeof i=="function"?i(n):i}function Ao(n){var i=Wt();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,q=null,re=i,de=!1;do{var ye=re.lane&-536870913;if(ye!==re.lane?(ct&ye)===ye:(ni&ye)===ye){var ie=re.revertLane;if(ie===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),ye===Hs&&(de=!0);else if((ni&ie)===ie){re=re.next,ie===Hs&&(de=!0);continue}else ye={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(_=q=ye,w=p):q=q.next=ye,We.lanes|=ie,Li|=ie;ye=re.action,gs&&a(p,ye),p=re.hasEagerState?re.eagerState:a(p,ye)}else ie={lane:ye,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},q===null?(_=q=ie,w=p):q=q.next=ie,We.lanes|=ye,Li|=ye;re=re.next}while(re!==null&&re!==i);if(q===null?w=p:q.next=_,!$n(p,n.memoizedState)&&(an=!0,de&&(a=qs,a!==null)))throw a;n.memoizedState=p,n.baseState=w,n.baseQueue=q,u.lastRenderedState=p}return h===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function tf(n){var i=Wt(),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);$n(p,i.memoizedState)||(an=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),a.lastRenderedState=p}return[p,u]}function vp(n,i,a){var u=We,h=Wt(),p=mt;if(p){if(a===void 0)throw Error(s(407));a=a()}else a=i();var w=!$n((At||h).memoizedState,a);if(w&&(h.memoizedState=a,an=!0),h=h.queue,sf(_p.bind(null,u,h,n),[n]),h.getSnapshot!==i||w||sn!==null&&sn.memoizedState.tag&1){if(u.flags|=2048,Gs(9,{destroy:void 0},Sp.bind(null,u,h,a,i),null),Mt===null)throw Error(s(349));p||(ni&127)!==0||wp(u,i,a)}return a}function wp(n,i,a){n.flags|=16384,n={getSnapshot:i,value:a},i=We.updateQueue,i===null?(i=Eo(),We.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!$n(n,a)}catch{return!0}}function Ep(n){var i=ls(n,2);i!==null&&Hn(i,n,2)}function nf(n){var i=jn();if(typeof n=="function"){var a=n;if(n=a(),gs){yt(!0);try{a()}finally{yt(!1)}}}return i.memoizedState=i.baseState=n,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:n},i}function Cp(n,i,a,u){return n.baseState=a,ef(n,At,typeof u=="function"?u:ri)}function Zv(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)}};V.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=V.T,w={};V.T=w;try{var _=a(h,u),q=V.S;q!==null&&q(w,_),jp(n,i,_)}catch(re){rf(n,i,re)}finally{p!==null&&w.types!==null&&(p.types=w.types),V.T=p}}else try{p=a(h,u),jp(n,i,p)}catch(re){rf(n,i,re)}}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(mt){var a=Mt.formState;if(a!==null){e:{var u=We;if(mt){if(Pt){t:{for(var h=Pt,p=hr;h.nodeType!==8;){if(!p){h=null;break t}if(h=mr(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Pt=mr(h.nextSibling),u=h.data==="F!";break e}}Ci(u)}u=!1}u&&(i=a[0])}}return a=jn(),a.memoizedState=a.baseState=i,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Op,lastRenderedState:i},a.queue=u,a=Qp.bind(null,We,u),u.dispatch=a,u=nf(!1),p=cf.bind(null,We,!1,u.queue),u=jn(),h={state:i,dispatch:null,action:n,pending:null},u.queue=h,a=Zv.bind(null,We,h,p,a),h.dispatch=a,u.memoizedState=n,[i,a,!1]}function Mp(n){var i=Wt();return Dp(i,At,n)}function Dp(n,i,a){if(i=ef(n,i,Op)[0],n=Ao(ri)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var u=Ka(i)}catch(w){throw w===Is?yo:w}else u=i;i=Wt();var h=i.queue,p=h.dispatch;return a!==i.memoizedState&&(We.flags|=2048,Gs(9,{destroy:void 0},Wv.bind(null,h,a),null)),[u,p,n]}function Wv(n,i){n.action=i}function Lp(n){var i=Wt(),a=At;if(a!==null)return Dp(i,a,n);Wt(),i=i.memoizedState,a=Wt();var u=a.queue.dispatch;return a.memoizedState=n,[i,u,!1]}function Gs(n,i,a,u){return n={tag:n,create:a,deps:u,inst:i,next:null},i=We.updateQueue,i===null&&(i=Eo(),We.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 Wt().memoizedState}function jo(n,i,a,u){var h=jn();We.flags|=n,h.memoizedState=Gs(1|i,{destroy:void 0},a,u===void 0?null:u)}function No(n,i,a,u){var h=Wt();u=u===void 0?null:u;var p=h.memoizedState.inst;At!==null&&u!==null&&Jc(u,At.memoizedState.deps)?h.memoizedState=Gs(i,p,a,u):(We.flags|=n,h.memoizedState=Gs(1|i,p,a,u))}function Up(n,i){jo(8390656,8,n,i)}function sf(n,i){No(2048,8,n,i)}function ew(n){We.flags|=4;var i=We.updateQueue;if(i===null)i=Eo(),We.updateQueue=i,i.events=[n];else{var a=i.events;a===null?i.events=[n]:a.push(n)}}function Pp(n){var i=Wt().memoizedState;return ew({ref:i,nextImpl:n}),function(){if((_t&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=Wt();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=Wt();i=i===void 0?null:i;var u=a.memoizedState;if(i!==null&&Jc(i,u[1]))return u[0];if(u=n(),gs){yt(!0);try{n()}finally{yt(!1)}}return a.memoizedState=[u,i],u}function lf(n,i,a){return a===void 0||(ni&1073741824)!==0&&(ct&261930)===0?n.memoizedState=i:(n.memoizedState=a,n=Vg(),We.lanes|=n,Li|=n,a)}function Vp(n,i,a,u){return $n(a,i)?a:$s.current!==null?(n=lf(n,a,u),$n(n,i)||(an=!0),n):(ni&42)===0||(ni&1073741824)!==0&&(ct&261930)===0?(an=!0,n.memoizedState=a):(n=Vg(),We.lanes|=n,Li|=n,i)}function Yp(n,i,a,u,h){var p=J.p;J.p=p!==0&&8>p?p:8;var w=V.T,_={};V.T=_,cf(n,!1,i,a);try{var q=h(),re=V.S;if(re!==null&&re(_,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var de=Xv(q,u);Qa(n,i,de,Kn(n))}else Qa(n,i,u,Kn(n))}catch(ye){Qa(n,i,{then:function(){},status:"rejected",reason:ye},Kn())}finally{J.p=p,w!==null&&_.types!==null&&(w.types=_.types),V.T=w}}function tw(){}function of(n,i,a,u){if(n.tag!==5)throw Error(s(476));var h=Gp(n).queue;Yp(n,h,i,ce,a===null?tw:function(){return Jp(n),a(u)})}function Gp(n){var i=n.memoizedState;if(i!==null)return i;i={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,lastRenderedState:ce},next:null};var a={};return i.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ri,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),Qa(n,i.next.queue,{},Kn())}function uf(){return gn(ml)}function Xp(){return Wt().memoizedState}function Kp(){return Wt().memoizedState}function nw(n){for(var i=n.return;i!==null;){switch(i.tag){case 24:case 3:var a=Kn();n=Ni(a);var u=Ti(i,n,a);u!==null&&(Hn(u,i,a),Ya(u,i,a)),i={cache:Uc()},n.payload=i;return}i=i.return}}function rw(n,i,a){var u=Kn();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&&(Hn(a,n,u),Wp(a,i,u)))}function Qp(n,i,a){var u=Kn();Qa(n,i,a,u)}function Qa(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=_,$n(_,w))return uo(n,i,h,0),Mt===null&&oo(),!1}catch{}finally{}if(a=Cc(n,i,h,u),a!==null)return Hn(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&&Hn(i,n,2)}function To(n){var i=n.alternate;return n===We||i!==null&&i===We}function Zp(n,i){Vs=_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,Ne(n,a)}}var Za={readContext:gn,use:Co,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt};Za.useEffectEvent=Xt;var eg={readContext:gn,use:Co,useCallback:function(n,i){return jn().memoizedState=[n,i===void 0?null:i],n},useContext:gn,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=jn();i=i===void 0?null:i;var u=n();if(gs){yt(!0);try{n()}finally{yt(!1)}}return a.memoizedState=[u,i],u},useReducer:function(n,i,a){var u=jn();if(a!==void 0){var h=a(i);if(gs){yt(!0);try{a(i)}finally{yt(!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=rw.bind(null,We,n),[u.memoizedState,n]},useRef:function(n){var i=jn();return n={current:n},i.memoizedState=n},useState:function(n){n=nf(n);var i=n.queue,a=Qp.bind(null,We,i);return i.dispatch=a,[n.memoizedState,a]},useDebugValue:af,useDeferredValue:function(n,i){var a=jn();return lf(a,n,i)},useTransition:function(){var n=nf(!1);return n=Yp.bind(null,We,n.queue,!0,!1),jn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,i,a){var u=We,h=jn();if(mt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=i(),Mt===null)throw Error(s(349));(ct&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,Gs(9,{destroy:void 0},Sp.bind(null,u,p,a,i),null),a},useId:function(){var n=jn(),i=Mt.identifierPrefix;if(mt){var a=zr,u=Lr;a=(u&~(1<<32-ut(u)-1)).toString(32)+a,i="_"+i+"R_"+a,a=ko++,0<a&&(i+="H"+a.toString(32)),i+="_"}else a=Kv++,i="_"+i+"r_"+a.toString(32)+"_";return n.memoizedState=i},useHostTransitionStatus:uf,useFormState:Rp,useActionState:Rp,useOptimistic:function(n){var i=jn();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,We,!0,a),a.dispatch=i,[n,i]},useMemoCache:Wc,useCacheRefresh:function(){return jn().memoizedState=nw.bind(null,We)},useEffectEvent:function(n){var i=jn(),a={impl:n};return i.memoizedState=a,function(){if((_t&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},ff={readContext:gn,use:Co,useCallback:Fp,useContext:gn,useEffect:sf,useImperativeHandle:Ip,useInsertionEffect:Bp,useLayoutEffect:Hp,useMemo:$p,useReducer:Ao,useRef:zp,useState:function(){return Ao(ri)},useDebugValue:af,useDeferredValue:function(n,i){var a=Wt();return Vp(a,At.memoizedState,n,i)},useTransition:function(){var n=Ao(ri)[0],i=Wt().memoizedState;return[typeof n=="boolean"?n:Ka(n),i]},useSyncExternalStore:vp,useId:Xp,useHostTransitionStatus:uf,useFormState:Mp,useActionState:Mp,useOptimistic:function(n,i){var a=Wt();return Cp(a,At,n,i)},useMemoCache:Wc,useCacheRefresh:Kp};ff.useEffectEvent=Pp;var tg={readContext:gn,use:Co,useCallback:Fp,useContext:gn,useEffect:sf,useImperativeHandle:Ip,useInsertionEffect:Bp,useLayoutEffect:Hp,useMemo:$p,useReducer:tf,useRef:zp,useState:function(){return tf(ri)},useDebugValue:af,useDeferredValue:function(n,i){var a=Wt();return At===null?lf(a,n,i):Vp(a,At.memoizedState,n,i)},useTransition:function(){var n=tf(ri)[0],i=Wt().memoizedState;return[typeof n=="boolean"?n:Ka(n),i]},useSyncExternalStore:vp,useId:Xp,useHostTransitionStatus:uf,useFormState:Lp,useActionState:Lp,useOptimistic:function(n,i){var a=Wt();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=Kn(),h=Ni(u);h.payload=i,a!=null&&(h.callback=a),i=Ti(n,h,u),i!==null&&(Hn(i,n,u),Ya(i,n,u))},enqueueReplaceState:function(n,i,a){n=n._reactInternals;var u=Kn(),h=Ni(u);h.tag=1,h.payload=i,a!=null&&(h.callback=a),i=Ti(n,h,u),i!==null&&(Hn(i,n,u),Ya(i,n,u))},enqueueForceUpdate:function(n,i){n=n._reactInternals;var a=Kn(),u=Ni(a);u.tag=2,i!=null&&(u.callback=i),i=Ti(n,u,a),i!==null&&(Hn(i,n,a),Ya(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?!Pa(a,u)||!Pa(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 ys(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=Ni(a),a.tag=3,a.payload={element:null},a.callback=function(){Oo(n,i)},a}function og(n){return n=Ni(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"&&(zi===null?zi=new Set([this]):zi.add(this));var _=u.stack;this.componentDidCatch(u.value,{componentStack:_!==null?_:""})})}function iw(n,i,a,u,h){if(a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(i=a.alternate,i!==null&&Bs(i,a,h,!0),a=Yn.current,a!==null){switch(a.tag){case 31:case 13:return dr===null?Fo():a.alternate===null&&Kt===0&&(Kt=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(mt)return i=Yn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,u!==Rc&&(n=Error(s(422),{cause:u}),qa(ur(n,a)))):(u!==Rc&&(i=Error(s(423),{cause:u}),qa(ur(i,a))),n=n.current.alternate,n.flags|=65536,h&=-h,n.lanes|=h,u=ur(u,a),h=mf(n.stateNode,u,h),Fc(n,h),Kt!==4&&(Kt=2)),!1;var p=Error(s(520),{cause:u});if(p=ur(p,a),al===null?al=[p]:al.push(p),Kt!==4&&(Kt=2),i===null)return!0;u=ur(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"&&(zi===null||!zi.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)),an=!1;function yn(n,i,a,u){i.child=n===null?dp(i,null,a,u):ps(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 fs(i),u=Xc(n,i,a,w,p,h),_=Kc(),n!==null&&!an?(Qc(n,i,h),ii(n,i,h)):(mt&&_&&Tc(i),i.flags|=1,yn(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:Pa,a(w,u)&&n.ref===i.ref)return ii(n,i,h)}return i.flags|=1,n=Zr(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(Pa(p,u)&&n.ref===i.ref)if(an=!1,i.pendingProps=u=p,_f(n,h))(n.flags&131072)!==0&&(an=!0);else return i.lanes=n.lanes,ii(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),Ri(),i.memoizedState=null):(n!==null&&go(i,null),Vc(),Ri());return yn(n,i,h,a),i.child}function Wa(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:rn._currentValue,pool:p},i.memoizedState={baseLanes:a,cachePool:p},n!==null&&go(i,null),Vc(),yp(i),n!==null&&Bs(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 ps(i,n.child,null,a),n=Ro(i,i.pendingProps),n.flags|=2,Gn(i),i.memoizedState=null,n}function sw(n,i,a){var u=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,n===null){if(mt){if(u.mode==="hidden")return n=Ro(i,u),i.lanes=536870912,Wa(null,n);if(Gc(i),(n=Pt)?(n=Ay(n,hr),n=n!==null&&n.data==="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:ki!==null?{id:Lr,overflow:zr}:null,retryLane:536870912,hydrationErrors:null},a=Zm(n),a.return=i,i.child=a,pn=i,Pt=null)):n=null,n===null)throw Ci(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(an||Bs(n,i,a,!1),h=(a&n.childLanes)!==0,an||h){if(u=Mt,u!==null&&(w=De(u,a),w!==0&&w!==p.retryLane))throw p.retryLane=w,ls(n,w),Hn(u,n,w),pf;Fo(),i=pg(n,i,a)}else n=p.treeContext,Pt=mr(w.nextSibling),pn=i,mt=!0,Ei=null,hr=!1,n!==null&&tp(i,n),i=Ro(i,u),i.flags|=4096;return i}return n=Zr(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 fs(i),a=Xc(n,i,a,u,void 0,h),u=Kc(),n!==null&&!an?(Qc(n,i,h),ii(n,i,h)):(mt&&u&&Tc(i),i.flags|=1,yn(n,i,a,h),i.child)}function gg(n,i,a,u,h,p){return fs(i),i.updateQueue=null,a=xp(i,u,a,h),bp(n),u=Kc(),n!==null&&!an?(Qc(n,i,p),ii(n,i,p)):(mt&&u&&Tc(i),i.flags|=1,yn(n,i,a,p),i.child)}function yg(n,i,a,u,h){if(fs(i),i.stateNode===null){var p=Ls,w=a.contextType;typeof w=="object"&&w!==null&&(p=gn(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?gn(w):Ls,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),Ja(i,u,p,h),Ga(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),u=!0}else if(n===null){p=i.stateNode;var _=i.memoizedProps,q=ys(a,_);p.props=q;var re=p.context,de=a.contextType;w=Ls,typeof de=="object"&&de!==null&&(w=gn(de));var ye=a.getDerivedStateFromProps;de=typeof ye=="function"||typeof p.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,de||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(_||re!==w)&&rg(i,p,u,w),ji=!1;var ie=i.memoizedState;p.state=ie,Ja(i,u,p,h),Ga(),re=i.memoizedState,_||ie!==re||ji?(typeof ye=="function"&&(hf(i,a,ye,u),re=i.memoizedState),(q=ji||ng(i,a,q,u,ie,re,w))?(de||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=re),p.props=u,p.state=re,p.context=w,u=q):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),u=!1)}else{p=i.stateNode,Ic(n,i),w=i.memoizedProps,de=ys(a,w),p.props=de,ye=i.pendingProps,ie=p.context,re=a.contextType,q=Ls,typeof re=="object"&&re!==null&&(q=gn(re)),_=a.getDerivedStateFromProps,(re=typeof _=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ye||ie!==q)&&rg(i,p,u,q),ji=!1,ie=i.memoizedState,p.state=ie,Ja(i,u,p,h),Ga();var ae=i.memoizedState;w!==ye||ie!==ae||ji||n!==null&&n.dependencies!==null&&mo(n.dependencies)?(typeof _=="function"&&(hf(i,a,_,u),ae=i.memoizedState),(de=ji||ng(i,a,de,u,ie,ae,q)||n!==null&&n.dependencies!==null&&mo(n.dependencies))?(re||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(u,ae,q),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(u,ae,q)),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=u,i.memoizedState=ae),p.props=u,p.state=ae,p.context=q,u=de):(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),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=ps(i,n.child,null,h),i.child=ps(i,null,a,h)):yn(n,i,a,h),i.memoizedState=p.state,n=i.child):n=ii(n,i,h),n}function bg(n,i,a,u){return us(),i.flags|=256,yn(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|=Xn),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:(Zt.current&2)!==0),w&&(h=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,n===null){if(mt){if(h?Oi(i):Ri(),(n=Pt)?(n=Ay(n,hr),n=n!==null&&n.data!=="&"?n:null,n!==null&&(i.memoizedState={dehydrated:n,treeContext:ki!==null?{id:Lr,overflow:zr}:null,retryLane:536870912,hydrationErrors:null},a=Zm(n),a.return=i,i.child=a,pn=i,Pt=null)):n=null,n===null)throw Ci(i);return th(n)?i.lanes=32:i.lanes=536870912,null}var _=u.children;return u=u.fallback,h?(Ri(),h=i.mode,_=Do({mode:"hidden",children:_},h),u=os(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,Wa(null,u)):(Oi(i),vf(i,_))}var q=n.memoizedState;if(q!==null&&(_=q.dehydrated,_!==null)){if(p)i.flags&256?(Oi(i),i.flags&=-257,i=wf(n,i,a)):i.memoizedState!==null?(Ri(),i.child=n.child,i.flags|=128,i=null):(Ri(),_=u.fallback,h=i.mode,u=Do({mode:"visible",children:u.children},h),_=os(_,h,a,null),_.flags|=2,u.return=i,_.return=i,u.sibling=_,i.child=u,ps(i,n.child,null,a),u=i.child,u.memoizedState=bf(a),u.childLanes=xf(n,w,a),i.memoizedState=yf,i=Wa(null,u));else if(Oi(i),th(_)){if(w=_.nextSibling&&_.nextSibling.dataset,w)var re=w.dgst;w=re,u=Error(s(419)),u.stack="",u.digest=w,qa({value:u,source:null,stack:null}),i=wf(n,i,a)}else if(an||Bs(n,i,a,!1),w=(a&n.childLanes)!==0,an||w){if(w=Mt,w!==null&&(u=De(w,a),u!==0&&u!==q.retryLane))throw q.retryLane=u,ls(n,u),Hn(w,n,u),pf;eh(_)||Fo(),i=wf(n,i,a)}else eh(_)?(i.flags|=192,i.child=n.child,i=null):(n=q.treeContext,Pt=mr(_.nextSibling),pn=i,mt=!0,Ei=null,hr=!1,n!==null&&tp(i,n),i=vf(i,u.children),i.flags|=4096);return i}return h?(Ri(),_=u.fallback,h=i.mode,q=n.child,re=q.sibling,u=Zr(q,{mode:"hidden",children:u.children}),u.subtreeFlags=q.subtreeFlags&65011712,re!==null?_=Zr(re,_):(_=os(_,h,a,null),_.flags|=2),_.return=i,u.return=i,u.sibling=_,i.child=u,Wa(null,u),u=i.child,_=n.child.memoizedState,_===null?_=bf(a):(h=_.cachePool,h!==null?(q=rn._currentValue,h=h.parent!==q?{parent:q,pool:q}:h):h=lp(),_={baseLanes:_.baseLanes|a,cachePool:h}),u.memoizedState=_,u.childLanes=xf(n,w,a),i.memoizedState=yf,Wa(n.child,u)):(Oi(i),a=n.child,n=a.sibling,a=Zr(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=Vn(22,n,null,i),n.lanes=0,n}function wf(n,i,a){return ps(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=Zt.current,_=(w&2)!==0;if(_?(w=w&1|2,i.flags|=128):w&=1,N(Zt,w),yn(n,i,u,a),u=mt?Ha: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 ii(n,i,a){if(n!==null&&(i.dependencies=n.dependencies),Li|=i.lanes,(a&i.childLanes)===0)if(n!==null){if(Bs(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=Zr(n,n.pendingProps),i.child=a,a.return=i;n.sibling!==null;)n=n.sibling,a=a.sibling=Zr(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 aw(n,i,a){switch(i.tag){case 3:Re(i,i.stateNode.containerInfo),Ai(i,rn,n.memoizedState.cache),us();break;case 27:case 5:Fe(i);break;case 4:Re(i,i.stateNode.containerInfo);break;case 10:Ai(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?(Oi(i),i.flags|=128,null):(a&i.child.childLanes)!==0?xg(n,i,a):(Oi(i),n=ii(n,i,a),n!==null?n.sibling:null);Oi(i);break;case 19:var h=(n.flags&128)!==0;if(u=(a&i.childLanes)!==0,u||(Bs(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),N(Zt,Zt.current),u)break;return null;case 22:return i.lanes=0,dg(n,i,a,i.pendingProps);case 24:Ai(i,rn,n.memoizedState.cache)}return ii(n,i,a)}function Sg(n,i,a){if(n!==null)if(n.memoizedProps!==i.pendingProps)an=!0;else{if(!_f(n,a)&&(i.flags&128)===0)return an=!1,aw(n,i,a);an=(n.flags&131072)!==0}else an=!1,mt&&(i.flags&1048576)!==0&&ep(i,Ha,i.index);switch(i.lanes=0,i.tag){case 16:e:{var u=i.pendingProps;if(n=ds(i.elementType),i.type=n,typeof n=="function")Ac(n)?(u=ys(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===ue){i.tag=11,i=cg(null,i,n,u,a);break e}else if(h===ee){i.tag=14,i=fg(null,i,n,u,a);break e}}throw i=te(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=ys(u,i.pendingProps),yg(n,i,u,h,a);case 3:e:{if(Re(i,i.stateNode.containerInfo),n===null)throw Error(s(387));u=i.pendingProps;var p=i.memoizedState;h=p.element,Ic(n,i),Ja(i,u,null,a);var w=i.memoizedState;if(u=w.cache,Ai(i,rn,u),u!==p.cache&&zc(i,[rn],a,!0),Ga(),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=ur(Error(s(424)),i),qa(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(Pt=mr(n.firstChild),pn=i,mt=!0,Ei=null,hr=!0,a=dp(i,null,u,a),i.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(us(),u===h){i=ii(n,i,a);break e}yn(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:mt||(a=i.type,n=i.pendingProps,u=Ko(Ee.current).createElement(a),u[Ue]=i,u[rt]=n,bn(u,a,n),$(u),i.stateNode=u):i.memoizedState=My(i.type,n.memoizedProps,i.pendingProps,n.memoizedState),null;case 27:return Fe(i),n===null&&mt&&(u=i.stateNode=Ty(i.type,i.pendingProps,Ee.current),pn=i,hr=!0,h=Pt,Hi(i.type)?(nh=h,Pt=mr(u.firstChild)):Pt=h),yn(n,i,i.pendingProps.children,a),Mo(n,i),n===null&&(i.flags|=4194304),i.child;case 5:return n===null&&mt&&((h=u=Pt)&&(u=zw(u,i.type,i.pendingProps,hr),u!==null?(i.stateNode=u,pn=i,Pt=mr(u.firstChild),hr=!1,h=!0):h=!1),h||Ci(i)),Fe(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,Qv,null,null,a),ml._currentValue=h),Mo(n,i),yn(n,i,u,a),i.child;case 6:return n===null&&mt&&((n=a=Pt)&&(a=Uw(a,i.pendingProps,hr),a!==null?(i.stateNode=a,pn=i,Pt=null,n=!0):n=!1),n||Ci(i)),null;case 13:return xg(n,i,a);case 4:return Re(i,i.stateNode.containerInfo),u=i.pendingProps,n===null?i.child=ps(i,null,u,a):yn(n,i,u,a),i.child;case 11:return cg(n,i,i.type,i.pendingProps,a);case 7:return yn(n,i,i.pendingProps,a),i.child;case 8:return yn(n,i,i.pendingProps.children,a),i.child;case 12:return yn(n,i,i.pendingProps.children,a),i.child;case 10:return u=i.pendingProps,Ai(i,i.type,u.value),yn(n,i,u.children,a),i.child;case 9:return h=i.type._context,u=i.pendingProps.children,fs(i),h=gn(h),u=u(h),i.flags|=1,yn(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 sw(n,i,a);case 22:return dg(n,i,a,i.pendingProps);case 24:return fs(i),u=gn(rn),n===null?(h=Bc(),h===null&&(h=Mt,p=Uc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=a),h=p),i.memoizedState={parent:u,cache:h},qc(i),Ai(i,rn,h)):((n.lanes&a)!==0&&(Ic(n,i),Ja(i,null,null,a),Ga()),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),Ai(i,rn,u)):(u=p.cache,Ai(i,rn,u),u!==h.cache&&zc(i,[rn],a,!0))),yn(n,i,i.pendingProps.children,a),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function si(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 ms=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 ms=bo,Hc}function Lo(n,i){i!==null&&(n.flags|=4),n.flags&16384&&(i=n.tag!==22?Si():536870912,n.lanes|=i,Qs|=i)}function el(n,i){if(!mt)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 Bt(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 lw(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 Bt(i),null;case 1:return Bt(i),null;case 3:return a=i.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),ti(rn),_e(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(Ps(i)?si(i):n===null||n.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Mc())),Bt(i),null;case 26:var h=i.type,p=i.memoizedState;return n===null?(si(i),p!==null?(Bt(i),_g(i,p)):(Bt(i),kf(i,h,null,u,a))):p?p!==n.memoizedState?(si(i),Bt(i),_g(i,p)):(Bt(i),i.flags&=-16777217):(n=n.memoizedProps,n!==u&&si(i),Bt(i),kf(i,h,n,u,a)),null;case 27:if(Ht(i),a=Ee.current,h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==u&&si(i);else{if(!u){if(i.stateNode===null)throw Error(s(166));return Bt(i),null}n=ve.current,Ps(i)?np(i):(n=Ty(h,u,a),i.stateNode=n,si(i))}return Bt(i),null;case 5:if(Ht(i),h=i.type,n!==null&&i.stateNode!=null)n.memoizedProps!==u&&si(i);else{if(!u){if(i.stateNode===null)throw Error(s(166));return Bt(i),null}if(p=ve.current,Ps(i))np(i);else{var w=Ko(Ee.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[Ue]=i,p[rt]=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(bn(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&&si(i)}}return Bt(i),kf(i,i.type,n===null?null:n.memoizedProps,i.pendingProps,a),null;case 6:if(n&&i.stateNode!=null)n.memoizedProps!==u&&si(i);else{if(typeof u!="string"&&i.stateNode===null)throw Error(s(166));if(n=Ee.current,Ps(i)){if(n=i.stateNode,a=i.memoizedProps,u=null,h=pn,h!==null)switch(h.tag){case 27:case 5:u=h.memoizedProps}n[Ue]=i,n=!!(n.nodeValue===a||u!==null&&u.suppressHydrationWarning===!0||xy(n.nodeValue,a)),n||Ci(i,!0)}else n=Ko(n).createTextNode(u),n[Ue]=i,i.stateNode=n}return Bt(i),null;case 31:if(a=i.memoizedState,n===null||n.memoizedState!==null){if(u=Ps(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[Ue]=i}else us(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Bt(i),n=!1}else a=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return i.flags&256?(Gn(i),i):(Gn(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Bt(i),null;case 13:if(u=i.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=Ps(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[Ue]=i}else us(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Bt(i),h=!1}else h=Mc(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Gn(i),i):(Gn(i),null)}return Gn(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),Bt(i),null);case 4:return _e(),n===null&&Yf(i.stateNode.containerInfo),Bt(i),null;case 10:return ti(i.type),Bt(i),null;case 19:if(X(Zt),u=i.memoizedState,u===null)return Bt(i),null;if(h=(i.flags&128)!==0,p=u.rendering,p===null)if(h)el(u,!1);else{if(Kt!==0||n!==null&&(n.flags&128)!==0)for(n=i.child;n!==null;){if(p=So(n),p!==null){for(i.flags|=128,el(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 N(Zt,Zt.current&1|2),mt&&Wr(i,u.treeForkCount),i.child}n=n.sibling}u.tail!==null&&st()>Ho&&(i.flags|=128,h=!0,el(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),el(u,!0),u.tail===null&&u.tailMode==="hidden"&&!p.alternate&&!mt)return Bt(i),null}else 2*st()-u.renderingStartTime>Ho&&a!==536870912&&(i.flags|=128,h=!0,el(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=st(),n.sibling=null,a=Zt.current,N(Zt,h?a&1|2:a&1),mt&&Wr(i,u.treeForkCount),n):(Bt(i),null);case 22:case 23:return Gn(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&&(Bt(i),i.subtreeFlags&6&&(i.flags|=8192)):Bt(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&&X(hs),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),i.memoizedState.cache!==a&&(i.flags|=2048),ti(rn),Bt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function ow(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 ti(rn),_e(),n=i.flags,(n&65536)!==0&&(n&128)===0?(i.flags=n&-65537|128,i):null;case 26:case 27:case 5:return Ht(i),null;case 31:if(i.memoizedState!==null){if(Gn(i),i.alternate===null)throw Error(s(340));us()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 13:if(Gn(i),n=i.memoizedState,n!==null&&n.dehydrated!==null){if(i.alternate===null)throw Error(s(340));us()}return n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 19:return X(Zt),null;case 4:return _e(),null;case 10:return ti(i.type),null;case 22:case 23:return Gn(i),Yc(),n!==null&&X(hs),n=i.flags,n&65536?(i.flags=n&-65537|128,i):null;case 24:return ti(rn),null;case 25:return null;default:return null}}function kg(n,i){switch(Oc(i),i.tag){case 3:ti(rn),_e();break;case 26:case 27:case 5:Ht(i);break;case 4:_e();break;case 31:i.memoizedState!==null&&Gn(i);break;case 13:Gn(i);break;case 19:X(Zt);break;case 10:ti(i.type);break;case 22:case 23:Gn(i),Yc(),n!==null&&X(hs);break;case 24:ti(rn)}}function tl(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(_){Ct(i,i.return,_)}}function Mi(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 q=a,re=_;try{re()}catch(de){Ct(h,q,de)}}}u=u.next}while(u!==p)}}catch(de){Ct(i,i.return,de)}}function Eg(n){var i=n.updateQueue;if(i!==null){var a=n.stateNode;try{pp(i,a)}catch(u){Ct(n,n.return,u)}}}function Cg(n,i,a){a.props=ys(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(u){Ct(n,i,u)}}function nl(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){Ct(n,i,h)}}function Ur(n,i){var a=n.ref,u=n.refCleanup;if(a!==null)if(typeof u=="function")try{u()}catch(h){Ct(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){Ct(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){Ct(n,n.return,h)}}function Ef(n,i,a){try{var u=n.stateNode;Tw(u,n.type,a,i),u[rt]=i}catch(h){Ct(n,n.return,h)}}function jg(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Hi(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&&Hi(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=Kr));else if(u!==4&&(u===27&&Hi(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&&Hi(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]);bn(i,u,a),i[Ue]=n,i[rt]=a}catch(p){Ct(n,n.return,p)}}var ai=!1,ln=!1,jf=!1,Tg=typeof WeakSet=="function"?WeakSet:Set,fn=null;function uw(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,q=-1,re=0,de=0,ye=n,ie=null;t:for(;;){for(var ae;ye!==a||h!==0&&ye.nodeType!==3||(_=w+h),ye!==p||u!==0&&ye.nodeType!==3||(q=w+u),ye.nodeType===3&&(w+=ye.nodeValue.length),(ae=ye.firstChild)!==null;)ie=ye,ye=ae;for(;;){if(ye===n)break t;if(ie===a&&++re===h&&(_=w),ie===p&&++de===u&&(q=w),(ae=ye.nextSibling)!==null)break;ye=ie,ie=ye.parentNode}ye=ae}a=_===-1||q===-1?null:{start:_,end:q}}else a=null}a=a||{start:0,end:0}}else a=null;for(Kf={focusedElem:n,selectionRange:a},ru=!1,fn=i;fn!==null;)if(i=fn,n=i.child,(i.subtreeFlags&1028)!==0&&n!==null)n.return=i,fn=n;else for(;fn!==null;){switch(i=fn,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 ze=ys(a.type,h);n=u.getSnapshotBeforeUpdate(ze,p),u.__reactInternalSnapshotBeforeUpdate=n}catch(Xe){Ct(a,a.return,Xe)}}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,fn=n;break}fn=i.return}}function Og(n,i,a){var u=a.flags;switch(a.tag){case 0:case 11:case 15:oi(n,a),u&4&&tl(5,a);break;case 1:if(oi(n,a),u&4)if(n=a.stateNode,i===null)try{n.componentDidMount()}catch(w){Ct(a,a.return,w)}else{var h=ys(a.type,i.memoizedProps);i=i.memoizedState;try{n.componentDidUpdate(h,i,n.__reactInternalSnapshotBeforeUpdate)}catch(w){Ct(a,a.return,w)}}u&64&&Eg(a),u&512&&nl(a,a.return);break;case 3:if(oi(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){Ct(a,a.return,w)}}break;case 27:i===null&&u&4&&Ng(a);case 26:case 5:oi(n,a),i===null&&u&4&&Ag(a),u&512&&nl(a,a.return);break;case 12:oi(n,a);break;case 31:oi(n,a),u&4&&Dg(n,a);break;case 13:oi(n,a),u&4&&Lg(n,a),u&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=bw.bind(null,a),Pw(n,a))));break;case 22:if(u=a.memoizedState!==null||ai,!u){i=i!==null&&i.memoizedState!==null||ln,h=ai;var p=ln;ai=u,(ln=i)&&!p?ui(n,a,(a.subtreeFlags&8772)!==0):oi(n,a),ai=h,ln=p}break;case 30:break;default:oi(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&&Jr(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 It=null,zn=!1;function li(n,i,a){for(a=a.child;a!==null;)Mg(n,i,a),a=a.sibling}function Mg(n,i,a){if(Ge&&typeof Ge.onCommitFiberUnmount=="function")try{Ge.onCommitFiberUnmount(je,a)}catch{}switch(a.tag){case 26:ln||Ur(a,i),li(n,i,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ln||Ur(a,i);var u=It,h=zn;Hi(a.type)&&(It=a.stateNode,zn=!1),li(n,i,a),fl(a.stateNode),It=u,zn=h;break;case 5:ln||Ur(a,i);case 6:if(u=It,h=zn,It=null,li(n,i,a),It=u,zn=h,It!==null)if(zn)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(a.stateNode)}catch(p){Ct(a,i,p)}else try{It.removeChild(a.stateNode)}catch(p){Ct(a,i,p)}break;case 18:It!==null&&(zn?(n=It,Ey(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),sa(n)):Ey(It,a.stateNode));break;case 4:u=It,h=zn,It=a.stateNode.containerInfo,zn=!0,li(n,i,a),It=u,zn=h;break;case 0:case 11:case 14:case 15:Mi(2,a,i),ln||Mi(4,a,i),li(n,i,a);break;case 1:ln||(Ur(a,i),u=a.stateNode,typeof u.componentWillUnmount=="function"&&Cg(a,i,u)),li(n,i,a);break;case 21:li(n,i,a);break;case 22:ln=(u=ln)||a.memoizedState!==null,li(n,i,a),ln=u;break;default:li(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{sa(n)}catch(a){Ct(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{sa(n)}catch(a){Ct(i,i.return,a)}}function cw(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=cw(n);i.forEach(function(u){if(!a.has(u)){a.add(u);var h=xw.bind(null,n,u);u.then(h,h)}})}function Un(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(Hi(_.type)){It=_.stateNode,zn=!1;break e}break;case 5:It=_.stateNode,zn=!1;break e;case 3:case 4:It=_.stateNode.containerInfo,zn=!0;break e}_=_.return}if(It===null)throw Error(s(160));Mg(p,w,h),It=null,zn=!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 _r=null;function zg(n,i){var a=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:Un(i,n),Pn(n),u&4&&(Mi(3,n,n.return),tl(3,n),Mi(5,n,n.return));break;case 1:Un(i,n),Pn(n),u&512&&(ln||a===null||Ur(a,a.return)),u&64&&ai&&(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=_r;if(Un(i,n),Pn(n),u&512&&(ln||a===null||Ur(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[Jt]||p[Ue]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(u),h.head.insertBefore(p,h.querySelector("head > title"))),bn(p,u,a),p[Ue]=n,$(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),bn(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),bn(p,u,a),h.head.appendChild(p);break;default:throw Error(s(468,u))}p[Ue]=n,$(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:Un(i,n),Pn(n),u&512&&(ln||a===null||Ur(a,a.return)),a!==null&&u&4&&Ef(n,n.memoizedProps,a.memoizedProps);break;case 5:if(Un(i,n),Pn(n),u&512&&(ln||a===null||Ur(a,a.return)),n.flags&32){h=n.stateNode;try{js(h,"")}catch(ze){Ct(n,n.return,ze)}}u&4&&n.stateNode!=null&&(h=n.memoizedProps,Ef(n,h,a!==null?a.memoizedProps:h)),u&1024&&(jf=!0);break;case 6:if(Un(i,n),Pn(n),u&4){if(n.stateNode===null)throw Error(s(162));u=n.memoizedProps,a=n.stateNode;try{a.nodeValue=u}catch(ze){Ct(n,n.return,ze)}}break;case 3:if(Wo=null,h=_r,_r=Qo(i.containerInfo),Un(i,n),_r=h,Pn(n),u&4&&a!==null&&a.memoizedState.isDehydrated)try{sa(i.containerInfo)}catch(ze){Ct(n,n.return,ze)}jf&&(jf=!1,Ug(n));break;case 4:u=_r,_r=Qo(n.stateNode.containerInfo),Un(i,n),Pn(n),_r=u;break;case 12:Un(i,n),Pn(n);break;case 31:Un(i,n),Pn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 13:Un(i,n),Pn(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Bo=st()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 22:h=n.memoizedState!==null;var q=a!==null&&a.memoizedState!==null,re=ai,de=ln;if(ai=re||h,ln=de||q,Un(i,n),ln=de,ai=re,Pn(n),u&8192)e:for(i=n.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(a===null||q||ai||ln||bs(n)),a=null,i=n;;){if(i.tag===5||i.tag===26){if(a===null){q=a=i;try{if(p=q.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{_=q.stateNode;var ye=q.memoizedProps.style,ie=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;_.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(ze){Ct(q,q.return,ze)}}}else if(i.tag===6){if(a===null){q=i;try{q.stateNode.nodeValue=h?"":q.memoizedProps}catch(ze){Ct(q,q.return,ze)}}}else if(i.tag===18){if(a===null){q=i;try{var ae=q.stateNode;h?Cy(ae,!0):Cy(q.stateNode,!1)}catch(ze){Ct(q,q.return,ze)}}}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:Un(i,n),Pn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Uo(n,u)));break;case 30:break;case 21:break;default:Un(i,n),Pn(n)}}function Pn(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&&(js(w,""),a.flags&=-33);var _=Cf(n);zo(n,_,w);break;case 3:case 4:var q=a.stateNode.containerInfo,re=Cf(n);Af(n,re,q);break;default:throw Error(s(161))}}catch(de){Ct(n,n.return,de)}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 oi(n,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Og(n,i.alternate,i),i=i.sibling}function bs(n){for(n=n.child;n!==null;){var i=n;switch(i.tag){case 0:case 11:case 14:case 15:Mi(4,i,i.return),bs(i);break;case 1:Ur(i,i.return);var a=i.stateNode;typeof a.componentWillUnmount=="function"&&Cg(i,i.return,a),bs(i);break;case 27:fl(i.stateNode);case 26:case 5:Ur(i,i.return),bs(i);break;case 22:i.memoizedState===null&&bs(i);break;case 30:bs(i);break;default:bs(i)}n=n.sibling}}function ui(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:ui(h,p,a),tl(4,p);break;case 1:if(ui(h,p,a),u=p,h=u.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(re){Ct(u,u.return,re)}if(u=p,h=u.updateQueue,h!==null){var _=u.stateNode;try{var q=h.shared.hiddenCallbacks;if(q!==null)for(h.shared.hiddenCallbacks=null,h=0;h<q.length;h++)mp(q[h],_)}catch(re){Ct(u,u.return,re)}}a&&w&64&&Eg(p),nl(p,p.return);break;case 27:Ng(p);case 26:case 5:ui(h,p,a),a&&u===null&&w&4&&Ag(p),nl(p,p.return);break;case 12:ui(h,p,a);break;case 31:ui(h,p,a),a&&w&4&&Dg(h,p);break;case 13:ui(h,p,a),a&&w&4&&Lg(h,p);break;case 22:p.memoizedState===null&&ui(h,p,a),nl(p,p.return);break;case 30:break;default:ui(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&&Ia(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&&Ia(n))}function kr(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:kr(n,i,a,u),h&2048&&tl(9,i);break;case 1:kr(n,i,a,u);break;case 3:kr(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&&Ia(n)));break;case 12:if(h&2048){kr(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(q){Ct(i,i.return,q)}}else kr(n,i,a,u);break;case 31:kr(n,i,a,u);break;case 13:kr(n,i,a,u);break;case 23:break;case 22:p=i.stateNode,w=i.alternate,i.memoizedState!==null?p._visibility&2?kr(n,i,a,u):rl(n,i):p._visibility&2?kr(n,i,a,u):(p._visibility|=2,Js(n,i,a,u,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Nf(w,i);break;case 24:kr(n,i,a,u),h&2048&&Tf(i.alternate,i);break;default:kr(n,i,a,u)}}function Js(n,i,a,u,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=n,w=i,_=a,q=u,re=w.flags;switch(w.tag){case 0:case 11:case 15:Js(p,w,_,q,h),tl(8,w);break;case 23:break;case 22:var de=w.stateNode;w.memoizedState!==null?de._visibility&2?Js(p,w,_,q,h):rl(p,w):(de._visibility|=2,Js(p,w,_,q,h)),h&&re&2048&&Nf(w.alternate,w);break;case 24:Js(p,w,_,q,h),h&&re&2048&&Tf(w.alternate,w);break;default:Js(p,w,_,q,h)}i=i.sibling}}function rl(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:rl(a,u),h&2048&&Nf(u.alternate,u);break;case 24:rl(a,u),h&2048&&Tf(u.alternate,u);break;default:rl(a,u)}i=i.sibling}}var il=8192;function Xs(n,i,a){if(n.subtreeFlags&il)for(n=n.child;n!==null;)Bg(n,i,a),n=n.sibling}function Bg(n,i,a){switch(n.tag){case 26:Xs(n,i,a),n.flags&il&&n.memoizedState!==null&&Kw(a,_r,n.memoizedState,n.memoizedProps);break;case 5:Xs(n,i,a);break;case 3:case 4:var u=_r;_r=Qo(n.stateNode.containerInfo),Xs(n,i,a),_r=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=il,il=16777216,Xs(n,i,a),il=u):Xs(n,i,a));break;default:Xs(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 sl(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];fn=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:sl(n),n.flags&2048&&Mi(9,n,n.return);break;case 3:sl(n);break;case 12:sl(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)):sl(n);break;default:sl(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];fn=u,Ig(u,n)}Hg(n)}for(n=n.child;n!==null;){switch(i=n,i.tag){case 0:case 11:case 15:Mi(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(;fn!==null;){var a=fn;switch(a.tag){case 0:case 11:case 15:Mi(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:Ia(a.memoizedState.cache)}if(u=a.child,u!==null)u.return=a,fn=u;else e:for(a=n;fn!==null;){u=fn;var h=u.sibling,p=u.return;if(Rg(u),u===a){fn=null;break e}if(h!==null){h.return=p,fn=h;break e}fn=p}}}var fw={getCacheForType:function(n){var i=gn(rn),a=i.data.get(n);return a===void 0&&(a=n(),i.data.set(n,a)),a},cacheSignal:function(){return gn(rn).controller.signal}},hw=typeof WeakMap=="function"?WeakMap:Map,_t=0,Mt=null,at=null,ct=0,Et=0,Jn=null,Di=!1,Ks=!1,Of=!1,ci=0,Kt=0,Li=0,xs=0,Rf=0,Xn=0,Qs=0,al=null,Bn=null,Mf=!1,Bo=0,Fg=0,Ho=1/0,qo=null,zi=null,un=0,Ui=null,Zs=null,fi=0,Df=0,Lf=null,$g=null,ll=0,zf=null;function Kn(){return(_t&2)!==0&&ct!==0?ct&-ct:V.T!==null?If():pt()}function Vg(){if(Xn===0)if((ct&536870912)===0||mt){var n=vr;vr<<=1,(vr&3932160)===0&&(vr=262144),Xn=n}else Xn=536870912;return n=Yn.current,n!==null&&(n.flags|=32),Xn}function Hn(n,i,a){(n===Mt&&(Et===2||Et===9)||n.cancelPendingCommit!==null)&&(Ws(n,0),Pi(n,ct,Xn,!1)),An(n,a),((_t&2)===0||n!==Mt)&&(n===Mt&&((_t&2)===0&&(xs|=a),Kt===4&&Pi(n,ct,Xn,!1)),Pr(n))}function Yg(n,i,a){if((_t&6)!==0)throw Error(s(327));var u=!a&&(i&127)===0&&(i&n.expiredLanes)===0||Yr(n,i),h=u?pw(n,i):Pf(n,i,!0),p=u;do{if(h===0){Ks&&!u&&Pi(n,i,0,!1);break}else{if(a=n.current.alternate,p&&!dw(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=al;var q=_.current.memoizedState.isDehydrated;if(q&&(Ws(_,w).flags|=256),w=Pf(_,w,!1),w!==2){if(Of&&!q){_.errorRecoveryDisabledLanes|=p,xs|=p,h=4;break e}p=Bn,Bn=h,p!==null&&(Bn===null?Bn=p:Bn.push.apply(Bn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){Ws(n,0),Pi(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:Pi(u,i,Xn,!Di);break e;case 2:Bn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(h=Bo+300-st(),10<h)){if(Pi(u,i,Xn,!Di),Vr(u,0,!0)!==0)break e;fi=i,u.timeoutHandle=_y(Gg.bind(null,u,a,Bn,qo,Mf,i,Xn,xs,Qs,Di,p,"Throttled",-0,0),h);break e}Gg(u,a,Bn,qo,Mf,i,Xn,xs,Qs,Di,p,null,-0,0)}}break}while(!0);Pr(n)}function Gg(n,i,a,u,h,p,w,_,q,re,de,ye,ie,ae){if(n.timeoutHandle=-1,ye=i.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Kr},Bg(i,p,ye);var ze=(p&62914560)===p?Bo-st():(p&4194048)===p?Fg-st():0;if(ze=Qw(ye,ze),ze!==null){fi=p,n.cancelPendingCommit=ze(ty.bind(null,n,i,p,a,u,h,w,_,q,de,ye,null,ie,ae)),Pi(n,p,w,!re);return}}ty(n,i,p,a,u,h,w,_,q)}function dw(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(!$n(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 Pi(n,i,a,u){i&=~Rf,i&=~xs,n.suspendedLanes|=i,n.pingedLanes&=~i,u&&(n.warmLanes|=i),u=n.expirationTimes;for(var h=i;0<h;){var p=31-ut(h),w=1<<p;u[p]=-1,h&=~w}a!==0&&he(n,a,i)}function Io(){return(_t&6)===0?(ol(0),!1):!0}function Uf(){if(at!==null){if(Et===0)var n=at.return;else n=at,ei=cs=null,Zc(n),Fs=null,$a=0,n=at;for(;n!==null;)kg(n.alternate,n),n=n.return;at=null}}function Ws(n,i){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,Mw(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),fi=0,Uf(),Mt=n,at=a=Zr(n.current,null),ct=i,Et=0,Jn=null,Di=!1,Ks=Yr(n,i),Of=!1,Qs=Xn=Rf=xs=Li=Kt=0,Bn=al=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-ut(u),p=1<<h;i|=n[h],u&=~p}return ci=i,oo(),a}function Jg(n,i){We=null,V.H=Za,i===Is||i===yo?(i=cp(),Et=3):i===Hc?(i=cp(),Et=4):Et=i===pf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Jn=i,at===null&&(Kt=1,Oo(n,ur(i,n.current)))}function Xg(){var n=Yn.current;return n===null?!0:(ct&4194048)===ct?dr===null:(ct&62914560)===ct||(ct&536870912)!==0?n===dr:!1}function Kg(){var n=V.H;return V.H=Za,n===null?Za:n}function Qg(){var n=V.A;return V.A=fw,n}function Fo(){Kt=4,Di||(ct&4194048)!==ct&&Yn.current!==null||(Ks=!0),(Li&134217727)===0&&(xs&134217727)===0||Mt===null||Pi(Mt,ct,Xn,!1)}function Pf(n,i,a){var u=_t;_t|=2;var h=Kg(),p=Qg();(Mt!==n||ct!==i)&&(qo=null,Ws(n,i)),i=!1;var w=Kt;e:do try{if(Et!==0&&at!==null){var _=at,q=Jn;switch(Et){case 8:Uf(),w=6;break e;case 3:case 2:case 9:case 6:Yn.current===null&&(i=!0);var re=Et;if(Et=0,Jn=null,ea(n,_,q,re),a&&Ks){w=0;break e}break;default:re=Et,Et=0,Jn=null,ea(n,_,q,re)}}mw(),w=Kt;break}catch(de){Jg(n,de)}while(!0);return i&&n.shellSuspendCounter++,ei=cs=null,_t=u,V.H=h,V.A=p,at===null&&(Mt=null,ct=0,oo()),w}function mw(){for(;at!==null;)Zg(at)}function pw(n,i){var a=_t;_t|=2;var u=Kg(),h=Qg();Mt!==n||ct!==i?(qo=null,Ho=st()+500,Ws(n,i)):Ks=Yr(n,i);e:do try{if(Et!==0&&at!==null){i=at;var p=Jn;t:switch(Et){case 1:Et=0,Jn=null,ea(n,i,p,1);break;case 2:case 9:if(op(p)){Et=0,Jn=null,Wg(i);break}i=function(){Et!==2&&Et!==9||Mt!==n||(Et=7),Pr(n)},p.then(i,i);break e;case 3:Et=7;break e;case 4:Et=5;break e;case 7:op(p)?(Et=0,Jn=null,Wg(i)):(Et=0,Jn=null,ea(n,i,p,7));break;case 5:var w=null;switch(at.tag){case 26:w=at.memoizedState;case 5:case 27:var _=at;if(w?Py(w):_.stateNode.complete){Et=0,Jn=null;var q=_.sibling;if(q!==null)at=q;else{var re=_.return;re!==null?(at=re,$o(re)):at=null}break t}}Et=0,Jn=null,ea(n,i,p,5);break;case 6:Et=0,Jn=null,ea(n,i,p,6);break;case 8:Uf(),Kt=6;break e;default:throw Error(s(462))}}gw();break}catch(de){Jg(n,de)}while(!0);return ei=cs=null,V.H=u,V.A=h,_t=a,at!==null?0:(Mt=null,ct=0,oo(),Kt)}function gw(){for(;at!==null&&!Gt();)Zg(at)}function Zg(n){var i=Sg(n.alternate,n,ci);n.memoizedProps=n.pendingProps,i===null?$o(n):at=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,ct);break;case 11:i=gg(a,i,i.pendingProps,i.type.render,i.ref,ct);break;case 5:Zc(i);default:kg(a,i),i=at=Qm(i,ci),i=Sg(a,i,ci)}n.memoizedProps=n.pendingProps,i===null?$o(n):at=i}function ea(n,i,a,u){ei=cs=null,Zc(i),Fs=null,$a=0;var h=i.return;try{if(iw(n,h,i,a,ct)){Kt=1,Oo(n,ur(a,n.current)),at=null;return}}catch(p){if(h!==null)throw at=h,p;Kt=1,Oo(n,ur(a,n.current)),at=null;return}i.flags&32768?(mt||u===1?n=!0:Ks||(ct&536870912)!==0?n=!1:(Di=n=!0,(u===2||u===9||u===3||u===6)&&(u=Yn.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,Di);return}n=i.return;var a=lw(i.alternate,i,ci);if(a!==null){at=a;return}if(i=i.sibling,i!==null){at=i;return}at=i=n}while(i!==null);Kt===0&&(Kt=5)}function ey(n,i){do{var a=ow(n.alternate,n);if(a!==null){a.flags&=32767,at=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!i&&(n=n.sibling,n!==null)){at=n;return}at=n=a}while(n!==null);Kt=6,at=null}function ty(n,i,a,u,h,p,w,_,q){n.cancelPendingCommit=null;do Vo();while(un!==0);if((_t&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,Dr(n,a,p,w,_,q),n===Mt&&(at=Mt=null,ct=0),Zs=i,Ui=n,fi=a,Df=p,Lf=h,$g=u,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,vw(He,function(){return ay(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,h=J.p,J.p=2,w=_t,_t|=4;try{uw(n,i,a)}finally{_t=w,J.p=h,V.T=u}}un=1,ny(),ry(),iy()}}function ny(){if(un===1){un=0;var n=Ui,i=Zs,a=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||a){a=V.T,V.T=null;var u=J.p;J.p=2;var h=_t;_t|=4;try{zg(i,n);var p=Kf,w=Im(n.containerInfo),_=p.focusedElem,q=p.selectionRange;if(w!==_&&_&&_.ownerDocument&&qm(_.ownerDocument.documentElement,_)){if(q!==null&&vc(_)){var re=q.start,de=q.end;if(de===void 0&&(de=re),"selectionStart"in _)_.selectionStart=re,_.selectionEnd=Math.min(de,_.value.length);else{var ye=_.ownerDocument||document,ie=ye&&ye.defaultView||window;if(ie.getSelection){var ae=ie.getSelection(),ze=_.textContent.length,Xe=Math.min(q.start,ze),Nt=q.end===void 0?Xe:Math.min(q.end,ze);!ae.extend&&Xe>Nt&&(w=Nt,Nt=Xe,Xe=w);var Q=Hm(_,Xe),Y=Hm(_,Nt);if(Q&&Y&&(ae.rangeCount!==1||ae.anchorNode!==Q.node||ae.anchorOffset!==Q.offset||ae.focusNode!==Y.node||ae.focusOffset!==Y.offset)){var ne=ye.createRange();ne.setStart(Q.node,Q.offset),ae.removeAllRanges(),Xe>Nt?(ae.addRange(ne),ae.extend(Y.node,Y.offset)):(ne.setEnd(Y.node,Y.offset),ae.addRange(ne))}}}}for(ye=[],ae=_;ae=ae.parentNode;)ae.nodeType===1&&ye.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<ye.length;_++){var me=ye[_];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}ru=!!Xf,Kf=Xf=null}finally{_t=h,J.p=u,V.T=a}}n.current=i,un=2}}function ry(){if(un===2){un=0;var n=Ui,i=Zs,a=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||a){a=V.T,V.T=null;var u=J.p;J.p=2;var h=_t;_t|=4;try{Og(n,i.alternate,i)}finally{_t=h,J.p=u,V.T=a}}un=3}}function iy(){if(un===4||un===3){un=0,En();var n=Ui,i=Zs,a=fi,u=$g;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?un=5:(un=0,Zs=Ui=null,sy(n,n.pendingLanes));var h=n.pendingLanes;if(h===0&&(zi=null),Ve(a),i=i.stateNode,Ge&&typeof Ge.onCommitFiberRoot=="function")try{Ge.onCommitFiberRoot(je,i,void 0,(i.current.flags&128)===128)}catch{}if(u!==null){i=V.T,h=J.p,J.p=2,V.T=null;try{for(var p=n.onRecoverableError,w=0;w<u.length;w++){var _=u[w];p(_.value,{componentStack:_.stack})}}finally{V.T=i,J.p=h}}(fi&3)!==0&&Vo(),Pr(n),h=n.pendingLanes,(a&261930)!==0&&(h&42)!==0?n===zf?ll++:(ll=0,zf=n):ll=0,ol(0)}}function sy(n,i){(n.pooledCacheLanes&=i)===0&&(i=n.pooledCache,i!=null&&(n.pooledCache=null,Ia(i)))}function Vo(){return ny(),ry(),iy(),ay()}function ay(){if(un!==5)return!1;var n=Ui,i=Df;Df=0;var a=Ve(fi),u=V.T,h=J.p;try{J.p=32>a?32:a,V.T=null,a=Lf,Lf=null;var p=Ui,w=fi;if(un=0,Zs=Ui=null,fi=0,(_t&6)!==0)throw Error(s(331));var _=_t;if(_t|=4,qg(p.current),Pg(p,p.current,w,a),_t=_,ol(0,!1),Ge&&typeof Ge.onPostCommitFiberRoot=="function")try{Ge.onPostCommitFiberRoot(je,p)}catch{}return!0}finally{J.p=h,V.T=u,sy(n,i)}}function ly(n,i,a){i=ur(a,i),i=mf(n.stateNode,i,2),n=Ti(n,i,2),n!==null&&(An(n,2),Pr(n))}function Ct(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"&&(zi===null||!zi.has(u))){n=ur(a,n),a=og(2),u=Ti(i,a,2),u!==null&&(ug(a,u,i,n),An(u,2),Pr(u));break}}i=i.return}}function Bf(n,i,a){var u=n.pingCache;if(u===null){u=n.pingCache=new hw;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=yw.bind(null,n,i,a),i.then(n,n))}function yw(n,i,a){var u=n.pingCache;u!==null&&u.delete(i),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,Mt===n&&(ct&a)===a&&(Kt===4||Kt===3&&(ct&62914560)===ct&&300>st()-Bo?(_t&2)===0&&Ws(n,0):Rf|=a,Qs===ct&&(Qs=0)),Pr(n)}function oy(n,i){i===0&&(i=Si()),n=ls(n,i),n!==null&&(An(n,i),Pr(n))}function bw(n){var i=n.memoizedState,a=0;i!==null&&(a=i.retryLane),oy(n,a)}function xw(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 vw(n,i){return dt(n,i)}var Yo=null,ta=null,Hf=!1,Go=!1,qf=!1,Bi=0;function Pr(n){n!==ta&&n.next===null&&(ta===null?Yo=ta=n:ta=ta.next=n),Go=!0,Hf||(Hf=!0,Sw())}function ol(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-ut(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=ct,p=Vr(u,u===Mt?p:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(p&3)===0||Yr(u,p)||(a=!0,hy(u,p));u=u.next}while(a);qf=!1}}function ww(){uy()}function uy(){Go=Hf=!1;var n=0;Bi!==0&&Rw()&&(n=Bi);for(var i=st(),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&&(ta=a)):(a=u,(n!==0||(p&3)!==0)&&(Go=!0)),u=h}un!==0&&un!==5||ol(n),Bi!==0&&(Bi=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-ut(p),_=1<<w,q=h[w];q===-1?((_&a)===0||(_&u)!==0)&&(h[w]=Gr(_,i)):q<=i&&(n.expiredLanes|=_),p&=~_}if(i=Mt,a=ct,a=Vr(n,n===i?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,a===0||n===i&&(Et===2||Et===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&xt(u),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||Yr(n,a)){if(i=a&-a,i===n.callbackPriority)return i;switch(u!==null&&xt(u),Ve(a)){case 2:case 8:a=we;break;case 32:a=He;break;case 268435456:a=qe;break;default:a=He}return u=fy.bind(null,n),a=dt(a,u),n.callbackPriority=i,n.callbackNode=a,i}return u!==null&&u!==null&&xt(u),n.callbackPriority=2,n.callbackNode=null,2}function fy(n,i){if(un!==0&&un!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(Vo()&&n.callbackNode!==a)return null;var u=ct;return u=Vr(n,n===Mt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(Yg(n,u,i),cy(n,st()),n.callbackNode!=null&&n.callbackNode===a?fy.bind(null,n):null)}function hy(n,i){if(Vo())return null;Yg(n,i,!0)}function Sw(){Dw(function(){(_t&6)!==0?dt(fe,ww):uy()})}function If(){if(Bi===0){var n=Hs;n===0&&(n=mn,mn<<=1,(mn&261888)===0&&(mn=256)),Bi=n}return Bi}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 _w(n,i,a,u,h){if(i==="submit"&&a&&a.stateNode===h){var p=dy((h[rt]||null).action),w=u.submitter;w&&(i=(i=w[rt]||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(Bi!==0){var q=w?my(h,w):new FormData(h);of(a,{pending:!0,data:q,method:h.method,action:p},null,q)}}else typeof p=="function"&&(_.preventDefault(),q=w?my(h,w):new FormData(h),of(a,{pending:!0,data:q,method:h.method,action:p},p,q))},currentTarget:h}]})}}for(var Ff=0;Ff<kc.length;Ff++){var $f=kc[Ff],kw=$f.toLowerCase(),Ew=$f[0].toUpperCase()+$f.slice(1);Sr(kw,"on"+Ew)}Sr(Vm,"onAnimationEnd"),Sr(Ym,"onAnimationIteration"),Sr(Gm,"onAnimationStart"),Sr("dblclick","onDoubleClick"),Sr("focusin","onFocus"),Sr("focusout","onBlur"),Sr(qv,"onTransitionRun"),Sr(Iv,"onTransitionStart"),Sr(Fv,"onTransitionCancel"),Sr(Jm,"onTransitionEnd"),se("onMouseEnter",["mouseout","mouseover"]),se("onMouseLeave",["mouseout","mouseover"]),se("onPointerEnter",["pointerout","pointerover"]),se("onPointerLeave",["pointerout","pointerover"]),be("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),be("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),be("onBeforeInput",["compositionend","keypress","textInput","paste"]),be("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ul="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(" "),Cw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ul));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],q=_.instance,re=_.currentTarget;if(_=_.listener,q!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=re;try{p(h)}catch(de){lo(de)}h.currentTarget=null,p=q}else for(w=0;w<u.length;w++){if(_=u[w],q=_.instance,re=_.currentTarget,_=_.listener,q!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=re;try{p(h)}catch(de){lo(de)}h.currentTarget=null,p=q}}}}function lt(n,i){var a=i[qt];a===void 0&&(a=i[qt]=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,Z.forEach(function(a){a!=="selectionchange"&&(Cw.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=eS;break;case 8:h=tS;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 q=w.tag;if((q===3||q===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;_!==null;){if(w=k(_),w===null)return;if(q=w.tag,q===5||q===6||q===26||q===27){u=p=w;continue e}_=_.parentNode}}u=u.return}wm(function(){var re=p,de=uc(a),ye=[];e:{var ie=Xm.get(n);if(ie!==void 0){var ae=io,ze=n;switch(n){case"keypress":if(no(a)===0)break e;case"keydown":case"keyup":ae=xv;break;case"focusin":ze="focus",ae=pc;break;case"focusout":ze="blur",ae=pc;break;case"beforeblur":case"afterblur":ae=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":ae=km;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=lv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=Sv;break;case Vm:case Ym:case Gm:ae=cv;break;case Jm:ae=kv;break;case"scroll":case"scrollend":ae=sv;break;case"wheel":ae=Cv;break;case"copy":case"cut":case"paste":ae=hv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Cm;break;case"toggle":case"beforetoggle":ae=jv}var Xe=(i&4)!==0,Nt=!Xe&&(n==="scroll"||n==="scrollend"),Q=Xe?ie!==null?ie+"Capture":null:ie;Xe=[];for(var Y=re,ne;Y!==null;){var me=Y;if(ne=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||ne===null||Q===null||(me=Oa(Y,Q),me!=null&&Xe.push(cl(Y,me,ne))),Nt)break;Y=Y.return}0<Xe.length&&(ie=new ae(ie,ze,null,a,de),ye.push({event:ie,listeners:Xe}))}}if((i&7)===0){e:{if(ie=n==="mouseover"||n==="pointerover",ae=n==="mouseout"||n==="pointerout",ie&&a!==oc&&(ze=a.relatedTarget||a.fromElement)&&(k(ze)||ze[vt]))break e;if((ae||ie)&&(ie=de.window===de?de:(ie=de.ownerDocument)?ie.defaultView||ie.parentWindow:window,ae?(ze=a.relatedTarget||a.toElement,ae=re,ze=ze?k(ze):null,ze!==null&&(Nt=o(ze),Xe=ze.tag,ze!==Nt||Xe!==5&&Xe!==27&&Xe!==6)&&(ze=null)):(ae=null,ze=re),ae!==ze)){if(Xe=km,me="onMouseLeave",Q="onMouseEnter",Y="mouse",(n==="pointerout"||n==="pointerover")&&(Xe=Cm,me="onPointerLeave",Q="onPointerEnter",Y="pointer"),Nt=ae==null?ie:O(ae),ne=ze==null?ie:O(ze),ie=new Xe(me,Y+"leave",ae,a,de),ie.target=Nt,ie.relatedTarget=ne,me=null,k(de)===re&&(Xe=new Xe(Q,Y+"enter",ze,a,de),Xe.target=ne,Xe.relatedTarget=Nt,me=Xe),Nt=me,ae&&ze)t:{for(Xe=Aw,Q=ae,Y=ze,ne=0,me=Q;me;me=Xe(me))ne++;me=0;for(var $e=Y;$e;$e=Xe($e))me++;for(;0<ne-me;)Q=Xe(Q),ne--;for(;0<me-ne;)Y=Xe(Y),me--;for(;ne--;){if(Q===Y||Y!==null&&Q===Y.alternate){Xe=Q;break t}Q=Xe(Q),Y=Xe(Y)}Xe=null}else Xe=null;ae!==null&&yy(ye,ie,ae,Xe,!1),ze!==null&&Nt!==null&&yy(ye,Nt,ze,Xe,!0)}}e:{if(ie=re?O(re):window,ae=ie.nodeName&&ie.nodeName.toLowerCase(),ae==="select"||ae==="input"&&ie.type==="file")var wt=Dm;else if(Rm(ie))if(Lm)wt=Pv;else{wt=zv;var Pe=Lv}else ae=ie.nodeName,!ae||ae.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?re&&lc(re.elementType)&&(wt=Dm):wt=Uv;if(wt&&(wt=wt(n,re))){Mm(ye,wt,a,de);break e}Pe&&Pe(n,ie,re),n==="focusout"&&re&&ie.type==="number"&&re.memoizedProps.value!=null&&ac(ie,"number",ie.value)}switch(Pe=re?O(re):window,n){case"focusin":(Rm(Pe)||Pe.contentEditable==="true")&&(Rs=Pe,wc=re,Ba=null);break;case"focusout":Ba=wc=Rs=null;break;case"mousedown":Sc=!0;break;case"contextmenu":case"mouseup":case"dragend":Sc=!1,Fm(ye,a,de);break;case"selectionchange":if(Hv)break;case"keydown":case"keyup":Fm(ye,a,de)}var et;if(yc)e:{switch(n){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else Os?Tm(n,a)&&(ft="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(ft="onCompositionStart");ft&&(Am&&a.locale!=="ko"&&(Os||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&Os&&(et=Sm()):(_i=de,hc="value"in _i?_i.value:_i.textContent,Os=!0)),Pe=Xo(re,ft),0<Pe.length&&(ft=new Em(ft,n,null,a,de),ye.push({event:ft,listeners:Pe}),et?ft.data=et:(et=Om(a),et!==null&&(ft.data=et)))),(et=Tv?Ov(n,a):Rv(n,a))&&(ft=Xo(re,"onBeforeInput"),0<ft.length&&(Pe=new Em("onBeforeInput","beforeinput",null,a,de),ye.push({event:Pe,listeners:ft}),Pe.data=et)),_w(ye,n,re,a,de)}py(ye,i)})}function cl(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=Oa(n,a),h!=null&&u.unshift(cl(n,h,p)),h=Oa(n,i),h!=null&&u.push(cl(n,h,p))),n.tag===3)return u;n=n.return}return[]}function Aw(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,q=_.alternate,re=_.stateNode;if(_=_.tag,q!==null&&q===u)break;_!==5&&_!==26&&_!==27||re===null||(q=re,h?(re=Oa(a,p),re!=null&&w.unshift(cl(a,re,q))):h||(re=Oa(a,p),re!=null&&w.push(cl(a,re,q)))),a=a.return}w.length!==0&&n.push({event:i,listeners:w})}var jw=/\r\n?/g,Nw=/\u0000|\uFFFD/g;function by(n){return(typeof n=="string"?n:""+n).replace(jw,`
|
|
49
|
+
`).replace(Nw,"")}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===""||js(n,u):(typeof u=="number"||typeof u=="bigint")&&i!=="body"&&js(n,""+u);break;case"className":wr(n,"class",u);break;case"tabIndex":wr(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":wr(n,a,u);break;case"style":xm(n,u,p);break;case"data":if(i!=="object"){wr(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=Kr);break;case"onScroll":u!=null&<("scroll",n);break;case"onScrollEnd":u!=null&<("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":lt("beforetoggle",n),lt("toggle",n),vn(n,"popover",u);break;case"xlinkActuate":Xr(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Xr(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Xr(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Xr(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Xr(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Xr(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Xr(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Xr(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Xr(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":vn(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=rv.get(a)||a,vn(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"?js(n,u):(typeof u=="number"||typeof u=="bigint")&&js(n,""+u);break;case"onScroll":u!=null&<("scroll",n);break;case"onScrollEnd":u!=null&<("scrollend",n);break;case"onClick":u!=null&&(n.onclick=Kr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ge.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[rt]||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,""):vn(n,a,u)}}}function bn(n,i,a){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",n),lt("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":lt("invalid",n);var _=p=w=h=null,q=null,re=null;for(u in a)if(a.hasOwnProperty(u)){var de=a[u];if(de!=null)switch(u){case"name":h=de;break;case"type":w=de;break;case"checked":q=de;break;case"defaultChecked":re=de;break;case"value":p=de;break;case"defaultValue":_=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(s(137,i));break;default:jt(n,i,u,de,a,null)}}pm(n,p,_,q,re,w,h,!1);return;case"select":lt("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?As(n,!!u,i,!1):a!=null&&As(n,!!u,a,!0);return;case"textarea":lt("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(q in a)if(a.hasOwnProperty(q)&&(u=a[q],u!=null))switch(q){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:jt(n,i,q,u,a,null)}return;case"dialog":lt("beforetoggle",n),lt("toggle",n),lt("cancel",n),lt("close",n);break;case"iframe":case"object":lt("load",n);break;case"video":case"audio":for(u=0;u<ul.length;u++)lt(ul[u],n);break;case"image":lt("error",n),lt("load",n);break;case"details":lt("toggle",n);break;case"embed":case"source":case"link":lt("error",n),lt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in a)if(a.hasOwnProperty(re)&&(u=a[re],u!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:jt(n,i,re,u,a,null)}return;default:if(lc(i)){for(de in a)a.hasOwnProperty(de)&&(u=a[de],u!==void 0&&Jf(n,i,de,u,a,void 0));return}}for(_ in a)a.hasOwnProperty(_)&&(u=a[_],u!=null&&jt(n,i,_,u,a,null))}function Tw(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,q=null,re=null,de=null;for(ae in a){var ye=a[ae];if(a.hasOwnProperty(ae)&&ye!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":q=ye;default:u.hasOwnProperty(ae)||jt(n,i,ae,null,u,ye)}}for(var ie in u){var ae=u[ie];if(ye=a[ie],u.hasOwnProperty(ie)&&(ae!=null||ye!=null))switch(ie){case"type":p=ae;break;case"name":h=ae;break;case"checked":re=ae;break;case"defaultChecked":de=ae;break;case"value":w=ae;break;case"defaultValue":_=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(s(137,i));break;default:ae!==ye&&jt(n,i,ie,ae,u,ye)}}sc(n,w,_,q,re,de,p,h);return;case"select":ae=w=_=ie=null;for(p in a)if(q=a[p],a.hasOwnProperty(p)&&q!=null)switch(p){case"value":break;case"multiple":ae=q;default:u.hasOwnProperty(p)||jt(n,i,p,null,u,q)}for(h in u)if(p=u[h],q=a[h],u.hasOwnProperty(h)&&(p!=null||q!=null))switch(h){case"value":ie=p;break;case"defaultValue":_=p;break;case"multiple":w=p;default:p!==q&&jt(n,i,h,p,u,q)}i=_,a=w,u=ae,ie!=null?As(n,!!a,ie,!1):!!u!=!!a&&(i!=null?As(n,!!a,i,!0):As(n,!!a,a?[]:"",!1));return;case"textarea":ae=ie=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":ie=h;break;case"defaultValue":ae=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,ie,ae);return;case"option":for(var ze in a)if(ie=a[ze],a.hasOwnProperty(ze)&&ie!=null&&!u.hasOwnProperty(ze))switch(ze){case"selected":n.selected=!1;break;default:jt(n,i,ze,null,u,ie)}for(q in u)if(ie=u[q],ae=a[q],u.hasOwnProperty(q)&&ie!==ae&&(ie!=null||ae!=null))switch(q){case"selected":n.selected=ie&&typeof ie!="function"&&typeof ie!="symbol";break;default:jt(n,i,q,ie,u,ae)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Xe in a)ie=a[Xe],a.hasOwnProperty(Xe)&&ie!=null&&!u.hasOwnProperty(Xe)&&jt(n,i,Xe,null,u,ie);for(re in u)if(ie=u[re],ae=a[re],u.hasOwnProperty(re)&&ie!==ae&&(ie!=null||ae!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:jt(n,i,re,ie,u,ae)}return;default:if(lc(i)){for(var Nt in a)ie=a[Nt],a.hasOwnProperty(Nt)&&ie!==void 0&&!u.hasOwnProperty(Nt)&&Jf(n,i,Nt,void 0,u,ie);for(de in u)ie=u[de],ae=a[de],!u.hasOwnProperty(de)||ie===ae||ie===void 0&&ae===void 0||Jf(n,i,de,ie,u,ae);return}}for(var Q in a)ie=a[Q],a.hasOwnProperty(Q)&&ie!=null&&!u.hasOwnProperty(Q)&&jt(n,i,Q,null,u,ie);for(ye in u)ie=u[ye],ae=a[ye],!u.hasOwnProperty(ye)||ie===ae||ie==null&&ae==null||jt(n,i,ye,ie,u,ae)}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 Ow(){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 q=a[u],re=q.startTime;if(re>_)break;var de=q.transferSize,ye=q.initiatorType;de&&vy(ye)&&(q=q.responseEnd,w+=de*(q<_?1:(_-re)/(q-re)))}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 Rw(){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,Mw=typeof clearTimeout=="function"?clearTimeout:void 0,ky=typeof Promise=="function"?Promise:void 0,Dw=typeof queueMicrotask=="function"?queueMicrotask:typeof ky<"u"?function(n){return ky.resolve(null).then(n).catch(Lw)}:_y;function Lw(n){setTimeout(function(){throw n})}function Hi(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),sa(i);return}u--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")u++;else if(a==="html")fl(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,fl(a);for(var p=a.firstChild;p;){var w=p.nextSibling,_=p.nodeName;p[Jt]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=w}}else a==="body"&&fl(n.ownerDocument.body);a=h}while(a);sa(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),Jr(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function zw(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[Jt])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=mr(n.nextSibling),n===null)break}return null}function Uw(n,i,a){if(i==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=mr(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=mr(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 Pw(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 mr(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 mr(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 fl(n){for(var i=n.attributes;i.length;)n.removeAttributeNode(i[0]);Jr(n)}var pr=new Map,Oy=new Set;function Qo(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var hi=J.d;J.d={f:Bw,r:Hw,D:qw,C:Iw,L:Fw,m:$w,X:Yw,S:Vw,M:Gw};function Bw(){var n=hi.f(),i=Io();return n||i}function Hw(n){var i=T(n);i!==null&&i.tag===5&&i.type==="form"?Jp(i):hi.r(n)}var na=typeof document>"u"?null:document;function Ry(n,i,a){var u=na;if(u&&typeof i=="string"&&i){var h=lr(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"),bn(i,"link",n),$(i),u.head.appendChild(i)))}}function qw(n){hi.D(n),Ry("dns-prefetch",n,null)}function Iw(n,i){hi.C(n,i),Ry("preconnect",n,i)}function Fw(n,i,a){hi.L(n,i,a);var u=na;if(u&&n&&i){var h='link[rel="preload"][as="'+lr(i)+'"]';i==="image"&&a&&a.imageSrcSet?(h+='[imagesrcset="'+lr(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(h+='[imagesizes="'+lr(a.imageSizes)+'"]')):h+='[href="'+lr(n)+'"]';var p=h;switch(i){case"style":p=ra(n);break;case"script":p=ia(n)}pr.has(p)||(n=g({rel:"preload",href:i==="image"&&a&&a.imageSrcSet?void 0:n,as:i},a),pr.set(p,n),u.querySelector(h)!==null||i==="style"&&u.querySelector(hl(p))||i==="script"&&u.querySelector(dl(p))||(i=u.createElement("link"),bn(i,"link",n),$(i),u.head.appendChild(i)))}}function $w(n,i){hi.m(n,i);var a=na;if(a&&n){var u=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+lr(u)+'"][href="'+lr(n)+'"]',p=h;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ia(n)}if(!pr.has(p)&&(n=g({rel:"modulepreload",href:n},i),pr.set(p,n),a.querySelector(h)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(dl(p)))return}u=a.createElement("link"),bn(u,"link",n),$(u),a.head.appendChild(u)}}}function Vw(n,i,a){hi.S(n,i,a);var u=na;if(u&&n){var h=U(u).hoistableStyles,p=ra(n);i=i||"default";var w=h.get(p);if(!w){var _={loading:0,preload:null};if(w=u.querySelector(hl(p)))_.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":i},a),(a=pr.get(p))&&rh(n,a);var q=w=u.createElement("link");$(q),bn(q,"link",n),q._p=new Promise(function(re,de){q.onload=re,q.onerror=de}),q.addEventListener("load",function(){_.loading|=1}),q.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Zo(w,i,u)}w={type:"stylesheet",instance:w,count:1,state:_},h.set(p,w)}}}function Yw(n,i){hi.X(n,i);var a=na;if(a&&n){var u=U(a).hoistableScripts,h=ia(n),p=u.get(h);p||(p=a.querySelector(dl(h)),p||(n=g({src:n,async:!0},i),(i=pr.get(h))&&ih(n,i),p=a.createElement("script"),$(p),bn(p,"link",n),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(h,p))}}function Gw(n,i){hi.M(n,i);var a=na;if(a&&n){var u=U(a).hoistableScripts,h=ia(n),p=u.get(h);p||(p=a.querySelector(dl(h)),p||(n=g({src:n,async:!0,type:"module"},i),(i=pr.get(h))&&ih(n,i),p=a.createElement("script"),$(p),bn(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=Ee.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=ra(a.href),a=U(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=ra(a.href);var p=U(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(hl(n)))&&!p._p&&(w.instance=p,w.state.loading=5),pr.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},pr.set(n,a),p||Jw(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=ia(a),a=U(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 ra(n){return'href="'+lr(n)+'"'}function hl(n){return'link[rel="stylesheet"]['+n+"]"}function Dy(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function Jw(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}),bn(i,"link",a),$(i),n.head.appendChild(i))}function ia(n){return'[src="'+lr(n)+'"]'}function dl(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~="'+lr(a.href)+'"]');if(u)return i.instance=u,$(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"),$(u),bn(u,"style",h),Zo(u,a.precedence,n),i.instance=u;case"stylesheet":h=ra(a.href);var p=n.querySelector(hl(h));if(p)return i.state.loading|=4,i.instance=p,$(p),p;u=Dy(a),(h=pr.get(h))&&rh(u,h),p=(n.ownerDocument||n).createElement("link"),$(p);var w=p;return w._p=new Promise(function(_,q){w.onload=_,w.onerror=q}),bn(p,"link",u),i.state.loading|=4,Zo(p,a.precedence,n),i.instance=p;case"script":return p=ia(a.src),(h=n.querySelector(dl(p)))?(i.instance=h,$(h),h):(u=a,(h=pr.get(p))&&(u=g({},a),ih(u,h)),n=n.ownerDocument||n,h=n.createElement("script"),$(h),bn(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[Jt]||p[Ue]||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 Xw(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 Kw(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=ra(u.href),p=i.querySelector(hl(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,$(p);return}p=i.ownerDocument||i,u=Dy(u),(h=pr.get(h))&&rh(u,h),p=p.createElement("link"),$(p);var w=p;w._p=new Promise(function(_,q){w.onload=_,w.onerror=q}),bn(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 Qw(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*Ow());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(Zw,n),tu=null,eu.call(n))}function Zw(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 ml={$$typeof:I,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function Ww(n,i,a,u,h,p,w,_,q){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=Mr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mr(0),this.hiddenUpdates=Mr(null),this.identifierPrefix=u,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function By(n,i,a,u,h,p,w,_,q,re,de,ye){return n=new Ww(n,i,a,w,q,re,de,ye,_),i=1,p===!0&&(i|=24),p=Vn(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=Ls,n):Ls}function qy(n,i,a,u,h,p){h=Hy(h),u.context===null?u.context=h:u.pendingContext=h,u=Ni(i),u.payload={element:a},p=p===void 0?null:p,p!==null&&(u.callback=p),a=Ti(n,u,i),a!==null&&(Hn(a,n,i),Ya(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=ls(n,67108864);i!==null&&Hn(i,n,67108864),ah(n,67108864)}}function $y(n){if(n.tag===13||n.tag===31){var i=Kn();i=Je(i);var a=ls(n,i);a!==null&&Hn(a,n,i),ah(n,i)}}var ru=!0;function eS(n,i,a,u){var h=V.T;V.T=null;var p=J.p;try{J.p=2,lh(n,i,a,u)}finally{J.p=p,V.T=h}}function tS(n,i,a,u){var h=V.T;V.T=null;var p=J.p;try{J.p=8,lh(n,i,a,u)}finally{J.p=p,V.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(rS(h,n,i,a,u))u.stopPropagation();else if(Yy(n,u),i&4&&-1<nS.indexOf(n)){for(;h!==null;){var p=T(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=Cn(p.pendingLanes);if(w!==0){var _=p;for(_.pendingLanes|=2,_.entangledLanes|=2;w;){var q=1<<31-ut(w);_.entanglements[1]|=q,w&=~q}Pr(p),(_t&6)===0&&(Ho=st()+500,ol(0))}}break;case 31:case 13:_=ls(p,2),_!==null&&Hn(_,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(sr()){case fe:return 2;case we:return 8;case He:case Qe:return 32;case qe:return 268435456;default:return 32}default:return 32}}var ch=!1,qi=null,Ii=null,Fi=null,pl=new Map,gl=new Map,$i=[],nS="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":qi=null;break;case"dragenter":case"dragleave":Ii=null;break;case"mouseover":case"mouseout":Fi=null;break;case"pointerover":case"pointerout":pl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":gl.delete(i.pointerId)}}function yl(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=T(i),i!==null&&Fy(i)),n):(n.eventSystemFlags|=u,i=n.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),n)}function rS(n,i,a,u,h){switch(i){case"focusin":return qi=yl(qi,n,i,a,u,h),!0;case"dragenter":return Ii=yl(Ii,n,i,a,u,h),!0;case"mouseover":return Fi=yl(Fi,n,i,a,u,h),!0;case"pointerover":var p=h.pointerId;return pl.set(p,yl(pl.get(p)||null,n,i,a,u,h)),!0;case"gotpointercapture":return p=h.pointerId,gl.set(p,yl(gl.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,nt(n.priority,function(){$y(a)});return}}else if(i===31){if(i=f(a),i!==null){n.blockedOn=i,nt(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=T(a),i!==null&&Fy(i),n.blockedOn=a,!1;i.shift()}return!0}function Jy(n,i,a){su(n)&&a.delete(i)}function iS(){ch=!1,qi!==null&&su(qi)&&(qi=null),Ii!==null&&su(Ii)&&(Ii=null),Fi!==null&&su(Fi)&&(Fi=null),pl.forEach(Jy),gl.forEach(Jy)}function au(n,i){n.blockedOn===i&&(n.blockedOn=null,ch||(ch=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,iS)))}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=T(a);p!==null&&(n.splice(i,3),i-=3,of(p,{pending:!0,data:h,method:a.method,action:u},u,h))}}))}function sa(n){function i(q){return au(q,n)}qi!==null&&au(qi,n),Ii!==null&&au(Ii,n),Fi!==null&&au(Fi,n),pl.forEach(i),gl.forEach(i);for(var a=0;a<$i.length;a++){var u=$i[a];u.blockedOn===n&&(u.blockedOn=null)}for(;0<$i.length&&(a=$i[0],a.blockedOn===null);)Gy(a),a.blockedOn===null&&$i.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[rt]||null;if(typeof p=="function")w||Xy(a);else if(w){var _=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[rt]||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=Kn();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[vt]=null}};function ou(n){this._internalRoot=n}ou.prototype.unstable_scheduleHydration=function(n){if(n){var i=pt();n={blockedOn:null,target:n,priority:i};for(var a=0;a<$i.length&&i!==0&&i<$i[a].priority;a++);$i.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"));J.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?b(n):null,n=n===null?null:n.stateNode,n};var sS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uu.isDisabled&&uu.supportsFiber)try{je=uu.inject(sS),Ge=uu}catch{}}return xl.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[vt]=i.current,Yf(n),new fh(i)},xl.hydrateRoot=function(n,i,a){if(!l(n))throw Error(s(299));var u=!1,h="",p=ig,w=sg,_=ag,q=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&&(q=a.formState)),i=By(n,1,!0,i,a??null,u,h,q,p,w,_,Ky),i.context=Hy(null),a=i.current,u=Kn(),u=Je(u),h=Ni(u),h.callback=null,Ti(a,h,u),a=u,i.current.lanes=a,An(i,a),Pr(i),n[vt]=i.current,Yf(n),new ou(i)},xl.version="19.2.4",xl}var l0;function gS(){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=pS(),mh.exports}var yS=gS();/**
|
|
50
50
|
* react-router v7.13.1
|
|
51
51
|
*
|
|
52
52
|
* Copyright (c) Remix Software Inc.
|
|
@@ -55,22 +55,22 @@ Error generating stack: `+u.message+`
|
|
|
55
55
|
* LICENSE.md file in the root directory of this source tree.
|
|
56
56
|
*
|
|
57
57
|
* @license MIT
|
|
58
|
-
*/var u0="popstate";function c0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function bS(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 ed("",{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:Pl(l)}return vS(t,r,null,e)}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Dr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xS(){return Math.random().toString(36).substring(2,10)}function f0(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 ed(e,t,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ea(t):t,state:r,key:t&&t.key||s||xS(),unstable_mask:l}}function Pl({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 Ea(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 vS(e,t,r,s={}){let{window:l=document.defaultView,v5Compat:o=!1}=s,c=l.history,f="POP",d=null,m=b();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function b(){return(c.state||{idx:null}).idx}function g(){f="POP";let D=b(),M=D==null?null:D-m;m=D,d&&d({action:f,location:N.location,delta:M})}function x(D,M){f="PUSH";let P=c0(D)?D:ed(N.location,D,M);m=b()+1;let I=f0(P,m),ue=N.createHref(P.unstable_mask||P);try{c.pushState(I,"",ue)}catch(H){if(H instanceof DOMException&&H.name==="DataCloneError")throw H;l.location.assign(ue)}o&&d&&d({action:f,location:N.location,delta:1})}function v(D,M){f="REPLACE";let P=c0(D)?D:ed(N.location,D,M);m=b();let I=f0(P,m),ue=N.createHref(P.unstable_mask||P);c.replaceState(I,"",ue),o&&d&&d({action:f,location:N.location,delta:0})}function S(D){return wS(D)}let N={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(u0,g),d=D,()=>{l.removeEventListener(u0,g),d=null}},createHref(D){return t(l,D)},createURL:S,encodeLocation(D){let M=S(D);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:x,replace:v,go(D){return c.go(D)}};return N}function wS(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Jt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Pl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Jb(e,t,r="/"){return SS(e,t,r,!1)}function SS(e,t,r,s){let l=typeof t=="string"?Ea(t):t,o=bi(l.pathname||"/",r);if(o==null)return null;let c=Xb(e);_S(c);let f=null;for(let d=0;f==null&&d<c.length;++d){let m=DS(o);f=RS(c[d],m,s)}return f}function Xb(e,t=[],r=[],s="",l=!1){let o=(c,f,d=l,m)=>{let b={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(s)&&d)return;Jt(b.relativePath.startsWith(s),`Absolute route path "${b.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(s.length)}let g=Vr([s,b.relativePath]),x=r.concat(b);c.children&&c.children.length>0&&(Jt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Xb(c.children,t,x,g,d)),!(c.path==null&&!c.index)&&t.push({path:g,score:TS(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 Kb(c.path))o(c,f,!0,m)}),t}function Kb(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=Kb(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 _S(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:OS(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var kS=/^:[\w-]+$/,ES=3,CS=2,AS=1,jS=10,NS=-2,h0=e=>e==="*";function TS(e,t){let r=e.split("/"),s=r.length;return r.some(h0)&&(s+=NS),t&&(s+=CS),r.filter(l=>!h0(l)).reduce((l,o)=>l+(kS.test(o)?ES:o===""?AS:jS),s)}function OS(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 RS(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,b=o==="/"?t:t.slice(o.length)||"/",g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},b),x=d.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},b)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:Vr([o,g.pathname]),pathnameBase:PS(Vr([o,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(o=Vr([o,g.pathnameBase]))}return c}function ju(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=MS(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:b,isOptional:g},x)=>{if(b==="*"){let S=f[x]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const v=f[x];return g&&!v?m[b]=void 0:m[b]=(v||"").replace(/%2F/g,"/"),m},{}),pathname:o,pathnameBase:c,pattern:e}}function MS(e,t=!1,r=!0){Dr(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,b)=>{if(s.push({paramName:f,isOptional:d!=null}),d){let g=b.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 DS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Dr(!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 bi(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 LS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function zS(e,t="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?Ea(e):e,o;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?o=d0(r.substring(1),"/"):o=d0(r,t)):o=t,{pathname:o,search:BS(s),hash:HS(l)}}function d0(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 US(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Od(e){let t=US(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=Ea(e):(l={...e},Jt(!l.pathname||!l.pathname.includes("?"),bh("?","pathname","search",l)),Jt(!l.pathname||!l.pathname.includes("#"),bh("#","pathname","hash",l)),Jt(!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=zS(l,f),m=c&&c!=="/"&&c.endsWith("/"),b=(o||c===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(m||b)&&(d.pathname+="/"),d}var Vr=e=>e.join("/").replace(/\/\/+/g,"/"),PS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),BS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,HS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,qS=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 IS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function FS(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Qb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Zb(e,t){let r=e;if(typeof r!="string"||!LS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,l=!1;if(Qb)try{let o=new URL(window.location.href),c=r.startsWith("//")?new URL(o.protocol+r):new URL(r),f=bi(c.pathname,t);c.origin===o.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Dr(!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 Wb=["POST","PUT","PATCH","DELETE"];new Set(Wb);var $S=["GET",...Wb];new Set($S);var Ca=k.createContext(null);Ca.displayName="DataRouter";var Vu=k.createContext(null);Vu.displayName="DataRouterState";var VS=k.createContext(!1),ex=k.createContext({isTransitioning:!1});ex.displayName="ViewTransition";var YS=k.createContext(new Map);YS.displayName="Fetchers";var GS=k.createContext(null);GS.displayName="Await";var lr=k.createContext(null);lr.displayName="Navigation";var Yl=k.createContext(null);Yl.displayName="Location";var Lr=k.createContext({outlet:null,matches:[],isDataRoute:!1});Lr.displayName="Route";var Rd=k.createContext(null);Rd.displayName="RouteError";var tx="REACT_ROUTER_ERROR",JS="REDIRECT",XS="ROUTE_ERROR_RESPONSE";function KS(e){if(e.startsWith(`${tx}:${JS}:{`))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 QS(e){if(e.startsWith(`${tx}:${XS}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new qS(t.status,t.statusText,t.data)}catch{}}function ZS(e,{relative:t}={}){Jt(Aa(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=k.useContext(lr),{hash:l,pathname:o,search:c}=Gl(e,{relative:t}),f=o;return r!=="/"&&(f=o==="/"?r:Vr([r,o])),s.createHref({pathname:f,search:c,hash:l})}function Aa(){return k.useContext(Yl)!=null}function _r(){return Jt(Aa(),"useLocation() may be used only in the context of a <Router> component."),k.useContext(Yl).location}var nx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function rx(e){k.useContext(lr).static||k.useLayoutEffect(e)}function Yr(){let{isDataRoute:e}=k.useContext(Lr);return e?f_():WS()}function WS(){Jt(Aa(),"useNavigate() may be used only in the context of a <Router> component.");let e=k.useContext(Ca),{basename:t,navigator:r}=k.useContext(lr),{matches:s}=k.useContext(Lr),{pathname:l}=_r(),o=JSON.stringify(Od(s)),c=k.useRef(!1);return rx(()=>{c.current=!0}),k.useCallback((d,m={})=>{if(Dr(c.current,nx),!c.current)return;if(typeof d=="number"){r.go(d);return}let b=$u(d,JSON.parse(o),l,m.relative==="path");e==null&&t!=="/"&&(b.pathname=b.pathname==="/"?t:Vr([t,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[t,r,o,l,e])}k.createContext(null);function Yu(){let{matches:e}=k.useContext(Lr),t=e[e.length-1];return t?t.params:{}}function Gl(e,{relative:t}={}){let{matches:r}=k.useContext(Lr),{pathname:s}=_r(),l=JSON.stringify(Od(r));return k.useMemo(()=>$u(e,JSON.parse(l),s,t==="path"),[e,l,s,t])}function e_(e,t){return ix(e,t)}function ix(e,t,r){var D;Jt(Aa(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=k.useContext(lr),{matches:l}=k.useContext(Lr),o=l[l.length-1],c=o?o.params:{},f=o?o.pathname:"/",d=o?o.pathnameBase:"/",m=o&&o.route;{let M=m&&m.path||"";ax(f,!m||M.endsWith("*")||M.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${M}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
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 bS(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 ed("",{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:Pl(l)}return vS(t,r,null,e)}function Vt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Tr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xS(){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 ed(e,t,r=null,s,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ea(t):t,state:r,key:t&&t.key||s||xS(),unstable_mask:l}}function Pl({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 Ea(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 vS(e,t,r,s={}){let{window:l=document.defaultView,v5Compat:o=!1}=s,c=l.history,f="POP",d=null,m=b();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function b(){return(c.state||{idx:null}).idx}function g(){f="POP";let D=b(),M=D==null?null:D-m;m=D,d&&d({action:f,location:j.location,delta:M})}function x(D,M){f="PUSH";let R=u0(D)?D:ed(j.location,D,M);m=b()+1;let I=c0(R,m),ue=j.createHref(R.unstable_mask||R);try{c.pushState(I,"",ue)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;l.location.assign(ue)}o&&d&&d({action:f,location:j.location,delta:1})}function v(D,M){f="REPLACE";let R=u0(D)?D:ed(j.location,D,M);m=b();let I=c0(R,m),ue=j.createHref(R.unstable_mask||R);c.replaceState(I,"",ue),o&&d&&d({action:f,location:j.location,delta:0})}function S(D){return wS(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(o0,g),d=D,()=>{l.removeEventListener(o0,g),d=null}},createHref(D){return t(l,D)},createURL:S,encodeLocation(D){let M=S(D);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:x,replace:v,go(D){return c.go(D)}};return j}function wS(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Vt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Pl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function Gb(e,t,r="/"){return SS(e,t,r,!1)}function SS(e,t,r,s){let l=typeof t=="string"?Ea(t):t,o=yi(l.pathname||"/",r);if(o==null)return null;let c=Jb(e);_S(c);let f=null;for(let d=0;f==null&&d<c.length;++d){let m=DS(o);f=RS(c[d],m,s)}return f}function Jb(e,t=[],r=[],s="",l=!1){let o=(c,f,d=l,m)=>{let b={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(s)&&d)return;Vt(b.relativePath.startsWith(s),`Absolute route path "${b.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(s.length)}let g=Ir([s,b.relativePath]),x=r.concat(b);c.children&&c.children.length>0&&(Vt(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:TS(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 _S(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:OS(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var kS=/^:[\w-]+$/,ES=3,CS=2,AS=1,jS=10,NS=-2,f0=e=>e==="*";function TS(e,t){let r=e.split("/"),s=r.length;return r.some(f0)&&(s+=NS),t&&(s+=CS),r.filter(l=>!f0(l)).reduce((l,o)=>l+(kS.test(o)?ES:o===""?AS:jS),s)}function OS(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 RS(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,b=o==="/"?t:t.slice(o.length)||"/",g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},b),x=d.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=ju({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},b)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:Ir([o,g.pathname]),pathnameBase:PS(Ir([o,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(o=Ir([o,g.pathnameBase]))}return c}function ju(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=MS(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:b,isOptional:g},x)=>{if(b==="*"){let S=f[x]||"";c=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const v=f[x];return g&&!v?m[b]=void 0:m[b]=(v||"").replace(/%2F/g,"/"),m},{}),pathname:o,pathnameBase:c,pattern:e}}function MS(e,t=!1,r=!0){Tr(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,b)=>{if(s.push({paramName:f,isOptional:d!=null}),d){let g=b.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 DS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Tr(!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 yi(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 LS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function zS(e,t="/"){let{pathname:r,search:s="",hash:l=""}=typeof e=="string"?Ea(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:BS(s),hash:HS(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 US(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Td(e){let t=US(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=Ea(e):(l={...e},Vt(!l.pathname||!l.pathname.includes("?"),bh("?","pathname","search",l)),Vt(!l.pathname||!l.pathname.includes("#"),bh("#","pathname","hash",l)),Vt(!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=zS(l,f),m=c&&c!=="/"&&c.endsWith("/"),b=(o||c===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(m||b)&&(d.pathname+="/"),d}var Ir=e=>e.join("/").replace(/\/\/+/g,"/"),PS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),BS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,HS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,qS=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 IS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function FS(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"||!LS.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=yi(c.pathname,t);c.origin===o.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Tr(!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 $S=["GET",...Zb];new Set($S);var Ca=E.createContext(null);Ca.displayName="DataRouter";var Vu=E.createContext(null);Vu.displayName="DataRouterState";var VS=E.createContext(!1),Wb=E.createContext({isTransitioning:!1});Wb.displayName="ViewTransition";var YS=E.createContext(new Map);YS.displayName="Fetchers";var GS=E.createContext(null);GS.displayName="Await";var ir=E.createContext(null);ir.displayName="Navigation";var Yl=E.createContext(null);Yl.displayName="Location";var Or=E.createContext({outlet:null,matches:[],isDataRoute:!1});Or.displayName="Route";var Od=E.createContext(null);Od.displayName="RouteError";var ex="REACT_ROUTER_ERROR",JS="REDIRECT",XS="ROUTE_ERROR_RESPONSE";function KS(e){if(e.startsWith(`${ex}:${JS}:{`))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 QS(e){if(e.startsWith(`${ex}:${XS}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new qS(t.status,t.statusText,t.data)}catch{}}function ZS(e,{relative:t}={}){Vt(Aa(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=E.useContext(ir),{hash:l,pathname:o,search:c}=Gl(e,{relative:t}),f=o;return r!=="/"&&(f=o==="/"?r:Ir([r,o])),s.createHref({pathname:f,search:c,hash:l})}function Aa(){return E.useContext(Yl)!=null}function xr(){return Vt(Aa(),"useLocation() may be used only in the context of a <Router> component."),E.useContext(Yl).location}var tx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nx(e){E.useContext(ir).static||E.useLayoutEffect(e)}function Fr(){let{isDataRoute:e}=E.useContext(Or);return e?f_():WS()}function WS(){Vt(Aa(),"useNavigate() may be used only in the context of a <Router> component.");let e=E.useContext(Ca),{basename:t,navigator:r}=E.useContext(ir),{matches:s}=E.useContext(Or),{pathname:l}=xr(),o=JSON.stringify(Td(s)),c=E.useRef(!1);return nx(()=>{c.current=!0}),E.useCallback((d,m={})=>{if(Tr(c.current,tx),!c.current)return;if(typeof d=="number"){r.go(d);return}let b=$u(d,JSON.parse(o),l,m.relative==="path");e==null&&t!=="/"&&(b.pathname=b.pathname==="/"?t:Ir([t,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[t,r,o,l,e])}E.createContext(null);function Yu(){let{matches:e}=E.useContext(Or),t=e[e.length-1];return t?t.params:{}}function Gl(e,{relative:t}={}){let{matches:r}=E.useContext(Or),{pathname:s}=xr(),l=JSON.stringify(Td(r));return E.useMemo(()=>$u(e,JSON.parse(l),s,t==="path"),[e,l,s,t])}function e_(e,t){return rx(e,t)}function rx(e,t,r){var D;Vt(Aa(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=E.useContext(ir),{matches:l}=E.useContext(Or),o=l[l.length-1],c=o?o.params:{},f=o?o.pathname:"/",d=o?o.pathnameBase:"/",m=o&&o.route;{let M=m&&m.path||"";sx(f,!m||M.endsWith("*")||M.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${M}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
59
|
|
|
60
|
-
Please change the parent <Route path="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let b=_r(),g;if(t){let M=typeof t=="string"?Ea(t):t;Jt(d==="/"||((D=M.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 "${M.pathname}" was given in the \`location\` prop.`),g=M}else g=b;let x=g.pathname||"/",v=x;if(d!=="/"){let M=d.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(M.length).join("/")}let S=Jb(e,{pathname:v});Dr(m||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Dr(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 N=s_(S&&S.map(M=>Object.assign({},M,{params:Object.assign({},c,M.params),pathname:Vr([d,s.encodeLocation?s.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?d:Vr([d,s.encodeLocation?s.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),l,r);return t&&N?k.createElement(Yl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},N):N}function t_(){let e=c_(),t=IS(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=k.createElement(k.Fragment,null,k.createElement("p",null,"💿 Hey developer 👋"),k.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",k.createElement("code",{style:o},"ErrorBoundary")," or"," ",k.createElement("code",{style:o},"errorElement")," prop on your route.")),k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},t),r?k.createElement("pre",{style:l},r):null,c)}var n_=k.createElement(t_,null),sx=class extends k.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=QS(e.digest);r&&(e=r)}let t=e!==void 0?k.createElement(Lr.Provider,{value:this.props.routeContext},k.createElement(Rd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?k.createElement(r_,{error:e},t):t}};sx.contextType=VS;var xh=new WeakMap;function r_({children:e,error:t}){let{basename:r}=k.useContext(lr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=KS(t.digest);if(s){let l=xh.get(t);if(l)throw l;let o=Zb(s.location,r);if(Qb&&!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 k.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function i_({routeContext:e,match:t,children:r}){let s=k.useContext(Ca);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),k.createElement(Lr.Provider,{value:e},r)}function s_(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 b=l.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Jt(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),l=l.slice(0,Math.min(l.length,b+1))}let c=!1,f=-1;if(r&&s){c=s.renderFallback;for(let b=0;b<l.length;b++){let g=l[b];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=b),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?(b,g)=>{var x,v;d(b,{location:s.location,params:((v=(x=s.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:FS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((b,g,x)=>{let v,S=!1,N=null,D=null;s&&(v=o&&g.route.id?o[g.route.id]:void 0,N=g.route.errorElement||n_,c&&(f<0&&x===0?(ax("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 M=t.concat(l.slice(0,x+1)),P=()=>{let I;return v?I=N:S?I=D:g.route.Component?I=k.createElement(g.route.Component,null):g.route.element?I=g.route.element:I=b,k.createElement(i_,{match:g,routeContext:{outlet:b,matches:M,isDataRoute:s!=null},children:I})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?k.createElement(sx,{location:s.location,revalidation:s.revalidation,component:N,error:v,children:P(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:m}):P()},null)}function Md(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function a_(e){let t=k.useContext(Ca);return Jt(t,Md(e)),t}function l_(e){let t=k.useContext(Vu);return Jt(t,Md(e)),t}function o_(e){let t=k.useContext(Lr);return Jt(t,Md(e)),t}function Dd(e){let t=o_(e),r=t.matches[t.matches.length-1];return Jt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function u_(){return Dd("useRouteId")}function c_(){var s;let e=k.useContext(Rd),t=l_("useRouteError"),r=Dd("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function f_(){let{router:e}=a_("useNavigate"),t=Dd("useNavigate"),r=k.useRef(!1);return rx(()=>{r.current=!0}),k.useCallback(async(l,o={})=>{Dr(r.current,nx),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...o}))},[e,t])}var m0={};function ax(e,t,r){!t&&!m0[e]&&(m0[e]=!0,Dr(!1,r))}k.memo(h_);function h_({routes:e,future:t,state:r,isStatic:s,onError:l}){return ix(e,void 0,{state:r,isStatic:s,onError:l})}function Bl({to:e,replace:t,state:r,relative:s}){Jt(Aa(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=k.useContext(lr);Dr(!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}=k.useContext(Lr),{pathname:c}=_r(),f=Yr(),d=$u(e,Od(o),c,s==="path"),m=JSON.stringify(d);return k.useEffect(()=>{f(JSON.parse(m),{replace:t,state:r,relative:s})},[f,m,s,t,r]),null}function Tr(e){Jt(!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 d_({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:l,static:o=!1,unstable_useTransitions:c}){Jt(!Aa(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),d=k.useMemo(()=>({basename:f,navigator:l,static:o,unstable_useTransitions:c,future:{}}),[f,l,o,c]);typeof r=="string"&&(r=Ea(r));let{pathname:m="/",search:b="",hash:g="",state:x=null,key:v="default",unstable_mask:S}=r,N=k.useMemo(()=>{let D=bi(m,f);return D==null?null:{location:{pathname:D,search:b,hash:g,state:x,key:v,unstable_mask:S},navigationType:s}},[f,m,b,g,x,v,s,S]);return Dr(N!=null,`<Router basename="${f}"> is not able to match the URL "${m}${b}${g}" because it does not start with the basename, so the <Router> won't render anything.`),N==null?null:k.createElement(lr.Provider,{value:d},k.createElement(Yl.Provider,{children:t,value:N}))}function lx({children:e,location:t}){return e_(td(e),t)}function td(e,t=[]){let r=[];return k.Children.forEach(e,(s,l)=>{if(!k.isValidElement(s))return;let o=[...t,l];if(s.type===k.Fragment){r.push.apply(r,td(s.props.children,o));return}Jt(s.type===Tr,`[${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>`),Jt(!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=td(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 m_(e){return Gu(e)&&e.tagName.toLowerCase()==="button"}function p_(e){return Gu(e)&&e.tagName.toLowerCase()==="form"}function g_(e){return Gu(e)&&e.tagName.toLowerCase()==="input"}function y_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function b_(e,t){return e.button===0&&(!t||t==="_self")&&!y_(e)}var cu=null;function x_(){if(cu===null)try{new FormData(document.createElement("form"),0),cu=!1}catch{cu=!0}return cu}var v_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vh(e){return e!=null&&!v_.has(e)?(Dr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_u}"`),null):e}function w_(e,t){let r,s,l,o,c;if(p_(e)){let f=e.getAttribute("action");s=f?bi(f,t):null,r=e.getAttribute("method")||Su,l=vh(e.getAttribute("enctype"))||_u,o=new FormData(e)}else if(m_(e)||g_(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?bi(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),!x_()){let{name:m,type:b,value:g}=e;if(b==="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 Ld(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function S_(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&&bi(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function __(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 k_(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_(e,t,r){let s=await Promise.all(e.map(async l=>{let o=t.routes[l.route.id];if(o){let c=await __(o,r);return c.links?c.links():[]}return[]}));return N_(s.flat(1).filter(k_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function p0(e,t,r,s,l,o){let c=(d,m)=>r[m]?d.route.id!==r[m].route.id:!0,f=(d,m)=>{var b;return r[m].pathname!==d.pathname||((b=r[m].route.path)==null?void 0:b.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 b=s.routes[d.route.id];if(!b||!b.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 C_(e,t,{includeHydrateFallback:r}={}){return A_(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 A_(e){return[...new Set(e)]}function j_(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function N_(e,t){let r=new Set;return new Set(t),e.reduce((s,l)=>{let o=JSON.stringify(j_(l));return r.has(o)||(r.add(o),s.push({key:o,link:l})),s},[])}function ox(){let e=k.useContext(Ca);return Ld(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function T_(){let e=k.useContext(Vu);return Ld(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var zd=k.createContext(void 0);zd.displayName="FrameworkContext";function ux(){let e=k.useContext(zd);return Ld(e,"You must render this element inside a <HydratedRouter> element"),e}function O_(e,t){let r=k.useContext(zd),[s,l]=k.useState(!1),[o,c]=k.useState(!1),{onFocus:f,onBlur:d,onMouseEnter:m,onMouseLeave:b,onTouchStart:g}=t,x=k.useRef(null);k.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let N=M=>{M.forEach(P=>{c(P.isIntersecting)})},D=new IntersectionObserver(N,{threshold:.5});return x.current&&D.observe(x.current),()=>{D.disconnect()}}},[e]),k.useEffect(()=>{if(s){let N=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(N)}}},[s]);let v=()=>{l(!0)},S=()=>{l(!1),c(!1)};return r?e!=="intent"?[o,x,{}]:[o,x,{onFocus:vl(f,v),onBlur:vl(d,S),onMouseEnter:vl(m,v),onMouseLeave:vl(b,S),onTouchStart:vl(g,v)}]:[!1,x,{}]}function vl(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function R_({page:e,...t}){let{router:r}=ox(),s=k.useMemo(()=>Jb(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?k.createElement(D_,{page:e,matches:s,...t}):null}function M_(e){let{manifest:t,routeModules:r}=ux(),[s,l]=k.useState([]);return k.useEffect(()=>{let o=!1;return E_(e,t,r).then(c=>{o||l(c)}),()=>{o=!0}},[e,t,r]),s}function D_({page:e,matches:t,...r}){let s=_r(),{future:l,manifest:o,routeModules:c}=ux(),{basename:f}=ox(),{loaderData:d,matches:m}=T_(),b=k.useMemo(()=>p0(e,t,m,o,s,"data"),[e,t,m,o,s]),g=k.useMemo(()=>p0(e,t,m,o,s,"assets"),[e,t,m,o,s]),x=k.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let N=new Set,D=!1;if(t.forEach(P=>{var ue;let I=o.routes[P.route.id];!I||!I.hasLoader||(!b.some(H=>H.route.id===P.route.id)&&P.route.id in d&&((ue=c[P.route.id])!=null&&ue.shouldRevalidate)||I.hasClientLoader?D=!0:N.add(P.route.id))}),N.size===0)return[];let M=S_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return D&&N.size>0&&M.searchParams.set("_routes",t.filter(P=>N.has(P.route.id)).map(P=>P.route.id).join(",")),[M.pathname+M.search]},[f,l.unstable_trailingSlashAwareDataRequests,d,s,o,b,t,e,c]),v=k.useMemo(()=>C_(g,o),[g,o]),S=M_(g);return k.createElement(k.Fragment,null,x.map(N=>k.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...r})),v.map(N=>k.createElement("link",{key:N,rel:"modulepreload",href:N,...r})),S.map(({key:N,link:D})=>k.createElement("link",{key:N,nonce:r.nonce,...D,crossOrigin:D.crossOrigin??r.crossOrigin})))}function L_(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var z_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{z_&&(window.__reactRouterVersion="7.13.1")}catch{}function U_({basename:e,children:t,unstable_useTransitions:r,window:s}){let l=k.useRef();l.current==null&&(l.current=bS({window:s,v5Compat:!0}));let o=l.current,[c,f]=k.useState({action:o.action,location:o.location}),d=k.useCallback(m=>{r===!1?f(m):k.startTransition(()=>f(m))},[r]);return k.useLayoutEffect(()=>o.listen(d),[o,d]),k.createElement(d_,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:r})}var cx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fx=k.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:l,reloadDocument:o,replace:c,unstable_mask:f,state:d,target:m,to:b,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...S},N){let{basename:D,navigator:M,unstable_useTransitions:P}=k.useContext(lr),I=typeof b=="string"&&cx.test(b),ue=Zb(b,D);b=ue.to;let H=ZS(b,{relative:l}),O=_r(),ee=null;if(f){let W=$u(f,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);D!=="/"&&(W.pathname=W.pathname==="/"?D:Vr([D,W.pathname])),ee=M.createHref(W)}let[G,B,z]=O_(s,S),X=q_(b,{replace:c,unstable_mask:f,state:d,target:m,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:P});function F(W){t&&t(W),W.defaultPrevented||X(W)}let le=!(ue.isExternal||o),ne=k.createElement("a",{...S,...z,href:(le?ee:void 0)||ue.absoluteURL||H,onClick:le?F:t,ref:L_(N,B),target:m,"data-discover":!I&&r==="render"?"true":void 0});return G&&!I?k.createElement(k.Fragment,null,ne,k.createElement(R_,{page:H})):ne});fx.displayName="Link";var P_=k.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:l=!1,style:o,to:c,viewTransition:f,children:d,...m},b){let g=Gl(c,{relative:m.relative}),x=_r(),v=k.useContext(Vu),{navigator:S,basename:N}=k.useContext(lr),D=v!=null&&Y_(g)&&f===!0,M=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,M=M.toLowerCase()),I&&N&&(I=bi(I,N)||I);const ue=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let H=P===M||!l&&P.startsWith(M)&&P.charAt(ue)==="/",O=I!=null&&(I===M||!l&&I.startsWith(M)&&I.charAt(M.length)==="/"),ee={isActive:H,isPending:O,isTransitioning:D},G=H?t:void 0,B;typeof s=="function"?B=s(ee):B=[s,H?"active":null,O?"pending":null,D?"transitioning":null].filter(Boolean).join(" ");let z=typeof o=="function"?o(ee):o;return k.createElement(fx,{...m,"aria-current":G,className:B,ref:b,style:z,to:c,viewTransition:f},typeof d=="function"?d(ee):d)});P_.displayName="NavLink";var B_=k.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:l,state:o,method:c=Su,action:f,onSubmit:d,relative:m,preventScrollReset:b,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},S)=>{let{unstable_useTransitions:N}=k.useContext(lr),D=$_(),M=V_(f,{relative:m}),P=c.toLowerCase()==="get"?"get":"post",I=typeof f=="string"&&cx.test(f),ue=H=>{if(d&&d(H),H.defaultPrevented)return;H.preventDefault();let O=H.nativeEvent.submitter,ee=(O==null?void 0:O.getAttribute("formmethod"))||c,G=()=>D(O||H.currentTarget,{fetcherKey:t,method:ee,navigate:r,replace:l,state:o,relative:m,preventScrollReset:b,viewTransition:g,unstable_defaultShouldRevalidate:x});N&&r!==!1?k.startTransition(()=>G()):G()};return k.createElement("form",{ref:S,method:P,action:M,onSubmit:s?d:ue,...v,"data-discover":!I&&e==="render"?"true":void 0})});B_.displayName="Form";function H_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hx(e){let t=k.useContext(Ca);return Jt(t,H_(e)),t}function q_(e,{target:t,replace:r,unstable_mask:s,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let b=Yr(),g=_r(),x=Gl(e,{relative:c});return k.useCallback(v=>{if(b_(v,t)){v.preventDefault();let S=r!==void 0?r:Pl(g)===Pl(x),N=()=>b(e,{replace:S,unstable_mask:s,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d});m?k.startTransition(()=>N()):N()}},[g,b,x,r,s,l,t,e,o,c,f,d,m])}var I_=0,F_=()=>`__${String(++I_)}__`;function $_(){let{router:e}=hx("useSubmit"),{basename:t}=k.useContext(lr),r=u_(),s=e.fetch,l=e.navigate;return k.useCallback(async(o,c={})=>{let{action:f,method:d,encType:m,formData:b,body:g}=w_(o,t);if(c.navigate===!1){let x=c.fetcherKey||F_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,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:b,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 V_(e,{relative:t}={}){let{basename:r}=k.useContext(lr),s=k.useContext(Lr);Jt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),o={...Gl(e||".",{relative:t})},c=_r();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),d=f.getAll("index");if(d.some(b=>b==="")){f.delete("index"),d.filter(g=>g).forEach(g=>f.append("index",g));let b=f.toString();o.search=b?`?${b}`:""}}return(!e||e===".")&&l.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:Vr([r,o.pathname])),Pl(o)}function Y_(e,{relative:t}={}){let r=k.useContext(ex);Jt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=hx("useViewTransitionState"),l=Gl(e,{relative:t});if(!r.isTransitioning)return!1;let o=bi(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=bi(r.nextLocation.pathname,s)||r.nextLocation.pathname;return ju(l.pathname,c)!=null||ju(l.pathname,o)!=null}var gi=Gb();const dx=k.createContext(null),mx="palmier_paired_hosts",g0="palmier_last_host";function G_(){try{const e=localStorage.getItem(mx);if(e)return JSON.parse(e)}catch{}return[]}function J_(e){localStorage.setItem(mx,JSON.stringify(e))}const y0="local",X_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function K_({children:e}){const[t,r]=k.useState(()=>{const x=G_();return X_&&!x.some(v=>v.hostId===y0)&&x.push({hostId:y0,clientToken:"",directUrl:window.location.origin}),x}),[s,l]=k.useState(()=>{try{return localStorage.getItem(g0)}catch{return null}});k.useEffect(()=>{J_(t)},[t]);const o=k.useCallback(x=>{l(v=>v===x?v:x);try{localStorage.setItem(g0,x)}catch{}},[]),c=k.useCallback(x=>{r(v=>[...v.filter(N=>N.hostId!==x.hostId),x])},[]),f=k.useCallback(x=>{r(v=>v.filter(S=>S.hostId!==x))},[]),d=k.useCallback((x,v)=>{r(S=>S.map(N=>N.hostId===x?{...N,name:v}:N))},[]),m=k.useCallback((x,v)=>{r(S=>S.map(N=>N.hostId!==x||N.lanUrl===v?N:{...N,lanUrl:v}))},[]),b=k.useCallback((x,v)=>{r(S=>S.map(N=>N.hostId!==x||N.lastAgent===v?N:{...N,lastAgent:v}))},[]),g=k.useCallback((x,v)=>{r(S=>S.map(N=>N.hostId!==x||N.timezone===v?N:{...N,timezone:v}))},[]);return y.jsx(dx.Provider,{value:{pairedHosts:t,lastHostId:s,addPairedHost:c,removePairedHost:f,renamePairedHost:d,setHostLanUrl:m,setHostLastAgent:b,setHostTimezone:g,setLastHostId:o},children:e})}function Wi(){const e=k.useContext(dx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const ar=new Uint8Array(0),es=new TextEncoder,rr=new TextDecoder;function Q_(...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 Tl(...e){const t=[];for(let r=0;r<e.length;r++)t.push(es.encode(e[r]));return t.length===0?ar:t.length===1?t[0]:Q_(...t)}function b0(e){return!e||e.length===0?"":rr.decode(e)}const x0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",v0=36,Z_=0xcfd41b9100000,w0=33,W_=333,S0=22;function e2(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*255)}function t2(e){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(e):e2(e)}class n2{constructor(){A(this,"buf");A(this,"seq");A(this,"inc");A(this,"inited");this.buf=new Uint8Array(S0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*Z_),this.inc=Math.floor(Math.random()*(W_-w0)+w0)}setPre(){const t=new Uint8Array(12);t2(t);for(let r=0;r<12;r++){const s=t[r]%36;this.buf[r]=x0.charCodeAt(s)}}fillSeq(){let t=this.seq;for(let r=S0-1;r>=12;r--)this.buf[r]=x0.charCodeAt(t%v0),t=Math.floor(t/v0)}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 Qi=new n2;var mi;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(mi||(mi={}));var da;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(da||(da={}));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 r2(e){return typeof e.code=="string"}class px{constructor(){A(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 i2.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const i2=new px;class Me extends Error{constructor(r,s,l){super(r);A(this,"name");A(this,"message");A(this,"code");A(this,"permissionContext");A(this,"chainedError");A(this,"api_error");this.name="NatsError",this.message=r,this.code=s,this.chainedError=l}static errorForCode(r,s){const l=px.getMessage(r);return new Me(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 tr;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(tr||(tr={}));var Or;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(Or||(Or={}));var Ol;(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"})(Ol||(Ol={}));const Nu="Nats-Service-Error",Tu="Nats-Service-Error-Code";class Ou extends Error{constructor(r,s){super(s);A(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 yi(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}.${Qi.next()}`}const nd="127.0.0.1";var Ji;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Ji||(Ji={}));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 rr.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function va(e,t=!0){const r=t?Me.errorForCode(ke.Timeout):null;let s,l;const o=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Me.errorForCode(ke.Timeout):r)},e)});return Object.assign(o,s)}function ja(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 Gt(){let e={};const t=new Promise((r,s)=>{e={resolve:r,reject:s}});return Object.assign(t,e)}function gx(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 s2(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Ud(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 s2(r>t?e[t]:e[r])}}}function Yt(e){return e*1e6}function Pd(e){return Math.floor(e/1e6)}function _0(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 Me(`'${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 xi(e=0,t=""){if(e===0&&t!==""||e>0&&t==="")throw new Error("setting status requires both code and description");return new Xi(e,t)}const wh="NATS/1.0";class Xi{constructor(t=0,r=""){A(this,"_code");A(this,"headers");A(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 Xi,l=rr.decode(t).split(`\r
|
|
60
|
+
Please change the parent <Route path="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let b=xr(),g;if(t){let M=typeof t=="string"?Ea(t):t;Vt(d==="/"||((D=M.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 "${M.pathname}" was given in the \`location\` prop.`),g=M}else g=b;let x=g.pathname||"/",v=x;if(d!=="/"){let M=d.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(M.length).join("/")}let S=Gb(e,{pathname:v});Tr(m||S!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Tr(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=s_(S&&S.map(M=>Object.assign({},M,{params:Object.assign({},c,M.params),pathname:Ir([d,s.encodeLocation?s.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?d:Ir([d,s.encodeLocation?s.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),l,r);return t&&j?E.createElement(Yl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function t_(){let e=c_(),t=IS(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 n_=E.createElement(t_,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=QS(e.digest);r&&(e=r)}let t=e!==void 0?E.createElement(Or.Provider,{value:this.props.routeContext},E.createElement(Od.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?E.createElement(r_,{error:e},t):t}};ix.contextType=VS;var xh=new WeakMap;function r_({children:e,error:t}){let{basename:r}=E.useContext(ir);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=KS(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 i_({routeContext:e,match:t,children:r}){let s=E.useContext(Ca);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),E.createElement(Or.Provider,{value:e},r)}function s_(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 b=l.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Vt(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),l=l.slice(0,Math.min(l.length,b+1))}let c=!1,f=-1;if(r&&s){c=s.renderFallback;for(let b=0;b<l.length;b++){let g=l[b];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=b),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?(b,g)=>{var x,v;d(b,{location:s.location,params:((v=(x=s.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:FS(s.matches),errorInfo:g})}:void 0;return l.reduceRight((b,g,x)=>{let v,S=!1,j=null,D=null;s&&(v=o&&g.route.id?o[g.route.id]:void 0,j=g.route.errorElement||n_,c&&(f<0&&x===0?(sx("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 M=t.concat(l.slice(0,x+1)),R=()=>{let I;return v?I=j:S?I=D:g.route.Component?I=E.createElement(g.route.Component,null):g.route.element?I=g.route.element:I=b,E.createElement(i_,{match:g,routeContext:{outlet:b,matches:M,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:j,error:v,children:R(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:m}):R()},null)}function Rd(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function a_(e){let t=E.useContext(Ca);return Vt(t,Rd(e)),t}function l_(e){let t=E.useContext(Vu);return Vt(t,Rd(e)),t}function o_(e){let t=E.useContext(Or);return Vt(t,Rd(e)),t}function Md(e){let t=o_(e),r=t.matches[t.matches.length-1];return Vt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function u_(){return Md("useRouteId")}function c_(){var s;let e=E.useContext(Od),t=l_("useRouteError"),r=Md("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function f_(){let{router:e}=a_("useNavigate"),t=Md("useNavigate"),r=E.useRef(!1);return nx(()=>{r.current=!0}),E.useCallback(async(l,o={})=>{Tr(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,Tr(!1,r))}E.memo(h_);function h_({routes:e,future:t,state:r,isStatic:s,onError:l}){return rx(e,void 0,{state:r,isStatic:s,onError:l})}function Bl({to:e,replace:t,state:r,relative:s}){Vt(Aa(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=E.useContext(ir);Tr(!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(Or),{pathname:c}=xr(),f=Fr(),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 Cr(e){Vt(!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 d_({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:l,static:o=!1,unstable_useTransitions:c}){Vt(!Aa(),"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=Ea(r));let{pathname:m="/",search:b="",hash:g="",state:x=null,key:v="default",unstable_mask:S}=r,j=E.useMemo(()=>{let D=yi(m,f);return D==null?null:{location:{pathname:D,search:b,hash:g,state:x,key:v,unstable_mask:S},navigationType:s}},[f,m,b,g,x,v,s,S]);return Tr(j!=null,`<Router basename="${f}"> is not able to match the URL "${m}${b}${g}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:E.createElement(ir.Provider,{value:d},E.createElement(Yl.Provider,{children:t,value:j}))}function ax({children:e,location:t}){return e_(td(e),t)}function td(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,td(s.props.children,o));return}Vt(s.type===Cr,`[${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>`),Vt(!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=td(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 m_(e){return Gu(e)&&e.tagName.toLowerCase()==="button"}function p_(e){return Gu(e)&&e.tagName.toLowerCase()==="form"}function g_(e){return Gu(e)&&e.tagName.toLowerCase()==="input"}function y_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function b_(e,t){return e.button===0&&(!t||t==="_self")&&!y_(e)}var cu=null;function x_(){if(cu===null)try{new FormData(document.createElement("form"),0),cu=!1}catch{cu=!0}return cu}var v_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vh(e){return e!=null&&!v_.has(e)?(Tr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_u}"`),null):e}function w_(e,t){let r,s,l,o,c;if(p_(e)){let f=e.getAttribute("action");s=f?yi(f,t):null,r=e.getAttribute("method")||Su,l=vh(e.getAttribute("enctype"))||_u,o=new FormData(e)}else if(m_(e)||g_(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?yi(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),!x_()){let{name:m,type:b,value:g}=e;if(b==="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 S_(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&&yi(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${s}`,l}async function __(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 k_(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_(e,t,r){let s=await Promise.all(e.map(async l=>{let o=t.routes[l.route.id];if(o){let c=await __(o,r);return c.links?c.links():[]}return[]}));return N_(s.flat(1).filter(k_).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 b;return r[m].pathname!==d.pathname||((b=r[m].route.path)==null?void 0:b.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 b=s.routes[d.route.id];if(!b||!b.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 C_(e,t,{includeHydrateFallback:r}={}){return A_(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 A_(e){return[...new Set(e)]}function j_(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function N_(e,t){let r=new Set;return new Set(t),e.reduce((s,l)=>{let o=JSON.stringify(j_(l));return r.has(o)||(r.add(o),s.push({key:o,link:l})),s},[])}function lx(){let e=E.useContext(Ca);return Dd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function T_(){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 O_(e,t){let r=E.useContext(Ld),[s,l]=E.useState(!1),[o,c]=E.useState(!1),{onFocus:f,onBlur:d,onMouseEnter:m,onMouseLeave:b,onTouchStart:g}=t,x=E.useRef(null);E.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=M=>{M.forEach(R=>{c(R.isIntersecting)})},D=new IntersectionObserver(j,{threshold:.5});return x.current&&D.observe(x.current),()=>{D.disconnect()}}},[e]),E.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"?[o,x,{}]:[o,x,{onFocus:vl(f,v),onBlur:vl(d,S),onMouseEnter:vl(m,v),onMouseLeave:vl(b,S),onTouchStart:vl(g,v)}]:[!1,x,{}]}function vl(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function R_({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(D_,{page:e,matches:s,...t}):null}function M_(e){let{manifest:t,routeModules:r}=ox(),[s,l]=E.useState([]);return E.useEffect(()=>{let o=!1;return E_(e,t,r).then(c=>{o||l(c)}),()=>{o=!0}},[e,t,r]),s}function D_({page:e,matches:t,...r}){let s=xr(),{future:l,manifest:o,routeModules:c}=ox(),{basename:f}=lx(),{loaderData:d,matches:m}=T_(),b=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 j=new Set,D=!1;if(t.forEach(R=>{var ue;let I=o.routes[R.route.id];!I||!I.hasLoader||(!b.some(B=>B.route.id===R.route.id)&&R.route.id in d&&((ue=c[R.route.id])!=null&&ue.shouldRevalidate)||I.hasClientLoader?D=!0:j.add(R.route.id))}),j.size===0)return[];let M=S_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return D&&j.size>0&&M.searchParams.set("_routes",t.filter(R=>j.has(R.route.id)).map(R=>R.route.id).join(",")),[M.pathname+M.search]},[f,l.unstable_trailingSlashAwareDataRequests,d,s,o,b,t,e,c]),v=E.useMemo(()=>C_(g,o),[g,o]),S=M_(g);return E.createElement(E.Fragment,null,x.map(j=>E.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...r})),v.map(j=>E.createElement("link",{key:j,rel:"modulepreload",href:j,...r})),S.map(({key:j,link:D})=>E.createElement("link",{key:j,nonce:r.nonce,...D,crossOrigin:D.crossOrigin??r.crossOrigin})))}function L_(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var z_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{z_&&(window.__reactRouterVersion="7.13.1")}catch{}function U_({basename:e,children:t,unstable_useTransitions:r,window:s}){let l=E.useRef();l.current==null&&(l.current=bS({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(d_,{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:b,preventScrollReset:g,viewTransition:x,unstable_defaultShouldRevalidate:v,...S},j){let{basename:D,navigator:M,unstable_useTransitions:R}=E.useContext(ir),I=typeof b=="string"&&ux.test(b),ue=Qb(b,D);b=ue.to;let B=ZS(b,{relative:l}),P=xr(),ee=null;if(f){let W=$u(f,[],P.unstable_mask?P.unstable_mask.pathname:"/",!0);D!=="/"&&(W.pathname=W.pathname==="/"?D:Ir([D,W.pathname])),ee=M.createHref(W)}let[G,H,z]=O_(s,S),K=q_(b,{replace:c,unstable_mask:f,state:d,target:m,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:R});function F(W){t&&t(W),W.defaultPrevented||K(W)}let oe=!(ue.isExternal||o),te=E.createElement("a",{...S,...z,href:(oe?ee:void 0)||ue.absoluteURL||B,onClick:oe?F:t,ref:L_(j,H),target:m,"data-discover":!I&&r==="render"?"true":void 0});return G&&!I?E.createElement(E.Fragment,null,te,E.createElement(R_,{page:B})):te});cx.displayName="Link";var P_=E.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:l=!1,style:o,to:c,viewTransition:f,children:d,...m},b){let g=Gl(c,{relative:m.relative}),x=xr(),v=E.useContext(Vu),{navigator:S,basename:j}=E.useContext(ir),D=v!=null&&Y_(g)&&f===!0,M=S.encodeLocation?S.encodeLocation(g).pathname:g.pathname,R=x.pathname,I=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(R=R.toLowerCase(),I=I?I.toLowerCase():null,M=M.toLowerCase()),I&&j&&(I=yi(I,j)||I);const ue=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let B=R===M||!l&&R.startsWith(M)&&R.charAt(ue)==="/",P=I!=null&&(I===M||!l&&I.startsWith(M)&&I.charAt(M.length)==="/"),ee={isActive:B,isPending:P,isTransitioning:D},G=B?t:void 0,H;typeof s=="function"?H=s(ee):H=[s,B?"active":null,P?"pending":null,D?"transitioning":null].filter(Boolean).join(" ");let z=typeof o=="function"?o(ee):o;return E.createElement(cx,{...m,"aria-current":G,className:H,ref:b,style:z,to:c,viewTransition:f},typeof d=="function"?d(ee):d)});P_.displayName="NavLink";var B_=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:b,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},S)=>{let{unstable_useTransitions:j}=E.useContext(ir),D=$_(),M=V_(f,{relative:m}),R=c.toLowerCase()==="get"?"get":"post",I=typeof f=="string"&&ux.test(f),ue=B=>{if(d&&d(B),B.defaultPrevented)return;B.preventDefault();let P=B.nativeEvent.submitter,ee=(P==null?void 0:P.getAttribute("formmethod"))||c,G=()=>D(P||B.currentTarget,{fetcherKey:t,method:ee,navigate:r,replace:l,state:o,relative:m,preventScrollReset:b,viewTransition:g,unstable_defaultShouldRevalidate:x});j&&r!==!1?E.startTransition(()=>G()):G()};return E.createElement("form",{ref:S,method:R,action:M,onSubmit:s?d:ue,...v,"data-discover":!I&&e==="render"?"true":void 0})});B_.displayName="Form";function H_(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(Ca);return Vt(t,H_(e)),t}function q_(e,{target:t,replace:r,unstable_mask:s,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let b=Fr(),g=xr(),x=Gl(e,{relative:c});return E.useCallback(v=>{if(b_(v,t)){v.preventDefault();let S=r!==void 0?r:Pl(g)===Pl(x),j=()=>b(e,{replace:S,unstable_mask:s,state:l,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:d});m?E.startTransition(()=>j()):j()}},[g,b,x,r,s,l,t,e,o,c,f,d,m])}var I_=0,F_=()=>`__${String(++I_)}__`;function $_(){let{router:e}=fx("useSubmit"),{basename:t}=E.useContext(ir),r=u_(),s=e.fetch,l=e.navigate;return E.useCallback(async(o,c={})=>{let{action:f,method:d,encType:m,formData:b,body:g}=w_(o,t);if(c.navigate===!1){let x=c.fetcherKey||F_();await s(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,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:b,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 V_(e,{relative:t}={}){let{basename:r}=E.useContext(ir),s=E.useContext(Or);Vt(s,"useFormAction must be used inside a RouteContext");let[l]=s.matches.slice(-1),o={...Gl(e||".",{relative:t})},c=xr();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),d=f.getAll("index");if(d.some(b=>b==="")){f.delete("index"),d.filter(g=>g).forEach(g=>f.append("index",g));let b=f.toString();o.search=b?`?${b}`:""}}return(!e||e===".")&&l.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:Ir([r,o.pathname])),Pl(o)}function Y_(e,{relative:t}={}){let r=E.useContext(Wb);Vt(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=Gl(e,{relative:t});if(!r.isTransitioning)return!1;let o=yi(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=yi(r.nextLocation.pathname,s)||r.nextLocation.pathname;return ju(l.pathname,c)!=null||ju(l.pathname,o)!=null}var pi=Yb();const hx=E.createContext(null),dx="palmier_paired_hosts",p0="palmier_last_host";function G_(){try{const e=localStorage.getItem(dx);if(e)return JSON.parse(e)}catch{}return[]}function J_(e){localStorage.setItem(dx,JSON.stringify(e))}const g0="local",X_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function K_({children:e}){const[t,r]=E.useState(()=>{const x=G_();return X_&&!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(()=>{J_(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(j=>j.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(j=>j.hostId===x?{...j,name:v}:j))},[]),m=E.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.lanUrl===v?j:{...j,lanUrl:v}))},[]),b=E.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.lastAgent===v?j:{...j,lastAgent:v}))},[]),g=E.useCallback((x,v)=>{r(S=>S.map(j=>j.hostId!==x||j.timezone===v?j:{...j,timezone:v}))},[]);return y.jsx(hx.Provider,{value:{pairedHosts:t,lastHostId:s,addPairedHost:c,removePairedHost:f,renamePairedHost:d,setHostLanUrl:m,setHostLastAgent:b,setHostTimezone:g,setLastHostId:o},children:e})}function Wi(){const e=E.useContext(hx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const rr=new Uint8Array(0),es=new TextEncoder,er=new TextDecoder;function Q_(...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 Tl(...e){const t=[];for(let r=0;r<e.length;r++)t.push(es.encode(e[r]));return t.length===0?rr:t.length===1?t[0]:Q_(...t)}function y0(e){return!e||e.length===0?"":er.decode(e)}const b0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",x0=36,Z_=0xcfd41b9100000,v0=33,W_=333,w0=22;function e2(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*255)}function t2(e){var t;(t=globalThis==null?void 0:globalThis.crypto)!=null&&t.getRandomValues?globalThis.crypto.getRandomValues(e):e2(e)}class n2{constructor(){A(this,"buf");A(this,"seq");A(this,"inc");A(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()*Z_),this.inc=Math.floor(Math.random()*(W_-v0)+v0)}setPre(){const t=new Uint8Array(12);t2(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 Qi=new n2;var di;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(di||(di={}));var da;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(da||(da={}));var Ce;(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"})(Ce||(Ce={}));function r2(e){return typeof e.code=="string"}class mx{constructor(){A(this,"messages");this.messages=new Map,this.messages.set(Ce.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(Ce.BadJson,"Bad JSON"),this.messages.set(Ce.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(t){return i2.getMessage(t)}getMessage(t){return this.messages.get(t)||t}}const i2=new mx;class Me extends Error{constructor(r,s,l){super(r);A(this,"name");A(this,"message");A(this,"code");A(this,"permissionContext");A(this,"chainedError");A(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 Me(l,r,s)}isAuthError(){return this.code===Ce.AuthenticationExpired||this.code===Ce.AuthorizationViolation||this.code===Ce.AccountExpired}isAuthTimeout(){return this.code===Ce.AuthenticationTimeout}isPermissionError(){return this.code===Ce.PermissionsViolation}isProtocolError(){return this.code===Ce.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Zn;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(Zn||(Zn={}));var Ar;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(Ar||(Ar={}));var Ol;(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"})(Ol||(Ol={}));const Nu="Nats-Service-Error",Tu="Nats-Service-Error-Code";class Ou extends Error{constructor(r,s){super(s);A(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 gi(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}.${Qi.next()}`}const nd="127.0.0.1";var Ji;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Ji||(Ji={}));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 er.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function va(e,t=!0){const r=t?Me.errorForCode(Ce.Timeout):null;let s,l;const o=new Promise((c,f)=>{s={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Me.errorForCode(Ce.Timeout):r)},e)});return Object.assign(o,s)}function ja(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 $t(){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 s2(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 s2(r>t?e[t]:e[r])}}}function Ft(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 Me(`'${e[o]}' is not a valid character for a header key`,Ce.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 bi(e=0,t=""){if(e===0&&t!==""||e>0&&t==="")throw new Error("setting status requires both code and description");return new Xi(e,t)}const wh="NATS/1.0";class Xi{constructor(t=0,r=""){A(this,"_code");A(this,"headers");A(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 Xi,l=er.decode(t).split(`\r
|
|
61
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 es.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new Me("invalid header value - \\r and \\n are not allowed.",
|
|
64
|
+
`}encode(){return es.encode(this.toString())}static validHeaderValue(t){if(/[\r\n]/.test(t))throw new Me("invalid header value - \\r and \\n are not allowed.",Ce.BadHeader);return t.trim()}keys(){const t=[];for(const r of this.headers.keys())t.push(r);return t}findKeys(t,r=Zn.Exact){const s=this.keys();switch(r){case Zn.Exact:return s.filter(l=>l===t);case Zn.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=Zn.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=Zn.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=Zn.Exact){return this.findKeys(t,r).length>0}set(t,r,s=Zn.Exact){this.delete(t,s),this.append(t,r,s)}append(t,r,s=Zn.Exact){const l=S0(t);s===Zn.CanonicalMIME&&(t=l);const o=this.findKeys(t,s);t=o.length>0?o[0]:t;const c=Xi.validHeaderValue(r);let f=this.headers.get(t);f||(f=[],this.headers.set(t,f)),f.push(c)}values(t,r=Zn.Exact){const s=[];return this.findKeys(t,r).forEach(o=>{const c=this.headers.get(o);c&&s.push(...c)}),s}delete(t,r=Zn.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 Xi;for(const s in t)r.headers.set(s,t[s]);return r}}function Ru(){return{encode(e){return es.encode(e)},decode(e){return er.decode(e)}}}function jr(e){return{encode(t){try{return t===void 0&&(t=null),es.encode(JSON.stringify(t))}catch(r){throw Me.errorForCode(Ce.BadJson,r)}},decode(t){try{return JSON.parse(er.decode(t),e)}catch(r){throw Me.errorForCode(Ce.BadJson,r)}}}}function gx(e){var t;return e&&e.data.length===0&&((t=e.headers)==null?void 0:t.code)===503?Me.errorForCode(Ce.NoResponders):null}class Pd{constructor(t,r,s){A(this,"_headers");A(this,"_msg");A(this,"_rdata");A(this,"_reply");A(this,"_subject");A(this,"publisher");this._msg=t,this._rdata=r,this.publisher=s}get subject(){return this._subject?this._subject:(this._subject=er.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=er.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=Xi.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=rr,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 jr(t).decode(this.data)}string(){return er.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}}A(Pd,"jc");function ma(e){return Xu("durable",e)}function Nn(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 jl(e,t=""){if(t==="")throw Error(`${e} name required`);const r=a2(t);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function a2(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 rd(e){if(e.data.length>0)return!1;const t=e.headers;return t?t.code>=100&&t.code<200:!1}function id(e){var t;return rd(e)&&((t=e.headers)==null?void 0:t.description)==="Idle Heartbeat"}function l2(e,t,r){const s=xi(e,t),l={hdr:1,sid:0,size:0},o=new Bd(l,ar,{});return o._headers=s,o._subject=r,o}function pa(e){if(e.data.length!==0)return null;const t=e.headers;return t?bx(t.code,t.description):null}var wr;(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"})(wr||(wr={}));function o2(e){return e.code!==ke.JetStream409?!1:[wr.MaxBatchExceeded,wr.MaxExpiresExceeded,wr.MaxBytesExceeded,wr.MaxMessageSizeExceeded,wr.PushConsumer,wr.IdleHeartbeatMissed,wr.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function bx(e,t=""){if(e<300)return null;switch(t=t.toLowerCase(),e){case 404:return new Me(t,ke.JetStream404NoMessages);case 408:return new Me(t,ke.JetStream408RequestTimeout);case 409:{const r=t.startsWith(wr.IdleHeartbeatMissed)?ke.JetStreamIdleHeartBeat:ke.JetStream409;return new Me(t,r)}case 503:return Me.errorForCode(ke.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=ke.Unknown),new Me(t,`${e}`)}}class xn{constructor(){A(this,"inflight");A(this,"processed");A(this,"received");A(this,"noIterator");A(this,"iterClosed");A(this,"done");A(this,"signal");A(this,"yields");A(this,"filtered");A(this,"pendingFiltered");A(this,"ingestionFilterFn");A(this,"protocolFilterFn");A(this,"dispatchedFn");A(this,"ctx");A(this,"_data");A(this,"err");A(this,"time");A(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=Gt(),this.yields=[],this.iterClosed=Gt(),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 Me("unsupported iterator",ke.ApiError);if(this.yielding)throw new Me("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=Gt())}}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 Hd{constructor(t,r,s={maxOut:2}){A(this,"interval");A(this,"maxOut");A(this,"cancelAfter");A(this,"timer");A(this,"autoCancelTimer");A(this,"last");A(this,"missed");A(this,"count");A(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 sd;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(sd||(sd={}));var Hl;(function(e){e.Old="old",e.New="new"})(Hl||(Hl={}));var ad;(function(e){e.File="file",e.Memory="memory"})(ad||(ad={}));var sn;(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"})(sn||(sn={}));var bn;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(bn||(bn={}));var wa;(function(e){e.Instant="instant",e.Original="original"})(wa||(wa={}));var Zi;(function(e){e.None="none",e.S2="s2"})(Zi||(Zi={}));var Mu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Mu||(Mu={}));function u2(e,t={}){return Object.assign({name:e,deliver_policy:sn.All,ack_policy:bn.Explicit,ack_wait:Yt(30*1e3),replay_policy:wa.Instant},t)}var k0;(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"})(k0||(k0={}));var zn;(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"})(zn||(zn={}));var Nr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(Nr||(Nr={}));var fa;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(fa||(fa={}));var E0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(E0||(E0={}));const nr="KV_";class c2{constructor(t){A(this,"config");A(this,"ordered");A(this,"mack");A(this,"stream");A(this,"callbackFn");A(this,"max");A(this,"qname");A(this,"isBind");A(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=u2("",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 ma(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=sn.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=sn.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=sn.All,this}deliverLastPerSubject(){return this.config.deliver_policy=sn.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=sn.Last,this}deliverNew(){return this.config.deliver_policy=sn.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=Yt(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=wa.Instant,this}replayOriginal(){return this.config.replay_policy=wa.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=Yt(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=Yt(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=Yt(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 Ki(e){return new c2(e)}function C0(e){return typeof e.getOpts=="function"}class f2{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 ga{static encode(t){return ga.toB64URLEncoding(f2.encode(t))}static decode(t,r=!1){return ga.decode(ga.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Sa{constructor(){A(this,"buffers");A(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=""),es.encode(t)}static toAscii(t){return rr.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 h2(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 d2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},wl=d2.performance||{};wl.now||wl.mozNow||wl.msNow||wl.oNow||wl.webkitNow;var A0={versions:{}},m2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function p2(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:{}},j0={},N0=p2(h2({__proto__:null,default:j0},[j0]));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&&A0.versions&&A0.versions.node;l?r=m2: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],b=[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(H){return Object.prototype.toString.call(H)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(H){return typeof H=="object"&&H.buffer&&H.buffer.constructor===ArrayBuffer});var v=function(H,O){return function(ee){return new P(O,!0).update(ee)[H]()}},S=function(H){var O=v("hex",H);l&&(O=N(O,H)),O.create=function(){return new P(H)},O.update=function(B){return O.create().update(B)};for(var ee=0;ee<g.length;++ee){var G=g[ee];O[G]=v(G,H)}return O},N=function(H,O){var ee,G=N0,B=N0.Buffer,z=O?"sha224":"sha256";return ee=B.from&&!r.JS_SHA256_NO_BUFFER_FROM?B.from:function(X){return new B(X)},function(X){if(typeof X=="string")return G.createHash(z).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===B?G.createHash(z).update(ee(X)).digest("hex"):H(X)}},D=function(H,O){return function(ee,G){return new I(ee,O,!0).update(G)[H]()}},M=function(H){var O=D("hex",H);O.create=function(B){return new I(B,H)},O.update=function(B,z){return O.create(B).update(z)};for(var ee=0;ee<g.length;++ee){var G=g[ee];O[G]=D(G,H)}return O};function P(H,O){O?(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],H?(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=H}function I(H,O,ee){var G,B=typeof H;if(B==="string"){var z,X=[],F=H.length,le=0;for(G=0;G<F;++G)(z=H.charCodeAt(G))<128?X[le++]=z:z<2048?(X[le++]=192|z>>>6,X[le++]=128|63&z):z<55296||z>=57344?(X[le++]=224|z>>>12,X[le++]=128|z>>>6&63,X[le++]=128|63&z):(z=65536+((1023&z)<<10|1023&H.charCodeAt(++G)),X[le++]=240|z>>>18,X[le++]=128|z>>>12&63,X[le++]=128|z>>>6&63,X[le++]=128|63&z);H=X}else{if(B!=="object")throw new Error(e);if(H===null)throw new Error(e);if(c&&H.constructor===ArrayBuffer)H=new Uint8Array(H);else if(!(Array.isArray(H)||c&&ArrayBuffer.isView(H)))throw new Error(e)}H.length>64&&(H=new P(O,!0).update(H).array());var ne=[],W=[];for(G=0;G<64;++G){var V=H[G]||0;ne[G]=92^V,W[G]=54^V}P.call(this,O,ee),this.update(W),this.oKeyPad=ne,this.inner=!0,this.sharedMemory=ee}P.prototype.update=function(H){if(!this.finalized){var O,ee=typeof H;if(ee!=="string"){if(ee!=="object")throw new Error(e);if(H===null)throw new Error(e);if(c&&H.constructor===ArrayBuffer)H=new Uint8Array(H);else if(!(Array.isArray(H)||c&&ArrayBuffer.isView(H)))throw new Error(e);O=!0}for(var G,B,z=0,X=H.length,F=this.blocks;z<X;){if(this.hashed&&(this.hashed=!1,F[0]=this.block,this.block=F[16]=F[1]=F[2]=F[3]=F[4]=F[5]=F[6]=F[7]=F[8]=F[9]=F[10]=F[11]=F[12]=F[13]=F[14]=F[15]=0),O)for(B=this.start;z<X&&B<64;++z)F[B>>>2]|=H[z]<<m[3&B++];else for(B=this.start;z<X&&B<64;++z)(G=H.charCodeAt(z))<128?F[B>>>2]|=G<<m[3&B++]:G<2048?(F[B>>>2]|=(192|G>>>6)<<m[3&B++],F[B>>>2]|=(128|63&G)<<m[3&B++]):G<55296||G>=57344?(F[B>>>2]|=(224|G>>>12)<<m[3&B++],F[B>>>2]|=(128|G>>>6&63)<<m[3&B++],F[B>>>2]|=(128|63&G)<<m[3&B++]):(G=65536+((1023&G)<<10|1023&H.charCodeAt(++z)),F[B>>>2]|=(240|G>>>18)<<m[3&B++],F[B>>>2]|=(128|G>>>12&63)<<m[3&B++],F[B>>>2]|=(128|G>>>6&63)<<m[3&B++],F[B>>>2]|=(128|63&G)<<m[3&B++]);this.lastByteIndex=B,this.bytes+=B-this.start,B>=64?(this.block=F[16],this.start=B-64,this.hash(),this.hashed=!0):this.start=B}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 H=this.blocks,O=this.lastByteIndex;H[16]=this.block,H[O>>>2]|=d[3&O],this.block=H[16],O>=56&&(this.hashed||this.hash(),H[0]=this.block,H[16]=H[1]=H[2]=H[3]=H[4]=H[5]=H[6]=H[7]=H[8]=H[9]=H[10]=H[11]=H[12]=H[13]=H[14]=H[15]=0),H[14]=this.hBytes<<3|this.bytes>>>29,H[15]=this.bytes<<3,this.hash()}},P.prototype.hash=function(){var H,O,ee,G,B,z,X,F,le,ne=this.h0,W=this.h1,V=this.h2,K=this.h3,ce=this.h4,Ee=this.h5,E=this.h6,L=this.h7,J=this.blocks;for(H=16;H<64;++H)O=((B=J[H-15])>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,ee=((B=J[H-2])>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,J[H]=J[H-16]+O+J[H-7]+ee|0;for(le=W&V,H=0;H<64;H+=4)this.first?(this.is224?(z=300032,L=(B=J[0]-1413257819)-150054599|0,K=B+24177077|0):(z=704751109,L=(B=J[0]-210244248)-1521486534|0,K=B+143694565|0),this.first=!1):(O=(ne>>>2|ne<<30)^(ne>>>13|ne<<19)^(ne>>>22|ne<<10),G=(z=ne&W)^ne&V^le,L=K+(B=L+(ee=(ce>>>6|ce<<26)^(ce>>>11|ce<<21)^(ce>>>25|ce<<7))+(ce&Ee^~ce&E)+b[H]+J[H])|0,K=B+(O+G)|0),O=(K>>>2|K<<30)^(K>>>13|K<<19)^(K>>>22|K<<10),G=(X=K&ne)^K&W^z,E=V+(B=E+(ee=(L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(L&ce^~L&Ee)+b[H+1]+J[H+1])|0,O=((V=B+(O+G)|0)>>>2|V<<30)^(V>>>13|V<<19)^(V>>>22|V<<10),G=(F=V&K)^V&ne^X,Ee=W+(B=Ee+(ee=(E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7))+(E&L^~E&ce)+b[H+2]+J[H+2])|0,O=((W=B+(O+G)|0)>>>2|W<<30)^(W>>>13|W<<19)^(W>>>22|W<<10),G=(le=W&V)^W&K^F,ce=ne+(B=ce+(ee=(Ee>>>6|Ee<<26)^(Ee>>>11|Ee<<21)^(Ee>>>25|Ee<<7))+(Ee&E^~Ee&L)+b[H+3]+J[H+3])|0,ne=B+(O+G)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+ne|0,this.h1=this.h1+W|0,this.h2=this.h2+V|0,this.h3=this.h3+K|0,this.h4=this.h4+ce|0,this.h5=this.h5+Ee|0,this.h6=this.h6+E|0,this.h7=this.h7+L|0},P.prototype.hex=function(){this.finalize();var H=this.h0,O=this.h1,ee=this.h2,G=this.h3,B=this.h4,z=this.h5,X=this.h6,F=this.h7,le=f[H>>>28&15]+f[H>>>24&15]+f[H>>>20&15]+f[H>>>16&15]+f[H>>>12&15]+f[H>>>8&15]+f[H>>>4&15]+f[15&H]+f[O>>>28&15]+f[O>>>24&15]+f[O>>>20&15]+f[O>>>16&15]+f[O>>>12&15]+f[O>>>8&15]+f[O>>>4&15]+f[15&O]+f[ee>>>28&15]+f[ee>>>24&15]+f[ee>>>20&15]+f[ee>>>16&15]+f[ee>>>12&15]+f[ee>>>8&15]+f[ee>>>4&15]+f[15&ee]+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]+f[B>>>28&15]+f[B>>>24&15]+f[B>>>20&15]+f[B>>>16&15]+f[B>>>12&15]+f[B>>>8&15]+f[B>>>4&15]+f[15&B]+f[z>>>28&15]+f[z>>>24&15]+f[z>>>20&15]+f[z>>>16&15]+f[z>>>12&15]+f[z>>>8&15]+f[z>>>4&15]+f[15&z]+f[X>>>28&15]+f[X>>>24&15]+f[X>>>20&15]+f[X>>>16&15]+f[X>>>12&15]+f[X>>>8&15]+f[X>>>4&15]+f[15&X];return this.is224||(le+=f[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]),le},P.prototype.toString=P.prototype.hex,P.prototype.digest=function(){this.finalize();var H=this.h0,O=this.h1,ee=this.h2,G=this.h3,B=this.h4,z=this.h5,X=this.h6,F=this.h7,le=[H>>>24&255,H>>>16&255,H>>>8&255,255&H,O>>>24&255,O>>>16&255,O>>>8&255,255&O,ee>>>24&255,ee>>>16&255,ee>>>8&255,255&ee,G>>>24&255,G>>>16&255,G>>>8&255,255&G,B>>>24&255,B>>>16&255,B>>>8&255,255&B,z>>>24&255,z>>>16&255,z>>>8&255,255&z,X>>>24&255,X>>>16&255,X>>>8&255,255&X];return this.is224||le.push(F>>>24&255,F>>>16&255,F>>>8&255,255&F),le},P.prototype.array=P.prototype.digest,P.prototype.arrayBuffer=function(){this.finalize();var H=new ArrayBuffer(this.is224?28:32),O=new DataView(H);return O.setUint32(0,this.h0),O.setUint32(4,this.h1),O.setUint32(8,this.h2),O.setUint32(12,this.h3),O.setUint32(16,this.h4),O.setUint32(20,this.h5),O.setUint32(24,this.h6),this.is224||O.setUint32(28,this.h7),H},I.prototype=new P,I.prototype.finalize=function(){if(P.prototype.finalize.call(this),this.inner){this.inner=!1;var H=this.array();P.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(H),P.prototype.finalize.call(this)}};var ue=S();ue.sha256=ue,ue.sha224=S(!0),ue.sha256.hmac=M(),ue.sha224.hmac=M(!0),o?Sh.exports=ue:(r.sha256=ue.sha256,r.sha224=ue.sha224)})();Ku.exports;Ku.exports.sha224;var T0=Ku.exports.sha256;function ld(e){return w2(e)}function g2(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 y2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function b2(e){return g2(e)?"hex":y2(e)?"b64":""}function x2(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 v2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function w2(e){switch(b2(e)){case"hex":return x2(e);case"b64":return v2(e)}return null}function S2(e,t){const r=typeof e=="string"?ld(e):e,s=typeof t=="string"?ld(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 xx{constructor(t,r,s=!0){A(this,"token");A(this,"received");A(this,"ctx");A(this,"requestSubject");A(this,"mux");this.mux=t,this.requestSubject=r,this.received=0,this.token=Qi.next(),s&&(this.ctx=new Error)}}class _2 extends xx{constructor(r,s,l={maxWait:1e3}){super(r,s);A(this,"callback");A(this,"done");A(this,"timer");A(this,"max");A(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=Gt(),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 jl(e,t=""){if(t==="")throw Error(`${e} name required`);const r=a2(t);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function a2(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 rd(e){if(e.data.length>0)return!1;const t=e.headers;return t?t.code>=100&&t.code<200:!1}function id(e){var t;return rd(e)&&((t=e.headers)==null?void 0:t.description)==="Idle Heartbeat"}function l2(e,t,r){const s=bi(e,t),l={hdr:1,sid:0,size:0},o=new Pd(l,rr,{});return o._headers=s,o._subject=r,o}function pa(e){if(e.data.length!==0)return null;const t=e.headers;return t?yx(t.code,t.description):null}var yr;(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"})(yr||(yr={}));function o2(e){return e.code!==Ce.JetStream409?!1:[yr.MaxBatchExceeded,yr.MaxExpiresExceeded,yr.MaxBytesExceeded,yr.MaxMessageSizeExceeded,yr.PushConsumer,yr.IdleHeartbeatMissed,yr.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 Me(t,Ce.JetStream404NoMessages);case 408:return new Me(t,Ce.JetStream408RequestTimeout);case 409:{const r=t.startsWith(yr.IdleHeartbeatMissed)?Ce.JetStreamIdleHeartBeat:Ce.JetStream409;return new Me(t,r)}case 503:return Me.errorForCode(Ce.JetStreamNotEnabled,new Error(t));default:return t===""&&(t=Ce.Unknown),new Me(t,`${e}`)}}class dn{constructor(){A(this,"inflight");A(this,"processed");A(this,"received");A(this,"noIterator");A(this,"iterClosed");A(this,"done");A(this,"signal");A(this,"yields");A(this,"filtered");A(this,"pendingFiltered");A(this,"ingestionFilterFn");A(this,"protocolFilterFn");A(this,"dispatchedFn");A(this,"ctx");A(this,"_data");A(this,"err");A(this,"time");A(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=$t(),this.yields=[],this.iterClosed=$t(),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 Me("unsupported iterator",Ce.ApiError);if(this.yielding)throw new Me("already yielding",Ce.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=$t())}}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}){A(this,"interval");A(this,"maxOut");A(this,"cancelAfter");A(this,"timer");A(this,"autoCancelTimer");A(this,"last");A(this,"missed");A(this,"count");A(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 sd;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(sd||(sd={}));var Hl;(function(e){e.Old="old",e.New="new"})(Hl||(Hl={}));var ad;(function(e){e.File="file",e.Memory="memory"})(ad||(ad={}));var en;(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"})(en||(en={}));var hn;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(hn||(hn={}));var wa;(function(e){e.Instant="instant",e.Original="original"})(wa||(wa={}));var Zi;(function(e){e.None="none",e.S2="s2"})(Zi||(Zi={}));var Mu;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Mu||(Mu={}));function u2(e,t={}){return Object.assign({name:e,deliver_policy:en.All,ack_policy:hn.Explicit,ack_wait:Ft(30*1e3),replay_policy:wa.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 Mn;(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"})(Mn||(Mn={}));var Er;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(Er||(Er={}));var fa;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(fa||(fa={}));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 Wn="KV_";class c2{constructor(t){A(this,"config");A(this,"ordered");A(this,"mack");A(this,"stream");A(this,"callbackFn");A(this,"max");A(this,"qname");A(this,"isBind");A(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=u2("",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?hn.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 ma(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=en.StartSequence,this.config.opt_start_seq=t,this}startTime(t){return this.config.deliver_policy=en.StartTime,this.config.opt_start_time=t.toISOString(),this}deliverAll(){return this.config.deliver_policy=en.All,this}deliverLastPerSubject(){return this.config.deliver_policy=en.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=en.Last,this}deliverNew(){return this.config.deliver_policy=en.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=hn.None,this}ackAll(){return this.config.ack_policy=hn.All,this}ackExplicit(){return this.config.ack_policy=hn.Explicit,this}ackWait(t){return this.config.ack_wait=Ft(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=wa.Instant,this}replayOriginal(){return this.config.replay_policy=wa.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=Ft(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=Ft(t),this}maxPullBatch(t){return this.config.max_batch=t,this}maxPullRequestExpires(t){return this.config.max_expires=Ft(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 Ki(e){return new c2(e)}function E0(e){return typeof e.getOpts=="function"}class f2{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 ga{static encode(t){return ga.toB64URLEncoding(f2.encode(t))}static decode(t,r=!1){return ga.decode(ga.fromB64URLEncoding(t),r)}static toB64URLEncoding(t){return t.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(t){return t.replace(/_/g,"/").replace(/-/g,"+")}}class Sa{constructor(){A(this,"buffers");A(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=""),es.encode(t)}static toAscii(t){return er.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 h2(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 d2=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},wl=d2.performance||{};wl.now||wl.mozNow||wl.msNow||wl.oNow||wl.webkitNow;var C0={versions:{}},m2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function p2(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=p2(h2({__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=m2: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],b=[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,P){return function(ee){return new R(P,!0).update(ee)[B]()}},S=function(B){var P=v("hex",B);l&&(P=j(P,B)),P.create=function(){return new R(B)},P.update=function(H){return P.create().update(H)};for(var ee=0;ee<g.length;++ee){var G=g[ee];P[G]=v(G,B)}return P},j=function(B,P){var ee,G=j0,H=j0.Buffer,z=P?"sha224":"sha256";return ee=H.from&&!r.JS_SHA256_NO_BUFFER_FROM?H.from:function(K){return new H(K)},function(K){if(typeof K=="string")return G.createHash(z).update(K,"utf8").digest("hex");if(K==null)throw new Error(e);return K.constructor===ArrayBuffer&&(K=new Uint8Array(K)),Array.isArray(K)||ArrayBuffer.isView(K)||K.constructor===H?G.createHash(z).update(ee(K)).digest("hex"):B(K)}},D=function(B,P){return function(ee,G){return new I(ee,P,!0).update(G)[B]()}},M=function(B){var P=D("hex",B);P.create=function(H){return new I(H,B)},P.update=function(H,z){return P.create(H).update(z)};for(var ee=0;ee<g.length;++ee){var G=g[ee];P[G]=D(G,B)}return P};function R(B,P){P?(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,P,ee){var G,H=typeof B;if(H==="string"){var z,K=[],F=B.length,oe=0;for(G=0;G<F;++G)(z=B.charCodeAt(G))<128?K[oe++]=z:z<2048?(K[oe++]=192|z>>>6,K[oe++]=128|63&z):z<55296||z>=57344?(K[oe++]=224|z>>>12,K[oe++]=128|z>>>6&63,K[oe++]=128|63&z):(z=65536+((1023&z)<<10|1023&B.charCodeAt(++G)),K[oe++]=240|z>>>18,K[oe++]=128|z>>>12&63,K[oe++]=128|z>>>6&63,K[oe++]=128|63&z);B=K}else{if(H!=="object")throw new Error(e);if(B===null)throw new Error(e);if(c&&B.constructor===ArrayBuffer)B=new Uint8Array(B);else if(!(Array.isArray(B)||c&&ArrayBuffer.isView(B)))throw new Error(e)}B.length>64&&(B=new R(P,!0).update(B).array());var te=[],W=[];for(G=0;G<64;++G){var V=B[G]||0;te[G]=92^V,W[G]=54^V}R.call(this,P,ee),this.update(W),this.oKeyPad=te,this.inner=!0,this.sharedMemory=ee}R.prototype.update=function(B){if(!this.finalized){var P,ee=typeof B;if(ee!=="string"){if(ee!=="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);P=!0}for(var G,H,z=0,K=B.length,F=this.blocks;z<K;){if(this.hashed&&(this.hashed=!1,F[0]=this.block,this.block=F[16]=F[1]=F[2]=F[3]=F[4]=F[5]=F[6]=F[7]=F[8]=F[9]=F[10]=F[11]=F[12]=F[13]=F[14]=F[15]=0),P)for(H=this.start;z<K&&H<64;++z)F[H>>>2]|=B[z]<<m[3&H++];else for(H=this.start;z<K&&H<64;++z)(G=B.charCodeAt(z))<128?F[H>>>2]|=G<<m[3&H++]:G<2048?(F[H>>>2]|=(192|G>>>6)<<m[3&H++],F[H>>>2]|=(128|63&G)<<m[3&H++]):G<55296||G>=57344?(F[H>>>2]|=(224|G>>>12)<<m[3&H++],F[H>>>2]|=(128|G>>>6&63)<<m[3&H++],F[H>>>2]|=(128|63&G)<<m[3&H++]):(G=65536+((1023&G)<<10|1023&B.charCodeAt(++z)),F[H>>>2]|=(240|G>>>18)<<m[3&H++],F[H>>>2]|=(128|G>>>12&63)<<m[3&H++],F[H>>>2]|=(128|G>>>6&63)<<m[3&H++],F[H>>>2]|=(128|63&G)<<m[3&H++]);this.lastByteIndex=H,this.bytes+=H-this.start,H>=64?(this.block=F[16],this.start=H-64,this.hash(),this.hashed=!0):this.start=H}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},R.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var B=this.blocks,P=this.lastByteIndex;B[16]=this.block,B[P>>>2]|=d[3&P],this.block=B[16],P>=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()}},R.prototype.hash=function(){var B,P,ee,G,H,z,K,F,oe,te=this.h0,W=this.h1,V=this.h2,J=this.h3,ce=this.h4,ke=this.h5,C=this.h6,L=this.h7,X=this.blocks;for(B=16;B<64;++B)P=((H=X[B-15])>>>7|H<<25)^(H>>>18|H<<14)^H>>>3,ee=((H=X[B-2])>>>17|H<<15)^(H>>>19|H<<13)^H>>>10,X[B]=X[B-16]+P+X[B-7]+ee|0;for(oe=W&V,B=0;B<64;B+=4)this.first?(this.is224?(z=300032,L=(H=X[0]-1413257819)-150054599|0,J=H+24177077|0):(z=704751109,L=(H=X[0]-210244248)-1521486534|0,J=H+143694565|0),this.first=!1):(P=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),G=(z=te&W)^te&V^oe,L=J+(H=L+(ee=(ce>>>6|ce<<26)^(ce>>>11|ce<<21)^(ce>>>25|ce<<7))+(ce&ke^~ce&C)+b[B]+X[B])|0,J=H+(P+G)|0),P=(J>>>2|J<<30)^(J>>>13|J<<19)^(J>>>22|J<<10),G=(K=J&te)^J&W^z,C=V+(H=C+(ee=(L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(L&ce^~L&ke)+b[B+1]+X[B+1])|0,P=((V=H+(P+G)|0)>>>2|V<<30)^(V>>>13|V<<19)^(V>>>22|V<<10),G=(F=V&J)^V&te^K,ke=W+(H=ke+(ee=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7))+(C&L^~C&ce)+b[B+2]+X[B+2])|0,P=((W=H+(P+G)|0)>>>2|W<<30)^(W>>>13|W<<19)^(W>>>22|W<<10),G=(oe=W&V)^W&J^F,ce=te+(H=ce+(ee=(ke>>>6|ke<<26)^(ke>>>11|ke<<21)^(ke>>>25|ke<<7))+(ke&C^~ke&L)+b[B+3]+X[B+3])|0,te=H+(P+G)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+te|0,this.h1=this.h1+W|0,this.h2=this.h2+V|0,this.h3=this.h3+J|0,this.h4=this.h4+ce|0,this.h5=this.h5+ke|0,this.h6=this.h6+C|0,this.h7=this.h7+L|0},R.prototype.hex=function(){this.finalize();var B=this.h0,P=this.h1,ee=this.h2,G=this.h3,H=this.h4,z=this.h5,K=this.h6,F=this.h7,oe=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[P>>>28&15]+f[P>>>24&15]+f[P>>>20&15]+f[P>>>16&15]+f[P>>>12&15]+f[P>>>8&15]+f[P>>>4&15]+f[15&P]+f[ee>>>28&15]+f[ee>>>24&15]+f[ee>>>20&15]+f[ee>>>16&15]+f[ee>>>12&15]+f[ee>>>8&15]+f[ee>>>4&15]+f[15&ee]+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]+f[H>>>28&15]+f[H>>>24&15]+f[H>>>20&15]+f[H>>>16&15]+f[H>>>12&15]+f[H>>>8&15]+f[H>>>4&15]+f[15&H]+f[z>>>28&15]+f[z>>>24&15]+f[z>>>20&15]+f[z>>>16&15]+f[z>>>12&15]+f[z>>>8&15]+f[z>>>4&15]+f[15&z]+f[K>>>28&15]+f[K>>>24&15]+f[K>>>20&15]+f[K>>>16&15]+f[K>>>12&15]+f[K>>>8&15]+f[K>>>4&15]+f[15&K];return this.is224||(oe+=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]),oe},R.prototype.toString=R.prototype.hex,R.prototype.digest=function(){this.finalize();var B=this.h0,P=this.h1,ee=this.h2,G=this.h3,H=this.h4,z=this.h5,K=this.h6,F=this.h7,oe=[B>>>24&255,B>>>16&255,B>>>8&255,255&B,P>>>24&255,P>>>16&255,P>>>8&255,255&P,ee>>>24&255,ee>>>16&255,ee>>>8&255,255&ee,G>>>24&255,G>>>16&255,G>>>8&255,255&G,H>>>24&255,H>>>16&255,H>>>8&255,255&H,z>>>24&255,z>>>16&255,z>>>8&255,255&z,K>>>24&255,K>>>16&255,K>>>8&255,255&K];return this.is224||oe.push(F>>>24&255,F>>>16&255,F>>>8&255,255&F),oe},R.prototype.array=R.prototype.digest,R.prototype.arrayBuffer=function(){this.finalize();var B=new ArrayBuffer(this.is224?28:32),P=new DataView(B);return P.setUint32(0,this.h0),P.setUint32(4,this.h1),P.setUint32(8,this.h2),P.setUint32(12,this.h3),P.setUint32(16,this.h4),P.setUint32(20,this.h5),P.setUint32(24,this.h6),this.is224||P.setUint32(28,this.h7),B},I.prototype=new R,I.prototype.finalize=function(){if(R.prototype.finalize.call(this),this.inner){this.inner=!1;var B=this.array();R.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(B),R.prototype.finalize.call(this)}};var ue=S();ue.sha256=ue,ue.sha224=S(!0),ue.sha256.hmac=M(),ue.sha224.hmac=M(!0),o?Sh.exports=ue:(r.sha256=ue.sha256,r.sha224=ue.sha224)})();Ku.exports;Ku.exports.sha224;var N0=Ku.exports.sha256;function ld(e){return w2(e)}function g2(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 y2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function b2(e){return g2(e)?"hex":y2(e)?"b64":""}function x2(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 v2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const t=atob(e);return Uint8Array.from(t,r=>r.charCodeAt(0))}function w2(e){switch(b2(e)){case"hex":return x2(e);case"b64":return v2(e)}return null}function S2(e,t){const r=typeof e=="string"?ld(e):e,s=typeof t=="string"?ld(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){A(this,"token");A(this,"received");A(this,"ctx");A(this,"requestSubject");A(this,"mux");this.mux=t,this.requestSubject=r,this.received=0,this.token=Qi.next(),s&&(this.ctx=new Error)}}class _2 extends bx{constructor(r,s,l={maxWait:1e3}){super(r,s);A(this,"callback");A(this,"done");A(this,"timer");A(this,"max");A(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=$t(),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===
|
|
68
|
+
${this.ctx.stack}`),this.cancel(r)):(this.callback(null,s),this.opts.strategy===Ar.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===Ar.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===Ar.SentinelMsg&&s&&s.data.length===0&&this.cancel())}}class xx extends bx{constructor(r,s,l={timeout:1e3},o=!0){super(r,s,o);A(this,"deferred");A(this,"timer");this.deferred=$t(),this.timer=va(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||Me.errorForCode(
|
|
71
|
-
`,Lu=Sa.fromAscii(ku),T2=new Uint8Array(Lu)[0],O2=new Uint8Array(Lu)[1];function R2(e){for(let t=0;t<e.length;t++){const r=t+1;if(e.byteLength>r&&e[t]===T2&&e[r]===O2)return r+1}return 0}function M2(e){const t=R2(e);if(t>0){const s=new Uint8Array(e).slice(0,t);return rr.decode(s)}return""}const D2=4,Sx=48,L2=65,z2=97;function U2(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 cd(e){return P2(e)!==void 0}function P2(e){for(let t=0;t<e.length;t++)switch(e[t]){case".":return _x(e);case":":return B2(e)}}function _x(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}=H2(e);if(!o||s>255)return;e=e.substring(l),t[r]=s}return U2(t[0],t[1],t[2],t[3])}function B2(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}=q2(e);if(!c||l>65535)return;if(o<e.length&&e[o]==="."){if(r<0&&s!=12||s+4>16)return;const f=_x(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+=D2;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 H2(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)-Sx),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 q2(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)-Sx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)t*=16,t+=e.charCodeAt(r)-z2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)t*=16,t+=e.charCodeAt(r)-L2+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 I2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function fd(e){return!I2(e)}function F2(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 $2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=F2(e),fd(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const t=fd(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 Rl{constructor(t,r=!1){A(this,"src");A(this,"listen");A(this,"hostname");A(this,"port");A(this,"didConnect");A(this,"reconnects");A(this,"lastConnect");A(this,"gossiped");A(this,"tlsName");A(this,"resolves");this.src=t,this.tlsName="";const s=$2(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(cd(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}://${fd(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new Rl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return t.randomize&&gx(r),this.resolves=r,r}}class V2{constructor(t=[],r={}){A(this,"firstSelect");A(this,"servers");A(this,"currentServer");A(this,"tlsName");A(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 Rl(l))}),this.randomize&&(this.servers=gx(this.servers))),this.servers.length===0&&this.addServer(`${nd}:${wx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();cd(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 Rl(t,r);cd(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 Rl(d,!0);c.set(d,m)});const f=[];return this.servers.forEach((d,m)=>{const b=d.listen;d.gossiped&&this.currentServer.listen!==b&&c.get(b)===void 0&&f.push(m),c.delete(b)}),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 Y2{constructor(){A(this,"baseInbox");A(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${yi(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=yx(r)),l.resolver(t,r))}}}close(){const t=Me.errorForCode(ke.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class G2{constructor(t,r,s){A(this,"ph");A(this,"interval");A(this,"maxOut");A(this,"timer");A(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:da.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=Gt();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 J2 extends Error{constructor(t){super(t),this.name="AssertionError"}}function X2(e,t="Assertion failed."){if(!e)throw new J2(t)}const O0=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){A(this,"_buf");A(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){X2(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(es.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(O0);for(;;){const l=this.capacity-this.length<O0,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 Mn;(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"})(Mn||(Mn={}));function R0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const K2=48;class M0{constructor(t){A(this,"dispatcher");A(this,"state");A(this,"as");A(this,"drop");A(this,"hdr");A(this,"ma");A(this,"argBuf");A(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=R0();break;case Ne.H:case Ne.h:this.state=je.OP_H,this.hdr=0,this.ma=R0();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:Mn.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 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:Mn.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:Mn.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:Mn.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:Mn.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:Mn.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:Mn.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}: ${rr.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]-K2)}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(C,T){this.hi=C|0,this.lo=T|0},r=function(C){var T,R=new Float64Array(16);if(C)for(T=0;T<C.length;T++)R[T]=C[T];return R},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]),b=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(C,T){return C<<T|C>>>32-T}function N(C,T){var R=C[T+3]&255;return R=R<<8|C[T+2]&255,R=R<<8|C[T+1]&255,R<<8|C[T+0]&255}function D(C,T){var R=C[T]<<24|C[T+1]<<16|C[T+2]<<8|C[T+3],U=C[T+4]<<24|C[T+5]<<16|C[T+6]<<8|C[T+7];return new t(R,U)}function M(C,T,R){var U;for(U=0;U<4;U++)C[T+U]=R&255,R>>>=8}function P(C,T,R){C[T]=R.hi>>24&255,C[T+1]=R.hi>>16&255,C[T+2]=R.hi>>8&255,C[T+3]=R.hi&255,C[T+4]=R.lo>>24&255,C[T+5]=R.lo>>16&255,C[T+6]=R.lo>>8&255,C[T+7]=R.lo&255}function I(C,T,R,U,$){var Z,ge=0;for(Z=0;Z<$;Z++)ge|=C[T+Z]^R[U+Z];return(1&ge-1>>>8)-1}function ue(C,T,R,U){return I(C,T,R,U,16)}function H(C,T,R,U){return I(C,T,R,U,32)}function O(C,T,R,U,$){var Z=new Uint32Array(16),ge=new Uint32Array(16),xe=new Uint32Array(16),se=new Uint32Array(4),pe,Le,it;for(pe=0;pe<4;pe++)ge[5*pe]=N(U,4*pe),ge[1+pe]=N(R,4*pe),ge[6+pe]=N(T,4*pe),ge[11+pe]=N(R,16+4*pe);for(pe=0;pe<16;pe++)xe[pe]=ge[pe];for(pe=0;pe<20;pe++){for(Le=0;Le<4;Le++){for(it=0;it<4;it++)se[it]=ge[(5*Le+4*it)%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),it=0;it<4;it++)Z[4*Le+(Le+it)%4]=se[it]}for(it=0;it<16;it++)ge[it]=Z[it]}if($){for(pe=0;pe<16;pe++)ge[pe]=ge[pe]+xe[pe]|0;for(pe=0;pe<4;pe++)ge[5*pe]=ge[5*pe]-N(U,4*pe)|0,ge[6+pe]=ge[6+pe]-N(T,4*pe)|0;for(pe=0;pe<4;pe++)M(C,4*pe,ge[5*pe]),M(C,16+4*pe,ge[6+pe])}else for(pe=0;pe<16;pe++)M(C,4*pe,ge[pe]+xe[pe]|0)}function ee(C,T,R,U){return O(C,T,R,U,!1),0}function G(C,T,R,U){return O(C,T,R,U,!0),0}var B=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function z(C,T,R,U,$,Z,ge){var xe=new Uint8Array(16),se=new Uint8Array(64),pe,Le;if(!$)return 0;for(Le=0;Le<16;Le++)xe[Le]=0;for(Le=0;Le<8;Le++)xe[Le]=Z[Le];for(;$>=64;){for(ee(se,xe,ge,B),Le=0;Le<64;Le++)C[T+Le]=(R?R[U+Le]:0)^se[Le];for(pe=1,Le=8;Le<16;Le++)pe=pe+(xe[Le]&255)|0,xe[Le]=pe&255,pe>>>=8;$-=64,T+=64,R&&(U+=64)}if($>0)for(ee(se,xe,ge,B),Le=0;Le<$;Le++)C[T+Le]=(R?R[U+Le]:0)^se[Le];return 0}function X(C,T,R,U,$){return z(C,T,null,0,R,U,$)}function F(C,T,R,U,$){var Z=new Uint8Array(32);return G(Z,U,$,B),X(C,T,R,U.subarray(16),Z)}function le(C,T,R,U,$,Z,ge){var xe=new Uint8Array(32);return G(xe,Z,ge,B),z(C,T,R,U,$,Z.subarray(16),xe)}function ne(C,T){var R,U=0;for(R=0;R<17;R++)U=U+(C[R]+T[R]|0)|0,C[R]=U&255,U>>>=8}var W=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function V(C,T,R,U,$,Z){var ge,xe,se,pe,Le=new Uint32Array(17),it=new Uint32Array(17),Ht=new Uint32Array(17),kn=new Uint32Array(17),Er=new Uint32Array(17);for(se=0;se<17;se++)it[se]=Ht[se]=0;for(se=0;se<16;se++)it[se]=Z[se];for(it[3]&=15,it[4]&=252,it[7]&=15,it[8]&=252,it[11]&=15,it[12]&=252,it[15]&=15;$>0;){for(se=0;se<17;se++)kn[se]=0;for(se=0;se<16&&se<$;++se)kn[se]=R[U+se];for(kn[se]=1,U+=se,$-=se,ne(Ht,kn),xe=0;xe<17;xe++)for(Le[xe]=0,se=0;se<17;se++)Le[xe]=Le[xe]+Ht[se]*(se<=xe?it[xe-se]:320*it[xe+17-se]|0)|0|0;for(xe=0;xe<17;xe++)Ht[xe]=Le[xe];for(pe=0,se=0;se<16;se++)pe=pe+Ht[se]|0,Ht[se]=pe&255,pe>>>=8;for(pe=pe+Ht[16]|0,Ht[16]=pe&3,pe=5*(pe>>>2)|0,se=0;se<16;se++)pe=pe+Ht[se]|0,Ht[se]=pe&255,pe>>>=8;pe=pe+Ht[16]|0,Ht[16]=pe}for(se=0;se<17;se++)Er[se]=Ht[se];for(ne(Ht,W),ge=-(Ht[16]>>>7)|0,se=0;se<17;se++)Ht[se]^=ge&(Er[se]^Ht[se]);for(se=0;se<16;se++)kn[se]=Z[se+16];for(kn[16]=0,ne(Ht,kn),se=0;se<16;se++)C[T+se]=Ht[se];return 0}function K(C,T,R,U,$,Z){var ge=new Uint8Array(16);return V(ge,0,R,U,$,Z),ue(C,T,ge,0)}function ce(C,T,R,U,$){var Z;if(R<32)return-1;for(le(C,0,T,0,R,U,$),V(C,16,C,32,R-32,C),Z=0;Z<16;Z++)C[Z]=0;return 0}function Ee(C,T,R,U,$){var Z,ge=new Uint8Array(32);if(R<32||(F(ge,0,32,U,$),K(T,16,T,32,R-32,ge)!==0))return-1;for(le(C,0,T,0,R,U,$),Z=0;Z<32;Z++)C[Z]=0;return 0}function E(C,T){var R;for(R=0;R<16;R++)C[R]=T[R]|0}function L(C){var T,R;for(R=0;R<16;R++)C[R]+=65536,T=Math.floor(C[R]/65536),C[(R+1)*(R<15?1:0)]+=T-1+37*(T-1)*(R===15?1:0),C[R]-=T*65536}function J(C,T,R){for(var U,$=~(R-1),Z=0;Z<16;Z++)U=$&(C[Z]^T[Z]),C[Z]^=U,T[Z]^=U}function j(C,T){var R,U,$,Z=r(),ge=r();for(R=0;R<16;R++)ge[R]=T[R];for(L(ge),L(ge),L(ge),U=0;U<2;U++){for(Z[0]=ge[0]-65517,R=1;R<15;R++)Z[R]=ge[R]-65535-(Z[R-1]>>16&1),Z[R-1]&=65535;Z[15]=ge[15]-32767-(Z[14]>>16&1),$=Z[15]>>16&1,Z[14]&=65535,J(ge,Z,1-$)}for(R=0;R<16;R++)C[2*R]=ge[R]&255,C[2*R+1]=ge[R]>>8}function be(C,T){var R=new Uint8Array(32),U=new Uint8Array(32);return j(R,C),j(U,T),H(R,0,U,0)}function Te(C){var T=new Uint8Array(32);return j(T,C),T[0]&1}function Ce(C,T){var R;for(R=0;R<16;R++)C[R]=T[2*R]+(T[2*R+1]<<8);C[15]&=32767}function oe(C,T,R){var U;for(U=0;U<16;U++)C[U]=T[U]+R[U]|0}function Re(C,T,R){var U;for(U=0;U<16;U++)C[U]=T[U]-R[U]|0}function _e(C,T,R){var U,$,Z=new Float64Array(31);for(U=0;U<31;U++)Z[U]=0;for(U=0;U<16;U++)for($=0;$<16;$++)Z[U+$]+=T[U]*R[$];for(U=0;U<15;U++)Z[U]+=38*Z[U+16];for(U=0;U<16;U++)C[U]=Z[U];L(C),L(C)}function Fe(C,T){_e(C,T,T)}function _t(C,T){var R=r(),U;for(U=0;U<16;U++)R[U]=T[U];for(U=253;U>=0;U--)Fe(R,R),U!==2&&U!==4&&_e(R,R,T);for(U=0;U<16;U++)C[U]=R[U]}function an(C,T){var R=r(),U;for(U=0;U<16;U++)R[U]=T[U];for(U=250;U>=0;U--)Fe(R,R),U!==1&&_e(R,R,T);for(U=0;U<16;U++)C[U]=R[U]}function tn(C,T,R){var U=new Uint8Array(32),$=new Float64Array(80),Z,ge,xe=r(),se=r(),pe=r(),Le=r(),it=r(),Ht=r();for(ge=0;ge<31;ge++)U[ge]=T[ge];for(U[31]=T[31]&127|64,U[0]&=248,Ce($,R),ge=0;ge<16;ge++)se[ge]=$[ge],Le[ge]=xe[ge]=pe[ge]=0;for(xe[0]=Le[0]=1,ge=254;ge>=0;--ge)Z=U[ge>>>3]>>>(ge&7)&1,J(xe,se,Z),J(pe,Le,Z),oe(it,xe,pe),Re(xe,xe,pe),oe(pe,se,Le),Re(se,se,Le),Fe(Le,it),Fe(Ht,xe),_e(xe,pe,xe),_e(pe,se,it),oe(it,xe,pe),Re(xe,xe,pe),Fe(se,xe),Re(pe,Le,Ht),_e(xe,pe,d),oe(xe,xe,Le),_e(pe,pe,xe),_e(xe,Le,Ht),_e(Le,se,$),Fe(se,it),J(xe,se,Z),J(pe,Le,Z);for(ge=0;ge<16;ge++)$[ge+16]=xe[ge],$[ge+32]=pe[ge],$[ge+48]=se[ge],$[ge+64]=Le[ge];var kn=$.subarray(32),Er=$.subarray(16);return _t(kn,kn),_e(Er,Er,kn),j(C,Er),0}function Ft(C,T){return tn(C,T,o)}function Pt(C,T){return s(T,32),Ft(C,T)}function Kt(C,T,R){var U=new Uint8Array(32);return tn(U,R,T),G(C,l,U,B)}var Nn=ce,qe=Ee;function tt(C,T,R,U,$,Z){var ge=new Uint8Array(32);return Kt(ge,$,Z),Nn(C,T,R,U,ge)}function st(C,T,R,U,$,Z){var ge=new Uint8Array(32);return Kt(ge,$,Z),qe(C,T,R,U,ge)}function Mt(){var C=0,T=0,R=0,U=0,$=65535,Z,ge,xe;for(xe=0;xe<arguments.length;xe++)Z=arguments[xe].lo,ge=arguments[xe].hi,C+=Z&$,T+=Z>>>16,R+=ge&$,U+=ge>>>16;return T+=C>>>16,R+=T>>>16,U+=R>>>16,new t(R&$|U<<16,C&$|T<<16)}function kt(C,T){return new t(C.hi>>>T,C.lo>>>T|C.hi<<32-T)}function pn(){var C=0,T=0,R;for(R=0;R<arguments.length;R++)C^=arguments[R].lo,T^=arguments[R].hi;return new t(T,C)}function at(C,T){var R,U,$=32-T;return T<32?(R=C.hi>>>T|C.lo<<$,U=C.lo>>>T|C.hi<<$):T<64&&(R=C.lo>>>T|C.hi<<$,U=C.hi>>>T|C.lo<<$),new t(R,U)}function or(C,T,R){var U=C.hi&T.hi^~C.hi&R.hi,$=C.lo&T.lo^~C.lo&R.lo;return new t(U,$)}function fe(C,T,R){var U=C.hi&T.hi^C.hi&R.hi^T.hi&R.hi,$=C.lo&T.lo^C.lo&R.lo^T.lo&R.lo;return new t(U,$)}function we(C){return pn(at(C,28),at(C,34),at(C,39))}function Be(C){return pn(at(C,14),at(C,18),at(C,41))}function Ke(C){return pn(at(C,1),at(C,8),kt(C,7))}function Ie(C){return pn(at(C,19),at(C,61),kt(C,6))}var zt=[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 Xt(C,T,R){var U=[],$=[],Z=[],ge=[],xe,se,pe;for(se=0;se<8;se++)U[se]=Z[se]=D(C,8*se);for(var Le=0;R>=128;){for(se=0;se<16;se++)ge[se]=D(T,8*se+Le);for(se=0;se<80;se++){for(pe=0;pe<8;pe++)$[pe]=Z[pe];for(xe=Mt(Z[7],Be(Z[4]),or(Z[4],Z[5],Z[6]),zt[se],ge[se%16]),$[7]=Mt(xe,we(Z[0]),fe(Z[0],Z[1],Z[2])),$[3]=Mt($[3],xe),pe=0;pe<8;pe++)Z[(pe+1)%8]=$[pe];if(se%16===15)for(pe=0;pe<16;pe++)ge[pe]=Mt(ge[pe],ge[(pe+9)%16],Ke(ge[(pe+1)%16]),Ie(ge[(pe+14)%16]))}for(se=0;se<8;se++)Z[se]=Mt(Z[se],U[se]),U[se]=Z[se];Le+=128,R-=128}for(se=0;se<8;se++)P(C,8*se,U[se]);return R}var Qt=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 mt(C,T,R){var U=new Uint8Array(64),$=new Uint8Array(256),Z,ge=R;for(Z=0;Z<64;Z++)U[Z]=Qt[Z];for(Xt(U,T,R),R%=128,Z=0;Z<256;Z++)$[Z]=0;for(Z=0;Z<R;Z++)$[Z]=T[ge-R+Z];for($[R]=128,R=256-128*(R<112?1:0),$[R-9]=0,P($,R-8,new t(ge/536870912|0,ge<<3)),Xt(U,$,R),Z=0;Z<64;Z++)C[Z]=U[Z];return 0}function Bt(C,T){var R=r(),U=r(),$=r(),Z=r(),ge=r(),xe=r(),se=r(),pe=r(),Le=r();Re(R,C[1],C[0]),Re(Le,T[1],T[0]),_e(R,R,Le),oe(U,C[0],C[1]),oe(Le,T[0],T[1]),_e(U,U,Le),_e($,C[3],T[3]),_e($,$,b),_e(Z,C[2],T[2]),oe(Z,Z,Z),Re(ge,U,R),Re(xe,Z,$),oe(se,Z,$),oe(pe,U,R),_e(C[0],ge,xe),_e(C[1],pe,se),_e(C[2],se,xe),_e(C[3],ge,pe)}function ht(C,T,R){var U;for(U=0;U<4;U++)J(C[U],T[U],R)}function gn(C,T){var R=r(),U=r(),$=r();_t($,T[2]),_e(R,T[0],$),_e(U,T[1],$),j(C,U),C[31]^=Te(R)<<7}function ln(C,T,R){var U,$;for(E(C[0],c),E(C[1],f),E(C[2],f),E(C[3],c),$=255;$>=0;--$)U=R[$/8|0]>>($&7)&1,ht(C,T,U),Bt(T,C),Bt(C,C),ht(C,T,U)}function kr(C,T){var R=[r(),r(),r(),r()];E(R[0],g),E(R[1],x),E(R[2],f),_e(R[3],g,x),ln(C,R,T)}function ve(C,T,R){var U=new Uint8Array(64),$=[r(),r(),r(),r()],Z;for(R||s(T,32),mt(U,T,32),U[0]&=248,U[31]&=127,U[31]|=64,kr($,U),gn(C,$),Z=0;Z<32;Z++)T[Z+32]=C[Z];return 0}var Xe=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 Oe(C,T){var R,U,$,Z;for(U=63;U>=32;--U){for(R=0,$=U-32,Z=U-12;$<Z;++$)T[$]+=R-16*T[U]*Xe[$-(U-32)],R=Math.floor((T[$]+128)/256),T[$]-=R*256;T[$]+=R,T[U]=0}for(R=0,$=0;$<32;$++)T[$]+=R-(T[31]>>4)*Xe[$],R=T[$]>>8,T[$]&=255;for($=0;$<32;$++)T[$]-=R*Xe[$];for(U=0;U<32;U++)T[U+1]+=T[U]>>8,C[U]=T[U]&255}function pt(C){var T=new Float64Array(64),R;for(R=0;R<64;R++)T[R]=C[R];for(R=0;R<64;R++)C[R]=0;Oe(C,T)}function on(C,T,R,U){var $=new Uint8Array(64),Z=new Uint8Array(64),ge=new Uint8Array(64),xe,se,pe=new Float64Array(64),Le=[r(),r(),r(),r()];mt($,U,32),$[0]&=248,$[31]&=127,$[31]|=64;var it=R+64;for(xe=0;xe<R;xe++)C[64+xe]=T[xe];for(xe=0;xe<32;xe++)C[32+xe]=$[32+xe];for(mt(ge,C.subarray(32),R+32),pt(ge),kr(Le,ge),gn(C,Le),xe=32;xe<64;xe++)C[xe]=U[xe];for(mt(Z,C,R+64),pt(Z),xe=0;xe<64;xe++)pe[xe]=0;for(xe=0;xe<32;xe++)pe[xe]=ge[xe];for(xe=0;xe<32;xe++)for(se=0;se<32;se++)pe[xe+se]+=Z[xe]*$[se];return Oe(C.subarray(32),pe),it}function ur(C,T){var R=r(),U=r(),$=r(),Z=r(),ge=r(),xe=r(),se=r();return E(C[2],f),Ce(C[1],T),Fe($,C[1]),_e(Z,$,m),Re($,$,C[2]),oe(Z,C[2],Z),Fe(ge,Z),Fe(xe,ge),_e(se,xe,ge),_e(R,se,$),_e(R,R,Z),an(R,R),_e(R,R,$),_e(R,R,Z),_e(R,R,Z),_e(C[0],R,Z),Fe(U,C[0]),_e(U,U,Z),be(U,$)&&_e(C[0],C[0],v),Fe(U,C[0]),_e(U,U,Z),be(U,$)?-1:(Te(C[0])===T[31]>>7&&Re(C[0],c,C[0]),_e(C[3],C[0],C[1]),0)}function Jr(C,T,R,U){var $,Z=new Uint8Array(32),ge=new Uint8Array(64),xe=[r(),r(),r(),r()],se=[r(),r(),r(),r()];if(R<64||ur(se,U))return-1;for($=0;$<R;$++)C[$]=T[$];for($=0;$<32;$++)C[$+32]=U[$];if(mt(ge,C,R),pt(ge),ln(xe,se,ge),kr(se,T.subarray(32)),Bt(xe,se),gn(Z,xe),R-=64,H(T,0,Z,0)){for($=0;$<R;$++)C[$]=0;return-1}for($=0;$<R;$++)C[$]=T[$+64];return R}var Si=32,zr=24,Tn=32,Ur=16,he=32,Ae=32,De=32,Ge=32,Ve=32,gt=zr,nt=Tn,He=Ur,Ue=64,rt=32,xt=64,$t=32,Un=64;e.lowlevel={crypto_core_hsalsa20:G,crypto_stream_xor:le,crypto_stream:F,crypto_stream_salsa20_xor:z,crypto_stream_salsa20:X,crypto_onetimeauth:V,crypto_onetimeauth_verify:K,crypto_verify_16:ue,crypto_verify_32:H,crypto_secretbox:ce,crypto_secretbox_open:Ee,crypto_scalarmult:tn,crypto_scalarmult_base:Ft,crypto_box_beforenm:Kt,crypto_box_afternm:Nn,crypto_box:tt,crypto_box_open:st,crypto_box_keypair:Pt,crypto_hash:mt,crypto_sign:on,crypto_sign_keypair:ve,crypto_sign_open:Jr,crypto_secretbox_KEYBYTES:Si,crypto_secretbox_NONCEBYTES:zr,crypto_secretbox_ZEROBYTES:Tn,crypto_secretbox_BOXZEROBYTES:Ur,crypto_scalarmult_BYTES:he,crypto_scalarmult_SCALARBYTES:Ae,crypto_box_PUBLICKEYBYTES:De,crypto_box_SECRETKEYBYTES:Ge,crypto_box_BEFORENMBYTES:Ve,crypto_box_NONCEBYTES:gt,crypto_box_ZEROBYTES:nt,crypto_box_BOXZEROBYTES:He,crypto_sign_BYTES:Ue,crypto_sign_PUBLICKEYBYTES:rt,crypto_sign_SECRETKEYBYTES:xt,crypto_sign_SEEDBYTES:$t,crypto_hash_BYTES:Un,gf:r,D:m,L:Xe,pack25519:j,unpack25519:Ce,M:_e,A:oe,S:Fe,Z:Re,pow2523:an,add:Bt,set25519:E,modL:Oe,scalarmult:ln,scalarbase:kr};function ns(C,T){if(C.length!==Si)throw new Error("bad key size");if(T.length!==zr)throw new Error("bad nonce size")}function rs(C,T){if(C.length!==De)throw new Error("bad public key size");if(T.length!==Ge)throw new Error("bad secret key size")}function Zt(){for(var C=0;C<arguments.length;C++)if(!(arguments[C]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Xr(C){for(var T=0;T<C.length;T++)C[T]=0}e.randomBytes=function(C){var T=new Uint8Array(C);return s(T,C),T},e.secretbox=function(C,T,R){Zt(C,T,R),ns(R,T);for(var U=new Uint8Array(Tn+C.length),$=new Uint8Array(U.length),Z=0;Z<C.length;Z++)U[Z+Tn]=C[Z];return ce($,U,U.length,T,R),$.subarray(Ur)},e.secretbox.open=function(C,T,R){Zt(C,T,R),ns(R,T);for(var U=new Uint8Array(Ur+C.length),$=new Uint8Array(U.length),Z=0;Z<C.length;Z++)U[Z+Ur]=C[Z];return U.length<32||Ee($,U,U.length,T,R)!==0?null:$.subarray(Tn)},e.secretbox.keyLength=Si,e.secretbox.nonceLength=zr,e.secretbox.overheadLength=Ur,e.scalarMult=function(C,T){if(Zt(C,T),C.length!==Ae)throw new Error("bad n size");if(T.length!==he)throw new Error("bad p size");var R=new Uint8Array(he);return tn(R,C,T),R},e.scalarMult.base=function(C){if(Zt(C),C.length!==Ae)throw new Error("bad n size");var T=new Uint8Array(he);return Ft(T,C),T},e.scalarMult.scalarLength=Ae,e.scalarMult.groupElementLength=he,e.box=function(C,T,R,U){var $=e.box.before(R,U);return e.secretbox(C,T,$)},e.box.before=function(C,T){Zt(C,T),rs(C,T);var R=new Uint8Array(Ve);return Kt(R,C,T),R},e.box.after=e.secretbox,e.box.open=function(C,T,R,U){var $=e.box.before(R,U);return e.secretbox.open(C,T,$)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var C=new Uint8Array(De),T=new Uint8Array(Ge);return Pt(C,T),{publicKey:C,secretKey:T}},e.box.keyPair.fromSecretKey=function(C){if(Zt(C),C.length!==Ge)throw new Error("bad secret key size");var T=new Uint8Array(De);return Ft(T,C),{publicKey:T,secretKey:new Uint8Array(C)}},e.box.publicKeyLength=De,e.box.secretKeyLength=Ge,e.box.sharedKeyLength=Ve,e.box.nonceLength=gt,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(C,T){if(Zt(C,T),T.length!==xt)throw new Error("bad secret key size");var R=new Uint8Array(Ue+C.length);return on(R,C,C.length,T),R},e.sign.open=function(C,T){if(Zt(C,T),T.length!==rt)throw new Error("bad public key size");var R=new Uint8Array(C.length),U=Jr(R,C,C.length,T);if(U<0)return null;for(var $=new Uint8Array(U),Z=0;Z<$.length;Z++)$[Z]=R[Z];return $},e.sign.detached=function(C,T){for(var R=e.sign(C,T),U=new Uint8Array(Ue),$=0;$<U.length;$++)U[$]=R[$];return U},e.sign.detached.verify=function(C,T,R){if(Zt(C,T,R),T.length!==Ue)throw new Error("bad signature size");if(R.length!==rt)throw new Error("bad public key size");var U=new Uint8Array(Ue+C.length),$=new Uint8Array(Ue+C.length),Z;for(Z=0;Z<Ue;Z++)U[Z]=T[Z];for(Z=0;Z<C.length;Z++)U[Z+Ue]=C[Z];return Jr($,U,U.length,R)>=0},e.sign.keyPair=function(){var C=new Uint8Array(rt),T=new Uint8Array(xt);return ve(C,T),{publicKey:C,secretKey:T}},e.sign.keyPair.fromSecretKey=function(C){if(Zt(C),C.length!==xt)throw new Error("bad secret key size");for(var T=new Uint8Array(rt),R=0;R<T.length;R++)T[R]=C[32+R];return{publicKey:T,secretKey:new Uint8Array(C)}},e.sign.keyPair.fromSeed=function(C){if(Zt(C),C.length!==$t)throw new Error("bad seed size");for(var T=new Uint8Array(rt),R=new Uint8Array(xt),U=0;U<32;U++)R[U]=C[U];return ve(T,R,!0),{publicKey:T,secretKey:R}},e.sign.publicKeyLength=rt,e.sign.secretKeyLength=xt,e.sign.seedLength=$t,e.sign.signatureLength=Ue,e.hash=function(C){Zt(C);var T=new Uint8Array(Un);return mt(T,C,C.length),T},e.hash.hashLength=Un,e.verify=function(C,T){return Zt(C,T),C.length===0||T.length===0||C.length!==T.length?!1:I(C,0,T,0,C.length)===0},e.setPRNG=function(C){s=C},(function(){var C=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(C&&C.getRandomValues){var T=65536;e.setPRNG(function(R,U){var $,Z=new Uint8Array(U);for($=0;$<U;$+=T)C.getRandomValues(Z.subarray($,$+Math.min(U-$,T)));for($=0;$<U;$++)R[$]=Z[$];Xr(Z)})}else typeof require<"u"&&(C=require("crypto"),C&&C.randomBytes&&e.setPRNG(function(R,U){var $,Z=C.randomBytes(U);for($=0;$<U;$++)R[$]=Z[$];Xr(Z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const du=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,Q2={fromSeed:du.sign.keyPair.fromSeed,sign:du.sign.detached,verify:du.sign.detached.verify,randomBytes:du.randomBytes};let kx;function Z2(e){kx=e}function Gi(){return kx}const W2=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^W2[(r>>8^l)&255]}return r}static validate(t,r){return zu.checksum(t)==r}}const Ch="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class D0{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 Rt extends Error{constructor(r,s){super(r);A(this,"name");A(this,"code");A(this,"chainedError");this.name="NKeysError",this.code=r,this.chainedError=s}}function ek(){return Qu(Ot.Operator)}function tk(){return Qu(Ot.Account)}function nk(){return Qu(Ot.User)}var Et;(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"})(Et||(Et={}));var Ot;(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"})(Ot||(Ot={}));class ha{static isValidPublicPrefix(t){return t==Ot.Server||t==Ot.Operator||t==Ot.Cluster||t==Ot.Account||t==Ot.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 Ot.Seed:return Ot.Seed;case Ot.Private:return Ot.Private;case Ot.Operator:return Ot.Operator;case Ot.Server:return Ot.Server;case Ot.Cluster:return Ot.Cluster;case Ot.Account:return Ot.Account;case Ot.User:return Ot.User;default:return-1}}}class Dn{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new Rt(Et.SerializationError);if(!ha.isValidPrefix(t))throw new Rt(Et.InvalidPrefixByte);return Dn._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new Rt(Et.ApiError);if(!ha.isValidPublicPrefix(t))throw new Rt(Et.InvalidPrefixByte);if(r.byteLength!==32)throw new Rt(Et.InvalidSeedLen);return Dn._encode(!0,t,r)}static decode(t,r){if(!ha.isValidPrefix(t))throw new Rt(Et.InvalidPrefixByte);const s=Dn._decode(r);if(s[0]!==t)throw new Rt(Et.InvalidPrefixByte);return s.slice(1)}static decodeSeed(t){const r=Dn._decode(t),s=Dn._decodePrefix(r);if(s[0]!=Ot.Seed)throw new Rt(Et.InvalidSeed);if(!ha.isValidPublicPrefix(s[1]))throw new Rt(Et.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=Dn._encodePrefix(Ot.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),D0.encode(d)}static _decode(t){if(t.byteLength<4)throw new Rt(Et.InvalidEncoding);let r;try{r=D0.decode(t)}catch(f){throw new Rt(Et.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 Rt(Et.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 Ex{constructor(t){A(this,"seed");this.seed=t}getRawSeed(){if(!this.seed)throw new Rt(Et.ClearedPair);return Dn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Rt(Et.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Rt(Et.ClearedPair);const t=Dn.decodeSeed(this.seed),r=Gi().fromSeed(this.getRawSeed()),s=Dn.encode(t.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new Rt(Et.ClearedPair);const t=Gi().fromSeed(this.getRawSeed());return Dn.encode(Ot.Private,t.secretKey)}sign(t){if(!this.seed)throw new Rt(Et.ClearedPair);const r=Gi().fromSeed(this.getRawSeed());return Gi().sign(t,r.secretKey)}verify(t,r){if(!this.seed)throw new Rt(Et.ClearedPair);const s=Gi().fromSeed(this.getRawSeed());return Gi().verify(t,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Qu(e){const t=Gi().randomBytes(32);let r=Dn.encodeSeed(e,new Uint8Array(t));return new Ex(r)}class rk{constructor(t){A(this,"publicKey");this.publicKey=t}getPublicKey(){if(!this.publicKey)throw new Rt(Et.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Rt(Et.PublicKeyOnly):new Rt(Et.ClearedPair)}getSeed(){throw this.publicKey?new Rt(Et.PublicKeyOnly):new Rt(Et.ClearedPair)}sign(t){throw this.publicKey?new Rt(Et.CannotSign):new Rt(Et.ClearedPair)}verify(t,r){if(!this.publicKey)throw new Rt(Et.ClearedPair);let s=Dn._decode(this.publicKey);return Gi().verify(t,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function ik(e){const t=new TextEncoder().encode(e),r=Dn._decode(t),s=ha.parsePrefix(r[0]);if(ha.isValidPublicPrefix(s))return new rk(t);throw new Rt(Et.InvalidPublicKey)}function sk(e){return Dn.decodeSeed(e),new Ex(e)}function ak(e){return btoa(String.fromCharCode(...e))}function lk(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}Z2(Q2);const L0={createAccount:tk,createOperator:ek,createPair:Qu,createUser:nk,fromPublic:ik,fromSeed:sk,NKeysError:Rt,NKeysErrorCode:Et,Prefix:Ot,decode:lk,encode:ak};function ok(e){return t=>{let r={};return e.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function uk(){return()=>{}}function ck(e,t){return()=>{const r=typeof e=="function"?e():e,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function fk(e){return()=>({auth_token:typeof e=="function"?e():e})}function hk(e){return t=>{const r=typeof e=="function"?e():e,s=r?L0.fromSeed(r):void 0,l=s?s.getPublicKey():"",o=es.encode(t||""),c=s!==void 0&&t?s.sign(o):void 0,f=c?L0.encode(c):"";return{nkey:l,sig:f}}}function Cx(e,t){return r=>{const s=typeof e=="function"?e():e,l=hk(t),{nkey:o,sig:c}=l(r);return{jwt:s,nkey:o,sig:c}}}const Ax=120*1e3,dk=2,jx=2*1e3;function mk(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Ax,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:jx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function pk(e){const t=[];return typeof e.authenticator=="function"&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(fk(e.token)),e.user&&t.push(ck(e.user,e.pass)),t.length===0?uk():ok(t)}function gk(e){const t=`${nd}:${wx()}`;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 Me("port and servers options are mutually exclusive",ke.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${nd}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);const r=Ju(mk(),e);if(r.authenticator=pk(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new Me(`${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{yi(r.inboxPrefix)}catch(s){throw new Me(s.message,ke.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof ud()=="function"),r.resolve&&typeof ud()!="function")throw new Me("'resolve' is not supported on this client",ke.InvalidOption);return r}function yk(e,t){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&t.noEcho)throw new Me("noEcho",ke.ServerOptionNotAvailable);const o=s||l||!1;if(t.tls&&!o)throw new Me("tls",ke.ServerOptionNotAvailable)}const bk=1024*32,xk=/^INFO\s+([^\r\n]+)\r\n/i,vk=Tl(`PONG\r
|
|
72
|
-
`),
|
|
73
|
-
`);class wk{constructor(t,r,s){A(this,"echo");A(this,"no_responders");A(this,"protocol");A(this,"verbose");A(this,"pedantic");A(this,"jwt");A(this,"nkey");A(this,"sig");A(this,"user");A(this,"pass");A(this,"auth_token");A(this,"tls_required");A(this,"name");A(this,"lang");A(this,"version");A(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 Nx extends xn{constructor(r,s,l={}){var c;super();A(this,"sid");A(this,"queue");A(this,"draining");A(this,"max");A(this,"subject");A(this,"drained");A(this,"protocol");A(this,"timer");A(this,"info");A(this,"cleanupFn");A(this,"closed");A(this,"requestSubject");Ju(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Gt();const o=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=va(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(Me.errorForCode(ke.ConnectionClosed)):this.isClosed()?Promise.reject(Me.errorForCode(ke.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Gt()).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 Sk{constructor(){A(this,"mux");A(this,"subs");A(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){A(this,"connected");A(this,"connectedOnce");A(this,"infoReceived");A(this,"info");A(this,"muxSubscriptions");A(this,"options");A(this,"outbound");A(this,"pongs");A(this,"subscriptions");A(this,"transport");A(this,"noMorePublishing");A(this,"connectError");A(this,"publisher");A(this,"_closed");A(this,"closed");A(this,"listeners");A(this,"heartbeats");A(this,"parser");A(this,"outMsgs");A(this,"inMsgs");A(this,"outBytes");A(this,"inBytes");A(this,"pendingLimit");A(this,"lastError");A(this,"abortReconnect");A(this,"whyClosed");A(this,"servers");A(this,"server");A(this,"features");A(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=bk,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new Sk,this.muxSubscriptions=new Y2,this.outbound=new Sa,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new C2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new V2(s,{randomize:!t.noRandomize}),this.closed=Gt(),this.parser=new M0(this),this.heartbeats=new G2(this,this.options.pingInterval||Ax,this.options.maxPingOut||dk)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=Me.errorForCode(ke.Disconnect);r.stack="",t.forEach(s=>{s.reject(r)}),this.parser=new M0(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=Gt();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=N2(),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:da.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:da.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:mi.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:mi.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=va(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:ud(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const o of s)try{l=null,this.dispatchStatus({type:da.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():jx;let s=r;const l=this.selectServer();if(!l||this.abortReconnect)throw t||(this.lastError?this.lastError:Me.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 ja(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 Me(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 Me(t,ke.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Me(t,ke.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Me(t,ke.AccountExpired):r.indexOf("authentication timeout")!==-1?new Me(t,ke.AuthenticationTimeout):new Me(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 Bd(t,r,this)),s.max!==void 0&&s.received>=s.max&&s.unsubscribe())}processError(t){const r=b0(t),s=Uu.toError(r),l={type:mi.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(vk)}processPong(){const t=this.pongs.shift();t&&t.resolve()}processInfo(t){const r=JSON.parse(b0(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(Ss(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:o,lang:c}=this.transport;try{const f=new wk({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(Tl(`CONNECT ${d}${ku}`)),this.transport.send(z0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:mi.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:mi.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case Mn.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case Mn.OK:break;case Mn.ERR:this.processError(t.data);break;case Mn.PING:this.processPing();break;case Mn.PONG:this.processPong();break;case Mn.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=Tl(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=ar,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=es.encode(r);else throw Me.errorForCode(ke.BadPayload);let o=l.length;s=s||{},s.reply=s.reply||"";let c=ar,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new Me("headers",ke.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,o=l.length+f}if(this.info&&o>this.info.max_payload)throw Me.errorForCode(ke.MaxPayloadExceeded);this.outBytes+=o,this.outMsgs++;let d;s.headers?(s.reply?d=`HPUB ${t} ${s.reply} ${f} ${o}\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||Me.errorForCode(Ce.Cancelled))}}const k2="$JS.API";function E2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Ju({apiPrefix:k2,timeout:5e3},e)}class Jl{constructor(t,r){A(this,"nc");A(this,"opts");A(this,"prefix");A(this,"timeout");A(this,"jc");this.nc=t,this.opts=E2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=jr()}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=rr;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===Ce.Timeout)&&f+1<o)await ja(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 Nl{constructor(t,r,s,l){A(this,"err");A(this,"offset");A(this,"pageInfo");A(this,"subject");A(this,"jsm");A(this,"filter");A(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 Ss(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 od(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 bt;(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"})(bt||(bt={}));class C2{constructor(t){A(this,"server");A(this,"features");A(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=Ss(t)),this.server=t,this.set(bt.JS_KV,"2.6.2"),this.set(bt.JS_OBJECTSTORE,"2.6.3"),this.set(bt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(bt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(bt.JS_ALLOW_DIRECT,"2.9.0"),this.set(bt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(bt.JS_SIMPLIFICATION,"2.9.4"),this.set(bt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(bt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(bt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(bt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(bt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(bt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(bt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(bt.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:od(this.server,Ss(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=Ss(t)),od(this.server,t)>=0}}class Du extends Jl{constructor(t,r){super(t,r)}async add(t,r,s=Mu.Create){if(Nn(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&&ma(l.config.durable_name);const o=this.nc;let{min:c,ok:f}=o.features.get(bt.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,b="";if(Array.isArray(r.filter_subjects)){const{min:x,ok:v}=o.features.get(bt.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(bt.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(f&&(b=r.name??r.durable_name??""),b!==""){let x=r.filter_subject??void 0;x===">"&&(x=void 0),m=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${t}.${b}.${x}`:`${this.prefix}.CONSUMER.CREATE.${t}.${b}`}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 Nn(t),ma(r),await this._request(`${this.prefix}.CONSUMER.INFO.${t}.${r}`)}async delete(t,r){return Nn(t),ma(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${t}.${r}`)).success}list(t){Nn(t);const r=l=>l.consumers,s=`${this.prefix}.CONSUMER.LIST.${t}`;return new Nl(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 aa(e,t,r=!1){if(r===!0&&!e)throw Me.errorForCode(Ce.ApiError,new Error(`${t} is not a function`));if(e&&typeof e!="function")throw Me.errorForCode(Ce.ApiError,new Error(`${t} is not a function`))}class A2 extends dn{constructor(r,s,l){super();A(this,"sub");A(this,"adapter");A(this,"subIterDone");aa(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&aa(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(aa(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(aa(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(aa(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&aa(l.cleanupFn,"cleanupFn");let o=(b,g)=>{this.callback(b,g)};if(l.callback){const b=l.callback;o=(g,x)=>{const[v,S]=this.adapter(g,x);if(v){b(v,null);return}const{ingest:j}=this.ingestionFilterFn?this.ingestionFilterFn(S,this):{ingest:!0};j&&(!this.protocolFilterFn||this.protocolFilterFn(S))&&(b(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=$t(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async b=>{await b.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 tr;function j2(e){tr=e}function vx(){return tr!==void 0&&tr.defaultPort!==void 0?tr.defaultPort:4222}function _h(){return tr!==void 0&&tr.urlParseFn?tr.urlParseFn:void 0}function N2(){if(!tr||typeof tr.factory!="function")throw new Error("transport fn is not set");return tr.factory()}function ud(){return tr!==void 0&&tr.dnsResolveFn?tr.dnsResolveFn:void 0}const ku=`\r
|
|
71
|
+
`,Lu=Sa.fromAscii(ku),T2=new Uint8Array(Lu)[0],O2=new Uint8Array(Lu)[1];function R2(e){for(let t=0;t<e.length;t++){const r=t+1;if(e.byteLength>r&&e[t]===T2&&e[r]===O2)return r+1}return 0}function M2(e){const t=R2(e);if(t>0){const s=new Uint8Array(e).slice(0,t);return er.decode(s)}return""}const D2=4,wx=48,L2=65,z2=97;function U2(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 cd(e){return P2(e)!==void 0}function P2(e){for(let t=0;t<e.length;t++)switch(e[t]){case".":return Sx(e);case":":return B2(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}=H2(e);if(!o||s>255)return;e=e.substring(l),t[r]=s}return U2(t[0],t[1],t[2],t[3])}function B2(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}=q2(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+=D2;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 H2(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 q2(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)-z2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)t*=16,t+=e.charCodeAt(r)-L2+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 I2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function fd(e){return!I2(e)}function F2(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 $2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=F2(e),fd(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const t=fd(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 Rl{constructor(t,r=!1){A(this,"src");A(this,"listen");A(this,"hostname");A(this,"port");A(this,"didConnect");A(this,"reconnects");A(this,"lastConnect");A(this,"gossiped");A(this,"tlsName");A(this,"resolves");this.src=t,this.tlsName="";const s=$2(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(cd(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}://${fd(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new Rl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return t.randomize&&px(r),this.resolves=r,r}}class V2{constructor(t=[],r={}){A(this,"firstSelect");A(this,"servers");A(this,"currentServer");A(this,"tlsName");A(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 Rl(l))}),this.randomize&&(this.servers=px(this.servers))),this.servers.length===0&&this.addServer(`${nd}:${vx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const t=this.getCurrentServer();cd(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 Rl(t,r);cd(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 Rl(d,!0);c.set(d,m)});const f=[];return this.servers.forEach((d,m)=>{const b=d.listen;d.gossiped&&this.currentServer.listen!==b&&c.get(b)===void 0&&f.push(m),c.delete(b)}),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 Y2{constructor(){A(this,"baseInbox");A(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(t){return this.baseInbox=`${gi(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=Me.errorForCode(Ce.Timeout);this.reqs.forEach(r=>{r.resolver(t,{})})}}class G2{constructor(t,r,s){A(this,"ph");A(this,"interval");A(this,"maxOut");A(this,"timer");A(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:da.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const t=$t();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 J2 extends Error{constructor(t){super(t),this.name="AssertionError"}}function X2(e,t="Assertion failed."){if(!e)throw new J2(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){A(this,"_buf");A(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){X2(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(es.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 Tn;(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"})(Tn||(Tn={}));function O0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const K2=48;class R0{constructor(t){A(this,"dispatcher");A(this,"state");A(this,"as");A(this,"drop");A(this,"hdr");A(this,"ma");A(this,"argBuf");A(this,"msgBuf");this.dispatcher=t,this.state=Te.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 Te.OP_START:switch(s){case Oe.M:case Oe.m:this.state=Te.OP_M,this.hdr=-1,this.ma=O0();break;case Oe.H:case Oe.h:this.state=Te.OP_H,this.hdr=0,this.ma=O0();break;case Oe.P:case Oe.p:this.state=Te.OP_P;break;case Oe.PLUS:this.state=Te.OP_PLUS;break;case Oe.MINUS:this.state=Te.OP_MINUS;break;case Oe.I:case Oe.i:this.state=Te.OP_I;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_H:switch(s){case Oe.M:case Oe.m:this.state=Te.OP_M;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_M:switch(s){case Oe.S:case Oe.s:this.state=Te.OP_MS;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MS:switch(s){case Oe.G:case Oe.g:this.state=Te.OP_MSG;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MSG:switch(s){case Oe.SPACE:case Oe.TAB:this.state=Te.OP_MSG_SPC;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MSG_SPC:switch(s){case Oe.SPACE:case Oe.TAB:continue;default:this.state=Te.MSG_ARG,this.as=r}break;case Te.MSG_ARG:switch(s){case Oe.CR:this.drop=1;break;case Oe.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=Te.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;case Te.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:Tn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Te.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:Tn.MSG,msg:this.ma,data:t.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Te.MSG_END);break;case Te.MSG_END:switch(s){case Oe.NL:this.drop=0,this.as=r+1,this.state=Te.OP_START;break;default:continue}break;case Te.OP_PLUS:switch(s){case Oe.O:case Oe.o:this.state=Te.OP_PLUS_O;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PLUS_O:switch(s){case Oe.K:case Oe.k:this.state=Te.OP_PLUS_OK;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PLUS_OK:switch(s){case Oe.NL:this.dispatcher.push({kind:Tn.OK}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_MINUS:switch(s){case Oe.E:case Oe.e:this.state=Te.OP_MINUS_E;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_E:switch(s){case Oe.R:case Oe.r:this.state=Te.OP_MINUS_ER;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_ER:switch(s){case Oe.R:case Oe.r:this.state=Te.OP_MINUS_ERR;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_ERR:switch(s){case Oe.SPACE:case Oe.TAB:this.state=Te.OP_MINUS_ERR_SPC;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_MINUS_ERR_SPC:switch(s){case Oe.SPACE:case Oe.TAB:continue;default:this.state=Te.MINUS_ERR_ARG,this.as=r}break;case Te.MINUS_ERR_ARG:switch(s){case Oe.CR:this.drop=1;break;case Oe.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:Tn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Te.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(s))}break;case Te.OP_P:switch(s){case Oe.I:case Oe.i:this.state=Te.OP_PI;break;case Oe.O:case Oe.o:this.state=Te.OP_PO;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PO:switch(s){case Oe.N:case Oe.n:this.state=Te.OP_PON;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PON:switch(s){case Oe.G:case Oe.g:this.state=Te.OP_PONG;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PONG:switch(s){case Oe.NL:this.dispatcher.push({kind:Tn.PONG}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_PI:switch(s){case Oe.N:case Oe.n:this.state=Te.OP_PIN;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PIN:switch(s){case Oe.G:case Oe.g:this.state=Te.OP_PING;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_PING:switch(s){case Oe.NL:this.dispatcher.push({kind:Tn.PING}),this.drop=0,this.state=Te.OP_START;break}break;case Te.OP_I:switch(s){case Oe.N:case Oe.n:this.state=Te.OP_IN;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_IN:switch(s){case Oe.F:case Oe.f:this.state=Te.OP_INF;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INF:switch(s){case Oe.O:case Oe.o:this.state=Te.OP_INFO;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INFO:switch(s){case Oe.SPACE:case Oe.TAB:this.state=Te.OP_INFO_SPC;break;default:throw this.fail(t.subarray(r))}break;case Te.OP_INFO_SPC:switch(s){case Oe.SPACE:case Oe.TAB:continue;default:this.state=Te.INFO_ARG,this.as=r}break;case Te.INFO_ARG:switch(s){case Oe.CR:this.drop=1;break;case Oe.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:Tn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Te.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(s)}break;default:throw this.fail(t.subarray(r))}}(this.state===Te.MSG_ARG||this.state===Te.MINUS_ERR_ARG||this.state===Te.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Eh(t.subarray(this.as,r-this.drop))),this.state===Te.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 Oe.SPACE:case Oe.TAB:case Oe.CR:case Oe.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}: ${er.decode(t)}`)}processHeaderMsgArgs(t){const r=[];let s=-1;for(let l=0;l<t.length;l++)switch(t[l]){case Oe.SPACE:case Oe.TAB:case Oe.CR:case Oe.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]-K2)}return r}}var Te;(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"})(Te||(Te={}));var Oe;(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"})(Oe||(Oe={}));(function(e){var t=function(k,T){this.hi=k|0,this.lo=T|0},r=function(k){var T,O=new Float64Array(16);if(k)for(T=0;T<k.length;T++)O[T]=k[T];return O},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]),b=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,T){return k<<T|k>>>32-T}function j(k,T){var O=k[T+3]&255;return O=O<<8|k[T+2]&255,O=O<<8|k[T+1]&255,O<<8|k[T+0]&255}function D(k,T){var O=k[T]<<24|k[T+1]<<16|k[T+2]<<8|k[T+3],U=k[T+4]<<24|k[T+5]<<16|k[T+6]<<8|k[T+7];return new t(O,U)}function M(k,T,O){var U;for(U=0;U<4;U++)k[T+U]=O&255,O>>>=8}function R(k,T,O){k[T]=O.hi>>24&255,k[T+1]=O.hi>>16&255,k[T+2]=O.hi>>8&255,k[T+3]=O.hi&255,k[T+4]=O.lo>>24&255,k[T+5]=O.lo>>16&255,k[T+6]=O.lo>>8&255,k[T+7]=O.lo&255}function I(k,T,O,U,$){var Z,ge=0;for(Z=0;Z<$;Z++)ge|=k[T+Z]^O[U+Z];return(1&ge-1>>>8)-1}function ue(k,T,O,U){return I(k,T,O,U,16)}function B(k,T,O,U){return I(k,T,O,U,32)}function P(k,T,O,U,$){var Z=new Uint32Array(16),ge=new Uint32Array(16),be=new Uint32Array(16),se=new Uint32Array(4),pe,Le,it;for(pe=0;pe<4;pe++)ge[5*pe]=j(U,4*pe),ge[1+pe]=j(O,4*pe),ge[6+pe]=j(T,4*pe),ge[11+pe]=j(O,16+4*pe);for(pe=0;pe<16;pe++)be[pe]=ge[pe];for(pe=0;pe<20;pe++){for(Le=0;Le<4;Le++){for(it=0;it<4;it++)se[it]=ge[(5*Le+4*it)%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),it=0;it<4;it++)Z[4*Le+(Le+it)%4]=se[it]}for(it=0;it<16;it++)ge[it]=Z[it]}if($){for(pe=0;pe<16;pe++)ge[pe]=ge[pe]+be[pe]|0;for(pe=0;pe<4;pe++)ge[5*pe]=ge[5*pe]-j(U,4*pe)|0,ge[6+pe]=ge[6+pe]-j(T,4*pe)|0;for(pe=0;pe<4;pe++)M(k,4*pe,ge[5*pe]),M(k,16+4*pe,ge[6+pe])}else for(pe=0;pe<16;pe++)M(k,4*pe,ge[pe]+be[pe]|0)}function ee(k,T,O,U){return P(k,T,O,U,!1),0}function G(k,T,O,U){return P(k,T,O,U,!0),0}var H=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function z(k,T,O,U,$,Z,ge){var be=new Uint8Array(16),se=new Uint8Array(64),pe,Le;if(!$)return 0;for(Le=0;Le<16;Le++)be[Le]=0;for(Le=0;Le<8;Le++)be[Le]=Z[Le];for(;$>=64;){for(ee(se,be,ge,H),Le=0;Le<64;Le++)k[T+Le]=(O?O[U+Le]:0)^se[Le];for(pe=1,Le=8;Le<16;Le++)pe=pe+(be[Le]&255)|0,be[Le]=pe&255,pe>>>=8;$-=64,T+=64,O&&(U+=64)}if($>0)for(ee(se,be,ge,H),Le=0;Le<$;Le++)k[T+Le]=(O?O[U+Le]:0)^se[Le];return 0}function K(k,T,O,U,$){return z(k,T,null,0,O,U,$)}function F(k,T,O,U,$){var Z=new Uint8Array(32);return G(Z,U,$,H),K(k,T,O,U.subarray(16),Z)}function oe(k,T,O,U,$,Z,ge){var be=new Uint8Array(32);return G(be,Z,ge,H),z(k,T,O,U,$,Z.subarray(16),be)}function te(k,T){var O,U=0;for(O=0;O<17;O++)U=U+(k[O]+T[O]|0)|0,k[O]=U&255,U>>>=8}var W=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function V(k,T,O,U,$,Z){var ge,be,se,pe,Le=new Uint32Array(17),it=new Uint32Array(17),Ut=new Uint32Array(17),vn=new Uint32Array(17),wr=new Uint32Array(17);for(se=0;se<17;se++)it[se]=Ut[se]=0;for(se=0;se<16;se++)it[se]=Z[se];for(it[3]&=15,it[4]&=252,it[7]&=15,it[8]&=252,it[11]&=15,it[12]&=252,it[15]&=15;$>0;){for(se=0;se<17;se++)vn[se]=0;for(se=0;se<16&&se<$;++se)vn[se]=O[U+se];for(vn[se]=1,U+=se,$-=se,te(Ut,vn),be=0;be<17;be++)for(Le[be]=0,se=0;se<17;se++)Le[be]=Le[be]+Ut[se]*(se<=be?it[be-se]:320*it[be+17-se]|0)|0|0;for(be=0;be<17;be++)Ut[be]=Le[be];for(pe=0,se=0;se<16;se++)pe=pe+Ut[se]|0,Ut[se]=pe&255,pe>>>=8;for(pe=pe+Ut[16]|0,Ut[16]=pe&3,pe=5*(pe>>>2)|0,se=0;se<16;se++)pe=pe+Ut[se]|0,Ut[se]=pe&255,pe>>>=8;pe=pe+Ut[16]|0,Ut[16]=pe}for(se=0;se<17;se++)wr[se]=Ut[se];for(te(Ut,W),ge=-(Ut[16]>>>7)|0,se=0;se<17;se++)Ut[se]^=ge&(wr[se]^Ut[se]);for(se=0;se<16;se++)vn[se]=Z[se+16];for(vn[16]=0,te(Ut,vn),se=0;se<16;se++)k[T+se]=Ut[se];return 0}function J(k,T,O,U,$,Z){var ge=new Uint8Array(16);return V(ge,0,O,U,$,Z),ue(k,T,ge,0)}function ce(k,T,O,U,$){var Z;if(O<32)return-1;for(oe(k,0,T,0,O,U,$),V(k,16,k,32,O-32,k),Z=0;Z<16;Z++)k[Z]=0;return 0}function ke(k,T,O,U,$){var Z,ge=new Uint8Array(32);if(O<32||(F(ge,0,32,U,$),J(T,16,T,32,O-32,ge)!==0))return-1;for(oe(k,0,T,0,O,U,$),Z=0;Z<32;Z++)k[Z]=0;return 0}function C(k,T){var O;for(O=0;O<16;O++)k[O]=T[O]|0}function L(k){var T,O;for(O=0;O<16;O++)k[O]+=65536,T=Math.floor(k[O]/65536),k[(O+1)*(O<15?1:0)]+=T-1+37*(T-1)*(O===15?1:0),k[O]-=T*65536}function X(k,T,O){for(var U,$=~(O-1),Z=0;Z<16;Z++)U=$&(k[Z]^T[Z]),k[Z]^=U,T[Z]^=U}function N(k,T){var O,U,$,Z=r(),ge=r();for(O=0;O<16;O++)ge[O]=T[O];for(L(ge),L(ge),L(ge),U=0;U<2;U++){for(Z[0]=ge[0]-65517,O=1;O<15;O++)Z[O]=ge[O]-65535-(Z[O-1]>>16&1),Z[O-1]&=65535;Z[15]=ge[15]-32767-(Z[14]>>16&1),$=Z[15]>>16&1,Z[14]&=65535,X(ge,Z,1-$)}for(O=0;O<16;O++)k[2*O]=ge[O]&255,k[2*O+1]=ge[O]>>8}function ve(k,T){var O=new Uint8Array(32),U=new Uint8Array(32);return N(O,k),N(U,T),B(O,0,U,0)}function Ae(k){var T=new Uint8Array(32);return N(T,k),T[0]&1}function Ee(k,T){var O;for(O=0;O<16;O++)k[O]=T[2*O]+(T[2*O+1]<<8);k[15]&=32767}function le(k,T,O){var U;for(U=0;U<16;U++)k[U]=T[U]+O[U]|0}function Re(k,T,O){var U;for(U=0;U<16;U++)k[U]=T[U]-O[U]|0}function _e(k,T,O){var U,$,Z=new Float64Array(31);for(U=0;U<31;U++)Z[U]=0;for(U=0;U<16;U++)for($=0;$<16;$++)Z[U+$]+=T[U]*O[$];for(U=0;U<15;U++)Z[U]+=38*Z[U+16];for(U=0;U<16;U++)k[U]=Z[U];L(k),L(k)}function Fe(k,T){_e(k,T,T)}function Ht(k,T){var O=r(),U;for(U=0;U<16;U++)O[U]=T[U];for(U=253;U>=0;U--)Fe(O,O),U!==2&&U!==4&&_e(O,O,T);for(U=0;U<16;U++)k[U]=O[U]}function Rt(k,T){var O=r(),U;for(U=0;U<16;U++)O[U]=T[U];for(U=250;U>=0;U--)Fe(O,O),U!==1&&_e(O,O,T);for(U=0;U<16;U++)k[U]=O[U]}function Qt(k,T,O){var U=new Uint8Array(32),$=new Float64Array(80),Z,ge,be=r(),se=r(),pe=r(),Le=r(),it=r(),Ut=r();for(ge=0;ge<31;ge++)U[ge]=T[ge];for(U[31]=T[31]&127|64,U[0]&=248,Ee($,O),ge=0;ge<16;ge++)se[ge]=$[ge],Le[ge]=be[ge]=pe[ge]=0;for(be[0]=Le[0]=1,ge=254;ge>=0;--ge)Z=U[ge>>>3]>>>(ge&7)&1,X(be,se,Z),X(pe,Le,Z),le(it,be,pe),Re(be,be,pe),le(pe,se,Le),Re(se,se,Le),Fe(Le,it),Fe(Ut,be),_e(be,pe,be),_e(pe,se,it),le(it,be,pe),Re(be,be,pe),Fe(se,be),Re(pe,Le,Ut),_e(be,pe,d),le(be,be,Le),_e(pe,pe,be),_e(be,Le,Ut),_e(Le,se,$),Fe(se,it),X(be,se,Z),X(pe,Le,Z);for(ge=0;ge<16;ge++)$[ge+16]=be[ge],$[ge+32]=pe[ge],$[ge+48]=se[ge],$[ge+64]=Le[ge];var vn=$.subarray(32),wr=$.subarray(16);return Ht(vn,vn),_e(wr,wr,vn),N(k,wr),0}function zt(k,T){return Qt(k,T,o)}function tn(k,T){return s(T,32),zt(k,T)}function Yt(k,T,O){var U=new Uint8Array(32);return Qt(U,O,T),G(k,l,U,H)}var nn=ce,Ke=ke;function ht(k,T,O,U,$,Z){var ge=new Uint8Array(32);return Yt(ge,$,Z),nn(k,T,O,U,ge)}function dt(k,T,O,U,$,Z){var ge=new Uint8Array(32);return Yt(ge,$,Z),Ke(k,T,O,U,ge)}function xt(){var k=0,T=0,O=0,U=0,$=65535,Z,ge,be;for(be=0;be<arguments.length;be++)Z=arguments[be].lo,ge=arguments[be].hi,k+=Z&$,T+=Z>>>16,O+=ge&$,U+=ge>>>16;return T+=k>>>16,O+=T>>>16,U+=O>>>16,new t(O&$|U<<16,k&$|T<<16)}function Gt(k,T){return new t(k.hi>>>T,k.lo>>>T|k.hi<<32-T)}function En(){var k=0,T=0,O;for(O=0;O<arguments.length;O++)k^=arguments[O].lo,T^=arguments[O].hi;return new t(T,k)}function st(k,T){var O,U,$=32-T;return T<32?(O=k.hi>>>T|k.lo<<$,U=k.lo>>>T|k.hi<<$):T<64&&(O=k.lo>>>T|k.hi<<$,U=k.hi>>>T|k.lo<<$),new t(O,U)}function sr(k,T,O){var U=k.hi&T.hi^~k.hi&O.hi,$=k.lo&T.lo^~k.lo&O.lo;return new t(U,$)}function fe(k,T,O){var U=k.hi&T.hi^k.hi&O.hi^T.hi&O.hi,$=k.lo&T.lo^k.lo&O.lo^T.lo&O.lo;return new t(U,$)}function we(k){return En(st(k,28),st(k,34),st(k,39))}function He(k){return En(st(k,14),st(k,18),st(k,41))}function Qe(k){return En(st(k,1),st(k,8),Gt(k,7))}function qe(k){return En(st(k,19),st(k,61),Gt(k,6))}var xe=[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 Ie(k,T,O){var U=[],$=[],Z=[],ge=[],be,se,pe;for(se=0;se<8;se++)U[se]=Z[se]=D(k,8*se);for(var Le=0;O>=128;){for(se=0;se<16;se++)ge[se]=D(T,8*se+Le);for(se=0;se<80;se++){for(pe=0;pe<8;pe++)$[pe]=Z[pe];for(be=xt(Z[7],He(Z[4]),sr(Z[4],Z[5],Z[6]),xe[se],ge[se%16]),$[7]=xt(be,we(Z[0]),fe(Z[0],Z[1],Z[2])),$[3]=xt($[3],be),pe=0;pe<8;pe++)Z[(pe+1)%8]=$[pe];if(se%16===15)for(pe=0;pe<16;pe++)ge[pe]=xt(ge[pe],ge[(pe+9)%16],Qe(ge[(pe+1)%16]),qe(ge[(pe+14)%16]))}for(se=0;se<8;se++)Z[se]=xt(Z[se],U[se]),U[se]=Z[se];Le+=128,O-=128}for(se=0;se<8;se++)R(k,8*se,U[se]);return O}var je=new Uint8Array([106,9,230,103,243,188,201,8,187,103,174,133,132,202,167,59,60,110,243,114,254,148,248,43,165,79,245,58,95,29,54,241,81,14,82,127,173,230,130,209,155,5,104,140,43,62,108,31,31,131,217,171,251,65,189,107,91,224,205,25,19,126,33,121]);function Ge(k,T,O){var U=new Uint8Array(64),$=new Uint8Array(256),Z,ge=O;for(Z=0;Z<64;Z++)U[Z]=je[Z];for(Ie(U,T,O),O%=128,Z=0;Z<256;Z++)$[Z]=0;for(Z=0;Z<O;Z++)$[Z]=T[ge-O+Z];for($[O]=128,O=256-128*(O<112?1:0),$[O-9]=0,R($,O-8,new t(ge/536870912|0,ge<<3)),Ie(U,$,O),Z=0;Z<64;Z++)k[Z]=U[Z];return 0}function yt(k,T){var O=r(),U=r(),$=r(),Z=r(),ge=r(),be=r(),se=r(),pe=r(),Le=r();Re(O,k[1],k[0]),Re(Le,T[1],T[0]),_e(O,O,Le),le(U,k[0],k[1]),le(Le,T[0],T[1]),_e(U,U,Le),_e($,k[3],T[3]),_e($,$,b),_e(Z,k[2],T[2]),le(Z,Z,Z),Re(ge,U,O),Re(be,Z,$),le(se,Z,$),le(pe,U,O),_e(k[0],ge,be),_e(k[1],pe,se),_e(k[2],se,be),_e(k[3],ge,pe)}function ut(k,T,O){var U;for(U=0;U<4;U++)X(k[U],T[U],O)}function xn(k,T){var O=r(),U=r(),$=r();Ht($,T[2]),_e(O,T[0],$),_e(U,T[1],$),N(k,U),k[31]^=Ae(O)<<7}function cn(k,T,O){var U,$;for(C(k[0],c),C(k[1],f),C(k[2],f),C(k[3],c),$=255;$>=0;--$)U=O[$/8|0]>>($&7)&1,ut(k,T,U),yt(T,k),yt(k,k),ut(k,T,U)}function wi(k,T){var O=[r(),r(),r(),r()];C(O[0],g),C(O[1],x),C(O[2],f),_e(O[3],g,x),cn(k,O,T)}function mn(k,T,O){var U=new Uint8Array(64),$=[r(),r(),r(),r()],Z;for(O||s(T,32),Ge(U,T,32),U[0]&=248,U[31]&=127,U[31]|=64,wi($,U),xn(k,$),Z=0;Z<32;Z++)T[Z+32]=k[Z];return 0}var vr=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 Rr(k,T){var O,U,$,Z;for(U=63;U>=32;--U){for(O=0,$=U-32,Z=U-12;$<Z;++$)T[$]+=O-16*T[U]*vr[$-(U-32)],O=Math.floor((T[$]+128)/256),T[$]-=O*256;T[$]+=O,T[U]=0}for(O=0,$=0;$<32;$++)T[$]+=O-(T[31]>>4)*vr[$],O=T[$]>>8,T[$]&=255;for($=0;$<32;$++)T[$]-=O*vr[$];for(U=0;U<32;U++)T[U+1]+=T[U]>>8,k[U]=T[U]&255}function Cn(k){var T=new Float64Array(64),O;for(O=0;O<64;O++)T[O]=k[O];for(O=0;O<64;O++)k[O]=0;Rr(k,T)}function Vr(k,T,O,U){var $=new Uint8Array(64),Z=new Uint8Array(64),ge=new Uint8Array(64),be,se,pe=new Float64Array(64),Le=[r(),r(),r(),r()];Ge($,U,32),$[0]&=248,$[31]&=127,$[31]|=64;var it=O+64;for(be=0;be<O;be++)k[64+be]=T[be];for(be=0;be<32;be++)k[32+be]=$[32+be];for(Ge(ge,k.subarray(32),O+32),Cn(ge),wi(Le,ge),xn(k,Le),be=32;be<64;be++)k[be]=U[be];for(Ge(Z,k,O+64),Cn(Z),be=0;be<64;be++)pe[be]=0;for(be=0;be<32;be++)pe[be]=ge[be];for(be=0;be<32;be++)for(se=0;se<32;se++)pe[be+se]+=Z[be]*$[se];return Rr(k.subarray(32),pe),it}function Yr(k,T){var O=r(),U=r(),$=r(),Z=r(),ge=r(),be=r(),se=r();return C(k[2],f),Ee(k[1],T),Fe($,k[1]),_e(Z,$,m),Re($,$,k[2]),le(Z,k[2],Z),Fe(ge,Z),Fe(be,ge),_e(se,be,ge),_e(O,se,$),_e(O,O,Z),Rt(O,O),_e(O,O,$),_e(O,O,Z),_e(O,O,Z),_e(k[0],O,Z),Fe(U,k[0]),_e(U,U,Z),ve(U,$)&&_e(k[0],k[0],v),Fe(U,k[0]),_e(U,U,Z),ve(U,$)?-1:(Ae(k[0])===T[31]>>7&&Re(k[0],c,k[0]),_e(k[3],k[0],k[1]),0)}function Gr(k,T,O,U){var $,Z=new Uint8Array(32),ge=new Uint8Array(64),be=[r(),r(),r(),r()],se=[r(),r(),r(),r()];if(O<64||Yr(se,U))return-1;for($=0;$<O;$++)k[$]=T[$];for($=0;$<32;$++)k[$+32]=U[$];if(Ge(ge,k,O),Cn(ge),cn(be,se,ge),wi(se,T.subarray(32)),yt(be,se),xn(Z,be),O-=64,B(T,0,Z,0)){for($=0;$<O;$++)k[$]=0;return-1}for($=0;$<O;$++)k[$]=T[$+64];return O}var Si=32,Mr=24,An=32,Dr=16,he=32,Ne=32,De=32,Je=32,Ve=32,pt=Mr,nt=An,Be=Dr,Ue=64,rt=32,vt=64,qt=32,Dn=64;e.lowlevel={crypto_core_hsalsa20:G,crypto_stream_xor:oe,crypto_stream:F,crypto_stream_salsa20_xor:z,crypto_stream_salsa20:K,crypto_onetimeauth:V,crypto_onetimeauth_verify:J,crypto_verify_16:ue,crypto_verify_32:B,crypto_secretbox:ce,crypto_secretbox_open:ke,crypto_scalarmult:Qt,crypto_scalarmult_base:zt,crypto_box_beforenm:Yt,crypto_box_afternm:nn,crypto_box:ht,crypto_box_open:dt,crypto_box_keypair:tn,crypto_hash:Ge,crypto_sign:Vr,crypto_sign_keypair:mn,crypto_sign_open:Gr,crypto_secretbox_KEYBYTES:Si,crypto_secretbox_NONCEBYTES:Mr,crypto_secretbox_ZEROBYTES:An,crypto_secretbox_BOXZEROBYTES:Dr,crypto_scalarmult_BYTES:he,crypto_scalarmult_SCALARBYTES:Ne,crypto_box_PUBLICKEYBYTES:De,crypto_box_SECRETKEYBYTES:Je,crypto_box_BEFORENMBYTES:Ve,crypto_box_NONCEBYTES:pt,crypto_box_ZEROBYTES:nt,crypto_box_BOXZEROBYTES:Be,crypto_sign_BYTES:Ue,crypto_sign_PUBLICKEYBYTES:rt,crypto_sign_SECRETKEYBYTES:vt,crypto_sign_SEEDBYTES:qt,crypto_hash_BYTES:Dn,gf:r,D:m,L:vr,pack25519:N,unpack25519:Ee,M:_e,A:le,S:Fe,Z:Re,pow2523:Rt,add:yt,set25519:C,modL:Rr,scalarmult:cn,scalarbase:wi};function ns(k,T){if(k.length!==Si)throw new Error("bad key size");if(T.length!==Mr)throw new Error("bad nonce size")}function rs(k,T){if(k.length!==De)throw new Error("bad public key size");if(T.length!==Je)throw new Error("bad secret key size")}function Jt(){for(var k=0;k<arguments.length;k++)if(!(arguments[k]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Jr(k){for(var T=0;T<k.length;T++)k[T]=0}e.randomBytes=function(k){var T=new Uint8Array(k);return s(T,k),T},e.secretbox=function(k,T,O){Jt(k,T,O),ns(O,T);for(var U=new Uint8Array(An+k.length),$=new Uint8Array(U.length),Z=0;Z<k.length;Z++)U[Z+An]=k[Z];return ce($,U,U.length,T,O),$.subarray(Dr)},e.secretbox.open=function(k,T,O){Jt(k,T,O),ns(O,T);for(var U=new Uint8Array(Dr+k.length),$=new Uint8Array(U.length),Z=0;Z<k.length;Z++)U[Z+Dr]=k[Z];return U.length<32||ke($,U,U.length,T,O)!==0?null:$.subarray(An)},e.secretbox.keyLength=Si,e.secretbox.nonceLength=Mr,e.secretbox.overheadLength=Dr,e.scalarMult=function(k,T){if(Jt(k,T),k.length!==Ne)throw new Error("bad n size");if(T.length!==he)throw new Error("bad p size");var O=new Uint8Array(he);return Qt(O,k,T),O},e.scalarMult.base=function(k){if(Jt(k),k.length!==Ne)throw new Error("bad n size");var T=new Uint8Array(he);return zt(T,k),T},e.scalarMult.scalarLength=Ne,e.scalarMult.groupElementLength=he,e.box=function(k,T,O,U){var $=e.box.before(O,U);return e.secretbox(k,T,$)},e.box.before=function(k,T){Jt(k,T),rs(k,T);var O=new Uint8Array(Ve);return Yt(O,k,T),O},e.box.after=e.secretbox,e.box.open=function(k,T,O,U){var $=e.box.before(O,U);return e.secretbox.open(k,T,$)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var k=new Uint8Array(De),T=new Uint8Array(Je);return tn(k,T),{publicKey:k,secretKey:T}},e.box.keyPair.fromSecretKey=function(k){if(Jt(k),k.length!==Je)throw new Error("bad secret key size");var T=new Uint8Array(De);return zt(T,k),{publicKey:T,secretKey:new Uint8Array(k)}},e.box.publicKeyLength=De,e.box.secretKeyLength=Je,e.box.sharedKeyLength=Ve,e.box.nonceLength=pt,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(k,T){if(Jt(k,T),T.length!==vt)throw new Error("bad secret key size");var O=new Uint8Array(Ue+k.length);return Vr(O,k,k.length,T),O},e.sign.open=function(k,T){if(Jt(k,T),T.length!==rt)throw new Error("bad public key size");var O=new Uint8Array(k.length),U=Gr(O,k,k.length,T);if(U<0)return null;for(var $=new Uint8Array(U),Z=0;Z<$.length;Z++)$[Z]=O[Z];return $},e.sign.detached=function(k,T){for(var O=e.sign(k,T),U=new Uint8Array(Ue),$=0;$<U.length;$++)U[$]=O[$];return U},e.sign.detached.verify=function(k,T,O){if(Jt(k,T,O),T.length!==Ue)throw new Error("bad signature size");if(O.length!==rt)throw new Error("bad public key size");var U=new Uint8Array(Ue+k.length),$=new Uint8Array(Ue+k.length),Z;for(Z=0;Z<Ue;Z++)U[Z]=T[Z];for(Z=0;Z<k.length;Z++)U[Z+Ue]=k[Z];return Gr($,U,U.length,O)>=0},e.sign.keyPair=function(){var k=new Uint8Array(rt),T=new Uint8Array(vt);return mn(k,T),{publicKey:k,secretKey:T}},e.sign.keyPair.fromSecretKey=function(k){if(Jt(k),k.length!==vt)throw new Error("bad secret key size");for(var T=new Uint8Array(rt),O=0;O<T.length;O++)T[O]=k[32+O];return{publicKey:T,secretKey:new Uint8Array(k)}},e.sign.keyPair.fromSeed=function(k){if(Jt(k),k.length!==qt)throw new Error("bad seed size");for(var T=new Uint8Array(rt),O=new Uint8Array(vt),U=0;U<32;U++)O[U]=k[U];return mn(T,O,!0),{publicKey:T,secretKey:O}},e.sign.publicKeyLength=rt,e.sign.secretKeyLength=vt,e.sign.seedLength=qt,e.sign.signatureLength=Ue,e.hash=function(k){Jt(k);var T=new Uint8Array(Dn);return Ge(T,k,k.length),T},e.hash.hashLength=Dn,e.verify=function(k,T){return Jt(k,T),k.length===0||T.length===0||k.length!==T.length?!1:I(k,0,T,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 T=65536;e.setPRNG(function(O,U){var $,Z=new Uint8Array(U);for($=0;$<U;$+=T)k.getRandomValues(Z.subarray($,$+Math.min(U-$,T)));for($=0;$<U;$++)O[$]=Z[$];Jr(Z)})}else typeof require<"u"&&(k=require("crypto"),k&&k.randomBytes&&e.setPRNG(function(O,U){var $,Z=k.randomBytes(U);for($=0;$<U;$++)O[$]=Z[$];Jr(Z)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const du=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,Q2={fromSeed:du.sign.keyPair.fromSeed,sign:du.sign.detached,verify:du.sign.detached.verify,randomBytes:du.randomBytes};let _x;function Z2(e){_x=e}function Gi(){return _x}const W2=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^W2[(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);A(this,"name");A(this,"code");A(this,"chainedError");this.name="NKeysError",this.code=r,this.chainedError=s}}function ek(){return Qu(Tt.Operator)}function tk(){return Qu(Tt.Account)}function nk(){return Qu(Tt.User)}var kt;(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"})(kt||(kt={}));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 ha{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 On{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new Ot(kt.SerializationError);if(!ha.isValidPrefix(t))throw new Ot(kt.InvalidPrefixByte);return On._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new Ot(kt.ApiError);if(!ha.isValidPublicPrefix(t))throw new Ot(kt.InvalidPrefixByte);if(r.byteLength!==32)throw new Ot(kt.InvalidSeedLen);return On._encode(!0,t,r)}static decode(t,r){if(!ha.isValidPrefix(t))throw new Ot(kt.InvalidPrefixByte);const s=On._decode(r);if(s[0]!==t)throw new Ot(kt.InvalidPrefixByte);return s.slice(1)}static decodeSeed(t){const r=On._decode(t),s=On._decodePrefix(r);if(s[0]!=Tt.Seed)throw new Ot(kt.InvalidSeed);if(!ha.isValidPublicPrefix(s[1]))throw new Ot(kt.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=On._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(kt.InvalidEncoding);let r;try{r=M0.decode(t)}catch(f){throw new Ot(kt.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(kt.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){A(this,"seed");this.seed=t}getRawSeed(){if(!this.seed)throw new Ot(kt.ClearedPair);return On.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new Ot(kt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new Ot(kt.ClearedPair);const t=On.decodeSeed(this.seed),r=Gi().fromSeed(this.getRawSeed()),s=On.encode(t.prefix,r.publicKey);return new TextDecoder().decode(s)}getPrivateKey(){if(!this.seed)throw new Ot(kt.ClearedPair);const t=Gi().fromSeed(this.getRawSeed());return On.encode(Tt.Private,t.secretKey)}sign(t){if(!this.seed)throw new Ot(kt.ClearedPair);const r=Gi().fromSeed(this.getRawSeed());return Gi().sign(t,r.secretKey)}verify(t,r){if(!this.seed)throw new Ot(kt.ClearedPair);const s=Gi().fromSeed(this.getRawSeed());return Gi().verify(t,r,s.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Qu(e){const t=Gi().randomBytes(32);let r=On.encodeSeed(e,new Uint8Array(t));return new kx(r)}class rk{constructor(t){A(this,"publicKey");this.publicKey=t}getPublicKey(){if(!this.publicKey)throw new Ot(kt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new Ot(kt.PublicKeyOnly):new Ot(kt.ClearedPair)}getSeed(){throw this.publicKey?new Ot(kt.PublicKeyOnly):new Ot(kt.ClearedPair)}sign(t){throw this.publicKey?new Ot(kt.CannotSign):new Ot(kt.ClearedPair)}verify(t,r){if(!this.publicKey)throw new Ot(kt.ClearedPair);let s=On._decode(this.publicKey);return Gi().verify(t,r,s.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function ik(e){const t=new TextEncoder().encode(e),r=On._decode(t),s=ha.parsePrefix(r[0]);if(ha.isValidPublicPrefix(s))return new rk(t);throw new Ot(kt.InvalidPublicKey)}function sk(e){return On.decodeSeed(e),new kx(e)}function ak(e){return btoa(String.fromCharCode(...e))}function lk(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}Z2(Q2);const D0={createAccount:tk,createOperator:ek,createPair:Qu,createUser:nk,fromPublic:ik,fromSeed:sk,NKeysError:Ot,NKeysErrorCode:kt,Prefix:Tt,decode:lk,encode:ak};function ok(e){return t=>{let r={};return e.forEach(s=>{const l=s(t)||{};r=Object.assign(r,l)}),r}}function uk(){return()=>{}}function ck(e,t){return()=>{const r=typeof e=="function"?e():e,s=typeof t=="function"?t():t;return{user:r,pass:s}}}function fk(e){return()=>({auth_token:typeof e=="function"?e():e})}function hk(e){return t=>{const r=typeof e=="function"?e():e,s=r?D0.fromSeed(r):void 0,l=s?s.getPublicKey():"",o=es.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=hk(t),{nkey:o,sig:c}=l(r);return{jwt:s,nkey:o,sig:c}}}const Cx=120*1e3,dk=2,Ax=2*1e3;function mk(){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 pk(e){const t=[];return typeof e.authenticator=="function"&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(fk(e.token)),e.user&&t.push(ck(e.user,e.pass)),t.length===0?uk():ok(t)}function gk(e){const t=`${nd}:${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 Me("port and servers options are mutually exclusive",Ce.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${nd}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);const r=Ju(mk(),e);if(r.authenticator=pk(r),["reconnectDelayHandler","authenticator"].forEach(s=>{if(r[s]&&typeof r[s]!="function")throw new Me(`${s} option should be a function`,Ce.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{gi(r.inboxPrefix)}catch(s){throw new Me(s.message,Ce.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof ud()=="function"),r.resolve&&typeof ud()!="function")throw new Me("'resolve' is not supported on this client",Ce.InvalidOption);return r}function yk(e,t){const{proto:r,tls_required:s,tls_available:l}=e;if((r===void 0||r<1)&&t.noEcho)throw new Me("noEcho",Ce.ServerOptionNotAvailable);const o=s||l||!1;if(t.tls&&!o)throw new Me("tls",Ce.ServerOptionNotAvailable)}const bk=1024*32,xk=/^INFO\s+([^\r\n]+)\r\n/i,vk=Tl(`PONG\r
|
|
72
|
+
`),L0=Tl(`PING\r
|
|
73
|
+
`);class wk{constructor(t,r,s){A(this,"echo");A(this,"no_responders");A(this,"protocol");A(this,"verbose");A(this,"pedantic");A(this,"jwt");A(this,"nkey");A(this,"sig");A(this,"user");A(this,"pass");A(this,"auth_token");A(this,"tls_required");A(this,"name");A(this,"lang");A(this,"version");A(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 dn{constructor(r,s,l={}){var c;super();A(this,"sid");A(this,"queue");A(this,"draining");A(this,"max");A(this,"subject");A(this,"drained");A(this,"protocol");A(this,"timer");A(this,"info");A(this,"cleanupFn");A(this,"closed");A(this,"requestSubject");Ju(this,l),this.protocol=r,this.subject=s,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=$t();const o=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=va(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(Me.errorForCode(Ce.ConnectionClosed)):this.isClosed()?Promise.reject(Me.errorForCode(Ce.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush($t()).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 Sk{constructor(){A(this,"mux");A(this,"subs");A(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){A(this,"connected");A(this,"connectedOnce");A(this,"infoReceived");A(this,"info");A(this,"muxSubscriptions");A(this,"options");A(this,"outbound");A(this,"pongs");A(this,"subscriptions");A(this,"transport");A(this,"noMorePublishing");A(this,"connectError");A(this,"publisher");A(this,"_closed");A(this,"closed");A(this,"listeners");A(this,"heartbeats");A(this,"parser");A(this,"outMsgs");A(this,"inMsgs");A(this,"outBytes");A(this,"inBytes");A(this,"pendingLimit");A(this,"lastError");A(this,"abortReconnect");A(this,"whyClosed");A(this,"servers");A(this,"server");A(this,"features");A(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=bk,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=t,this.publisher=r,this.subscriptions=new Sk,this.muxSubscriptions=new Y2,this.outbound=new Sa,this.pongs=[],this.whyClosed="",this.pendingLimit=t.pendingLimit||this.pendingLimit,this.features=new C2({major:0,minor:0,micro:0}),this.connectPromise=null;const s=typeof t.servers=="string"?[t.servers]:t.servers;this.servers=new V2(s,{randomize:!t.noRandomize}),this.closed=$t(),this.parser=new R0(this),this.heartbeats=new G2(this,this.options.pingInterval||Cx,this.options.maxPingOut||dk)}resetOutbound(){this.outbound.reset();const t=this.pongs;this.pongs=[];const r=Me.errorForCode(Ce.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 dn;return this.listeners.push(t),t}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const t=$t();return t.catch(()=>{}),this.pongs.unshift(t),this.connectError=r=>{t.reject(r)},this.transport=N2(),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:da.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:da.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(t){this.dispatchStatus({type:di.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:di.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===Ce.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=va(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:ud(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const o of s)try{l=null,this.dispatchStatus({type:da.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:Me.errorForCode(Ce.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 ja(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 Me(t,Ce.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 Me(t,Ce.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Me(t,Ce.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Me(t,Ce.AccountExpired):r.indexOf("authentication timeout")!==-1?new Me(t,Ce.AuthenticationTimeout):new Me(t,Ce.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:di.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(vk)}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(Ss(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:o,lang:c}=this.transport;try{const f=new wk({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(Tl(`CONNECT ${d}${ku}`)),this.transport.send(L0)}catch(f){this._close(f)}}s&&this.dispatchStatus({type:di.Update,data:s}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:di.LDM,data:this.servers.getCurrentServer().toString()})}push(t){switch(t.kind){case Tn.MSG:{const{msg:r,data:s}=t;this.processMsg(r,s);break}case Tn.OK:break;case Tn.ERR:this.processError(t.data);break;case Tn.PING:this.processPing();break;case Tn.PONG:this.processPong();break;case Tn.INFO:this.processInfo(t.data);break}}sendCommand(t,...r){const s=this.outbound.length();let l;typeof t=="string"?l=Tl(t):l=t,this.outbound.fill(l,...r),s===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(t,r=rr,s){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=es.encode(r);else throw Me.errorForCode(Ce.BadPayload);let o=l.length;s=s||{},s.reply=s.reply||"";let c=rr,f=0;if(s.headers){if(this.info&&!this.info.headers)throw new Me("headers",Ce.ServerOptionNotAvailable);c=s.headers.encode(),f=c.length,o=l.length+f}if(this.info&&o>this.info.max_payload)throw Me.errorForCode(Ce.MaxPayloadExceeded);this.outBytes+=o,this.outMsgs++;let d;s.headers?(s.reply?d=`HPUB ${t} ${s.reply} ${f} ${o}\r
|
|
74
74
|
`:d=`HPUB ${t} ${f} ${o}\r
|
|
75
75
|
`,this.sendCommand(d,c,l,Lu)):(s.reply?d=`PUB ${t} ${s.reply} ${o}\r
|
|
76
76
|
`:d=`PUB ${t} ${o}\r
|
|
@@ -78,44 +78,40 @@ ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(s),this.cance
|
|
|
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=Gt()),this.pongs.push(t),this.outbound.fill(z0),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(Tl(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 Nx(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 _k="$SRV";class U0{constructor(t){A(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||xi(),(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 ql{constructor(t,r="",s=""){A(this,"subject");A(this,"queue");A(this,"srv");r!==""&&Ek("service group",r);let l="";if(t instanceof Xl)this.srv=t,l="";else if(t instanceof ql){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;jl("endpoint",t);let{subject:l,handler:o,metadata:c,queue:f}=s;l=l||t,f=f||this.queue,kk("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 ql(this,t,r)}}function kk(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 Ek(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 Xl{constructor(t,r={name:"",version:""}){A(this,"nc");A(this,"_id");A(this,"config");A(this,"handlers");A(this,"internal");A(this,"_stopped");A(this,"_done");A(this,"started");this.nc=t,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),jl("name",this.config.name),jl("queue",this.config.queue),Ss(this.config.version),this._id=Qi.next(),this.internal=[],this._done=Gt(),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??_k;return r===""&&s===""?`${o}.${t}`:(jl("control subject name",r),s!==""?(jl("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=xi();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 Ck(l,o,s),f.queue=s;const d=c?(m,b)=>{if(m){this.close(m);return}const g=Date.now();try{c(m,new U0(b))}catch(x){f.stats.countError(x),b==null||b.respond(ar,{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 b=new Error(`required subscription ${t.subject} errored: ${m.message}`);b.stack=m.stack,this.close(b).catch()}}),f}info(){return{type:Ol.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:Ol.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=Xl.controlSubject(r,l,o),c.handler=s,this.setupHandler(c,!0)}start(){const t=Rr(),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(Ji.PING,o),this.addInternalHandler(Ji.STATS,r),this.addInternalHandler(Ji.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:Ol.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 ql(this,t,r)}addEndpoint(t,r){return new ql(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 U0(o))},r.iterClosed.then(()=>{this.close().catch()}));const s=this.setupHandler(t,!1);return s.qi=r,this.handlers.push(s),r}}class Ck{constructor(t,r,s=""){A(this,"name");A(this,"subject");A(this,"average_processing_time");A(this,"num_requests");A(this,"processing_time");A(this,"num_errors");A(this,"last_error");A(this,"data");A(this,"metadata");A(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+=Yt(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=Yt(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 Ak{constructor(t,r={strategy:Or.JitterTimer,maxWait:2e3},s){A(this,"nc");A(this,"prefix");A(this,"opts");this.nc=t,this.prefix=s,this.opts=r}ping(t="",r=""){return this.q(Ji.PING,t,r)}stats(t="",r=""){return this.q(Ji.STATS,t,r)}info(t="",r=""){return this.q(Ji.INFO,t,r)}async q(t,r="",s=""){const l=new xn,o=Rr(),c=Xl.controlSubject(t,r,s,this.prefix),f=await this.nc.requestMany(c,ar,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 Tx(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function jk(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Tx(),storage:ad.File}}const Pu="KV-Operation",P0="$KV",Nk=/^[-/=.\w]+$/,Tk=/^[-/=.>*\w]+$/,Ok=/^[-\w]+$/;function Rk(e){if(e.startsWith(".")||e.endsWith(".")||!Nk.test(e))throw new Error(`invalid key: ${e}`)}function Mk(e){if(e.startsWith(".")||e.endsWith(".")||!Tk.test(e))throw new Error(`invalid key: ${e}`)}function Dk(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(!Ok.test(e))throw new Error(`invalid bucket name: ${e}`)}var Fr;(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"})(Fr||(Fr={}));class Il{constructor(t,r,s){A(this,"js");A(this,"jsm");A(this,"stream");A(this,"bucket");A(this,"direct");A(this,"codec");A(this,"prefix");A(this,"editPrefix");A(this,"useJsPrefix");A(this,"_prefixLen");A(this,"validateKey",Rk);A(this,"validateSearchKey",Mk);A(this,"hasWildcards",Dk);Eu(t),this.js=r,this.jsm=s,this.bucket=t,this.prefix=P0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(t,r,s={}){Eu(r);const l=await t.jetstreamManager(),o=new Il(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 Il(r,t,l);return o.config.name=s.streamName??c.bucketName(),Object.assign(c,o),c.stream=o.config.name,c.codec=s.codec||Tx(),c.direct=o.config.allow_direct??!1,c.initializePrefixes(o),c}async init(t={}){const r=Object.assign(jk(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=sd.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(nr)||(g.name=`${nr}${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(nr)?v.name.substring(nr.length):v.name;return v.name.startsWith(nr)||(v.name=`${nr}${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?Zi.S2:Zi.None);const o=this.js.nc,c=o.getServerVersion(),f=c?od(c,Ss("2.7.2"))>=0:!1;s.discard=f?Hl.New:Hl.Old;const{ok:d,min:m}=o.features.get(bt.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=Yt(r.ttl)),s.allow_rollup_hdrs=!0;let b;try{b=await this.jsm.streams.info(s.name),!b.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")b=await this.jsm.streams.add(s);else throw g}this.initializePrefixes(b)}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(nr)&&(s=s.substring(nr.length)),r.external&&r.external.api!==""){const l=r.name.substring(nr.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${nr}${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}`:`${P0}.${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(zn.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new Xk(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new Kk(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=xi();o.headers=d,d.set(Fr.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=Gt(),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=xi();o.set(Pu,r),r==="PURGE"&&o.set(zn.RollupHdr,zn.RollupValueSubject),s!=null&&s.previousSeq&&o.set(Fr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),ar,{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=sn.LastPerSubject;r===Nr.AllHistory&&(c=sn.All),r===Nr.UpdatesOnly&&(c=sn.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:Yt(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,Nr.AllHistory,l),d=f.filter_subject,m=Ki(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 b=await this.js.subscribe(d,m);if(o){const{info:{last:g}}=b,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=b,s.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(bt.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=Nr.LastValue;t.include===Nr.AllHistory?o=Nr.AllHistory:t.include===Nr.UpdatesOnly&&(o=Nr.UpdatesOnly);const c=t.ignoreDeletes===!0;let f=t.initializedFn,d=0;const m=this._buildCC(r,o,l),b=m.filter_subject,g=Ki(m);this.canSetWatcherName()&&g.consumerName(Qi.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 N=this.jmToEntry(S);if(c&&N.operation==="DEL")return;s.push(N),s.received++,f&&(d>0&&s.received>=d||S.info.pending===0)&&(s.push(f),f=void 0)}});const x=await this.js.subscribe(b,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(N){s.stop(N)}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,Nr.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,o=Ki(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 b=(d=m.headers)==null?void 0:d.get(Pu);if(b!=="DEL"&&b!=="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 Ox(l,r)}}class Ox{constructor(t,r=""){A(this,"si");A(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(nr)?this.si.config.name.substring(nr.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 Pd(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!==Zi.None:!1}}const qd="OBJ_",B0="SHA-256=";function Lk(e){return Eu(e),`${qd}${e}`}function zk(e){return e.startsWith(qd)?e.substring(4):e}class hd{constructor(t){A(this,"si");A(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return zk(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!==Zi.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 vr;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(vr||(vr={}));var $r;(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"})($r||($r={}));var ya;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(ya||(ya={}));const H0=Uint8Array.of(43,65,67,75),Uk=Uint8Array.of(45,78,65,75),Sl=Uint8Array.of(43,87,80,73),Pk=Uint8Array.of(43,78,88,84),Bk=Uint8Array.of(43,84,69,82,77),Hk=Uint8Array.of(32);function Fl(e,t=5e3){return new rE(e,t)}class Ah extends xn{constructor(r,s,l=!1){super();A(this,"consumer");A(this,"opts");A(this,"sub");A(this,"monitor");A(this,"pending");A(this,"inbox");A(this,"refilling");A(this,"pong");A(this,"callback");A(this,"timeout");A(this,"cleanupHandler");A(this,"listeners");A(this,"statusIterator");A(this,"forOrderedConsumer");A(this,"resetHandler");A(this,"abortOnMissingResource");A(this,"bind");A(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=yi(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(id(m))return;const N=(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:M,bytesLeft:P}=this.parseDiscard(m.headers);if(M>0||P>0)this.pending.msgs-=M,this.pending.bytes-=P,this.pending.requests--,this.notify(ya.Discard,{msgsLeft:M,bytesLeft:P});else if(N===400){this.stop(new Me(D,`${N}`));return}else if(N===409&&D==="consumer deleted"){if(this.notify($r.ConsumerDeleted,`${N} ${D}`),!this.refilling||this.abortOnMissingResource){const I=new Me(D,`${N}`);this.stop(I);return}}else if(N===503){if(this.notify($r.NoResponders,`${N} No Responders`),!this.refilling||this.abortOnMissingResource){const I=new Me("no responders",`${N}`);this.stop(I);return}}else this.notify(ya.DebugEvent,`${N} ${D}`)}else this._push(Fl(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 N=this.pullOptions();this.pull(N)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Hd(l,d=>(this.notify($r.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 b of d)switch(b.type){case mi.Disconnect:(m=this.monitor)==null||m.cancel();break;case mi.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=Ud([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($r.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify($r.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=ja(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(ya.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=Yt(this.opts.idle_heartbeat),o=Yt(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(zn.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const o=r==null?void 0:r.get(zn.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 qk extends xn{constructor(){super();A(this,"src");A(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 dd{constructor(t,r){A(this,"api");A(this,"_info");A(this,"stream");A(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=va(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=Gt(),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===$r.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=va(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 Ik{constructor(t,r,s={}){A(this,"api");A(this,"consumerOpts");A(this,"consumer");A(this,"opts");A(this,"cursor");A(this,"stream");A(this,"namePrefix");A(this,"serial");A(this,"currentConsumer");A(this,"userCallback");A(this,"iter");A(this,"type");A(this,"startSeq");A(this,"maxInitialReset");this.api=t,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Qi.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=vr.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:sn.StartSequence,opt_start_seq:t,ack_policy:bn.None,inactive_threshold:Yt(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||sn.StartSequence,(this.consumerOpts.deliver_policy===sn.LastPerSubject||this.consumerOpts.deliver_policy===sn.New||this.consumerOpts.deliver_policy===sn.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===sn.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=sn.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=Yt(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var c,f,d,m,b;Qi.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=Ud([((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($r.OrderedConsumerRecreated,o.name);break}catch(x){if(x.message==="stream not found"&&((m=this.iter)==null||m.notify($r.StreamNotFound,g),this.type===vr.Fetch||this.opts.abort_on_missing_resource===!0))return(b=this.iter)==null||b.stop(x),Promise.reject(x);if(r&&g>=this.maxInitialReset)throw x;await ja(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===vr.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 qk),this.consumer=new dd(this.api,this.currentConsumer);const o=t;o.callback=this.internalHandler(this.serial);let c=null;this.type===vr.Fetch&&s?c=await this.consumer.fetch(t):this.type===vr.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(ya.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===vr.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===vr.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=vr.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===vr.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=vr.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=Gt();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 md{constructor(t){A(this,"api");A(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(bt.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 dd(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 dd(this.api,s)).catch(s=>Promise.reject(s)))}async ordered(t,r){await this.checkVersion();const s=this.api;return new Id(s.nc,s.opts).info(t).then(o=>Promise.resolve(new Ik(this.api,t,r))).catch(o=>Promise.reject(o))}}class Zu{constructor(t,r){A(this,"api");A(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 md(new Du(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new md(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 Id extends Jl{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:o}=r.features.get(bt.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(bt.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(bt.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(bt.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(bt.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(bt.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),Rn(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 Rn(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),Rn(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){Rn(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],b=r||{};let g=0;for(;c>d;){g++,b.offset=f*g;const v=await this._request(s,b);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 Nl(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 Rn(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){Rn(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){Rn(t);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${t}`,r);return new Rx(l)}find(t){return this.findStream(t)}listKvs(){const t=s=>{var d;const o=s.streams.filter(m=>m.config.name.startsWith(nr));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 Ox(m,c))},r=`${this.prefix}.STREAM.LIST`;return new Nl(r,t,this)}listObjectStores(){const t=s=>{const o=s.streams.filter(f=>f.config.name.startsWith(qd));return o.forEach(f=>{this._fixInfo(f)}),o.map(f=>new hd(f))},r=`${this.prefix}.STREAM.LIST`;return new Nl(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=o=>o.streams,l=`${this.prefix}.STREAM.NAMES`;return new Nl(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new Zu(this,r))}}class Fk extends Jl{constructor(t,r){super(t,r)}async getMessage(t,r){Rn(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const o=s?this.jc.encode(s):ar,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=pa(d);if(m)return Promise.reject(m);const b=new pd(d);return Promise.resolve(b)}async getBatch(t,r){Rn(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:Or.SentinelMsg});return(async()=>{var g,x,v;let d=!1,m=!1,b;for await(const S of f){if(!d){d=!0;const N=((g=S.headers)==null?void 0:g.code)||0;if(N!==0&&N<200||N>299){b=(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 pd(S))}c.push(()=>{if(m)throw new Error("batch direct get not supported by the server");if(b)throw new Error(`bad request: ${b}`);c.stop()})})(),Promise.resolve(c)}}class pd{constructor(t){A(this,"data");A(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(fa.Subject)}get seq(){const t=this.header.last(fa.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(fa.TimeStamp)}get stream(){return this.header.last(fa.Stream)}json(t){return Rr(t).decode(this.data)}string(){return rr.decode(this.data)}}A(pd,"jc");class $k extends Jl{constructor(r,s){super(r,s);A(this,"streams");A(this,"consumers");A(this,"direct");this.streams=new Id(r,s),this.consumers=new Du(r,s),this.direct=new Fk(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 Rx{constructor(t){A(this,"_header");A(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):ar}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=Xi.decode(t)}else this._header=xi();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 Rr(t).decode(this.data)}string(){return rr.decode(this.data)}}A(Rx,"jc");class Vk{constructor(t){A(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new Zu(this.api,r))}}class jh{constructor(t){A(this,"info");A(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Xi.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 q0(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 Yk(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Ml{constructor(t,r,s){A(this,"jsm");A(this,"js");A(this,"stream");A(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=Rr().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 hd(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new hd(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var ue;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout: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=((ue=t.options)==null?void 0:ue.max_chunk_size)||128*1024;m=m>d?d:m,t.options.max_chunk_size=m;const b=await this.info(t.name),{name:g,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Qi.next(),S=this._chunkSubject(v),N=this._metaSubject(g),D=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},q0(t)),M=Gt(),P=[],I=new Sa;try{const H=r?r.getReader():null,O=T0.create();for(;;){const{done:ee,value:G}=H?await H.read():{done:!0,value:void 0};if(ee){if(I.size()>0){const F=I.drain();O.update(F),D.chunks++,D.size+=F.length,P.push(this.js.publish(S,F,{timeout:o}))}await Promise.all(P),P.length=0,D.mtime=new Date().toISOString();const B=ga.encode(O.digest());D.digest=`${B0}${B}`,D.deleted=!1;const z=xi();typeof c=="number"&&z.set(Fr.ExpectedLastSubjectSequenceHdr,`${c}`),z.set(zn.RollupHdr,zn.RollupValueSubject);const X=await this.js.publish(N,Rr().encode(D),{headers:z,timeout:o});if(D.revision=X.seq,b)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${b.nuid}`})}catch{}M.resolve(new jh(D));break}if(G)for(I.fill(G);I.size()>m;){D.chunks++,D.size+=m;const B=I.drain(t.options.max_chunk_size);O.update(B),P.push(this.js.publish(S,B,{timeout:o}))}}}catch(H){await this.jsm.streams.purge(this.stream,{filter:S}),M.reject(H)}return M}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 Sa,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 Ml.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(B0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const s=ld(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Gt(),o={info:new jh(r),error:l};if(r.size===0)return o.data=Yk(),l.resolve(null),Promise.resolve(o);let c;const f=Ki();f.orderedConsumer();const d=T0.create(),m=`$O.${this.name}.C.${r.nuid}`,b=await this.js.subscribe(m,f);return(async()=>{for await(const g of b)g.data.length>0&&(d.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(S2(s,d.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),b.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),o.data=new ReadableStream({start(g){c=g},cancel(){b.unsubscribe()}}),o}linkStore(t,r){if(!(r instanceof Ml))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=Rr(),l=xi();return l.set(zn.RollupHdr,zn.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,q0(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=Rr(),c=Ki();c.orderedConsumer(),t.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((d,m)=>{var b;if(d){s.stop(d);return}if(m!==null){const g=o.decode(m.data);g.deleted&&t.ignoreDeletes===!0||s.push(g),((b=m.info)==null?void 0:b.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.${ga.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=Lk(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=Hl.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?Zi.S2:Zi.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 Ml(r,l,t);return await o.init(s),Promise.resolve(o)}}class Gk{constructor(t){A(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:o}=s.nc.features.get(bt.JS_KV);return l?r.bindOnly?Il.bind(this.js,t,r):Il.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(bt.JS_OBJECTSTORE);return l?Ml.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${o} or better`))}}class Fd extends Jl{constructor(r,s){super(r,s);A(this,"consumers");A(this,"streams");A(this,"consumerAPI");A(this,"streamAPI");this.consumerAPI=new Du(r,s),this.streamAPI=new Id(r,s),this.consumers=new md(this.consumerAPI),this.streams=new Vk(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 Gk(this)}async publish(r,s=ar,l){l=l||{},l.expect=l.expect||{};const o=(l==null?void 0:l.headers)||xi();l&&(l.msgID&&o.set(Fr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&o.set(Fr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&o.set(Fr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&o.set(Fr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&o.set(Fr.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 b;for(let x=0;x<d;x++)try{b=await this.nc.request(r,s,f);break}catch(v){if(v.code==="503"&&x+1<d)await ja(m);else throw v}const g=this.parseJsResponse(b);if(g.stream==="")throw Me.errorForCode(ke.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){Rn(r),ma(s);let o=this.timeout;l>o&&(o=l),l=l<0?0:Yt(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=pa(f);if(d)throw d;return Fl(f,this.timeout)}fetch(r,s,l={}){Rn(r),ma(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 b={};if(b.batch=l.batch||1,d){const P=this.nc.features.get(bt.JS_PULL_MAX_BYTES);if(!P.ok)throw new Error(`max_bytes is only supported on servers ${P.min} or better`);b.max_bytes=d}b.no_wait=l.no_wait||!1,b.no_wait&&b.expires&&(b.expires=0);const g=l.expires||0;if(g&&(b.expires=Yt(g)),g===0&&b.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(b.idle_heartbeat=Yt(x),l.delay_heartbeat===!0&&(b.idle_heartbeat=Yt(x*4)));const v=new xn,S=b.batch;let N=0;v.protocolFilterFn=(P,I=!1)=>id(P.msg)?(m==null||m.work(),!1):!0,v.dispatchedFn=P=>{if(P){if(c&&(f+=P.data.length),N++,o&&P.info.pending===0)return;(v.getPending()===1&&P.info.pending===0||S===N||d>0&&f>=d)&&v.stop()}};const D=yi(this.nc.options.inboxPrefix),M=this.nc.subscribe(D,{max:l.batch,callback:(P,I)=>{P===null&&(P=pa(I)),P!==null?(o&&(o.cancel(),o=null),r2(P)?v.stop(Dx(P)===null?void 0:P):v.stop(P)):(m==null||m.work(),v.received++,v.push(Fl(I,this.timeout)))}});return g&&(o=va(g),o.catch(()=>{M.isClosed()||(M.drain().catch(()=>{}),o=null),m&&m.cancel()})),(async()=>{try{x&&(m=new Hd(x,P=>(v.push(()=>{v.err=new Me(`${wr.IdleHeartbeatMissed}: ${P}`,ke.JetStreamIdleHeartBeat)}),!0)))}catch{}await M.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(b),{reply:D}),v}async pullSubscribe(r,s=Ki()){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 Qk(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(d){throw f.unsubscribe(),d}return f}async subscribe(r,s=Ki()){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 Mx(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=Ki()){const l=C0(s)?s.getOpts():s;if(l.isBind=C0(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 Me("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 Me("ordered consumer: durable_name cannot be set",ke.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Me("ordered consumer: deliver_subject cannot be set",ke.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Me("ordered consumer: max_deliver cannot be set",ke.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Me("ordered consumer: deliver_group cannot be set",ke.ApiError);l.config.deliver_subject=yi(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||Yt(5e3),l.config.ack_wait=Yt(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||yi(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=Zk(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Fd.ingestionFn(r.ordered),s.protocolFilterFn=(l,o=!1)=>{const c=l;return rd(c.msg)?(o||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==bn.None&&(s.dispatchedFn=tE),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:sn.All,ack_policy:bn.Explicit,ack_wait:Yt(30*1e3),replay_policy:wa.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(pa(c.msg)||(d=o.monitor)==null||d.work(),id(c.msg)){const m=r?o._checkHbOrderConsumer(c.msg):!0;return r||o.info.flow_control.heartbeat_count++,{ingest:m,protocol:!0}}else if(rd(c.msg))return o.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?o._checkOrderedConsumer(s):!0,protocol:!1}}}}class $d{constructor(t){A(this,"options");A(this,"protocol");A(this,"draining");A(this,"listeners");A(this,"_services");this.draining=!1,this.options=gk(t),this.listeners=[]}static connect(t={}){return new Promise((r,s)=>{const l=new $d(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 Me.errorForCode(ke.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw Me.errorForCode(ke.ConnectionDraining);if(t=t||"",t.length===0)throw Me.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 Nx(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=ar,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||Or.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new Me("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 b=this.subscribe(yi(this.options.inboxPrefix),{callback:(S,N)=>{var D,M;if(((D=N==null?void 0:N.data)==null?void 0:D.length)===0&&((M=N==null?void 0:N.headers)==null?void 0:M.status)===ke.NoResponders&&(S=Me.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=$t()),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(Tl(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 _k="$SRV";class z0{constructor(t){A(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||bi(),(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 ql{constructor(t,r="",s=""){A(this,"subject");A(this,"queue");A(this,"srv");r!==""&&Ek("service group",r);let l="";if(t instanceof Xl)this.srv=t,l="";else if(t instanceof ql){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;jl("endpoint",t);let{subject:l,handler:o,metadata:c,queue:f}=s;l=l||t,f=f||this.queue,kk("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 ql(this,t,r)}}function kk(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 Ek(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 Xl{constructor(t,r={name:"",version:""}){A(this,"nc");A(this,"_id");A(this,"config");A(this,"handlers");A(this,"internal");A(this,"_stopped");A(this,"_done");A(this,"started");this.nc=t,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),jl("name",this.config.name),jl("queue",this.config.queue),Ss(this.config.version),this._id=Qi.next(),this.internal=[],this._done=$t(),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??_k;return r===""&&s===""?`${o}.${t}`:(jl("control subject name",r),s!==""?(jl("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=bi();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 Ck(l,o,s),f.queue=s;const d=c?(m,b)=>{if(m){this.close(m);return}const g=Date.now();try{c(m,new z0(b))}catch(x){f.stats.countError(x),b==null||b.respond(rr,{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 b=new Error(`required subscription ${t.subject} errored: ${m.message}`);b.stack=m.stack,this.close(b).catch()}}),f}info(){return{type:Ol.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:Ol.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=Xl.controlSubject(r,l,o),c.handler=s,this.setupHandler(c,!0)}start(){const t=jr(),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(Ji.PING,o),this.addInternalHandler(Ji.STATS,r),this.addInternalHandler(Ji.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:Ol.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 ql(this,t,r)}addEndpoint(t,r){return new ql(this).addEndpoint(t,r)}_addEndpoint(t){const r=new dn;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 Ck{constructor(t,r,s=""){A(this,"name");A(this,"subject");A(this,"average_processing_time");A(this,"num_requests");A(this,"processing_time");A(this,"num_errors");A(this,"last_error");A(this,"data");A(this,"metadata");A(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+=Ft(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=Ft(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 Ak{constructor(t,r={strategy:Ar.JitterTimer,maxWait:2e3},s){A(this,"nc");A(this,"prefix");A(this,"opts");this.nc=t,this.prefix=s,this.opts=r}ping(t="",r=""){return this.q(Ji.PING,t,r)}stats(t="",r=""){return this.q(Ji.STATS,t,r)}info(t="",r=""){return this.q(Ji.INFO,t,r)}async q(t,r="",s=""){const l=new dn,o=jr(),c=Xl.controlSubject(t,r,s,this.prefix),f=await this.nc.requestMany(c,rr,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 jk(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Nx(),storage:ad.File}}const Pu="KV-Operation",U0="$KV",Nk=/^[-/=.\w]+$/,Tk=/^[-/=.>*\w]+$/,Ok=/^[-\w]+$/;function Rk(e){if(e.startsWith(".")||e.endsWith(".")||!Nk.test(e))throw new Error(`invalid key: ${e}`)}function Mk(e){if(e.startsWith(".")||e.endsWith(".")||!Tk.test(e))throw new Error(`invalid key: ${e}`)}function Dk(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(!Ok.test(e))throw new Error(`invalid bucket name: ${e}`)}var Hr;(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"})(Hr||(Hr={}));class Il{constructor(t,r,s){A(this,"js");A(this,"jsm");A(this,"stream");A(this,"bucket");A(this,"direct");A(this,"codec");A(this,"prefix");A(this,"editPrefix");A(this,"useJsPrefix");A(this,"_prefixLen");A(this,"validateKey",Rk);A(this,"validateSearchKey",Mk);A(this,"hasWildcards",Dk);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 Il(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 Il(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(jk(),t);this.codec=r.codec;const s={};this.stream=s.name=t.streamName??this.bucketName(),s.retention=sd.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(Wn)||(g.name=`${Wn}${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(Wn)?v.name.substring(Wn.length):v.name;return v.name.startsWith(Wn)||(v.name=`${Wn}${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?Zi.S2:Zi.None);const o=this.js.nc,c=o.getServerVersion(),f=c?od(c,Ss("2.7.2"))>=0:!1;s.discard=f?Hl.New:Hl.Old;const{ok:d,min:m}=o.features.get(bt.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=Ft(r.ttl)),s.allow_rollup_hdrs=!0;let b;try{b=await this.jsm.streams.info(s.name),!b.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")b=await this.jsm.streams.add(s);else throw g}this.initializePrefixes(b)}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(Wn)&&(s=s.substring(Wn.length)),r.external&&r.external.api!==""){const l=r.name.substring(Wn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${s}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Wn}${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(Mn.MessageSizeHdr)||"";return s!==""?parseInt(s,10):t.length}smToEntry(t){return new Xk(this.bucket,this.prefixLen,t)}jmToEntry(t){const r=this.decodeKey(t.subject.substring(this.prefixLen));return new Kk(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=bi();o.headers=d,d.set(Hr.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===Ce.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=$t(),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=bi();o.set(Pu,r),r==="PURGE"&&o.set(Mn.RollupHdr,Mn.RollupValueSubject),s!=null&&s.previousSeq&&o.set(Hr.ExpectedLastSubjectSequenceHdr,`${s.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),rr,{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=en.LastPerSubject;r===Er.AllHistory&&(c=en.All),r===Er.UpdatesOnly&&(c=en.New);let f;return o.length===1&&(f=o[0],o=void 0),Object.assign({deliver_policy:c,ack_policy:hn.None,filter_subjects:o,filter_subject:f,flow_control:!0,idle_heartbeat:Ft(5*1e3)},s)}remove(t){return this.purge(t)}async history(t={}){const r=t.key??">",s=new dn,l={};l.headers_only=t.headers_only||!1;let o;o=()=>{s.stop()};let c=0;const f=this._buildCC(r,Er.AllHistory,l),d=f.filter_subject,m=Ki(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 b=await this.js.subscribe(d,m);if(o){const{info:{last:g}}=b,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=b,s.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{s.stop()}).catch(g=>{s.stop(g)}),s}canSetWatcherName(){const r=this.js.nc,{ok:s}=r.features.get(bt.JS_NEW_CONSUMER_CREATE_API);return s}async watch(t={}){const r=t.key??">",s=new dn,l={};l.headers_only=t.headers_only||!1;let o=Er.LastValue;t.include===Er.AllHistory?o=Er.AllHistory:t.include===Er.UpdatesOnly&&(o=Er.UpdatesOnly);const c=t.ignoreDeletes===!0;let f=t.initializedFn,d=0;const m=this._buildCC(r,o,l),b=m.filter_subject,g=Ki(m);this.canSetWatcherName()&&g.consumerName(Qi.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(b,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 dn,s=this._buildCC(t,Er.LastValue,{headers_only:!0}),l=Array.isArray(t)?">":s.filter_subject,o=Ki(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 b=(d=m.headers)==null?void 0:d.get(Pu);if(b!=="DEL"&&b!=="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=""){A(this,"si");A(this,"cluster");this.si=t,this.cluster=r}get bucket(){return this.si.config.name.startsWith(Wn)?this.si.config.name.substring(Wn.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!==Zi.None:!1}}const Hd="OBJ_",P0="SHA-256=";function Lk(e){return Eu(e),`${Hd}${e}`}function zk(e){return e.startsWith(Hd)?e.substring(4):e}class hd{constructor(t){A(this,"si");A(this,"backingStore");this.si=t,this.backingStore="JetStream"}get bucket(){return zk(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!==Zi.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 gr;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(gr||(gr={}));var qr;(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"})(qr||(qr={}));var ya;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(ya||(ya={}));const B0=Uint8Array.of(43,65,67,75),Uk=Uint8Array.of(45,78,65,75),Sl=Uint8Array.of(43,87,80,73),Pk=Uint8Array.of(43,78,88,84),Bk=Uint8Array.of(43,84,69,82,77),Hk=Uint8Array.of(32);function Fl(e,t=5e3){return new rE(e,t)}class Ah extends dn{constructor(r,s,l=!1){super();A(this,"consumer");A(this,"opts");A(this,"sub");A(this,"monitor");A(this,"pending");A(this,"inbox");A(this,"refilling");A(this,"pong");A(this,"callback");A(this,"timeout");A(this,"cleanupHandler");A(this,"listeners");A(this,"statusIterator");A(this,"forOrderedConsumer");A(this,"resetHandler");A(this,"abortOnMissingResource");A(this,"bind");A(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=gi(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(id(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:M,bytesLeft:R}=this.parseDiscard(m.headers);if(M>0||R>0)this.pending.msgs-=M,this.pending.bytes-=R,this.pending.requests--,this.notify(ya.Discard,{msgsLeft:M,bytesLeft:R});else if(j===400){this.stop(new Me(D,`${j}`));return}else if(j===409&&D==="consumer deleted"){if(this.notify(qr.ConsumerDeleted,`${j} ${D}`),!this.refilling||this.abortOnMissingResource){const I=new Me(D,`${j}`);this.stop(I);return}}else if(j===503){if(this.notify(qr.NoResponders,`${j} No Responders`),!this.refilling||this.abortOnMissingResource){const I=new Me("no responders",`${j}`);this.stop(I);return}}else this.notify(ya.DebugEvent,`${j} ${D}`)}else this._push(Fl(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 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(qr.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 b of d)switch(b.type){case di.Disconnect:(m=this.monitor)==null||m.cancel();break;case di.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(qr.StreamNotFound,s),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(qr.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=ja(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(ya.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,s=this.opts.max_bytes-this.pending.bytes,l=Ft(this.opts.idle_heartbeat),o=Ft(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(Mn.PendingMessagesHdr);l&&(s.msgsLeft=parseInt(l));const o=r==null?void 0:r.get(Mn.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 dn;return this.listeners.push(r),Promise.resolve(r)}}class qk extends dn{constructor(){super();A(this,"src");A(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 dn;return this.listeners.push(r),Promise.resolve(r)}}class dd{constructor(t,r){A(this,"api");A(this,"_info");A(this,"stream");A(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=va(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=$t(),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===qr.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=va(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 Ik{constructor(t,r,s={}){A(this,"api");A(this,"consumerOpts");A(this,"consumer");A(this,"opts");A(this,"cursor");A(this,"stream");A(this,"namePrefix");A(this,"serial");A(this,"currentConsumer");A(this,"userCallback");A(this,"iter");A(this,"type");A(this,"startSeq");A(this,"maxInitialReset");this.api=t,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Qi.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=gr.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:en.StartSequence,opt_start_seq:t,ack_policy:hn.None,inactive_threshold:Ft(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||en.StartSequence,(this.consumerOpts.deliver_policy===en.LastPerSubject||this.consumerOpts.deliver_policy===en.New||this.consumerOpts.deliver_policy===en.Last)&&(delete s.opt_start_seq,s.deliver_policy=this.consumerOpts.deliver_policy),s.deliver_policy===en.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=en.StartTime,s.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(s.inactive_threshold=Ft(this.consumerOpts.inactive_threshold))),s}async resetConsumer(t=0){var c,f,d,m,b;Qi.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(qr.OrderedConsumerRecreated,o.name);break}catch(x){if(x.message==="stream not found"&&((m=this.iter)==null||m.notify(qr.StreamNotFound,g),this.type===gr.Fetch||this.opts.abort_on_missing_resource===!0))return(b=this.iter)==null||b.stop(x),Promise.reject(x);if(r&&g>=this.maxInitialReset)throw x;await ja(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===gr.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 qk),this.consumer=new dd(this.api,this.currentConsumer);const o=t;o.callback=this.internalHandler(this.serial);let c=null;this.type===gr.Fetch&&s?c=await this.consumer.fetch(t):this.type===gr.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(ya.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===gr.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===gr.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:s}=t;return s&&(this.userCallback=s),this.type=gr.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===gr.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=gr.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=$t();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 md{constructor(t){A(this,"api");A(this,"notified");this.api=t,this.notified=!1}checkVersion(){const t=this.api.nc.features.get(bt.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 dd(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 dd(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 Ik(this.api,t,r))).catch(o=>Promise.reject(o))}}class Zu{constructor(t,r){A(this,"api");A(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 md(new Du(this.api.nc,this.api.opts)).getPullConsumerFor(t)}getConsumer(t){return new md(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 Jl{constructor(t,r){super(t,r)}checkStreamConfigVersions(t){const r=this.nc;if(t.metadata){const{min:l,ok:o}=r.features.get(bt.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(bt.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(bt.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(bt.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(bt.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(bt.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),Nn(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 Nn(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),Nn(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){Nn(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],b=r||{};let g=0;for(;c>d;){g++,b.offset=f*g;const v=await this._request(s,b);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 Nl(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 Nn(t),await this._request(`${this.prefix}.STREAM.PURGE.${t}`,r)}async deleteMessage(t,r,s=!0){Nn(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){Nn(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(Wn));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 Nl(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 hd(f))},r=`${this.prefix}.STREAM.LIST`;return new Nl(r,t,this)}names(t=""){const r=t!=null&&t.length?{subject:t}:{},s=o=>o.streams,l=`${this.prefix}.STREAM.NAMES`;return new Nl(l,s,this,r)}async get(t){const r=await this.info(t);return Promise.resolve(new Zu(this,r))}}class Fk extends Jl{constructor(t,r){super(t,r)}async getMessage(t,r){Nn(t);let s=r;const{last_by_subj:l}=s;l&&(s=null);const o=s?this.jc.encode(s):rr,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=pa(d);if(m)return Promise.reject(m);const b=new pd(d);return Promise.resolve(b)}async getBatch(t,r){Nn(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 dn,f=await this.nc.requestMany(l,o,{strategy:Ar.SentinelMsg});return(async()=>{var g,x,v;let d=!1,m=!1,b;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){b=(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 pd(S))}c.push(()=>{if(m)throw new Error("batch direct get not supported by the server");if(b)throw new Error(`bad request: ${b}`);c.stop()})})(),Promise.resolve(c)}}class pd{constructor(t){A(this,"data");A(this,"header");if(!t.headers)throw new Error("headers expected");this.data=t.data,this.header=t.headers}get subject(){return this.header.last(fa.Subject)}get seq(){const t=this.header.last(fa.Sequence);return typeof t=="string"?parseInt(t):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(fa.TimeStamp)}get stream(){return this.header.last(fa.Stream)}json(t){return jr(t).decode(this.data)}string(){return er.decode(this.data)}}A(pd,"jc");class $k extends Jl{constructor(r,s){super(r,s);A(this,"streams");A(this,"consumers");A(this,"direct");this.streams=new qd(r,s),this.consumers=new Du(r,s),this.direct=new Fk(r,s)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new dn;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){A(this,"_header");A(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):rr}get header(){if(!this._header)if(this.smr.message.hdrs){const t=this._parse(this.smr.message.hdrs);this._header=Xi.decode(t)}else this._header=bi();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 jr(t).decode(this.data)}string(){return er.decode(this.data)}}A(Ox,"jc");class Vk{constructor(t){A(this,"api");this.api=t}get(t){return this.api.info(t).then(r=>new Zu(this.api,r))}}class jh{constructor(t){A(this,"info");A(this,"hdrs");this.info=t}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=Xi.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 Yk(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Ml{constructor(t,r,s){A(this,"jsm");A(this,"js");A(this,"stream");A(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=jr().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 hd(t)))}async status(t){const r=await this._si(t);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new hd(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(t,r,s){var ue;const l=this.js.getOptions();s=s||{timeout:l.timeout},s.timeout=s.timeout||l.timeout,s.previousRevision=s.previousRevision??void 0;const{timeout: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=((ue=t.options)==null?void 0:ue.max_chunk_size)||128*1024;m=m>d?d:m,t.options.max_chunk_size=m;const b=await this.info(t.name),{name:g,error:x}=this._checkNotEmpty(t.name);if(x)return Promise.reject(x);const v=Qi.next(),S=this._chunkSubject(v),j=this._metaSubject(g),D=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},H0(t)),M=$t(),R=[],I=new Sa;try{const B=r?r.getReader():null,P=N0.create();for(;;){const{done:ee,value:G}=B?await B.read():{done:!0,value:void 0};if(ee){if(I.size()>0){const F=I.drain();P.update(F),D.chunks++,D.size+=F.length,R.push(this.js.publish(S,F,{timeout:o}))}await Promise.all(R),R.length=0,D.mtime=new Date().toISOString();const H=ga.encode(P.digest());D.digest=`${P0}${H}`,D.deleted=!1;const z=bi();typeof c=="number"&&z.set(Hr.ExpectedLastSubjectSequenceHdr,`${c}`),z.set(Mn.RollupHdr,Mn.RollupValueSubject);const K=await this.js.publish(j,jr().encode(D),{headers:z,timeout:o});if(D.revision=K.seq,b)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${b.nuid}`})}catch{}M.resolve(new jh(D));break}if(G)for(I.fill(G);I.size()>m;){D.chunks++,D.size+=m;const H=I.drain(t.options.max_chunk_size);P.update(H),R.push(this.js.publish(S,H,{timeout:o}))}}}catch(B){await this.jsm.streams.purge(this.stream,{filter:S}),M.reject(B)}return M}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 Sa,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 Ml.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=ld(r.digest.substring(8));if(s===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=$t(),o={info:new jh(r),error:l};if(r.size===0)return o.data=Yk(),l.resolve(null),Promise.resolve(o);let c;const f=Ki();f.orderedConsumer();const d=N0.create(),m=`$O.${this.name}.C.${r.nuid}`,b=await this.js.subscribe(m,f);return(async()=>{for await(const g of b)g.data.length>0&&(d.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(S2(s,d.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${s}`)),b.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),o.data=new ReadableStream({start(g){c=g},cancel(){b.unsubscribe()}}),o}linkStore(t,r){if(!(r instanceof Ml))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=jr(),l=bi();return l.set(Mn.RollupHdr,Mn.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 dn,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=jr(),c=Ki();c.orderedConsumer(),t.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((d,m)=>{var b;if(d){s.stop(d);return}if(m!==null){const g=o.decode(m.data);g.deleted&&t.ignoreDeletes===!0||s.push(g),((b=m.info)==null?void 0:b.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.${ga.encode(t)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(t={}){try{this.stream=Lk(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=Hl.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?Zi.S2:Zi.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 Ml(r,l,t);return await o.init(s),Promise.resolve(o)}}class Gk{constructor(t){A(this,"js");this.js=t}kv(t,r={}){const s=this.js,{ok:l,min:o}=s.nc.features.get(bt.JS_KV);return l?r.bindOnly?Il.bind(this.js,t,r):Il.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(bt.JS_OBJECTSTORE);return l?Ml.create(this.js,t,r):Promise.reject(new Error(`objectstore is only supported on servers ${o} or better`))}}class Id extends Jl{constructor(r,s){super(r,s);A(this,"consumers");A(this,"streams");A(this,"consumerAPI");A(this,"streamAPI");this.consumerAPI=new Du(r,s),this.streamAPI=new qd(r,s),this.consumers=new md(this.consumerAPI),this.streams=new Vk(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 Gk(this)}async publish(r,s=rr,l){l=l||{},l.expect=l.expect||{};const o=(l==null?void 0:l.headers)||bi();l&&(l.msgID&&o.set(Hr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&o.set(Hr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&o.set(Hr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&o.set(Hr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&o.set(Hr.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 b;for(let x=0;x<d;x++)try{b=await this.nc.request(r,s,f);break}catch(v){if(v.code==="503"&&x+1<d)await ja(m);else throw v}const g=this.parseJsResponse(b);if(g.stream==="")throw Me.errorForCode(Ce.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,s,l=0){Nn(r),ma(s);let o=this.timeout;l>o&&(o=l),l=l<0?0:Ft(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=pa(f);if(d)throw d;return Fl(f,this.timeout)}fetch(r,s,l={}){Nn(r),ma(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 b={};if(b.batch=l.batch||1,d){const R=this.nc.features.get(bt.JS_PULL_MAX_BYTES);if(!R.ok)throw new Error(`max_bytes is only supported on servers ${R.min} or better`);b.max_bytes=d}b.no_wait=l.no_wait||!1,b.no_wait&&b.expires&&(b.expires=0);const g=l.expires||0;if(g&&(b.expires=Ft(g)),g===0&&b.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(b.idle_heartbeat=Ft(x),l.delay_heartbeat===!0&&(b.idle_heartbeat=Ft(x*4)));const v=new dn,S=b.batch;let j=0;v.protocolFilterFn=(R,I=!1)=>id(R.msg)?(m==null||m.work(),!1):!0,v.dispatchedFn=R=>{if(R){if(c&&(f+=R.data.length),j++,o&&R.info.pending===0)return;(v.getPending()===1&&R.info.pending===0||S===j||d>0&&f>=d)&&v.stop()}};const D=gi(this.nc.options.inboxPrefix),M=this.nc.subscribe(D,{max:l.batch,callback:(R,I)=>{R===null&&(R=pa(I)),R!==null?(o&&(o.cancel(),o=null),r2(R)?v.stop(Mx(R)===null?void 0:R):v.stop(R)):(m==null||m.work(),v.received++,v.push(Fl(I,this.timeout)))}});return g&&(o=va(g),o.catch(()=>{M.isClosed()||(M.drain().catch(()=>{}),o=null),m&&m.cancel()})),(async()=>{try{x&&(m=new Bd(x,R=>(v.push(()=>{v.err=new Me(`${yr.IdleHeartbeatMissed}: ${R}`,Ce.JetStreamIdleHeartBeat)}),!0)))}catch{}await M.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(b),{reply:D}),v}async pullSubscribe(r,s=Ki()){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===hn.None||o===hn.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new Qk(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(d){throw f.unsubscribe(),d}return f}async subscribe(r,s=Ki()){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=Ki()){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!==hn.NotSet&&l.config.ack_policy!==hn.None)throw new Me("ordered consumer: ack_policy can only be set to 'none'",Ce.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new Me("ordered consumer: durable_name cannot be set",Ce.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Me("ordered consumer: deliver_subject cannot be set",Ce.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Me("ordered consumer: max_deliver cannot be set",Ce.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Me("ordered consumer: deliver_group cannot be set",Ce.ApiError);l.config.deliver_subject=gi(this.nc.options.inboxPrefix),l.config.ack_policy=hn.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Ft(5e3),l.config.ack_wait=Ft(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===hn.NotSet&&(l.config.ack_policy=hn.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||gi(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const s={};return s.adapter=Zk(r.callbackFn===void 0,this.timeout),s.ingestionFilterFn=Id.ingestionFn(r.ordered),s.protocolFilterFn=(l,o=!1)=>{const c=l;return rd(c.msg)?(o||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==hn.None&&(s.dispatchedFn=tE),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:en.All,ack_policy:hn.Explicit,ack_wait:Ft(30*1e3),replay_policy:wa.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(pa(c.msg)||(d=o.monitor)==null||d.work(),id(c.msg)){const m=r?o._checkHbOrderConsumer(c.msg):!0;return r||o.info.flow_control.heartbeat_count++,{ingest:m,protocol:!0}}else if(rd(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){A(this,"options");A(this,"protocol");A(this,"draining");A(this,"listeners");A(this,"_services");this.draining=!1,this.options=gk(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 Me.errorForCode(Ce.ConnectionClosed);if(r&&this.isDraining()||s&&this.protocol.noMorePublishing)throw Me.errorForCode(Ce.ConnectionDraining);if(t=t||"",t.length===0)throw Me.errorForCode(Ce.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=rr,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||Ar.Timer,s.maxWait=s.maxWait||1e3,s.maxWait<1)return Promise.reject(new Me("timeout",Ce.InvalidOption));const o=new dn;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 b=this.subscribe(gi(this.options.inboxPrefix),{callback:(S,j)=>{var D,M;if(((D=j==null?void 0:j.data)==null?void 0:D.length)===0&&((M=j==null?void 0:j.headers)==null?void 0:M.status)===Ce.NoResponders&&(S=Me.errorForCode(Ce.NoResponders)),S){d&&(S.stack+=`
|
|
82
82
|
|
|
83
|
-
${d}`),g(S);return}f(null,
|
|
83
|
+
${d}`),g(S);return}f(null,j),s.strategy===Ar.Count&&(m--,m===0&&g()),s.strategy===Ar.JitterTimer&&(v(),x=setTimeout(()=>{g()},300)),s.strategy===Ar.SentinelMsg&&j&&j.data.length===0&&g()}});b.requestSubject=t,b.closed.then(()=>{c()}).catch(S=>{o.stop(S)});const g=S=>{S&&o.push(()=>{throw S}),v(),b.drain().then(()=>{c()}).catch(j=>{c()})};o.iterClosed.then(()=>{v(),b==null||b.unsubscribe()}).catch(S=>{v(),b==null||b.unsubscribe()});try{this.publish(t,r,{reply:b.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(b=>{m.cancel(b)});const m=new _2(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(b){m.cancel(b)}}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 Me("timeout",Ce.InvalidOption));if(!s.noMux&&s.reply)return Promise.reject(new Me("reply can only be used with noMux",Ce.InvalidOption));if(s.noMux){const o=s.reply?s.reply:gi(this.options.inboxPrefix),c=$t(),f=l?new Error:null,d=this.subscribe(o,{max:1,timeout:s.timeout,callback:(m,b)=>{m?(f&&m.code!==Ce.Timeout&&(m.stack+=`
|
|
84
84
|
|
|
85
|
-
${f.stack}`),d.unsubscribe(),c.reject(m)):(m=
|
|
85
|
+
${f.stack}`),d.unsubscribe(),c.reject(m)):(m=gx(b),m?(f&&(m.stack+=`
|
|
86
86
|
|
|
87
|
-
${f.stack}`),c.reject(m)):c.resolve(b))}});return d.requestSubject=t,this.protocol.publish(t,r,{reply:o,headers:s.headers}),c}else{const o=new vx(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(Me.errorForCode(ke.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Me.errorForCode(ke.ConnectionClosed)):this.isDraining()?Promise.reject(Me.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 $k(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 Fd(this,t)}getServerVersion(){const t=this.info;return t?Ss(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Me.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 Jk(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Me.errorForCode(ke.ConnectionClosed)):this.isDraining()?Promise.reject(Me.errorForCode(ke.ConnectionDraining)):this.protocol.reconnect()}}class Jk{constructor(t){A(this,"nc");this.nc=t}add(t){try{return new Xl(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new Ak(this.nc,t,r)}}class Xk{constructor(t,r,s){A(this,"bucket");A(this,"sm");A(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(zn.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Kk{constructor(t,r,s){A(this,"bucket");A(this,"key");A(this,"sm");this.bucket=t,this.key=r,this.sm=s}get value(){return this.sm.data}get created(){return new Date(Pd(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(zn.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Mx extends A2{constructor(r,s,l){super(r.nc,s,l);A(this,"js");A(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=yi(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const o=this.info;o.config.name=Qi.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=sn.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,b=this.sub.info;b.last=m,this.info.config=m.config,this.info.name=m.name}).catch(d=>{const m=new Me(`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(Pd(r))}_setupHbMonitoring(r,s=0){const l={cancelAfter:0,maxOut:2};s&&(l.cancelAfter=s);const o=this.sub,c=f=>{var b,g,x,v;const d=l2(409,`${wr.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((b=this.info)==null?void 0:b.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 Hd(r,c,l)}_checkHbOrderConsumer(r){const s=r.headers.get(zn.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(zn.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 Qk extends Mx{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(bt.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=Yt(f));let d=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(d=t.idle_heartbeat,c.idle_heartbeat=Yt(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,b=`${m.prefix}.CONSUMER.MSG.NEXT.${r}.${o}`,g=this.sub.subject;m.nc.publish(b,m.jc.encode(c),{reply:g})}}}function Zk(e,t){return e?eE(t):Wk(t)}function Wk(e){return(t,r)=>t?[t,null]:(t=pa(r),t?[t,null]:[null,Fl(r,e)])}function eE(e){return(t,r)=>{if(t)return[t,null];const s=pa(r);return s!==null?[Dx(s),null]:[null,Fl(r,e)]}}function Dx(e){if(e!==null)switch(e.code){case ke.JetStream404NoMessages:case ke.JetStream408RequestTimeout:return null;case ke.JetStream409:return o2(e)?e:null;default:return e}return null}function tE(e){e&&e.ack()}function nE(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 rE{constructor(t,r){A(this,"msg");A(this,"di");A(this,"didAck");A(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=nE(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]===Sl[0]&&t[1]===Sl[1]&&t[2]===Sl[2]&&t[3]===Sl[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=Gt();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 vx(o.muxSubscriptions,this.msg.reply,{timeout:t.timeout},c);o.request(f);try{o.publish(this.msg.reply,H0,{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(H0)}nak(t){let r=Uk;t&&(r=Ru().encode(`-NAK ${JSON.stringify({delay:Yt(t)})}`)),this.doAck(r)}working(){this.doAck(Sl)}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=Yt(r.expires));const l=Rr().encode(s),o=Sa.concat(Pk,Hk,l),c=t?{reply:t}:void 0;this.msg.respond(o,c)}term(t=""){let r=Bk;(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 iE="1.30.3",sE="nats.ws";class aE{constructor(){A(this,"version");A(this,"lang");A(this,"closeError");A(this,"connected");A(this,"done");A(this,"socket");A(this,"options");A(this,"socketClosed");A(this,"encrypted");A(this,"peeked");A(this,"yields");A(this,"signal");A(this,"closedNotification");this.version=iE,this.lang=sE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Gt(),this.closedNotification=Gt()}async connect(t,r){const s=Gt();if(r.tls)return s.reject(new Me("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=Sa.concat(...this.yields),f=M2(c);if(f!==""){const d=xk.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]);yk(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 Me(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 ja(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=Gt())}}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 lE(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 Lx(e={}){return j2({defaultPort:443,urlParseFn:lE,factory:()=>new aE}),$d.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var _a;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(_a||(_a={}));class Nh extends Error{constructor(t,r,s){super(t),this.message=t,this.code=r,this.data=s}}const oE=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"},uE=e=>{const t=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>t!==null?t.name:oE(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,b=(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(),N=f(g);let D;const M=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=(G,B)=>{var z,X;if(N){const F=N==null?void 0:N.methods.find(le=>B===le.name);if(F)return F.rtype==="promise"?le=>r.nativePromise(g,B.toString(),le):(le,ne)=>r.nativeCallback(g,B.toString(),le,ne);if(G)return(z=G[B])===null||z===void 0?void 0:z.bind(G)}else{if(G)return(X=G[B])===null||X===void 0?void 0:X.bind(G);throw new Nh(`"${g}" plugin is not implemented on ${S}`,_a.Unimplemented)}},I=G=>{let B;const z=(...X)=>{const F=M().then(le=>{const ne=P(le,G);if(ne){const W=ne(...X);return B=W==null?void 0:W.remove,W}else throw new Nh(`"${g}.${G}()" is not implemented on ${S}`,_a.Unimplemented)});return G==="addListener"&&(F.remove=async()=>B()),F};return z.toString=()=>`${G.toString()}() { [capacitor code] }`,Object.defineProperty(z,"name",{value:G,writable:!1,configurable:!1}),z},ue=I("addListener"),H=I("removeListener"),O=(G,B)=>{const z=ue({eventName:G},B),X=async()=>{const le=await z;H({eventName:G,callbackId:le},B)},F=new Promise(le=>z.then(()=>le({remove:X})));return F.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await X()},F},ee=new Proxy({},{get(G,B){switch(B){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return N?O:ue;case"removeListener":return H;default:return I(B)}}});return s[g]=ee,m.set(g,{name:g,proxy:ee,platforms:new Set([...Object.keys(x),...N?[S]:[]])}),ee};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=d,r.isNativePlatform=o,r.isPluginAvailable=c,r.registerPlugin=b,r.Exception=Nh,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},cE=e=>e.Capacitor=uE(e),Vn=cE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Es=Vn.registerPlugin;class Vd{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 Vn.Exception(t,_a.Unimplemented)}unavailable(t="not available"){return new Vn.Exception(t,_a.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 I0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),F0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class fE extends Vd{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=F0(l).trim(),o=F0(o).trim(),r[l]=o}),r}async setCookie(t){try{const r=I0(t.key),s=I0(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)}}}Es("CapacitorCookies",{web:()=>new fE});const hE=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)}),dE=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,o,c)=>(l[o]=e[t[c]],l),{})},mE=(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,pE=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),l=dE(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 gE extends Vd{async request(t){const r=pE(t,t.webFetchExtra),s=mE(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 hE(m);break;case"json":d=await o.json();break;case"document":case"text":default:d=await o.text()}const b={};return o.headers.forEach((g,x)=>{b[x]=g}),{data:d,headers:b,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"}))}}Es("CapacitorHttp",{web:()=>new gE});var $0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})($0||($0={}));var V0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(V0||(V0={}));class yE extends Vd{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")}}Es("SystemBars",{web:()=>new yE});const bE="modulepreload",xE=function(e){return"/"+e},Y0={},Yd=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let c=function(m){return Promise.all(m.map(b=>Promise.resolve(b).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=xE(m),m in Y0)return;Y0[m]=!0;const b=m.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const x=document.createElement("link");if(x.rel=b?"stylesheet":bE,b||(x.as="script"),x.crossOrigin="",x.href=m,d&&x.setAttribute("nonce",d),document.head.appendChild(x),b)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)})},gd=Es("App",{web:()=>Yd(()=>import("./web-ew6AFUex.js"),[]).then(e=>new e.AppWeb)}),vE=Es("Network",{web:()=>Yd(()=>import("./web-Dp5Zj6HJ.js"),[]).then(e=>new e.NetworkWeb)}),Bu=Vn.isNativePlatform()?"https://app.palmier.me":"";async function zx(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 wE(e,t,r){return zx("POST",e,t)}function SE(e,t){return zx("GET",e,void 0)}const G0=Vn.isNativePlatform(),Ux=k.createContext(null),_E=2e3,Th=6e3,kE=1500,EE=6e4;function CE({children:e,activeHost:t}){const[r,s]=k.useState(null),[l,o]=k.useState(!1),c=k.useRef(null),[f,d]=k.useState(!1),[m,b]=k.useState(!1),[g,x]=k.useState(!1),[v,S]=k.useState(!1),N=k.useRef(Ru()),D=k.useRef(new Set),M=k.useRef(0),P=!!t.directUrl,I=G0&&!P&&!!t.lanUrl&&v,ue=m||g?"disconnected":P?f?"direct":"connecting":l?I?"lan":"nats":"connecting",H=ue!=="connecting"&&ue!=="disconnected";k.useEffect(()=>{if(!G0||P||!t.lanUrl){S(!1);return}let G=!1;const B=t.lanUrl,z=t.hostId;async function X(){console.log("[HOST/LAN] probing",B);try{const W=await fetch(`${B}/health`,{signal:AbortSignal.timeout(kE)});if(G)return;if(!W.ok){console.log("[HOST/LAN] probe got non-ok:",W.status),S(!1);return}const V=await W.json(),K=V.hostId===z;K?console.log("[HOST/LAN] reachable"):console.log("[HOST/LAN] hostId mismatch — got:",V.hostId,"expected:",z),S(K)}catch(W){G||(console.log("[HOST/LAN] probe failed:",W instanceof Error?W.message:W),S(!1))}}X();const F=window.setInterval(X,EE),le=gd.addListener("appStateChange",W=>{W.isActive&&X()}),ne=vE.addListener("networkStatusChange",()=>X());return()=>{G=!0,clearInterval(F),le.then(W=>W.remove()),ne.then(W=>W.remove())}},[t.hostId,t.lanUrl,P]),k.useEffect(()=>{if(P){c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),o(!1));return}let G=!1,B=1e3;const z=3e4;async function X(){for(;!G;)try{const F=await fetch(`${Bu}/api/nats-credentials/${t.hostId}`);if(G)return;if(F.status===401||F.status===403||F.status===404){console.error("[NATS] Host not found or rejected by relay:",F.status),x(!0);return}if(!F.ok)throw new Error(`credentials fetch ${F.status}`);const le=await F.json();if(!le.natsWsUrl){console.error("[NATS] Relay returned empty natsWsUrl — treating as terminal"),x(!0);return}if(G)return;console.log("[NATS] Connecting to",le.natsWsUrl);const ne=await Lx({servers:le.natsWsUrl,authenticator:Cx(le.natsJwt,new TextEncoder().encode(le.natsNkeySeed)),pingInterval:3e4,maxPingOut:2});if(G){ne.close().catch(()=>{});return}if(console.log("[NATS] Connected"),c.current=ne,s(ne),o(!0),B=1e3,await ne.closed(),G)return;console.log("[NATS] Connection closed, will reconnect"),c.current=null,s(null),o(!1)}catch(F){if(G)return;console.warn(`[NATS] Connect failed, retrying in ${B}ms:`,F),o(!1),await new Promise(le=>setTimeout(le,B)),B=Math.min(B*2,z)}}return X(),()=>{G=!0,c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),o(!1))}},[P,t]),k.useEffect(()=>{if(P)return;const G=gd.addListener("appStateChange",B=>{if(!B.isActive||!c.current)return;const z=c.current;Promise.race([z.flush(),new Promise((X,F)=>setTimeout(()=>F(new Error("ping timeout")),2e3))]).catch(()=>{console.log("[NATS] Resume probe failed — cycling conn"),z.close().catch(()=>{})})});return()=>{G.then(B=>B.remove())}},[P]),k.useEffect(()=>{if(!P){d(!1);return}const G=new AbortController;async function B(){var le;const X=new AbortController,F=setTimeout(()=>X.abort(),_E);G.signal.addEventListener("abort",()=>X.abort());try{const ne=await fetch(`${t.directUrl}/events`,{headers:{Authorization:`Bearer ${t.clientToken}`},signal:X.signal});return clearTimeout(F),ne.ok?((le=ne.body)==null?void 0:le.getReader())??null:null}catch{return clearTimeout(F),null}}async function z(X){d(!0),console.log("[HOST] SSE connected to",t.directUrl),M.current=Date.now();function F(){setTimeout(()=>{G.signal.aborted||Date.now()-M.current<Th||(console.log("[HOST] Heartbeat timeout — no data for",Th/1e3,"s"),G.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Th)}F();const le=new TextDecoder;let ne="";try{for(;;){const{done:W,value:V}=await X.read();if(W)break;ne+=le.decode(V,{stream:!0}),M.current=Date.now(),F();const K=ne.split(`
|
|
88
|
-
`);ne=K.pop()??"";for(const ce of K)if(ce.startsWith("data: ")){const Ee=ce.slice(6);try{const E=JSON.parse(Ee);if(E.task_id&&E.event_type){const L=`host-event.${t.hostId}.${E.task_id}`;for(const J of D.current)J({subject:L,data:N.current.encode(Ee)})}}catch{}}}}catch{}}return(async()=>{const X=await B();X&&await z(X)})(),()=>{G.abort(),d(!1)}},[t,P]);const O=k.useCallback(async(G,B,z)=>{function X(ne){ne&&typeof ne=="object"&&ne.error==="Unauthorized"&&b(!0)}async function F(ne,W){console.log(`[HOST/${W}] → ${G}`,B??"");const V=await fetch(`${ne}/rpc/${G}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.clientToken}`},body:B!=null?JSON.stringify(B):void 0,signal:z!=null&&z.timeout?AbortSignal.timeout(z.timeout):void 0});if(V.status===401)throw b(!0),new Error("Unauthorized");const K=await V.json();return X(K),console.log(`[HOST/${W}] ← ${G}`,K),K}async function le(){if(!c.current)throw new Error("Not connected");const ne=`host.${t.hostId}.rpc.${G}`,W={...B??{},clientToken:t.clientToken},V=N.current.encode(JSON.stringify(W));console.log(`[HOST/NATS] → ${G}`,B??"");const K=await c.current.request(ne,V,{timeout:(z==null?void 0:z.timeout)??1e4}),ce=JSON.parse(N.current.decode(K.data));return X(ce),console.log(`[HOST/NATS] ← ${G}`,ce),ce}if(P)return F(t.directUrl,"HTTP");if(I&&t.lanUrl)try{return await F(t.lanUrl,"LAN")}catch(ne){if(ne instanceof Error&&ne.message==="Unauthorized")throw ne;console.log("[HOST/LAN] failed, falling back to NATS:",ne),S(!1)}return le()},[t,P,I]),ee=k.useCallback((G,B)=>{if(P)return D.current.add(B),()=>{D.current.delete(B)};if(c.current){const z=c.current.subscribe(`host-event.${G}.>`);let X=!1;return(async()=>{try{for await(const F of z){if(X)break;B({subject:F.subject,data:F.data})}}catch{}})(),()=>{X=!0,z.unsubscribe()}}return()=>{}},[t,P]);return y.jsx(Ux.Provider,{value:{connected:H,mode:ue,nc:r,request:O,subscribeEvents:ee,activeHost:t,unauthorized:m},children:e})}function vi(){const e=k.useContext(Ux);if(!e)throw new Error("useHostConnection must be used within HostConnectionProvider");return e}const Cn=Vn.isNativePlatform()?Es("Device"):null;function AE(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 Gd(){const{activeHost:e}=vi(),t=e.timezone;return k.useCallback(r=>AE(r,t),[t])}function jE(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 NE(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 TE(e,t,r){return new Date(Date.UTC(e,t-1,r)).getUTCDay()}function OE(e,t){return new Date(Date.UTC(e,t,0)).getUTCDate()}function J0(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 Dl(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 RE(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 ME(e,t){const r=e.split(" ");if(r.length!==5)return null;const[s,l,o,,c]=r;if(l==="*"){const b=Number(s);if(Number.isNaN(b))return null;if(b>t.minute)return{...t,minute:b};const g=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour+1,b));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 b=Number(c);if(Number.isNaN(b))return null;for(let g=0;g<8;g++){const x=J0({...t,hour:d,minute:f},g);if(TE(x.year,x.month,x.day)===b&&Dl(x,t)>0)return x}return null}if(o!=="*"){const b=Number(o);if(Number.isNaN(b))return null;let g=t.year,x=t.month;for(let v=0;v<24;v++){if(b<=OE(g,x)){const S={year:g,month:x,day:b,hour:d,minute:f};if(Dl(S,t)>0)return S}x++,x>12&&(x=1,g++)}return null}const m={...t,hour:d,minute:f};return Dl(m,t)>0?m:J0(m,1)}function DE(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 LE(e,t,r){if(!e||!t||t.length===0||e==="on_new_notification"||e==="on_new_sms")return null;const s=NE(r),l=[];for(const o of t)if(e==="specific_times"){const c=DE(o);c&&Dl(c,s)>0&&l.push(c)}else{const c=ME(o,s);c&&l.push(c)}return l.length===0?null:(l.sort(Dl),RE(l[0],r))}const Px={};function zE(e){for(const t of e)Px[t.key]=t.label}function yd(e){return Px[e]??e}const UE=()=>window.matchMedia("(max-width: 600px)").matches;function PE({task:e,lastEvent:t,onEdit:r,onDelete:s,onViewRun:l}){var V;const{request:o,activeHost:c}=vi(),f=Gd(),d=c.timezone,[m,b]=k.useState(!1),[g,x]=k.useState(!1),[v,S]=k.useState(!1),N=k.useRef(null),D=(t==null?void 0:t.running_state)==="started",M=(((V=e.schedule_values)==null?void 0:V.length)??0)>0,P=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",I=!!e.command,ue=!!e.schedule_type&&(M||P)||I,O=!!e.schedule_enabled&&ue?D?"var(--color-success)":(t==null?void 0:t.running_state)==="failed"?"var(--color-error)":"var(--color-success)":"var(--color-text-secondary)";k.useEffect(()=>{if(!g)return;function K(ce){N.current&&!N.current.contains(ce.target)&&x(!1)}return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[g]);function ee(){UE()?S(!0):x(K=>!K)}function G(){x(!1),S(!1)}async function B(){if(G(),!!confirm("Abort this task?")){b(!0);try{await o("task.abort",{id:e.id})}catch(K){console.error("Abort failed:",K)}finally{b(!1)}}}async function z(){G();try{const K=await o("task.run",{id:e.id});l(e.id,K.run_id)}catch(K){console.error("Run failed:",K)}}async function X(){if(G(),!!confirm("Delete this task? Results and reports will be kept."))try{await o("task.delete",{id:e.id}),s(e.id)}catch(K){console.error("Delete failed:",K)}}const F={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function le(){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 K=LE(e.schedule_type,e.schedule_values,d);return K===null?"No upcoming runs":`Next: ${f(K)}`}const ne=le(),W=y.jsxs(y.Fragment,{children:[y.jsxs("button",{onClick:()=>{G(),r(e)},children:[y.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),y.jsxs("button",{onClick:()=>{G(),l(e.id)},children:[y.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),D?y.jsxs("button",{className:"menu-item-danger",onClick:B,disabled:m,children:[y.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):y.jsxs(y.Fragment,{children:[y.jsxs("button",{onClick:z,children:[y.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),y.jsxs("button",{className:"menu-item-danger",onClick:X,children:[y.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"task-card",onClick:()=>l(e.id,D?"latest":void 0),children:[y.jsxs("div",{className:"task-card-header",children:[y.jsxs("div",{className:"task-card-title-row",children:[D?y.jsx("span",{className:"status-spinner",children:y.jsx("span",{})}):y.jsx("span",{className:"status-dot",style:{backgroundColor:O}}),y.jsx("h3",{className:"task-card-name",children:e.custom_name||e.name||e.user_prompt})]}),y.jsx("div",{className:"task-card-actions",onClick:K=>K.stopPropagation(),children:y.jsxs("div",{className:"task-card-menu",ref:N,children:[y.jsx("button",{className:"task-card-menu-btn",onClick:ee,"aria-label":"Task actions",children:"⋮"}),g&&y.jsx("div",{className:"task-card-menu-dropdown",children:W})]})})]}),y.jsxs("div",{className:"task-card-meta",children:[e.agent&&y.jsx("span",{className:"task-card-agent",children:yd(e.agent)}),t&&F[t.running_state]&&y.jsxs("span",{className:"task-card-last-event",children:[F[t.running_state]," ",f(t.time_stamp)]}),ue&&y.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?ne:"Schedule disabled"})]})]}),v&&gi.createPortal(y.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>S(!1),children:y.jsxs("div",{className:"bottom-sheet",onClick:K=>K.stopPropagation(),children:[y.jsx("div",{className:"bottom-sheet-handle"}),y.jsx("div",{className:"bottom-sheet-title",children:e.custom_name||e.name||e.user_prompt}),y.jsx("div",{className:"bottom-sheet-actions",children:W})]})}),document.body)]})}function BE({permissions:e}){return y.jsxs("div",{className:"permissions-dialog",children:[y.jsx("h2",{children:"Granted Permissions"}),y.jsx("div",{className:"permissions-dialog-scroll",children:e&&e.length>0?y.jsx("div",{className:"permissions-section",children:y.jsx("ul",{className:"permissions-list",children:e.map((t,r)=>y.jsxs("li",{className:"permission-item",children:[y.jsx("span",{className:"permission-tool",children:t.name}),y.jsx("span",{className:"permission-desc",children:t.description})]},r))})}):y.jsx("p",{className:"permissions-empty",children:"No permissions have been granted for this task."})}),y.jsx("div",{className:"permissions-dialog-actions",children:y.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const ua=[];function HE(){const e=ua.pop();e&&(e.pushed.current=!1,e.close())}let X0=!1;function qE(){X0||(X0=!0,window.addEventListener("popstate",HE))}function bd(e,t){const r=k.useRef(!1),s=k.useRef(t);s.current=t;const l=k.useCallback(()=>s.current(),[]),o=k.useRef({close:l,pushed:r});o.current.close=l,k.useEffect(()=>{if(e&&!r.current)qE(),history.pushState({modal:!0},""),ua.push(o.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=ua.indexOf(o.current);c!==-1&&ua.splice(c,1),history.back()}},[e,l]),k.useEffect(()=>{const c=o.current;return()=>{if(r.current){r.current=!1;const f=ua.indexOf(c);f!==-1&&ua.splice(f,1),history.back()}}},[])}const IE=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],FE=["specific_times","hourly","daily","weekly","monthly"];function pu(e){return FE.includes(e)}function $E(e){return e==="on_new_notification"||e==="on_new_sms"}function pi(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function VE(e){const t=e.split(" ");if(t.length!==5)return pi();const[r,s,l,,o]=t;if(s==="*")return pi("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return o!=="*"?{...pi("weekly"),time:c,dayOfWeek:o}:l!=="*"?{...pi("monthly"),time:c,dayOfMonth:l}:{...pi("daily"),time:c}}function Bx(e,t){if(e==="specific_times"){const[r,s]=t.split("T");return{...pi("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return VE(t)}function YE(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 GE(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:YE(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?Bx(t,r).schedule:"ondemand"}function JE({initial:e,agents:t,hostPlatform:r,isNotificationListener:s,onSaved:l,onCancel:o}){var kr;const{request:c,activeHost:f}=vi(),{setHostLastAgent:d}=Wi(),m=()=>{var Oe;const ve=f.lastAgent,Xe=t.map(pt=>pt.key);return ve&&Xe.includes(ve)?ve:((Oe=t[0])==null?void 0:Oe.key)??""},[b,g]=k.useState((e==null?void 0:e.custom_name)??""),[x,v]=k.useState((e==null?void 0:e.user_prompt)??""),[S,N]=k.useState((e==null?void 0:e.agent)??m()),D=!!((kr=e==null?void 0:e.permissions)!=null&&kr.length)&&S===(e==null?void 0:e.agent),[M,P]=k.useState(!1),I=k.useCallback(()=>P(!1),[]);bd(M,I);const[ue,H]=k.useState(null),[O,ee]=k.useState(()=>Rh(e)),[G,B]=k.useState(()=>{const ve=e==null?void 0:e.schedule_type,Xe=e==null?void 0:e.schedule_values;if(Xe&&(ve==="crons"||ve==="specific_times"))return Xe.map(pt=>Bx(ve,pt));const Oe=Rh(e);return pu(Oe)?[pi(Oe)]:[]}),[z,X]=k.useState((e==null?void 0:e.requires_confirmation)??!1),[F,le]=k.useState(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0),[ne,W]=k.useState((e==null?void 0:e.yolo_mode)??!1),[V,K]=k.useState((e==null?void 0:e.foreground_mode)??!1),[ce,Ee]=k.useState((e==null?void 0:e.command)??""),[E,L]=k.useState(!1),J=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[j,be]=k.useState(J),[Te,Ce]=k.useState([]),[oe,Re]=k.useState(!1),[_e,Fe]=k.useState(!1),[_t,an]=k.useState(""),tn=k.useCallback(()=>Fe(!1),[]);bd(_e,tn),k.useEffect(()=>{if(O!=="on_new_notification"||!s||!Vn.isNativePlatform()||!Cn)return;let ve=!1;return Re(!0),Cn.getInstalledApps().then(({apps:Xe})=>{if(ve)return;const Oe="com.palmier.app",pt=Xe.filter(on=>on.packageName!==Oe).sort((on,ur)=>(on.appName||on.packageName).localeCompare(ur.appName||ur.packageName));Ce(pt)}).catch(()=>{}).finally(()=>{ve||Re(!1)}),()=>{ve=!0}},[O,s]);const Ft=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[Pt,Kt]=k.useState(Ft),Nn=k.useRef(null),qe=pu(O),tt=O==="command",st=$E(O),Mt=O==="specific_times"||O==="daily"||O==="weekly"||O==="monthly",kt=t.find(ve=>ve.key===S),pn=!!(kt!=null&&kt.supportsYolo);k.useEffect(()=>{!pn&&ne&&W(!1)},[pn,ne]);const at=!!e,or=Rh(e),fe=at&&b.trim()!==((e==null?void 0:e.custom_name)??""),we=!at||fe||x!==((e==null?void 0:e.user_prompt)??"")||S!==((e==null?void 0:e.agent)??"")||O!==or||z!==((e==null?void 0:e.requires_confirmation)??!1)||F!==(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0)||ne!==((e==null?void 0:e.yolo_mode)??!1)||V!==((e==null?void 0:e.foreground_mode)??!1)||tt&&ce!==((e==null?void 0:e.command)??"")||qe&&(JSON.stringify(Bt())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Oh(O)!==((e==null?void 0:e.schedule_type)??void 0))||st&&O!==(e==null?void 0:e.schedule_type)||O==="on_new_notification"&&j.trim()!==J.trim()||O==="on_new_sms"&&Pt.trim()!==Ft.trim(),Be=jE(f.timezone),Ke=qe&&G.some(ve=>ve.schedule==="specific_times"&&(!ve.onceDate||ve.onceDate<Be.date||ve.onceDate===Be.date&&(ve.onceTime??"")<=Be.time)),Ie=we&&!!x.trim()&&!Ke&&(!tt||!!ce.trim())&&(!qe||G.length>0);function zt(ve,Xe){B(Oe=>Oe.map((pt,on)=>on===ve?{...pt,...Xe}:pt))}function Xt(ve){B(Xe=>Xe.filter((Oe,pt)=>pt!==ve))}function Qt(){pu(O)&&B(ve=>[...ve,ve.length>0?{...ve[ve.length-1]}:pi(O)])}function mt(ve){ee(ve),pu(ve)?B([pi(ve)]):(B([]),X(!1)),ve==="command"?setTimeout(()=>{var Xe;return(Xe=Nn.current)==null?void 0:Xe.focus()},0):Ee(""),ve!=="on_new_notification"&&be(J),ve!=="on_new_sms"&&Kt(Ft)}function Bt(){return G.flatMap(ve=>{const Xe=GE(ve);return Xe?[Xe]:[]})}function ht(){return ne?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
|
|
89
|
-
|
|
90
|
-
Are you sure you want to continue?`):!0}async function gn(){L(!0),H(null);try{const ve=qe?Bt():O==="on_new_notification"&&j.trim()?[j.trim()]:O==="on_new_sms"&&Pt.trim()?[Pt.trim()]:[],Xe=qe||st?Oh(O):null,Oe={user_prompt:x,agent:S,schedule_type:Xe,schedule_values:ve.length>0?ve:null,schedule_enabled:O==="ondemand"?!0:F,requires_confirmation:qe?z:!1,yolo_mode:ne,foreground_mode:V,command:tt?ce:""};at&&(Oe.id=e.id,fe&&(Oe.custom_name=b.trim()));const on=await c(at?"task.update":"task.create",Oe,{timeout:45e3});if(on.error){H(on.error);return}at||d(f.hostId,S),l(on)}catch(ve){H(ve instanceof Error?ve.message:String(ve))}finally{L(!1)}}const ln=at?"Save":(qe||st||tt)&&F?"Schedule":"Save";return y.jsxs("div",{className:"task-form-overlay",children:[y.jsx("div",{className:"task-form",children:M?y.jsx(BE,{permissions:e==null?void 0:e.permissions}):y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"task-form-header",children:y.jsx("h2",{children:e?"Edit Task":"New Task"})}),ue&&y.jsx("div",{className:"form-error",children:ue}),at&&y.jsxs("div",{children:[y.jsxs("label",{className:"form-label task-title-field",children:["Title",y.jsx("input",{className:"form-input",type:"text",value:b,onChange:ve=>g(ve.target.value),placeholder:e.name,maxLength:80,disabled:E})]}),y.jsx("p",{className:"command-help-text task-title-help",children:"Leave empty to use an auto-generated title."})]}),y.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:x,onChange:ve=>v(ve.target.value),placeholder:tt?"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:E}),y.jsxs("div",{className:"plan-actions",children:[t.length>0&&y.jsx("div",{className:"agent-picker-section-inline",children:t.length>1?y.jsx("select",{className:"form-select form-select-sm",value:S,onChange:ve=>N(ve.target.value),disabled:E,children:t.map(ve=>y.jsx("option",{value:ve.key,children:ve.label},ve.key))}):y.jsx("span",{className:"agent-picker-single",children:(kt==null?void 0:kt.label)??t[0].label})}),pn&&y.jsxs("label",{className:"yolo-inline",style:{marginLeft:"auto"},children:[y.jsx("input",{type:"checkbox",checked:ne,onChange:ve=>W(ve.target.checked),disabled:E}),"Yolo"]}),pn&&ne&&y.jsx("p",{className:"yolo-warning",children:"The agent will auto-approve all tool calls without asking for permission."}),D&&y.jsx("div",{className:"granted-permissions-row",children:y.jsx("button",{className:"btn btn-link",onClick:()=>P(!0),children:"Granted Permissions"})})]}),y.jsx("div",{className:"toggles-group",children:y.jsxs("div",{className:"schedule-section",children:[y.jsxs("h3",{className:"schedule-section-title",children:["Schedule ",Mt&&y.jsx("span",{className:"schedule-section-hint",children:"based on host time"})]}),y.jsxs("select",{className:"form-select",value:O,onChange:ve=>mt(ve.target.value),disabled:E,children:[y.jsx("option",{value:"ondemand",children:"On User Demand"}),y.jsx("option",{value:"specific_times",children:"Specific Times"}),y.jsx("option",{value:"hourly",children:"Hourly"}),y.jsx("option",{value:"daily",children:"Daily"}),y.jsx("option",{value:"weekly",children:"Weekly"}),y.jsx("option",{value:"monthly",children:"Monthly"}),y.jsx("option",{value:"on_new_notification",children:"On New Notification"}),y.jsx("option",{value:"on_new_sms",children:"On New SMS"}),y.jsx("option",{value:"command",children:"On Command Output"})]}),st&&y.jsxs("div",{className:"schedule-reactive",children:[y.jsxs("p",{className:"command-help-text",children:[O==="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 ",O==="on_new_notification"?"notification":"SMS","”."]}),O==="on_new_notification"&&(()=>{const ve=Te.find(Oe=>Oe.packageName===j),Xe=(ve==null?void 0:ve.appName)||j;return y.jsxs(y.Fragment,{children:[s?j.trim()?y.jsxs("div",{className:"app-filter-selected",children:[y.jsx("span",{className:"app-filter-selected-name",children:Xe}),(ve==null?void 0:ve.appName)&&y.jsx("span",{className:"app-filter-selected-pkg",children:ve.packageName}),y.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>be(""),"aria-label":"Clear app filter",disabled:E,children:"✕"})]}):y.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{an(""),Fe(!0)},disabled:E,children:"Select app"}):y.jsx("input",{className:"form-input",type:"text",value:j,onChange:Oe=>be(Oe.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:E}),y.jsx("p",{className:"command-help-text app-filter-help",children:j.trim()?`Only notifications from ${Xe} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),O==="on_new_sms"&&y.jsxs(y.Fragment,{children:[y.jsx("input",{className:"form-input",type:"text",value:Pt,onChange:ve=>Kt(ve.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:E}),y.jsx("p",{className:"command-help-text app-filter-help",children:Pt.trim()?`Only SMS from ${Pt.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),tt&&y.jsxs("div",{className:"schedule-reactive",children:[y.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."}),y.jsx("input",{ref:Nn,className:"form-input form-input-mono",type:"text",value:ce,onChange:ve=>Ee(ve.target.value),placeholder:"gws gmail +watch --project my-project",disabled:E})]}),qe&&O!=="hourly"&&y.jsxs(y.Fragment,{children:[G.map((ve,Xe)=>y.jsxs("div",{className:"trigger-row-card",children:[y.jsxs("div",{className:"trigger-row-content",children:[O==="daily"&&y.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Oe=>zt(Xe,{time:Oe.target.value})}),O==="weekly"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("select",{className:"form-select",value:ve.dayOfWeek,onChange:Oe=>zt(Xe,{dayOfWeek:Oe.target.value}),children:IE.map((Oe,pt)=>y.jsx("option",{value:String(pt),children:Oe},pt))}),y.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Oe=>zt(Xe,{time:Oe.target.value})})]}),O==="monthly"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("select",{className:"form-select",value:ve.dayOfMonth,onChange:Oe=>zt(Xe,{dayOfMonth:Oe.target.value}),children:Array.from({length:28},(Oe,pt)=>pt+1).map(Oe=>y.jsxs("option",{value:String(Oe),children:["Day ",Oe]},Oe))}),y.jsx("input",{className:"form-input",type:"time",value:ve.time,onChange:Oe=>zt(Xe,{time:Oe.target.value})})]}),O==="specific_times"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("input",{className:"form-input",type:"date",value:ve.onceDate,min:Be.date,onChange:Oe=>zt(Xe,{onceDate:Oe.target.value})}),y.jsx("input",{className:"form-input",type:"time",value:ve.onceTime,min:ve.onceDate===Be.date?Be.time:void 0,onChange:Oe=>zt(Xe,{onceTime:Oe.target.value})})]})]}),G.length>1&&y.jsx("button",{className:"trigger-remove-btn",onClick:()=>Xt(Xe),title:"Remove trigger",children:"×"})]},Xe)),y.jsx("button",{className:"trigger-add-btn",onClick:Qt,children:"+ Add"})]}),r==="win32"&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:V,onChange:ve=>K(ve.target.checked),disabled:E}),"Run in the foreground (host must login to Windows)"]}),qe&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:z,onChange:ve=>X(ve.target.checked),disabled:E}),"Confirm before each run"]}),O!=="ondemand"&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:F,onChange:ve=>le(ve.target.checked),disabled:E}),"Enabled"]})]})}),!ne&&kt&&!kt.supportsPermissions&&y.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",kt.label,". The task may fail if required permissions are not pre-configured."]}),y.jsxs("div",{className:"form-actions",children:[y.jsxs("button",{className:"btn btn-primary",onClick:()=>ht()&&gn(),disabled:!Ie||E,children:[E&&y.jsx("span",{className:"btn-spinner"}),ln]}),y.jsx("button",{className:"btn btn-secondary",onClick:()=>{we&&x.trim()&&!confirm("You have unsaved changes. Discard?")||o()},style:{marginLeft:"auto"},children:"Cancel"})]})]})}),_e&&(()=>{const ve=_t.trim().toLowerCase(),Xe=ve?Te.filter(Oe=>Oe.packageName.toLowerCase().includes(ve)||Oe.appName.toLowerCase().includes(ve)):Te;return y.jsx("div",{className:"app-filter-overlay",onClick:tn,children:y.jsxs("div",{className:"app-filter-dialog",onClick:Oe=>Oe.stopPropagation(),children:[y.jsxs("div",{className:"app-filter-header",children:[y.jsx("h2",{children:"Select app"}),y.jsx("button",{className:"app-filter-close",onClick:tn,"aria-label":"Close",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:y.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),y.jsx("input",{className:"form-input app-filter-search",type:"text",value:_t,onChange:Oe=>an(Oe.target.value),onKeyDown:Oe=>{Oe.key==="Enter"&&_t.trim()&&(be(_t.trim()),tn())},placeholder:"Search or type a package name",autoFocus:!0}),y.jsxs("ul",{className:"app-filter-list",children:[oe&&Te.length===0?Array.from({length:6}).map((Oe,pt)=>y.jsx("li",{className:"app-filter-row app-filter-skeleton",children:y.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${pt}`)):Xe.length===0&&!_t.trim()?y.jsx("li",{className:"app-filter-empty",children:"No apps"}):Xe.map(Oe=>y.jsx("li",{className:"app-filter-row",onClick:()=>{be(Oe.packageName),tn()},children:y.jsxs("div",{className:"app-filter-row-labels",children:[y.jsx("div",{className:"app-filter-row-name",children:Oe.appName||Oe.packageName}),Oe.appName&&y.jsx("div",{className:"app-filter-row-pkg",children:Oe.packageName})]})},Oe.packageName)),_t.trim()&&y.jsx("li",{className:"app-filter-row",onClick:()=>{be(_t.trim()),tn()},children:y.jsx("div",{className:"app-filter-row-labels",children:y.jsx("div",{className:"app-filter-row-name",children:_t.trim()})})})]})]})})})()]})}function Hx({pullDistance:e,refreshing:t,threshold:r}){const s=e>0||t,l=e>=r;return y.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:y.jsx("div",{className:"pull-to-refresh-badge",children:t?y.jsx("div",{className:"spinner"}):y.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:[y.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),y.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function qx({onRefresh:e,threshold:t=70,maxPull:r=110,enabled:s=!0}){const[l,o]=k.useState(0),[c,f]=k.useState(!1),d=k.useRef(null),m=k.useRef(!1),b=k.useRef(0),g=k.useRef(!1),x=k.useRef(e);return k.useEffect(()=>{x.current=e}),k.useEffect(()=>{if(!s)return;const v=D=>{if(g.current||window.scrollY>0){d.current=null;return}if(XE(D.target)){d.current=null;return}d.current=D.touches[0].clientY,m.current=!1,b.current=0},S=D=>{if(g.current||d.current==null)return;const M=D.touches[0].clientY-d.current;if(M<=0){m.current=!1,b.current=0,o(0);return}m.current=!0;const P=Math.min(r,M*.5);b.current=P,o(P),D.cancelable&&D.preventDefault()},N=()=>{if(!m.current){d.current=null,o(0);return}const D=b.current;d.current=null,m.current=!1,b.current=0,D>=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",N,{passive:!0}),window.addEventListener("touchcancel",N,{passive:!0}),()=>{window.removeEventListener("touchstart",v),window.removeEventListener("touchmove",S),window.removeEventListener("touchend",N),window.removeEventListener("touchcancel",N)}},[s,t,r]),{pullDistance:l,refreshing:c,threshold:t}}function XE(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 KE(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 QE({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:o,isNotificationListener:c,onViewRun:f,hostInfoStatus:d,onRetryHostInfo:m}){const[b,g]=k.useState([]),[x,v]=k.useState(!1),[S,N]=k.useState(null),[D,M]=k.useState(new Map),[P,I]=k.useState(!1),[ue,H]=k.useState(void 0),O=k.useCallback(()=>{I(!1),H(void 0)},[]),ee=k.useCallback(async()=>{if(e){v(!0),N(null);try{const le=(await r("task.list")).tasks??[],ne=new Map;for(const W of le)W.status&&ne.set(W.id,W.status);M(ne),g(le)}catch(F){const le=F instanceof Error?F.message:String(F);le==="Not connected"||le.includes("503")||le.toLowerCase().includes("no responders")?N(null):N(le),g([])}finally{v(!1)}}},[e,t,r]);k.useEffect(()=>{e?ee():(g([]),v(!1))},[e,t,ee]);const G=k.useRef(!1);k.useEffect(()=>{d==="error"?G.current=!0:d==="ready"&&G.current&&(G.current=!1,ee())},[d,ee]);const B=qx({onRefresh:ee,enabled:e});k.useEffect(()=>!e||!t?void 0:s(t,async le=>{const ne=le.subject.split(".");if(ne.length<3)return;const W=ne.slice(2).join(".");let V={};try{V=JSON.parse(new TextDecoder().decode(le.data))}catch{return}const K=V.event_type;if(!(K!=="running-state"&&K!=="permission-resolved"))try{const ce=await r("task.status",{id:W},{timeout:5e3});if(ce.error)return;M(Ee=>{const E=new Map(Ee);return E.set(W,ce),E})}catch{}}),[e,t,s,r]);function z(F){g(le=>{const ne=le.findIndex(W=>W.id===F.id);if(ne>=0){const W=[...le];return W[ne]=F,W}return[F,...le]}),I(!1),H(void 0)}function X(F){g(le=>le.filter(ne=>ne.id!==F)),M(le=>{const ne=new Map(le);return ne.delete(F),ne})}return y.jsxs(y.Fragment,{children:[y.jsx(Hx,{pullDistance:B.pullDistance,refreshing:B.refreshing,threshold:B.threshold}),S&&y.jsxs("div",{className:"form-error",children:[S,S.toLowerCase().includes("failed to fetch")&&y.jsxs(y.Fragment,{children:[" ",y.jsx("a",{href:"#",onClick:F=>{F.preventDefault(),window.location.reload()},children:"Reload"})]})]}),x&&!b.length&&d==="ready"?y.jsx("div",{className:"task-list",children:[0,1,2].map(F=>y.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[y.jsx("div",{className:"task-card-header",children:y.jsxs("div",{className:"task-card-title-row",children:[y.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),y.jsx("div",{className:"skeleton-line",style:{width:`${60+F*12}%`}})]})}),y.jsxs("div",{className:"task-card-meta",children:[y.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},F))}):b.length===0?d==="loading"?y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),y.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Retrying automatically — if this persists, run ",y.jsx("code",{children:"palmier restart"})," on the host machine."]}),y.jsx("button",{className:"btn btn-secondary",onClick:m,children:"Retry now"})]}):y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),y.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):y.jsx("div",{className:"task-list",children:b.map(F=>y.jsx(PE,{task:F,lastEvent:D.get(F.id),onEdit:le=>{H(le),I(!0),r("task.get",{id:le.id}).then(ne=>{ne.error||H(ne)}).catch(()=>{})},onDelete:X,onViewRun:f},F.id))}),y.jsx("button",{className:"fab",onClick:()=>{H(void 0),I(!0)},"aria-label":"New task",title:"New task",children:y.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),y.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),P&&y.jsx(JE,{initial:ue,agents:l,hostPlatform:o,isNotificationListener:c,onSaved:z,onCancel:O},ue?KE(ue):"new")]})}let ba=null;function K0(e){ba&&(e.preventDefault(),e.returnValue="")}function Mh(e){const t=!!ba;ba=e;const r=!!ba;r&&!t?window.addEventListener("beforeunload",K0):!r&&t&&window.removeEventListener("beforeunload",K0)}function _s(){return ba?window.confirm(ba):!0}function ZE(){const e=Yr(),t=_r(),{hostId:r}=Yu(),s=t.pathname.endsWith("/tasks"),l=!s;function o(c){_s()&&r&&e(`/hosts/${encodeURIComponent(r)}${c}`)}return y.jsxs(y.Fragment,{children:[y.jsxs("button",{className:`tab-btn ${l?"tab-btn-active":""}`,onClick:()=>o(""),children:[y.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:y.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),y.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>o("/tasks"),children:[y.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:[y.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),y.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}function Ix(e){const[t,r]=k.useState(()=>window.matchMedia(e).matches);return k.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=Vn.isNativePlatform(),WE=["Device","Data","Messaging"],eC=[{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 tC(){if(!Cu||!Cn)return new Set;try{const{capabilities:e}=await Cn.getCapabilityStatus();return new Set(e.filter(t=>t.enabled).map(t=>t.name))}catch{return new Set}}function Fx({onChange:e,confirmDisable:t=!1}){const[r,s]=k.useState(new Map),[l,o]=k.useState(null),[c,f]=k.useState(null),d=k.useCallback(async()=>{if(!(!Cu||!Cn))try{const{capabilities:S}=await Cn.getCapabilityStatus(),N=new Map;for(const D of S)N.set(D.name,D);s(N),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]);k.useEffect(()=>{d()},[d]),k.useEffect(()=>{if(!Cu)return;const S=gd.addListener("resume",d);return()=>{S.then(N=>N.remove())}},[d]);async function m(S,N){if(Cn){o(S.capability);try{const D=await Cn.setCapabilityEnabled({capability:S.capability,enabled:N});!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{o(null)}}}function b(S){const N=r.get(S.capability);if(N){if(N.enabled&&t){f(S);return}m(S,!N.enabled)}}function g(){const S=c;S&&(f(null),m(S,!1))}if(!Cu)return null;const x=WE.map(S=>({group:S,items:eC.filter(N=>{const D=r.get(N.capability);return N.group===S&&(D==null?void 0:D.supported)})})).filter(S=>S.items.length>0);if(x.length===0)return y.jsx("div",{className:"capability-toggles-loading",children:y.jsx("span",{className:"spinner"})});const v=c&&gi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>f(null),children:y.jsxs("div",{className:"confirm-modal",onClick:S=>S.stopPropagation(),children:[y.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",c.label,"?"]}),y.jsxs("p",{className:"confirm-modal-message",children:["All hosts linked to this device will no longer be able to use ",c.label,"."]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:g,children:"Disable"})]})]})}),document.body);return y.jsxs(y.Fragment,{children:[x.map(({group:S,items:N},D)=>y.jsx("div",{className:D>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:N.map(M=>{const P=r.get(M.capability),I=!!(P!=null&&P.enabled);return y.jsxs("label",{className:"drawer-toggle",children:[y.jsx("span",{className:"drawer-toggle-label",children:M.label}),y.jsx("button",{className:`toggle-switch ${I?"toggle-switch-on":""}`,onClick:()=>b(M),disabled:l===M.capability,role:"switch","aria-checked":I,children:y.jsx("span",{className:"toggle-switch-thumb"})})]},M.capability)})},S)),v]})}function Dh(e){return e.replace(/^https:\/\//,"")}function nC({request:e,onClose:t}){const[r,s]=k.useState(null),[l,o]=k.useState(!1),[c,f]=k.useState(null),[d,m]=k.useState(!1);k.useEffect(()=>{let x=!1;return e("passwords.list").then(v=>{x||(v.passwords?s([...v.passwords].sort((S,N)=>S.origin===N.origin?S.username.localeCompare(N.username):S.origin.localeCompare(N.origin))):o(!0))}).catch(()=>{x||o(!0)}),()=>{x=!0}},[e]);async function b(){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(N=>!(N.origin===x&&N.username===v)))??S),f(null)}catch(S){console.error("Failed to delete password:",S)}finally{m(!1)}}const g=c&&gi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>{d||f(null)},children:y.jsxs("div",{className:"confirm-modal",onClick:x=>x.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Remove password?"}),y.jsxs("p",{className:"confirm-modal-message",children:["The saved password for ",y.jsx("strong",{children:c.username})," on"," ",y.jsx("strong",{children:Dh(c.origin)})," will be removed from this host."]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),disabled:d,children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:b,disabled:d,children:d?"Removing…":"Remove"})]})]})}),document.body);return gi.createPortal(y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"confirm-modal-overlay",onClick:t,children:y.jsxs("div",{className:"confirm-modal passwords-dialog",onClick:x=>x.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Saved Passwords"}),y.jsx("div",{className:"passwords-dialog-scroll",children:l?y.jsx("p",{className:"passwords-empty",children:"Couldn't load saved passwords."}):r===null?y.jsx("p",{className:"passwords-empty",children:"Loading…"}):r.length===0?y.jsx("p",{className:"passwords-empty",children:"No saved passwords. Passwords are saved when you approve them during a task."}):y.jsx("ul",{className:"passwords-list",children:r.map(x=>y.jsxs("li",{className:"password-item",children:[y.jsxs("div",{className:"password-item-text",children:[y.jsx("span",{className:"password-item-origin",children:Dh(x.origin)}),y.jsx("span",{className:"password-item-username",children:x.username})]}),y.jsx("button",{className:"password-delete-btn",onClick:()=>f(x),"aria-label":`Remove password for ${x.username} on ${Dh(x.origin)}`,children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.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}`))})}),y.jsx("div",{className:"confirm-modal-actions",children:y.jsx("button",{className:"btn btn-primary",onClick:t,children:"Done"})})]})}),g]}),document.body)}const Q0=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),rC=Vn.isNativePlatform();function Z0({daemonVersion:e,agents:t,playwrightCli:r,linkedClientToken:s,request:l,onEnabledCapabilitiesChange:o,onLinkedClientTokenChange:c}){var Nn;const{pairedHosts:f,removePairedHost:d,renamePairedHost:m}=Wi(),{activeHost:b}=vi(),g=Yr(),x=_r(),S=Yu().hostId??null,N=b.clientToken||null,D=!!N&&s===N,M=Ix("(min-width: 768px)"),[P,I]=k.useState(!1),[ue,H]=k.useState(()=>Date.now());k.useEffect(()=>{const qe=()=>H(Date.now()),tt=6e4-Date.now()%6e4,st=setTimeout(()=>{qe();const Mt=setInterval(qe,6e4);st._iv=Mt},tt);return()=>{const Mt=st._iv;Mt&&clearInterval(Mt),clearTimeout(st)}},[]);const O=b.timezone?new Date(ue).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:b.timezone}):"";async function ee(){if(!(!Cn||!l||!N)){I(!0);try{const{token:qe}=await Cn.getFcmToken();if(!qe)return;await l("device.link",{fcmToken:qe}),c==null||c(N)}catch(qe){console.error("Failed to make this the linked device:",qe)}finally{I(!1)}}}async function G(qe){const tt=qe===S;if(tt&&l)try{await l("clients.revoke_self")}catch{}d(qe),Ee(null),tt&&g("/",{replace:!0})}function B(qe){const st=x.pathname.endsWith("/tasks")?"/tasks":"";g(`/hosts/${encodeURIComponent(qe)}${st}`)}const[z,X]=k.useState(!1),[F,le]=k.useState(!1),[ne,W]=k.useState(null),[V,K]=k.useState(""),[ce,Ee]=k.useState(null),[E,L]=k.useState(!1),[J,j]=k.useState(!1),be=k.useRef(null),Te=k.useRef(null),Ce=k.useCallback(()=>{le(!0)},[]);function oe(){F&&(X(!1),le(!1))}function Re(){le(!1),X(!0)}function _e(qe,tt){W(qe),K(tt)}function Fe(){ne&&V.trim()&&m(ne,V.trim()),W(null),K("")}function _t(){W(null),K("")}k.useEffect(()=>{ne&&Te.current&&(Te.current.focus(),Te.current.select())},[ne]),k.useEffect(()=>{if(!z||F)return;function qe(tt){tt.key==="Escape"&&Ce()}return document.addEventListener("keydown",qe),()=>{document.removeEventListener("keydown",qe)}},[z,F,Ce]);const an=y.jsxs(y.Fragment,{children:[!M&&y.jsx("button",{className:"drawer-close-btn",onClick:Ce,"aria-label":"Close menu",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:y.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!Q0&&f.length>0&&y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),y.jsx("div",{className:"host-picker-inline",children:y.jsx("div",{className:"host-picker-list",role:"listbox",children:f.map(qe=>{const tt=qe.hostId===S,st=ne===qe.hostId,Mt=qe.name||qe.hostId.slice(0,8);return y.jsx("div",{className:"host-picker-item-wrapper",children:y.jsxs("div",{className:`host-picker-item ${tt?"host-picker-item-active":""}`,onClick:()=>{if(!st&&!tt){if(!_s())return;B(qe.hostId),M||Ce()}},role:"option","aria-selected":tt,children:[st?y.jsx("input",{ref:Te,className:"form-input host-picker-rename-input",type:"text",value:V,onChange:kt=>K(kt.target.value),onKeyDown:kt=>{kt.key==="Enter"&&Fe(),kt.key==="Escape"&&_t()},onBlur:Fe,onClick:kt=>kt.stopPropagation()}):y.jsx("span",{className:"host-picker-item-name",children:Mt}),y.jsxs("div",{className:"host-picker-item-actions",children:[tt&&!st&&y.jsx("button",{className:"host-picker-edit-btn",onClick:kt=>{kt.stopPropagation(),_e(qe.hostId,Mt)},"aria-label":"Rename host",children:y.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:y.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"})})}),!tt&&y.jsx("button",{className:"host-picker-delete-btn",onClick:kt=>{kt.stopPropagation(),Ee(qe.hostId)},"aria-label":`Unpair ${Mt}`,children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.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"})})})]})]})},qe.hostId)})})})]}),!Q0&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsx("div",{className:"drawer-section",children:y.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{_s()&&(g("/pair"),M||Ce())},children:"Add New Host"})})]}),rC&&l&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Device Capabilities"}),D?y.jsx(Fx,{onChange:o,confirmDisable:!0}):y.jsxs(y.Fragment,{children:[y.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.)."}),y.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>{s&&s!==N?L(!0):ee()},disabled:P,children:P?"Linking…":"Link the host to this device"})]})]})]}),l&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Passwords"}),y.jsx("button",{className:"btn btn-link",onClick:()=>j(!0),children:"Manage saved passwords"})]})]}),y.jsxs("div",{className:"drawer-footer",children:[t&&t.length>0&&(()=>{const qe=t.filter(st=>st.version),tt=t.filter(st=>!st.version);return y.jsxs("div",{className:"drawer-agents",children:[qe.length>0&&y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Agents"}),qe.map(st=>y.jsxs("div",{className:"drawer-agents-row",children:[y.jsx("span",{children:st.label}),y.jsxs("span",{className:"drawer-agents-version",children:["v",st.version]})]},st.key))]}),tt.length>0&&y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Version not managed by Palmier"}),tt.map(st=>y.jsx("div",{className:"drawer-agents-row",children:y.jsx("span",{children:st.label})},st.key))]})]})})(),r&&y.jsx("div",{className:"drawer-agents",children:y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Browser Automation"}),y.jsxs("div",{className:"drawer-agents-row",children:[y.jsx("span",{children:r.label}),y.jsxs("span",{className:"drawer-agents-version",children:["v",r.version]})]})]})}),(b.timezone||e)&&y.jsxs("div",{className:"drawer-host-info",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Host"}),b.timezone&&y.jsxs("div",{className:"drawer-host-time",children:[O," · ",b.timezone]}),e&&y.jsxs("div",{className:"drawer-version",children:["Version: v",e]})]}),y.jsxs("div",{className:"drawer-legal",children:[y.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),y.jsx("span",{className:"drawer-legal-sep",children:"·"}),y.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),tn=!!ce&&ce===S&&D,Ft=ce&&gi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>Ee(null),children:y.jsxs("div",{className:"confirm-modal",onClick:qe=>qe.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Remove host?"}),y.jsxs("p",{className:"confirm-modal-message",children:['"',((Nn=f.find(qe=>qe.hostId===ce))==null?void 0:Nn.name)||ce.slice(0,8),'" will be ',tn?"removed and unlinked":"removed",".",tn&&y.jsx(y.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."})]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>Ee(null),children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:()=>G(ce),children:"Remove"})]})]})}),document.body),Pt=E&&gi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>L(!1),children:y.jsxs("div",{className:"confirm-modal",onClick:qe=>qe.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),y.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."}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>L(!1),children:"Cancel"}),y.jsx("button",{className:"btn btn-primary",onClick:()=>{L(!1),ee()},children:"Link"})]})]})}),document.body),Kt=J&&l&&y.jsx(nC,{request:l,onClose:()=>j(!1)});return M?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:be,children:an}),Ft,Pt,Kt]}):y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"hamburger-btn",onClick:Re,"aria-label":"Open menu",children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:y.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),z&&gi.createPortal(y.jsx("div",{className:`drawer-overlay ${F?"drawer-overlay-closing":""}`,onClick:Ce,onAnimationEnd:oe,children:y.jsx("div",{className:`drawer-panel ${F?"drawer-panel-closing":""}`,ref:be,onClick:qe=>qe.stopPropagation(),children:an})}),document.body),Ft,Pt,Kt]})}const iC=Vn.isNativePlatform(),Jd={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function sC(){return y.jsxs("svg",{...Jd,"aria-hidden":"true",children:[y.jsx("path",{d:"M3 11 L12 3 L21 11"}),y.jsx("path",{d:"M5 9.5 V21 H19 V9.5"})]})}function W0(){return y.jsxs("svg",{...Jd,"aria-hidden":"true",children:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),y.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 aC(){return y.jsxs("svg",{...Jd,"aria-hidden":"true",children:[y.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"}),y.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),y.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function lC(){const{mode:e}=vi(),[t,r]=k.useState(!1),s=k.useRef(null);if(k.useEffect(()=>{if(!t)return;function f(m){var b;(b=s.current)!=null&&b.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=y.jsx(sC,{}),o="Connected via LAN",c="lan";break;case"nats":l=y.jsx(W0,{}),o=iC?"Connected via relay":"Connected",c="relay";break;case"disconnected":l=y.jsx(aC,{}),o="Disconnected",c="disconnected";break;case"connecting":default:l=y.jsx(W0,{}),o="Connecting…",c="connecting";break}return y.jsxs("div",{ref:s,className:`conn-status conn-status--${c}`,children:[y.jsx("button",{type:"button",className:"conn-status-btn","aria-label":o,onClick:()=>r(f=>!f),children:l}),y.jsx("div",{className:`conn-status-popover ${t?"conn-status-popover--open":""}`,role:"tooltip",children:o})]})}function eb(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 oC({agents:e,hostPlatform:t,onStarted:r}){const{request:s,activeHost:l}=vi(),{setHostLastAgent:o}=Wi(),[c,f]=k.useState(""),[d,m]=k.useState(()=>eb(e,l.lastAgent)),[b,g]=k.useState(!1),[x,v]=k.useState(!1),[S,N]=k.useState(null);k.useEffect(()=>{e.length&&(e.find(O=>O.key===d)||m(eb(e,l.lastAgent)))},[e,d,l.lastAgent]),k.useEffect(()=>{const O=c.trim().length>0;return Mh(O?"Your session draft will be lost. Continue?":null),()=>Mh(null)},[c]);const D=e.find(O=>O.key===d),M=!!(D!=null&&D.supportsYolo);k.useEffect(()=>{!M&&b&&g(!1)},[M,b]);const P=!!c.trim()&&!!d&&!x;function I(){return b?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
|
-
|
|
93
|
-
Are you sure you want to continue?`):!0}async function ue(){if(!(!P||!I())){v(!0),N(null);try{const O=await s("task.run_oneoff",{user_prompt:c,agent:d,yolo_mode:b,...t==="win32"?{foreground_mode:!0}:{}});if(O.error){N(O.error);return}o(l.hostId,d),f(""),Mh(null),O.task_id&&r(O.task_id,O.run_id)}catch(O){N(O instanceof Error?O.message:String(O))}finally{v(!1)}}}function H(O){O.key==="Enter"&&(O.metaKey||O.ctrlKey)&&(O.preventDefault(),ue())}return y.jsxs("div",{className:"session-composer",children:[S&&y.jsx("div",{className:"form-error",children:S}),y.jsx("textarea",{className:"session-composer-textarea",value:c,onChange:O=>f(O.target.value),onKeyDown:H,placeholder:"What can I do for you?",rows:3,disabled:x}),y.jsxs("div",{className:"session-composer-controls",children:[e.length>0&&y.jsx("div",{className:"agent-picker-section-inline",children:e.length>1?y.jsx("select",{className:"form-select form-select-sm",value:d,onChange:O=>m(O.target.value),disabled:x,children:e.map(O=>y.jsx("option",{value:O.key,children:O.label},O.key))}):y.jsx("span",{className:"agent-picker-single",children:(D==null?void 0:D.label)??e[0].label})}),M&&y.jsxs("label",{className:"session-composer-yolo",children:[y.jsx("input",{type:"checkbox",checked:b,onChange:O=>g(O.target.checked),disabled:x}),"Yolo"]}),y.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:ue,disabled:!P,"aria-label":"Run session",title:"Run session",children:x?y.jsx("span",{className:"btn-spinner"}):y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),M&&b&&y.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const vs=72,tb=6;function uC({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.",disabled:d=!1}){const m=t===e,[b,g]=k.useState(0),[x,v]=k.useState(!1),S=k.useRef(0),N=k.useRef(0),D=k.useRef(null),M=k.useRef(0),P=k.useRef(!1),I=k.useRef(null);k.useEffect(()=>{m||g(0)},[m]),k.useEffect(()=>{if(!m)return;function B(z){var X;(X=I.current)!=null&&X.contains(z.target)||r(null)}return document.addEventListener("pointerdown",B),()=>document.removeEventListener("pointerdown",B)},[m,r]);function ue(B){B.button!==void 0&&B.button!==0||(S.current=B.clientX,N.current=B.clientY,D.current=null,M.current=m?-vs:0,P.current=!1)}function H(B){if(d||B.pointerType==="mouse"&&B.buttons===0)return;const z=B.clientX-S.current,X=B.clientY-N.current;if(D.current===null){if(Math.abs(z)<tb&&Math.abs(X)<tb)return;if(D.current=Math.abs(z)>Math.abs(X)?"x":"y",D.current==="x")try{B.currentTarget.setPointerCapture(B.pointerId)}catch{}}if(D.current!=="x")return;P.current=!0,x||v(!0);let F=M.current+z;F>0&&(F=F/4),F<-vs&&(F=-vs+(F+vs)/4),g(F)}function O(){if(D.current!=="x"){v(!1);return}D.current=null,v(!1),b<=-36?(g(-vs),r(e)):(g(0),m&&r(null))}function ee(B){if(P.current){P.current=!1,B.stopPropagation(),B.preventDefault();return}m&&(B.stopPropagation(),B.preventDefault(),r(null))}const G=b!==0?b:m?-vs:0;return y.jsxs("div",{ref:I,className:"swipe-row",children:[!d&&y.jsxs("button",{type:"button",className:`swipe-row-action${G<0?"":" swipe-row-action--hidden"}`,style:{width:vs},onClick:B=>{B.stopPropagation(),window.confirm(f)&&s()},tabIndex:m?0:-1,"aria-hidden":!m,"aria-label":c,children:[y.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:[y.jsx("polyline",{points:"3 6 5 6 21 6"}),y.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),y.jsx("path",{d:"M10 11v6M14 11v6"}),y.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]}),y.jsx("span",{className:"swipe-row-action-label",children:c})]}),y.jsx("div",{className:`swipe-row-content ${x?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${G}px)`},onPointerDown:ue,onPointerMove:H,onPointerUp:O,onPointerCancel:O,onClickCapture:ee,onClick:l,children:o})]})}function $x({starred:e,onToggle:t,className:r}){return y.jsx("button",{type:"button",className:`star-button${e?" star-button--on":""}${r?` ${r}`:""}`,onClick:s=>{s.stopPropagation(),t()},"aria-pressed":e,"aria-label":e?"Unstar session":"Star session",title:e?"Unstar":"Star",children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})}const cC=10;function fC({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:o,filterTaskId:c,onClearFilter:f,hostInfoStatus:d,onRetryHostInfo:m}){const b=Gd(),[g,x]=k.useState([]),[v,S]=k.useState(0),[N,D]=k.useState(!1),[M,P]=k.useState(!1),[I,ue]=k.useState(null),H=Yr();async function O(E){const L=`${E.task_id}:${E.run_id}`;x(J=>J.filter(j=>`${j.task_id}:${j.run_id}`!==L)),S(J=>Math.max(0,J-1)),ue(null);try{await r("taskrun.delete",{task_id:E.task_id,run_id:E.run_id})}catch(J){console.error("Failed to delete run:",J),x(j=>[E,...j]),S(j=>j+1)}}async function ee(E){const L=`${E.task_id}:${E.run_id}`,J=!E.starred,j=be=>x(Te=>Te.map(Ce=>`${Ce.task_id}:${Ce.run_id}`===L?{...Ce,starred:be}:Ce));j(J);try{const be=await r("taskrun.star",{task_id:E.task_id,run_id:E.run_id,starred:J});if(be.error)throw new Error(be.error)}catch(be){console.error("Failed to update star:",be),j(!J)}}const G=k.useRef(null),B=k.useCallback(E=>{const L={offset:E,limit:cC};return c&&(L.task_id=c),L},[c]),z=k.useCallback(async(E,L)=>{if(e){L?P(!0):D(!0);try{const J=await r("taskrun.list",B(E)),j=J.entries??[];S(J.total??0),x(L?be=>{const Te=new Set(be.map(oe=>`${oe.task_id}:${oe.run_id}`)),Ce=j.filter(oe=>!Te.has(`${oe.task_id}:${oe.run_id}`));return[...be,...Ce]}:j)}catch(J){J instanceof Error&&J.message==="Not connected"||console.error("Failed to load runs:",J)}finally{D(!1),P(!1)}}},[e,r,B]);k.useEffect(()=>{e?(x([]),S(0),z(0,!1)):(x([]),S(0))},[e,t,z,c]);const X=k.useRef(!1);k.useEffect(()=>{d==="error"?X.current=!0:d==="ready"&&X.current&&(X.current=!1,z(0,!1))},[d,z]);const F=qx({onRefresh:()=>z(0,!1),enabled:e});k.useEffect(()=>!e||!t?void 0:s(t,async L=>{try{const J=JSON.parse(new TextDecoder().decode(L.data));if(J.event_type==="running-state"&&J.running_state&&["started","finished","failed","aborted"].includes(J.running_state)){const j=await r("taskrun.list",B(0)),be=j.entries??[];S(j.total??0),x(Te=>{const Ce=new Map(be.map(Fe=>[`${Fe.task_id}:${Fe.run_id}`,Fe])),oe=Te.map(Fe=>{const _t=`${Fe.task_id}:${Fe.run_id}`;return Ce.get(_t)??Fe}),Re=new Set(oe.map(Fe=>`${Fe.task_id}:${Fe.run_id}`));return[...be.filter(Fe=>!Re.has(`${Fe.task_id}:${Fe.run_id}`)),...oe]})}}catch{}}),[e,t,s,r]),k.useEffect(()=>{const E=G.current;if(!E)return;const L=new IntersectionObserver(J=>{J[0].isIntersecting&&!M&&g.length<v&&z(g.length,!0)},{threshold:.1});return L.observe(E),()=>L.disconnect()},[g.length,v,M,z]);function le(E,L){if(!E||!L)return"";const J=Math.round((L-E)/1e3);if(J<60)return`${J}s`;const j=Math.floor(J/60),be=J%60;return`${j}m ${be}s`}const ne={started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function W(E,L){_s()&&t&&H(`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(E)}/${encodeURIComponent(L)}`)}const V=!c&&d==="ready"&&y.jsx(oC,{agents:l,hostPlatform:o,onStarted:(E,L)=>{if(!t)return;const J=`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(E)}`;H(L?`${J}/${encodeURIComponent(L)}`:J)}}),K=y.jsx(Hx,{pullDistance:F.pullDistance,refreshing:F.refreshing,threshold:F.threshold}),ce=c&&f&&y.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:y.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",y.jsx("button",{onClick:f,"aria-label":"Clear filter",children:"×"})]})});function Ee(E){if(E==="failed")return"var(--color-error)";if(E==="aborted")return"var(--color-warning, #d97706)"}return N&&g.length===0&&e&&d==="ready"?y.jsxs(y.Fragment,{children:[K,V,y.jsx("div",{className:"task-list",children:[0,1,2].map(E=>y.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[y.jsx("div",{className:"task-card-header",children:y.jsx("div",{className:"task-card-title-row",children:y.jsx("div",{className:"skeleton-line",style:{width:`${70+E*10}%`}})})}),y.jsx("div",{className:"task-card-meta",children:y.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},E))})]}):g.length===0?y.jsxs(y.Fragment,{children:[K,V,ce,y.jsx("div",{className:"sessions-view",children:d==="loading"?y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),y.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Retrying automatically — if this persists, run ",y.jsx("code",{children:"palmier restart"})," on the host machine."]}),y.jsx("button",{className:"btn btn-secondary",onClick:m,children:"Retry now"})]}):y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),y.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."})]})})]}):y.jsxs(y.Fragment,{children:[K,V,ce,y.jsxs("div",{className:"task-list",children:[g.map((E,L)=>{const J=`${E.task_id}:${E.run_id}`;return y.jsx(uC,{id:J,revealedId:I,setRevealedId:ue,onDelete:()=>O(E),disabled:E.starred,confirmMessage:"Delete this session? Its run history will be removed from the host.",onClick:()=>!E.error&&W(E.task_id,E.run_id),children:y.jsxs("div",{className:"sessions-card",children:[y.jsxs("div",{className:"sessions-card-body",children:[y.jsx("h3",{className:"sessions-card-name",children:E.task_name||E.task_id}),y.jsxs("div",{className:"sessions-card-meta",children:[E.running_state==="started"?y.jsx("span",{className:"status-spinner","aria-label":"Running",children:y.jsx("span",{})}):y.jsx("span",{style:{color:Ee(E.running_state)},children:ne[E.running_state??""]??E.running_state}),E.end_time&&y.jsx("span",{children:b(E.end_time)}),E.start_time&&E.end_time&&y.jsx("span",{style:{color:"var(--color-muted)"},children:le(E.start_time,E.end_time)}),E.error&&y.jsx("span",{style:{color:"var(--color-muted)"},children:E.error})]})]}),!E.error&&y.jsx($x,{starred:!!E.starred,onToggle:()=>ee(E)}),y.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${J}-${L}`)}),y.jsx("div",{ref:G,style:{height:1}}),M&&y.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:y.jsx("div",{className:"spinner"})})]})]})}function hC(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const dC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pC={};function nb(e,t){return(pC.jsx?mC:dC).test(e)}const gC=/[ \t\n\f\r]/g;function yC(e){return typeof e=="object"?e.type==="text"?rb(e.value):!1:rb(e)}function rb(e){return e.replace(gC,"")===""}class Kl{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}Kl.prototype.normal={};Kl.prototype.property={};Kl.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 Kl(r,s,t)}function xd(e){return e.toLowerCase()}class Yn{constructor(t,r){this.attribute=r,this.property=t}}Yn.prototype.attribute="";Yn.prototype.booleanish=!1;Yn.prototype.boolean=!1;Yn.prototype.commaOrSpaceSeparated=!1;Yn.prototype.commaSeparated=!1;Yn.prototype.defined=!1;Yn.prototype.mustUseProperty=!1;Yn.prototype.number=!1;Yn.prototype.overloadedBoolean=!1;Yn.prototype.property="";Yn.prototype.spaceSeparated=!1;Yn.prototype.space=void 0;let bC=0;const et=Cs(),dn=Cs(),vd=Cs(),Se=Cs(),Ut=Cs(),xa=Cs(),er=Cs();function Cs(){return 2**++bC}const wd=Object.freeze(Object.defineProperty({__proto__:null,boolean:et,booleanish:dn,commaOrSpaceSeparated:er,commaSeparated:xa,number:Se,overloadedBoolean:vd,spaceSeparated:Ut},Symbol.toStringTag,{value:"Module"})),Lh=Object.keys(wd);class Xd extends Yn{constructor(t,r,s,l){let o=-1;if(super(t,r),ib(this,"space",l),typeof s=="number")for(;++o<Lh.length;){const c=Lh[o];ib(this,Lh[o],(s&wd[c])===wd[c])}}}Xd.prototype.defined=!0;function ib(e,t,r){r&&(e[t]=r)}function Na(e){const t={},r={};for(const[s,l]of Object.entries(e.properties)){const o=new Xd(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,r[xd(s)]=s,r[xd(o.attribute)]=s}return new Kl(t,r,e.space)}const Yx=Na({properties:{ariaActiveDescendant:null,ariaAtomic:dn,ariaAutoComplete:null,ariaBusy:dn,ariaChecked:dn,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Ut,ariaCurrent:null,ariaDescribedBy:Ut,ariaDetails:null,ariaDisabled:dn,ariaDropEffect:Ut,ariaErrorMessage:null,ariaExpanded:dn,ariaFlowTo:Ut,ariaGrabbed:dn,ariaHasPopup:null,ariaHidden:dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ut,ariaLevel:Se,ariaLive:null,ariaModal:dn,ariaMultiLine:dn,ariaMultiSelectable:dn,ariaOrientation:null,ariaOwns:Ut,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:dn,ariaReadOnly:dn,ariaRelevant:null,ariaRequired:dn,ariaRoleDescription:Ut,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:dn,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 xC=Na({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xa,acceptCharset:Ut,accessKey:Ut,action:null,allow:null,allowFullScreen:et,allowPaymentRequest:et,allowUserMedia:et,alt:null,as:null,async:et,autoCapitalize:null,autoComplete:Ut,autoFocus:et,autoPlay:et,blocking:Ut,capture:null,charSet:null,checked:et,cite:null,className:Ut,cols:Se,colSpan:null,content:null,contentEditable:dn,controls:et,controlsList:Ut,coords:Se|xa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:et,defer:et,dir:null,dirName:null,disabled:et,download:vd,draggable:dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:et,formTarget:null,headers:Ut,height:Se,hidden:vd,high:Se,href:null,hrefLang:null,htmlFor:Ut,httpEquiv:Ut,id:null,imageSizes:null,imageSrcSet:null,inert:et,inputMode:null,integrity:null,is:null,isMap:et,itemId:null,itemProp:Ut,itemRef:Ut,itemScope:et,itemType:Ut,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:et,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:et,muted:et,name:null,nonce:null,noModule:et,noValidate:et,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:et,optimum:Se,pattern:null,ping:Ut,placeholder:null,playsInline:et,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:et,referrerPolicy:null,rel:Ut,required:et,reversed:et,rows:Se,rowSpan:Se,sandbox:Ut,scope:null,scoped:et,seamless:et,selected:et,shadowRootClonable:et,shadowRootDelegatesFocus:et,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:dn,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:et,useMap:null,value:dn,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:et,declare:et,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:et,noHref:et,noShade:et,noWrap:et,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:dn,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:et,disableRemotePlayback:et,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Jx}),vC=Na({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:er,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:et,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:xa,g2:xa,glyphName:xa,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:er,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:er,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:er,rev:er,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:er,requiredFeatures:er,requiredFonts:er,requiredFormats:er,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:er,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:er,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:er,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=Na({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=Na({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Jx}),Qx=Na({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),wC={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"},SC=/[A-Z]/g,sb=/-[a-z]/g,_C=/^data[-\w.:]+$/i;function kC(e,t){const r=xd(t);let s=t,l=Yn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&_C.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(sb,CC);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!sb.test(o)){let c=o.replace(SC,EC);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=Xd}return new l(s,t)}function EC(e){return"-"+e.toLowerCase()}function CC(e){return e.charAt(1).toUpperCase()}const AC=Vx([Yx,xC,Xx,Kx,Qx],"html"),Kd=Vx([Yx,vC,Xx,Kx,Qx],"svg");function jC(e){return e.join(" ").trim()}var la={},zh,ab;function NC(){if(ab)return zh;ab=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="/",b="*",g="",x="comment",v="declaration";function S(D,M){if(typeof D!="string")throw new TypeError("First argument must be a string");if(!D)return[];M=M||{};var P=1,I=1;function ue(ne){var W=ne.match(t);W&&(P+=W.length);var V=ne.lastIndexOf(d);I=~V?ne.length-V:I+ne.length}function H(){var ne={line:P,column:I};return function(W){return W.position=new O(ne),B(),W}}function O(ne){this.start=ne,this.end={line:P,column:I},this.source=M.source}O.prototype.content=D;function ee(ne){var W=new Error(M.source+":"+P+":"+I+": "+ne);if(W.reason=ne,W.filename=M.source,W.line=P,W.column=I,W.source=D,!M.silent)throw W}function G(ne){var W=ne.exec(D);if(W){var V=W[0];return ue(V),D=D.slice(V.length),W}}function B(){G(r)}function z(ne){var W;for(ne=ne||[];W=X();)W!==!1&&ne.push(W);return ne}function X(){var ne=H();if(!(m!=D.charAt(0)||b!=D.charAt(1))){for(var W=2;g!=D.charAt(W)&&(b!=D.charAt(W)||m!=D.charAt(W+1));)++W;if(W+=2,g===D.charAt(W-1))return ee("End of comment missing");var V=D.slice(2,W-2);return I+=2,ue(V),D=D.slice(W),I+=2,ne({type:x,comment:V})}}function F(){var ne=H(),W=G(s);if(W){if(X(),!G(l))return ee("property missing ':'");var V=G(o),K=ne({type:v,property:N(W[0].replace(e,g)),value:V?N(V[0].replace(e,g)):g});return G(c),K}}function le(){var ne=[];z(ne);for(var W;W=F();)W!==!1&&(ne.push(W),z(ne));return ne}return B(),le()}function N(D){return D?D.replace(f,g):g}return zh=S,zh}var lb;function TC(){if(lb)return la;lb=1;var e=la&&la.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(la,"__esModule",{value:!0}),la.default=r;const t=e(NC());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:b}=d;f?l(m,b,d):b&&(o=o||{},o[m]=b)}),o}return la}var _l={},ob;function OC(){if(ob)return _l;ob=1,Object.defineProperty(_l,"__esModule",{value:!0}),_l.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,b){return b.toUpperCase()},f=function(m,b){return"".concat(b,"-")},d=function(m,b){return b===void 0&&(b={}),o(m)?m:(m=m.toLowerCase(),b.reactCompat?m=m.replace(l,f):m=m.replace(s,f),m.replace(t,c))};return _l.camelCase=d,_l}var kl,ub;function RC(){if(ub)return kl;ub=1;var e=kl&&kl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(TC()),r=OC();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,kl=s,kl}var MC=RC();const DC=Yb(MC),Zx=Wx("end"),Qd=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 LC(e){const t=Qd(e),r=Zx(e);if(t&&r)return{start:t,end:r}}function Ll(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?cb(e.position):"start"in e||"end"in e?cb(e):"line"in e||"column"in e?Sd(e):""}function Sd(e){return fb(e&&e.line)+":"+fb(e&&e.column)}function cb(e){return Sd(e&&e.start)+"-"+Sd(e&&e.end)}function fb(e){return e&&typeof e=="number"?e:1}class jn 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=Ll(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}}jn.prototype.file="";jn.prototype.name="";jn.prototype.reason="";jn.prototype.message="";jn.prototype.stack="";jn.prototype.column=void 0;jn.prototype.line=void 0;jn.prototype.ancestors=void 0;jn.prototype.cause=void 0;jn.prototype.fatal=void 0;jn.prototype.place=void 0;jn.prototype.ruleId=void 0;jn.prototype.source=void 0;const Zd={}.hasOwnProperty,zC=new Map,UC=/[A-Z]/g,PC=new Set(["table","tbody","thead","tfoot","tr"]),BC=new Set(["td","th"]),e1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function HC(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=JC(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=GC(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"?Kd:AC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=t1(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function t1(e,t,r){if(t.type==="element")return qC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return IC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return $C(e,t,r);if(t.type==="mdxjsEsm")return FC(e,t);if(t.type==="root")return VC(e,t,r);if(t.type==="text")return YC(e,t)}function qC(e,t,r){const s=e.schema;let l=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Kd,e.schema=l),e.ancestors.push(t);const o=r1(e,t.tagName,!1),c=XC(e,t);let f=em(e,t);return PC.has(t.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!yC(d):!0})),n1(e,c,o,t),Wd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,r)}function IC(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)}$l(e,t.position)}function FC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);$l(e,t.position)}function $C(e,t,r){const s=e.schema;let l=s;t.name==="svg"&&s.space==="html"&&(l=Kd,e.schema=l),e.ancestors.push(t);const o=t.name===null?e.Fragment:r1(e,t.name,!0),c=KC(e,t),f=em(e,t);return n1(e,c,o,t),Wd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,r)}function VC(e,t,r){const s={};return Wd(s,em(e,t)),e.create(t,e.Fragment,s,r)}function YC(e,t){return t.value}function n1(e,t,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=s)}function Wd(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function GC(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 JC(e,t){return r;function r(s,l,o,c){const f=Array.isArray(o.children),d=Qd(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 XC(e,t){const r={};let s,l;for(l in t.properties)if(l!=="children"&&Zd.call(t.properties,l)){const o=QC(e,l,t.properties[l]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&BC.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 KC(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 $l(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 $l(e,t.position);else o=s.value===null?!0:s.value;r[l]=o}return r}function em(e,t){const r=[];let s=-1;const l=e.passKeys?new Map:zC;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=t1(e,o,c);f!==void 0&&r.push(f)}return r}function QC(e,t,r){const s=kC(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?hC(r):jC(r)),s.property==="style"){let l=typeof r=="object"?r:ZC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=WC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?wC[s.property]||s.property:s.attribute,r]}}function ZC(e,t){try{return DC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new jn("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 o=-1,c;for(;++o<l.length;){const f=nb(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=nb(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const l=s.value;return Zd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);$l(e)}function $l(e,t){const r=new jn("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 WC(e){const t={};let r;for(r in e)Zd.call(e,r)&&(t[eA(r)]=e[r]);return t}function eA(e){let t=e.replace(UC,tA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function tA(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"]},nA={};function tm(e,t){const r=nA,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(rA(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 hb(e.children,t,r)}return Array.isArray(e)?hb(e,t,r):""}function hb(e,t,r){const s=[];let l=-1;for(;++l<e.length;)s[l]=i1(e[l],t,r);return s.join("")}function rA(e){return!!(e&&typeof e=="object")}const db=document.createElement("i");function nm(e){const t="&"+e+";";db.innerHTML=t;const r=db.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function sr(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 Sr(e,t){return e.length>0?(sr(e,e.length,0,t),e):t}const mb={}.hasOwnProperty;function s1(e){const t={};let r=-1;for(;++r<e.length;)iA(t,e[r]);return t}function iA(e,t){let r;for(r in t){const l=(mb.call(e,r)?e[r]:void 0)||(e[r]={}),o=t[r];let c;if(o)for(c in o){mb.call(l,c)||(l[c]=[]);const f=o[c];sA(l[c],Array.isArray(f)?f:f?[f]:[])}}}function sA(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);sr(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 Mr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ln=ts(/[A-Za-z]/),An=ts(/[\dA-Za-z]/),aA=ts(/[#-'*+\--9=?A-Z^-~]/);function Hu(e){return e!==null&&(e<32||e===127)}const _d=ts(/\d/),lA=ts(/[\dA-Fa-f]/),oA=ts(/[!-/:-@[-`{-~]/);function Ye(e){return e!==null&&e<-2}function Lt(e){return e!==null&&(e<0||e===32)}function ut(e){return e===-2||e===-1||e===32}const Wu=ts(new RegExp("\\p{P}|\\p{S}","u")),ks=ts(/\s/);function ts(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Ta(e){const t=[];let r=-1,s=0,l=0;for(;++r<e.length;){const o=e.charCodeAt(r);let c="";if(o===37&&An(e.charCodeAt(r+1))&&An(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 yt(e,t,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(d){return ut(d)?(e.enter(r),f(d)):t(d)}function f(d){return ut(d)&&o++<l?(e.consume(d),f):(e.exit(r),t(d))}}const uA={tokenize:cA};function cA(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"),yt(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 Ye(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const fA={tokenize:hA},pb={tokenize:dA};function hA(e){const t=this,r=[];let s=0,l,o,c;return f;function f(I){if(s<r.length){const ue=r[s];return t.containerState=ue[1],e.attempt(ue[0].continuation,d,m)(I)}return m(I)}function d(I){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&P();const ue=t.events.length;let H=ue,O;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){O=t.events[H][1].end;break}M(s);let ee=ue;for(;ee<t.events.length;)t.events[ee][1].end={...O},ee++;return sr(t.events,H+1,0,t.events.slice(ue)),t.events.length=ee,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(pb,b,g)(I)}function b(I){return l&&P(),M(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(pb,v,S)(I)}function v(I){return s++,r.push([t.currentConstruct,t.containerState]),x(I)}function S(I){if(I===null){l&&P(),M(0),e.consume(I);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:o}),N(I)}function N(I){if(I===null){D(e.exit("chunkFlow"),!0),M(0),e.consume(I);return}return Ye(I)?(e.consume(I),D(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),N)}function D(I,ue){const H=t.sliceStream(I);if(ue&&H.push(null),I.previous=o,o&&(o.next=I),o=I,l.defineSkip(I.start),l.write(H),t.parser.lazy[I.start.line]){let O=l.events.length;for(;O--;)if(l.events[O][1].start.offset<c&&(!l.events[O][1].end||l.events[O][1].end.offset>c))return;const ee=t.events.length;let G=ee,B,z;for(;G--;)if(t.events[G][0]==="exit"&&t.events[G][1].type==="chunkFlow"){if(B){z=t.events[G][1].end;break}B=!0}for(M(s),O=ee;O<t.events.length;)t.events[O][1].end={...z},O++;sr(t.events,G+1,0,t.events.slice(ee)),t.events.length=O}}function M(I){let ue=r.length;for(;ue-- >I;){const H=r[ue];t.containerState=H[1],H[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 dA(e,t,r){return yt(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ka(e){if(e===null||Lt(e)||ks(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 kd={name:"attention",resolveAll:mA,tokenize:pA};function mA(e,t){let r=-1,s,l,o,c,f,d,m,b;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};gb(g,-d),gb(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=Sr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Sr(m,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",o,t]]),m=Sr(m,ec(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),m=Sr(m,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[r][1].end.offset-e[r][1].start.offset?(b=2,m=Sr(m,[["enter",e[r][1],t],["exit",e[r][1],t]])):b=0,sr(e,s-1,r-s+3,m),r=s+m.length-b-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function pA(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=ka(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"),b=ka(d),g=!b||b===2&&l||r.includes(d),x=!l||l===2&&b||r.includes(s);return m._open=!!(o===42?g:g&&(l||!x)),m._close=!!(o===42?x:x&&(b||!g)),t(d)}}function gb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const gA={name:"autolink",tokenize:yA};function yA(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 Ln(v)?(e.consume(v),c):v===64?r(v):m(v)}function c(v){return v===43||v===45||v===46||An(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||An(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),b):aA(v)?(e.consume(v),m):r(v)}function b(v){return An(v)?g(v):r(v)}function g(v){return v===46?(e.consume(v),s=0,b):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||An(v))&&s++<63){const S=v===45?x:g;return e.consume(v),S}return r(v)}}const Ql={partial:!0,tokenize:bA};function bA(e,t,r){return s;function s(o){return ut(o)?yt(e,l,"linePrefix")(o):l(o)}function l(o){return o===null||Ye(o)?t(o):r(o)}}const l1={continuation:{tokenize:vA},exit:wA,name:"blockQuote",tokenize:xA};function xA(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 ut(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function vA(e,t,r){const s=this;return l;function l(c){return ut(c)?yt(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(l1,t,r)(c)}}function wA(e){e.exit("blockQuote")}const o1={name:"characterEscape",tokenize:SA};function SA(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 oA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(o)}}const u1={name:"characterReference",tokenize:_A};function _A(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=An,b(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=lA,b):(e.enter("characterReferenceValue"),o=7,c=_d,b(g))}function b(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===An&&!nm(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),b):r(g)}}const yb={partial:!0,tokenize:EA},bb={concrete:!0,name:"codeFenced",tokenize:kA};function kA(e,t,r){const s=this,l={partial:!0,tokenize:H};let o=0,c=0,f;return d;function d(O){return m(O)}function m(O){const ee=s.events[s.events.length-1];return o=ee&&ee[1].type==="linePrefix"?ee[2].sliceSerialize(ee[1],!0).length:0,f=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(O)}function b(O){return O===f?(c++,e.consume(O),b):c<3?r(O):(e.exit("codeFencedFenceSequence"),ut(O)?yt(e,g,"whitespace")(O):g(O))}function g(O){return O===null||Ye(O)?(e.exit("codeFencedFence"),s.interrupt?t(O):e.check(yb,N,ue)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===null||Ye(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(O)):ut(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),yt(e,v,"whitespace")(O)):O===96&&O===f?r(O):(e.consume(O),x)}function v(O){return O===null||Ye(O)?g(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(O))}function S(O){return O===null||Ye(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(O)):O===96&&O===f?r(O):(e.consume(O),S)}function N(O){return e.attempt(l,ue,D)(O)}function D(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),M}function M(O){return o>0&&ut(O)?yt(e,P,"linePrefix",o+1)(O):P(O)}function P(O){return O===null||Ye(O)?e.check(yb,N,ue)(O):(e.enter("codeFlowValue"),I(O))}function I(O){return O===null||Ye(O)?(e.exit("codeFlowValue"),P(O)):(e.consume(O),I)}function ue(O){return e.exit("codeFenced"),t(O)}function H(O,ee,G){let B=0;return z;function z(W){return O.enter("lineEnding"),O.consume(W),O.exit("lineEnding"),X}function X(W){return O.enter("codeFencedFence"),ut(W)?yt(O,F,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):F(W)}function F(W){return W===f?(O.enter("codeFencedFenceSequence"),le(W)):G(W)}function le(W){return W===f?(B++,O.consume(W),le):B>=c?(O.exit("codeFencedFenceSequence"),ut(W)?yt(O,ne,"whitespace")(W):ne(W)):G(W)}function ne(W){return W===null||Ye(W)?(O.exit("codeFencedFence"),ee(W)):G(W)}}}function EA(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:AA},CA={partial:!0,tokenize:jA};function AA(e,t,r){const s=this;return l;function l(m){return e.enter("codeIndented"),yt(e,o,"linePrefix",5)(m)}function o(m){const b=s.events[s.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?c(m):r(m)}function c(m){return m===null?d(m):Ye(m)?e.attempt(CA,c,d)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||Ye(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),f)}function d(m){return e.exit("codeIndented"),t(m)}}function jA(e,t,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):Ye(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):yt(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):Ye(c)?l(c):r(c)}}const NA={name:"codeText",previous:OA,resolve:TA,tokenize:RA};function TA(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 OA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function RA(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,b(g)):Ye(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||Ye(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),m)}function b(g){return g===96?(e.consume(g),l++,b):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",m(g))}}class MA{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&&El(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),El(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),El(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);El(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);El(this.left,r.reverse())}}}function El(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,o,c,f,d,m;const b=new MA(e);for(;++r<b.length;){for(;r in t;)r=t[r];if(s=b.get(r),r&&s[1].type==="chunkFlow"&&b.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,DA(b,r)),r=t[r],m=!0);else if(s[1]._container){for(o=r,l=void 0;o--;)if(c=b.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(b.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={...b.get(l)[1].start},f=b.slice(l,r),f.unshift(s),b.splice(l,r-l+1,f))}}return sr(e,0,Number.POSITIVE_INFINITY,b.slice(0)),!m}function DA(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 b,g,x=-1,v=r,S=0,N=0;const D=[N];for(;v;){for(;e.get(++l)[1]!==v;);o.push(l),v._tokenizer||(b=s.sliceStream(v),v.next||b.push(null),g&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(b),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&&(N=x+1,D.push(N),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 M=f.slice(D[x],D[x+1]),P=o.pop();d.push([P,P+M.length-1]),e.splice(P,2,M)}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 LA={resolve:UA,tokenize:PA},zA={partial:!0,tokenize:BA};function UA(e){return c1(e),e}function PA(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):Ye(f)?e.check(zA,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 BA(e,t,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),yt(e,o,"linePrefix")}function o(c){if(c===null||Ye(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,o,c,f,d){const m=d||Number.POSITIVE_INFINITY;let b=0;return g;function g(M){return M===60?(e.enter(s),e.enter(l),e.enter(o),e.consume(M),e.exit(o),x):M===null||M===32||M===41||Hu(M)?r(M):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),N(M))}function x(M){return M===62?(e.enter(o),e.consume(M),e.exit(o),e.exit(l),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(M))}function v(M){return M===62?(e.exit("chunkString"),e.exit(f),x(M)):M===null||M===60||Ye(M)?r(M):(e.consume(M),M===92?S:v)}function S(M){return M===60||M===62||M===92?(e.consume(M),v):v(M)}function N(M){return!b&&(M===null||M===41||Lt(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(M)):b<m&&M===40?(e.consume(M),b++,N):M===41?(e.consume(M),b--,N):M===null||M===32||M===40||Hu(M)?r(M):(e.consume(M),M===92?D:N)}function D(M){return M===40||M===41||M===92?(e.consume(M),N):N(M)}}function h1(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),b}function b(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):Ye(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),b):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Ye(v)||f++>999?(e.exit("chunkString"),b(v)):(e.consume(v),d||(d=!ut(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,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):Ye(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),yt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),b(x))}function b(x){return x===c||x===null||Ye(x)?(e.exit("chunkString"),m(x)):(e.consume(x),x===92?g:b)}function g(x){return x===c||x===92?(e.consume(x),b):b(x)}}function zl(e,t){let r;return s;function s(l){return Ye(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):ut(l)?yt(e,s,r?"linePrefix":"lineSuffix")(l):t(l)}}const HA={name:"definition",tokenize:IA},qA={partial:!0,tokenize:FA};function IA(e,t,r){const s=this;let l;return o;function o(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=Mr(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)?zl(e,m)(v):m(v)}function m(v){return f1(e,b,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function b(v){return e.attempt(qA,g,g)(v)}function g(v){return ut(v)?yt(e,x,"whitespace")(v):x(v)}function x(v){return v===null||Ye(v)?(e.exit("definition"),s.parser.defined.push(l),t(v)):r(v)}}function FA(e,t,r){return s;function s(f){return Lt(f)?zl(e,l)(f):r(f)}function l(f){return d1(e,o,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return ut(f)?yt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Ye(f)?t(f):r(f)}}const $A={name:"hardBreakEscape",tokenize:VA};function VA(e,t,r){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return Ye(o)?(e.exit("hardBreakEscape"),t(o)):r(o)}}const YA={name:"headingAtx",resolve:GA,tokenize:JA};function GA(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"},sr(e,s,r-s+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function JA(e,t,r){let s=0;return l;function l(b){return e.enter("atxHeading"),o(b)}function o(b){return e.enter("atxHeadingSequence"),c(b)}function c(b){return b===35&&s++<6?(e.consume(b),c):b===null||Lt(b)?(e.exit("atxHeadingSequence"),f(b)):r(b)}function f(b){return b===35?(e.enter("atxHeadingSequence"),d(b)):b===null||Ye(b)?(e.exit("atxHeading"),t(b)):ut(b)?yt(e,f,"whitespace")(b):(e.enter("atxHeadingText"),m(b))}function d(b){return b===35?(e.consume(b),d):(e.exit("atxHeadingSequence"),f(b))}function m(b){return b===null||b===35||Lt(b)?(e.exit("atxHeadingText"),f(b)):(e.consume(b),m)}}const XA=["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"],xb=["pre","script","style","textarea"],KA={concrete:!0,name:"htmlFlow",resolveTo:WA,tokenize:ej},QA={partial:!0,tokenize:nj},ZA={partial:!0,tokenize:tj};function WA(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 ej(e,t,r){const s=this;let l,o,c,f,d;return m;function m(j){return b(j)}function b(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,N):j===63?(e.consume(j),l=3,s.interrupt?t:E):Ln(j)?(e.consume(j),c=String.fromCharCode(j),D):r(j)}function x(j){return j===45?(e.consume(j),l=2,v):j===91?(e.consume(j),l=5,f=0,S):Ln(j)?(e.consume(j),l=4,s.interrupt?t:E):r(j)}function v(j){return j===45?(e.consume(j),s.interrupt?t:E):r(j)}function S(j){const be="CDATA[";return j===be.charCodeAt(f++)?(e.consume(j),f===be.length?s.interrupt?t:F:S):r(j)}function N(j){return Ln(j)?(e.consume(j),c=String.fromCharCode(j),D):r(j)}function D(j){if(j===null||j===47||j===62||Lt(j)){const be=j===47,Te=c.toLowerCase();return!be&&!o&&xb.includes(Te)?(l=1,s.interrupt?t(j):F(j)):XA.includes(c.toLowerCase())?(l=6,be?(e.consume(j),M):s.interrupt?t(j):F(j)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(j):o?P(j):I(j))}return j===45||An(j)?(e.consume(j),c+=String.fromCharCode(j),D):r(j)}function M(j){return j===62?(e.consume(j),s.interrupt?t:F):r(j)}function P(j){return ut(j)?(e.consume(j),P):z(j)}function I(j){return j===47?(e.consume(j),z):j===58||j===95||Ln(j)?(e.consume(j),ue):ut(j)?(e.consume(j),I):z(j)}function ue(j){return j===45||j===46||j===58||j===95||An(j)?(e.consume(j),ue):H(j)}function H(j){return j===61?(e.consume(j),O):ut(j)?(e.consume(j),H):I(j)}function O(j){return j===null||j===60||j===61||j===62||j===96?r(j):j===34||j===39?(e.consume(j),d=j,ee):ut(j)?(e.consume(j),O):G(j)}function ee(j){return j===d?(e.consume(j),d=null,B):j===null||Ye(j)?r(j):(e.consume(j),ee)}function G(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||Lt(j)?H(j):(e.consume(j),G)}function B(j){return j===47||j===62||ut(j)?I(j):r(j)}function z(j){return j===62?(e.consume(j),X):r(j)}function X(j){return j===null||Ye(j)?F(j):ut(j)?(e.consume(j),X):r(j)}function F(j){return j===45&&l===2?(e.consume(j),V):j===60&&l===1?(e.consume(j),K):j===62&&l===4?(e.consume(j),L):j===63&&l===3?(e.consume(j),E):j===93&&l===5?(e.consume(j),Ee):Ye(j)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(QA,J,le)(j)):j===null||Ye(j)?(e.exit("htmlFlowData"),le(j)):(e.consume(j),F)}function le(j){return e.check(ZA,ne,J)(j)}function ne(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),W}function W(j){return j===null||Ye(j)?le(j):(e.enter("htmlFlowData"),F(j))}function V(j){return j===45?(e.consume(j),E):F(j)}function K(j){return j===47?(e.consume(j),c="",ce):F(j)}function ce(j){if(j===62){const be=c.toLowerCase();return xb.includes(be)?(e.consume(j),L):F(j)}return Ln(j)&&c.length<8?(e.consume(j),c+=String.fromCharCode(j),ce):F(j)}function Ee(j){return j===93?(e.consume(j),E):F(j)}function E(j){return j===62?(e.consume(j),L):j===45&&l===2?(e.consume(j),E):F(j)}function L(j){return j===null||Ye(j)?(e.exit("htmlFlowData"),J(j)):(e.consume(j),L)}function J(j){return e.exit("htmlFlow"),t(j)}}function tj(e,t,r){const s=this;return l;function l(c){return Ye(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 nj(e,t,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Ql,t,r)}}const rj={name:"htmlText",tokenize:ij};function ij(e,t,r){const s=this;let l,o,c;return f;function f(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),d}function d(E){return E===33?(e.consume(E),m):E===47?(e.consume(E),H):E===63?(e.consume(E),I):Ln(E)?(e.consume(E),G):r(E)}function m(E){return E===45?(e.consume(E),b):E===91?(e.consume(E),o=0,S):Ln(E)?(e.consume(E),P):r(E)}function b(E){return E===45?(e.consume(E),v):r(E)}function g(E){return E===null?r(E):E===45?(e.consume(E),x):Ye(E)?(c=g,K(E)):(e.consume(E),g)}function x(E){return E===45?(e.consume(E),v):g(E)}function v(E){return E===62?V(E):E===45?x(E):g(E)}function S(E){const L="CDATA[";return E===L.charCodeAt(o++)?(e.consume(E),o===L.length?N:S):r(E)}function N(E){return E===null?r(E):E===93?(e.consume(E),D):Ye(E)?(c=N,K(E)):(e.consume(E),N)}function D(E){return E===93?(e.consume(E),M):N(E)}function M(E){return E===62?V(E):E===93?(e.consume(E),M):N(E)}function P(E){return E===null||E===62?V(E):Ye(E)?(c=P,K(E)):(e.consume(E),P)}function I(E){return E===null?r(E):E===63?(e.consume(E),ue):Ye(E)?(c=I,K(E)):(e.consume(E),I)}function ue(E){return E===62?V(E):I(E)}function H(E){return Ln(E)?(e.consume(E),O):r(E)}function O(E){return E===45||An(E)?(e.consume(E),O):ee(E)}function ee(E){return Ye(E)?(c=ee,K(E)):ut(E)?(e.consume(E),ee):V(E)}function G(E){return E===45||An(E)?(e.consume(E),G):E===47||E===62||Lt(E)?B(E):r(E)}function B(E){return E===47?(e.consume(E),V):E===58||E===95||Ln(E)?(e.consume(E),z):Ye(E)?(c=B,K(E)):ut(E)?(e.consume(E),B):V(E)}function z(E){return E===45||E===46||E===58||E===95||An(E)?(e.consume(E),z):X(E)}function X(E){return E===61?(e.consume(E),F):Ye(E)?(c=X,K(E)):ut(E)?(e.consume(E),X):B(E)}function F(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(e.consume(E),l=E,le):Ye(E)?(c=F,K(E)):ut(E)?(e.consume(E),F):(e.consume(E),ne)}function le(E){return E===l?(e.consume(E),l=void 0,W):E===null?r(E):Ye(E)?(c=le,K(E)):(e.consume(E),le)}function ne(E){return E===null||E===34||E===39||E===60||E===61||E===96?r(E):E===47||E===62||Lt(E)?B(E):(e.consume(E),ne)}function W(E){return E===47||E===62||Lt(E)?B(E):r(E)}function V(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):r(E)}function K(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),ce}function ce(E){return ut(E)?yt(e,Ee,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):Ee(E)}function Ee(E){return e.enter("htmlTextData"),c(E)}}const rm={name:"labelEnd",resolveAll:oj,resolveTo:uj,tokenize:cj},sj={tokenize:fj},aj={tokenize:hj},lj={tokenize:dj};function oj(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&&sr(e,0,e.length,r),e}function uj(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}},b={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",d,t],["enter",m,t]],f=Sr(f,e.slice(o+1,o+s+3)),f=Sr(f,[["enter",b,t]]),f=Sr(f,ec(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=Sr(f,[["exit",b,t],e[c-2],e[c-1],["exit",m,t]]),f=Sr(f,e.slice(c+1)),f=Sr(f,[["exit",d,t]]),sr(e,o,e.length,f),e}function cj(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(Mr(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(sj,b,c?b:g)(x):x===91?e.attempt(aj,b,c?m:g)(x):c?b(x):g(x)}function m(x){return e.attempt(lj,b,g)(x)}function b(x){return t(x)}function g(x){return o._balanced=!0,r(x)}}function fj(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)?zl(e,o)(g):o(g)}function o(g){return g===41?b(g):f1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Lt(g)?zl(e,d)(g):b(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):b(g)}function m(g){return Lt(g)?zl(e,b)(g):b(g)}function b(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):r(g)}}function hj(e,t,r){const s=this;return l;function l(f){return h1.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(Mr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):r(f)}function c(f){return r(f)}}function dj(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 mj={name:"labelStartImage",resolveAll:rm.resolveAll,tokenize:pj};function pj(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 gj={name:"labelStartLink",resolveAll:rm.resolveAll,tokenize:yj};function yj(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:bj};function bj(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),yt(e,t,"linePrefix")}}const Au={name:"thematicBreak",tokenize:xj};function xj(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||Ye(m))?(e.exit("thematicBreak"),t(m)):r(m)}function d(m){return m===l?(e.consume(m),s++,d):(e.exit("thematicBreakSequence"),ut(m)?yt(e,f,"whitespace")(m):f(m))}}const $n={continuation:{tokenize:_j},exit:Ej,name:"list",tokenize:Sj},vj={partial:!0,tokenize:Cj},wj={partial:!0,tokenize:kj};function Sj(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:_d(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 _d(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(Ql,s.interrupt?r:b,e.attempt(vj,x,g))}function b(v){return s.containerState.initialBlankLine=!0,o++,x(v)}function g(v){return ut(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 _j(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Ql,l,o);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,yt(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!ut(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(wj,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,yt(e,e.attempt($n,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function kj(e,t,r){const s=this;return yt(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 Ej(e){e.exit(this.containerState.type)}function Cj(e,t,r){const s=this;return yt(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!ut(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):r(o)}}const vb={name:"setextUnderline",resolveTo:Aj,tokenize:jj};function Aj(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 jj(e,t,r){const s=this;let l;return o;function o(m){let b=s.events.length,g;for(;b--;)if(s.events[b][1].type!=="lineEnding"&&s.events[b][1].type!=="linePrefix"&&s.events[b][1].type!=="content"){g=s.events[b][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"),ut(m)?yt(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||Ye(m)?(e.exit("setextHeadingLine"),t(m)):r(m)}}const Nj={tokenize:Tj};function Tj(e){const t=this,r=e.attempt(Ql,s,e.attempt(this.parser.constructs.flowInitial,l,yt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(LA,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 Oj={resolveAll:p1()},Rj=m1("string"),Mj=m1("text");function m1(e){return{resolveAll:p1(e==="text"?Dj: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(b){return m(b)?o(b):f(b)}function f(b){if(b===null){r.consume(b);return}return r.enter("data"),r.consume(b),d}function d(b){return m(b)?(r.exit("data"),o(b)):(r.consume(b),d)}function m(b){if(b===null)return!0;const g=l[b];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,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 Dj(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 Lj={42:$n,43:$n,45:$n,48:$n,49:$n,50:$n,51:$n,52:$n,53:$n,54:$n,55:$n,56:$n,57:$n,62:l1},zj={91:HA},Uj={[-2]:Ph,[-1]:Ph,32:Ph},Pj={35:YA,42:Au,45:[vb,Au],60:KA,61:vb,95:Au,96:bb,126:bb},Bj={38:u1,92:o1},Hj={[-5]:Bh,[-4]:Bh,[-3]:Bh,33:mj,38:u1,42:kd,60:[gA,rj],91:gj,92:[$A,o1],93:rm,95:kd,96:NA},qj={null:[kd,Oj]},Ij={null:[42,95]},Fj={null:[]},$j=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Ij,contentInitial:zj,disable:Fj,document:Lj,flow:Pj,flowInitial:Uj,insideSpan:qj,string:Bj,text:Hj},Symbol.toStringTag,{value:"Module"}));function Vj(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:ee(H),check:ee(O),consume:P,enter:I,exit:ue,interrupt:ee(O,{interrupt:!0})},m={code:null,containerState:{},defineSkip:N,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:v,write:g};let b=t.tokenize.call(m,d);return t.resolveAll&&o.push(t),m;function g(X){return c=Sr(c,X),D(),c[c.length-1]!==null?[]:(G(t,0),m.events=ec(o,m.events,m),m.events)}function x(X,F){return Gj(v(X),F)}function v(X){return Yj(c,X)}function S(){const{_bufferIndex:X,_index:F,line:le,column:ne,offset:W}=s;return{_bufferIndex:X,_index:F,line:le,column:ne,offset:W}}function N(X){l[X.line]=X.column,z()}function D(){let X;for(;s._index<c.length;){const F=c[s._index];if(typeof F=="string")for(X=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===X&&s._bufferIndex<F.length;)M(F.charCodeAt(s._bufferIndex));else M(F)}}function M(X){b=b(X)}function P(X){Ye(X)?(s.line++,s.column=1,s.offset+=X===-3?2:1,z()):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,F){const le=F||{};return le.type=X,le.start=S(),m.events.push(["enter",le,m]),f.push(le),le}function ue(X){const F=f.pop();return F.end=S(),m.events.push(["exit",F,m]),F}function H(X,F){G(X,F.from)}function O(X,F){F.restore()}function ee(X,F){return le;function le(ne,W,V){let K,ce,Ee,E;return Array.isArray(ne)?J(ne):"tokenize"in ne?J([ne]):L(ne);function L(Ce){return oe;function oe(Re){const _e=Re!==null&&Ce[Re],Fe=Re!==null&&Ce.null,_t=[...Array.isArray(_e)?_e:_e?[_e]:[],...Array.isArray(Fe)?Fe:Fe?[Fe]:[]];return J(_t)(Re)}}function J(Ce){return K=Ce,ce=0,Ce.length===0?V:j(Ce[ce])}function j(Ce){return oe;function oe(Re){return E=B(),Ee=Ce,Ce.partial||(m.currentConstruct=Ce),Ce.name&&m.parser.constructs.disable.null.includes(Ce.name)?Te():Ce.tokenize.call(F?Object.assign(Object.create(m),F):m,d,be,Te)(Re)}}function be(Ce){return X(Ee,E),W}function Te(Ce){return E.restore(),++ce<K.length?j(K[ce]):V}}}function G(X,F){X.resolveAll&&!o.includes(X)&&o.push(X),X.resolve&&sr(m.events,F,m.events.length-F,X.resolve(m.events.slice(F),m)),X.resolveTo&&(m.events=X.resolveTo(m.events,m))}function B(){const X=S(),F=m.previous,le=m.currentConstruct,ne=m.events.length,W=Array.from(f);return{from:ne,restore:V};function V(){s=X,m.previous=F,m.currentConstruct=le,m.events.length=ne,f=W,z()}}function z(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function Yj(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 Gj(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=`
|
|
87
|
+
${f.stack}`),c.reject(m)):c.resolve(b))}});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(Me.errorForCode(Ce.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Me.errorForCode(Ce.ConnectionClosed)):this.isDraining()?Promise.reject(Me.errorForCode(Ce.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 dn;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 $k(this,t);if(t.checkAPI!==!1)try{await r.getAccountInfo()}catch(s){const l=s;throw l.code===Ce.NoResponders&&(l.code=Ce.JetStreamNotEnabled),l}return r}jetstream(t={}){return new Id(this,t)}getServerVersion(){const t=this.info;return t?Ss(t.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Me.errorForCode(Ce.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 Jk(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Me.errorForCode(Ce.ConnectionClosed)):this.isDraining()?Promise.reject(Me.errorForCode(Ce.ConnectionDraining)):this.protocol.reconnect()}}class Jk{constructor(t){A(this,"nc");this.nc=t}add(t){try{return new Xl(this.nc,t).start()}catch(r){return Promise.reject(r)}}client(t,r){return new Ak(this.nc,t,r)}}class Xk{constructor(t,r,s){A(this,"bucket");A(this,"sm");A(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(Mn.MessageSizeHdr)||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Kk{constructor(t,r,s){A(this,"bucket");A(this,"key");A(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(Mn.MessageSizeHdr))||"";return t!==""?parseInt(t,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Rx extends A2{constructor(r,s,l){super(r.nc,s,l);A(this,"js");A(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=gi(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,s);const o=this.info;o.config.name=Qi.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=en.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,b=this.sub.info;b.last=m,this.info.config=m.config,this.info.name=m.name}).catch(d=>{const m=new Me(`unable to recreate ordered consumer ${o.stream} at seq ${r}`,Ce.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 b,g,x,v;const d=l2(409,`${yr.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((b=this.info)==null?void 0:b.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(Mn.ConsumerStalledHdr);s!==""&&this.js.nc.publish(s);const l=parseInt(r.headers.get(Mn.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 Qk 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(bt.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=Ft(f));let d=0;if(t.idle_heartbeat&&t.idle_heartbeat>0&&(d=t.idle_heartbeat,c.idle_heartbeat=Ft(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,b=`${m.prefix}.CONSUMER.MSG.NEXT.${r}.${o}`,g=this.sub.subject;m.nc.publish(b,m.jc.encode(c),{reply:g})}}}function Zk(e,t){return e?eE(t):Wk(t)}function Wk(e){return(t,r)=>t?[t,null]:(t=pa(r),t?[t,null]:[null,Fl(r,e)])}function eE(e){return(t,r)=>{if(t)return[t,null];const s=pa(r);return s!==null?[Mx(s),null]:[null,Fl(r,e)]}}function Mx(e){if(e!==null)switch(e.code){case Ce.JetStream404NoMessages:case Ce.JetStream408RequestTimeout:return null;case Ce.JetStream409:return o2(e)?e:null;default:return e}return null}function tE(e){e&&e.ack()}function nE(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 rE{constructor(t,r){A(this,"msg");A(this,"di");A(this,"didAck");A(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=nE(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]===Sl[0]&&t[1]===Sl[1]&&t[2]===Sl[2]&&t[3]===Sl[3]}async ackAck(t){var s;t=t||{},t.timeout=t.timeout||this.timeout;const r=$t();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=Uk;t&&(r=Ru().encode(`-NAK ${JSON.stringify({delay:Ft(t)})}`)),this.doAck(r)}working(){this.doAck(Sl)}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=Ft(r.expires));const l=jr().encode(s),o=Sa.concat(Pk,Hk,l),c=t?{reply:t}:void 0;this.msg.respond(o,c)}term(t=""){let r=Bk;(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 iE="1.30.3",sE="nats.ws";class aE{constructor(){A(this,"version");A(this,"lang");A(this,"closeError");A(this,"connected");A(this,"done");A(this,"socket");A(this,"options");A(this,"socketClosed");A(this,"encrypted");A(this,"peeked");A(this,"yields");A(this,"signal");A(this,"closedNotification");this.version=iE,this.lang=sE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=$t(),this.closedNotification=$t()}async connect(t,r){const s=$t();if(r.tls)return s.reject(new Me("tls",Ce.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=Sa.concat(...this.yields),f=M2(c);if(f!==""){const d=xk.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]);yk(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 Me(c.message,Ce.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 ja(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=$t())}}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 lE(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 j2({defaultPort:443,urlParseFn:lE,factory:()=>new aE}),Fd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var _a;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(_a||(_a={}));class Nh extends Error{constructor(t,r,s){super(t),this.message=t,this.code=r,this.data=s}}const oE=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"},uE=e=>{const t=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},s=r.Plugins=r.Plugins||{},l=()=>t!==null?t.name:oE(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,b=(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 M=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),R=(G,H)=>{var z,K;if(j){const F=j==null?void 0:j.methods.find(oe=>H===oe.name);if(F)return F.rtype==="promise"?oe=>r.nativePromise(g,H.toString(),oe):(oe,te)=>r.nativeCallback(g,H.toString(),oe,te);if(G)return(z=G[H])===null||z===void 0?void 0:z.bind(G)}else{if(G)return(K=G[H])===null||K===void 0?void 0:K.bind(G);throw new Nh(`"${g}" plugin is not implemented on ${S}`,_a.Unimplemented)}},I=G=>{let H;const z=(...K)=>{const F=M().then(oe=>{const te=R(oe,G);if(te){const W=te(...K);return H=W==null?void 0:W.remove,W}else throw new Nh(`"${g}.${G}()" is not implemented on ${S}`,_a.Unimplemented)});return G==="addListener"&&(F.remove=async()=>H()),F};return z.toString=()=>`${G.toString()}() { [capacitor code] }`,Object.defineProperty(z,"name",{value:G,writable:!1,configurable:!1}),z},ue=I("addListener"),B=I("removeListener"),P=(G,H)=>{const z=ue({eventName:G},H),K=async()=>{const oe=await z;B({eventName:G,callbackId:oe},H)},F=new Promise(oe=>z.then(()=>oe({remove:K})));return F.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await K()},F},ee=new Proxy({},{get(G,H){switch(H){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return j?P:ue;case"removeListener":return B;default:return I(H)}}});return s[g]=ee,m.set(g,{name:g,proxy:ee,platforms:new Set([...Object.keys(x),...j?[S]:[]])}),ee};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=d,r.isNativePlatform=o,r.isPluginAvailable=c,r.registerPlugin=b,r.Exception=Nh,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},cE=e=>e.Capacitor=uE(e),In=cE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Es=In.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 In.Exception(t,_a.Unimplemented)}unavailable(t="not available"){return new In.Exception(t,_a.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 fE 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)}}}Es("CapacitorCookies",{web:()=>new fE});const hE=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)}),dE=(e={})=>{const t=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,o,c)=>(l[o]=e[t[c]],l),{})},mE=(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,pE=(e,t={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},t),l=dE(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 gE extends $d{async request(t){const r=pE(t,t.webFetchExtra),s=mE(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 hE(m);break;case"json":d=await o.json();break;case"document":case"text":default:d=await o.text()}const b={};return o.headers.forEach((g,x)=>{b[x]=g}),{data:d,headers:b,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"}))}}Es("CapacitorHttp",{web:()=>new gE});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 yE 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")}}Es("SystemBars",{web:()=>new yE});const bE="modulepreload",xE=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(b=>Promise.resolve(b).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=xE(m),m in V0)return;V0[m]=!0;const b=m.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const x=document.createElement("link");if(x.rel=b?"stylesheet":bE,b||(x.as="script"),x.crossOrigin="",x.href=m,d&&x.setAttribute("nonce",d),document.head.appendChild(x),b)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)})},gd=Es("App",{web:()=>Vd(()=>import("./web-BQ0rMZ_X.js"),[]).then(e=>new e.AppWeb)}),vE=Es("Network",{web:()=>Vd(()=>import("./web-o_D8jqAS.js"),[]).then(e=>new e.NetworkWeb)}),Bu=In.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 wE(e,t,r){return Lx("POST",e,t)}function SE(e,t){return Lx("GET",e,void 0)}const Y0=In.isNativePlatform(),zx=E.createContext(null),_E=2e3,Th=6e3,kE=1500,EE=6e4;function CE({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,b]=E.useState(!1),[g,x]=E.useState(!1),[v,S]=E.useState(!1),j=E.useRef(Ru()),D=E.useRef(new Set),M=E.useRef(0),R=!!t.directUrl,I=Y0&&!R&&!!t.lanUrl&&v,ue=m||g?"disconnected":R?f?"direct":"connecting":l?I?"lan":"nats":"connecting",B=ue!=="connecting"&&ue!=="disconnected";E.useEffect(()=>{if(!Y0||R||!t.lanUrl){S(!1);return}let G=!1;const H=t.lanUrl,z=t.hostId;async function K(){console.log("[HOST/LAN] probing",H);try{const W=await fetch(`${H}/health`,{signal:AbortSignal.timeout(kE)});if(G)return;if(!W.ok){console.log("[HOST/LAN] probe got non-ok:",W.status),S(!1);return}const V=await W.json(),J=V.hostId===z;J?console.log("[HOST/LAN] reachable"):console.log("[HOST/LAN] hostId mismatch — got:",V.hostId,"expected:",z),S(J)}catch(W){G||(console.log("[HOST/LAN] probe failed:",W instanceof Error?W.message:W),S(!1))}}K();const F=window.setInterval(K,EE),oe=gd.addListener("appStateChange",W=>{W.isActive&&K()}),te=vE.addListener("networkStatusChange",()=>K());return()=>{G=!0,clearInterval(F),oe.then(W=>W.remove()),te.then(W=>W.remove())}},[t.hostId,t.lanUrl,R]),E.useEffect(()=>{if(R){c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),o(!1));return}let G=!1,H=1e3;const z=3e4;async function K(){for(;!G;)try{const F=await fetch(`${Bu}/api/nats-credentials/${t.hostId}`);if(G)return;if(F.status===401||F.status===403||F.status===404){console.error("[NATS] Host not found or rejected by relay:",F.status),x(!0);return}if(!F.ok)throw new Error(`credentials fetch ${F.status}`);const oe=await F.json();if(!oe.natsWsUrl){console.error("[NATS] Relay returned empty natsWsUrl — treating as terminal"),x(!0);return}if(G)return;console.log("[NATS] Connecting to",oe.natsWsUrl);const te=await Dx({servers:oe.natsWsUrl,authenticator:Ex(oe.natsJwt,new TextEncoder().encode(oe.natsNkeySeed)),pingInterval:3e4,maxPingOut:2});if(G){te.close().catch(()=>{});return}if(console.log("[NATS] Connected"),c.current=te,s(te),o(!0),H=1e3,await te.closed(),G)return;console.log("[NATS] Connection closed, will reconnect"),c.current=null,s(null),o(!1)}catch(F){if(G)return;console.warn(`[NATS] Connect failed, retrying in ${H}ms:`,F),o(!1),await new Promise(oe=>setTimeout(oe,H)),H=Math.min(H*2,z)}}return K(),()=>{G=!0,c.current&&(c.current.close().catch(()=>{}),c.current=null,s(null),o(!1))}},[R,t]),E.useEffect(()=>{if(R)return;const G=gd.addListener("appStateChange",H=>{if(!H.isActive||!c.current)return;const z=c.current;Promise.race([z.flush(),new Promise((K,F)=>setTimeout(()=>F(new Error("ping timeout")),2e3))]).catch(()=>{console.log("[NATS] Resume probe failed — cycling conn"),z.close().catch(()=>{})})});return()=>{G.then(H=>H.remove())}},[R]),E.useEffect(()=>{if(!R){d(!1);return}const G=new AbortController;async function H(){var oe;const K=new AbortController,F=setTimeout(()=>K.abort(),_E);G.signal.addEventListener("abort",()=>K.abort());try{const te=await fetch(`${t.directUrl}/events`,{headers:{Authorization:`Bearer ${t.clientToken}`},signal:K.signal});return clearTimeout(F),te.ok?((oe=te.body)==null?void 0:oe.getReader())??null:null}catch{return clearTimeout(F),null}}async function z(K){d(!0),console.log("[HOST] SSE connected to",t.directUrl),M.current=Date.now();function F(){setTimeout(()=>{G.signal.aborted||Date.now()-M.current<Th||(console.log("[HOST] Heartbeat timeout — no data for",Th/1e3,"s"),G.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},Th)}F();const oe=new TextDecoder;let te="";try{for(;;){const{done:W,value:V}=await K.read();if(W)break;te+=oe.decode(V,{stream:!0}),M.current=Date.now(),F();const J=te.split(`
|
|
88
|
+
`);te=J.pop()??"";for(const ce of J)if(ce.startsWith("data: ")){const ke=ce.slice(6);try{const C=JSON.parse(ke);if(C.task_id&&C.event_type){const L=`host-event.${t.hostId}.${C.task_id}`;for(const X of D.current)X({subject:L,data:j.current.encode(ke)})}}catch{}}}}catch{}}return(async()=>{const K=await H();K&&await z(K)})(),()=>{G.abort(),d(!1)}},[t,R]);const P=E.useCallback(async(G,H,z)=>{function K(te){te&&typeof te=="object"&&te.error==="Unauthorized"&&b(!0)}async function F(te,W){console.log(`[HOST/${W}] → ${G}`,H??"");const V=await fetch(`${te}/rpc/${G}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.clientToken}`},body:H!=null?JSON.stringify(H):void 0,signal:z!=null&&z.timeout?AbortSignal.timeout(z.timeout):void 0});if(V.status===401)throw b(!0),new Error("Unauthorized");const J=await V.json();return K(J),console.log(`[HOST/${W}] ← ${G}`,J),J}async function oe(){if(!c.current)throw new Error("Not connected");const te=`host.${t.hostId}.rpc.${G}`,W={...H??{},clientToken:t.clientToken},V=j.current.encode(JSON.stringify(W));console.log(`[HOST/NATS] → ${G}`,H??"");const J=await c.current.request(te,V,{timeout:(z==null?void 0:z.timeout)??1e4}),ce=JSON.parse(j.current.decode(J.data));return K(ce),console.log(`[HOST/NATS] ← ${G}`,ce),ce}if(R)return F(t.directUrl,"HTTP");if(I&&t.lanUrl)try{return await F(t.lanUrl,"LAN")}catch(te){if(te instanceof Error&&te.message==="Unauthorized")throw te;console.log("[HOST/LAN] failed, falling back to NATS:",te),S(!1)}return oe()},[t,R,I]),ee=E.useCallback((G,H)=>{if(R)return D.current.add(H),()=>{D.current.delete(H)};if(c.current){const z=c.current.subscribe(`host-event.${G}.>`);let K=!1;return(async()=>{try{for await(const F of z){if(K)break;H({subject:F.subject,data:F.data})}}catch{}})(),()=>{K=!0,z.unsubscribe()}}return()=>{}},[t,R]);return y.jsx(zx.Provider,{value:{connected:B,mode:ue,nc:r,request:P,subscribeEvents:ee,activeHost:t,unauthorized:m},children:e})}function xi(){const e=E.useContext(zx);if(!e)throw new Error("useHostConnection must be used within HostConnectionProvider");return e}const Sn=In.isNativePlatform()?Es("Device"):null;function AE(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}=xi(),t=e.timezone;return E.useCallback(r=>AE(r,t),[t])}function jE(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 NE(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 TE(e,t,r){return new Date(Date.UTC(e,t-1,r)).getUTCDay()}function OE(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 Dl(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 RE(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 ME(e,t){const r=e.split(" ");if(r.length!==5)return null;const[s,l,o,,c]=r;if(l==="*"){const b=Number(s);if(Number.isNaN(b))return null;if(b>t.minute)return{...t,minute:b};const g=new Date(Date.UTC(t.year,t.month-1,t.day,t.hour+1,b));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 b=Number(c);if(Number.isNaN(b))return null;for(let g=0;g<8;g++){const x=G0({...t,hour:d,minute:f},g);if(TE(x.year,x.month,x.day)===b&&Dl(x,t)>0)return x}return null}if(o!=="*"){const b=Number(o);if(Number.isNaN(b))return null;let g=t.year,x=t.month;for(let v=0;v<24;v++){if(b<=OE(g,x)){const S={year:g,month:x,day:b,hour:d,minute:f};if(Dl(S,t)>0)return S}x++,x>12&&(x=1,g++)}return null}const m={...t,hour:d,minute:f};return Dl(m,t)>0?m:G0(m,1)}function DE(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 LE(e,t,r){if(!e||!t||t.length===0||e==="on_new_notification"||e==="on_new_sms")return null;const s=NE(r),l=[];for(const o of t)if(e==="specific_times"){const c=DE(o);c&&Dl(c,s)>0&&l.push(c)}else{const c=ME(o,s);c&&l.push(c)}return l.length===0?null:(l.sort(Dl),RE(l[0],r))}const Ux={};function zE(e){for(const t of e)Ux[t.key]=t.label}function yd(e){return Ux[e]??e}const UE=()=>window.matchMedia("(max-width: 600px)").matches;function PE({task:e,lastEvent:t,onEdit:r,onDelete:s,onViewRun:l}){var V;const{request:o,activeHost:c}=xi(),f=Yd(),d=c.timezone,[m,b]=E.useState(!1),[g,x]=E.useState(!1),[v,S]=E.useState(!1),j=E.useRef(null),D=(t==null?void 0:t.running_state)==="started",M=(((V=e.schedule_values)==null?void 0:V.length)??0)>0,R=e.schedule_type==="on_new_notification"||e.schedule_type==="on_new_sms",I=!!e.command,ue=!!e.schedule_type&&(M||R)||I,P=!!e.schedule_enabled&&ue?D?"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 J(ce){j.current&&!j.current.contains(ce.target)&&x(!1)}return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[g]);function ee(){UE()?S(!0):x(J=>!J)}function G(){x(!1),S(!1)}async function H(){if(G(),!!confirm("Abort this task?")){b(!0);try{await o("task.abort",{id:e.id})}catch(J){console.error("Abort failed:",J)}finally{b(!1)}}}async function z(){G();try{const J=await o("task.run",{id:e.id});l(e.id,J.run_id)}catch(J){console.error("Run failed:",J)}}async function K(){if(G(),!!confirm("Delete this task? Results and reports will be kept."))try{await o("task.delete",{id:e.id}),s(e.id)}catch(J){console.error("Delete failed:",J)}}const F={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function oe(){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 J=LE(e.schedule_type,e.schedule_values,d);return J===null?"No upcoming runs":`Next: ${f(J)}`}const te=oe(),W=y.jsxs(y.Fragment,{children:[y.jsxs("button",{onClick:()=>{G(),r(e)},children:[y.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),y.jsxs("button",{onClick:()=>{G(),l(e.id)},children:[y.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),D?y.jsxs("button",{className:"menu-item-danger",onClick:H,disabled:m,children:[y.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):y.jsxs(y.Fragment,{children:[y.jsxs("button",{onClick:z,children:[y.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),y.jsxs("button",{className:"menu-item-danger",onClick:K,children:[y.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"task-card",onClick:()=>l(e.id,D?"latest":void 0),children:[y.jsxs("div",{className:"task-card-header",children:[y.jsxs("div",{className:"task-card-title-row",children:[D?y.jsx("span",{className:"status-spinner",children:y.jsx("span",{})}):y.jsx("span",{className:"status-dot",style:{backgroundColor:P}}),y.jsx("h3",{className:"task-card-name",children:e.custom_name||e.name||e.user_prompt})]}),y.jsx("div",{className:"task-card-actions",onClick:J=>J.stopPropagation(),children:y.jsxs("div",{className:"task-card-menu",ref:j,children:[y.jsx("button",{className:"task-card-menu-btn",onClick:ee,"aria-label":"Task actions",children:"⋮"}),g&&y.jsx("div",{className:"task-card-menu-dropdown",children:W})]})})]}),y.jsxs("div",{className:"task-card-meta",children:[e.agent&&y.jsx("span",{className:"task-card-agent",children:yd(e.agent)}),t&&F[t.running_state]&&y.jsxs("span",{className:"task-card-last-event",children:[F[t.running_state]," ",f(t.time_stamp)]}),ue&&y.jsx("span",{className:"task-card-triggers",children:e.schedule_enabled?te:"Schedule disabled"})]})]}),v&&pi.createPortal(y.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>S(!1),children:y.jsxs("div",{className:"bottom-sheet",onClick:J=>J.stopPropagation(),children:[y.jsx("div",{className:"bottom-sheet-handle"}),y.jsx("div",{className:"bottom-sheet-title",children:e.custom_name||e.name||e.user_prompt}),y.jsx("div",{className:"bottom-sheet-actions",children:W})]})}),document.body)]})}const ua=[];function BE(){const e=ua.pop();e&&(e.pushed.current=!1,e.close())}let J0=!1;function HE(){J0||(J0=!0,window.addEventListener("popstate",BE))}function Px(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)HE(),history.pushState({modal:!0},""),ua.push(o.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=ua.indexOf(o.current);c!==-1&&ua.splice(c,1),history.back()}},[e,l]),E.useEffect(()=>{const c=o.current;return()=>{if(r.current){r.current=!1;const f=ua.indexOf(c);f!==-1&&ua.splice(f,1),history.back()}}},[])}const qE=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],IE=["specific_times","hourly","daily","weekly","monthly"];function pu(e){return IE.includes(e)}function FE(e){return e==="on_new_notification"||e==="on_new_sms"}function mi(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function $E(e){const t=e.split(" ");if(t.length!==5)return mi();const[r,s,l,,o]=t;if(s==="*")return mi("hourly");const c=`${s.padStart(2,"0")}:${r.padStart(2,"0")}`;return o!=="*"?{...mi("weekly"),time:c,dayOfWeek:o}:l!=="*"?{...mi("monthly"),time:c,dayOfMonth:l}:{...mi("daily"),time:c}}function Bx(e,t){if(e==="specific_times"){const[r,s]=t.split("T");return{...mi("specific_times"),onceDate:r??"",onceTime:(s??"09:00").slice(0,5)}}return $E(t)}function VE(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 YE(e){return e.schedule==="specific_times"?e.onceDate?`${e.onceDate}T${e.onceTime}`:null:VE(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?Bx(t,r).schedule:"ondemand"}function GE({initial:e,agents:t,hostPlatform:r,isNotificationListener:s,onSaved:l,onCancel:o}){const{request:c,activeHost:f}=xi(),{setHostLastAgent:d}=Wi(),m=()=>{var je;const xe=f.lastAgent,Ie=t.map(Ge=>Ge.key);return xe&&Ie.includes(xe)?xe:((je=t[0])==null?void 0:je.key)??""},[b,g]=E.useState((e==null?void 0:e.custom_name)??""),[x,v]=E.useState((e==null?void 0:e.user_prompt)??""),[S,j]=E.useState((e==null?void 0:e.agent)??m()),[D,M]=E.useState(null),[R,I]=E.useState(()=>Rh(e)),[ue,B]=E.useState(()=>{const xe=e==null?void 0:e.schedule_type,Ie=e==null?void 0:e.schedule_values;if(Ie&&(xe==="crons"||xe==="specific_times"))return Ie.map(Ge=>Bx(xe,Ge));const je=Rh(e);return pu(je)?[mi(je)]:[]}),[P,ee]=E.useState((e==null?void 0:e.requires_confirmation)??!1),[G,H]=E.useState(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0),[z,K]=E.useState((e==null?void 0:e.foreground_mode)??!1),[F,oe]=E.useState((e==null?void 0:e.command)??""),[te,W]=E.useState(!1),V=(e==null?void 0:e.schedule_type)==="on_new_notification"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[J,ce]=E.useState(V),[ke,C]=E.useState([]),[L,X]=E.useState(!1),[N,ve]=E.useState(!1),[Ae,Ee]=E.useState(""),le=E.useCallback(()=>ve(!1),[]);Px(N,le),E.useEffect(()=>{if(R!=="on_new_notification"||!s||!In.isNativePlatform()||!Sn)return;let xe=!1;return X(!0),Sn.getInstalledApps().then(({apps:Ie})=>{if(xe)return;const je="com.palmier.app",Ge=Ie.filter(yt=>yt.packageName!==je).sort((yt,ut)=>(yt.appName||yt.packageName).localeCompare(ut.appName||ut.packageName));C(Ge)}).catch(()=>{}).finally(()=>{xe||X(!1)}),()=>{xe=!0}},[R,s]);const Re=(e==null?void 0:e.schedule_type)==="on_new_sms"&&e.schedule_values&&e.schedule_values.length>0?e.schedule_values[0]:"",[_e,Fe]=E.useState(Re),Ht=E.useRef(null),Rt=pu(R),Qt=R==="command",zt=FE(R),tn=R==="specific_times"||R==="daily"||R==="weekly"||R==="monthly",Yt=t.find(xe=>xe.key===S),nn=!!e,Ke=Rh(e),ht=nn&&b.trim()!==((e==null?void 0:e.custom_name)??""),dt=!nn||ht||x!==((e==null?void 0:e.user_prompt)??"")||S!==((e==null?void 0:e.agent)??"")||R!==Ke||P!==((e==null?void 0:e.requires_confirmation)??!1)||G!==(e!=null&&e.schedule_type||e!=null&&e.command?e.schedule_enabled??!0:!0)||z!==((e==null?void 0:e.foreground_mode)??!1)||Qt&&F!==((e==null?void 0:e.command)??"")||Rt&&(JSON.stringify(He())!==JSON.stringify((e==null?void 0:e.schedule_values)??[])||Oh(R)!==((e==null?void 0:e.schedule_type)??void 0))||zt&&R!==(e==null?void 0:e.schedule_type)||R==="on_new_notification"&&J.trim()!==V.trim()||R==="on_new_sms"&&_e.trim()!==Re.trim(),xt=jE(f.timezone),Gt=Rt&&ue.some(xe=>xe.schedule==="specific_times"&&(!xe.onceDate||xe.onceDate<xt.date||xe.onceDate===xt.date&&(xe.onceTime??"")<=xt.time)),En=dt&&!!x.trim()&&!Gt&&(!Qt||!!F.trim())&&(!Rt||ue.length>0);function st(xe,Ie){B(je=>je.map((Ge,yt)=>yt===xe?{...Ge,...Ie}:Ge))}function sr(xe){B(Ie=>Ie.filter((je,Ge)=>Ge!==xe))}function fe(){pu(R)&&B(xe=>[...xe,xe.length>0?{...xe[xe.length-1]}:mi(R)])}function we(xe){I(xe),pu(xe)?B([mi(xe)]):(B([]),ee(!1)),xe==="command"?setTimeout(()=>{var Ie;return(Ie=Ht.current)==null?void 0:Ie.focus()},0):oe(""),xe!=="on_new_notification"&&ce(V),xe!=="on_new_sms"&&Fe(Re)}function He(){return ue.flatMap(xe=>{const Ie=YE(xe);return Ie?[Ie]:[]})}async function Qe(){W(!0),M(null);try{const xe=Rt?He():R==="on_new_notification"&&J.trim()?[J.trim()]:R==="on_new_sms"&&_e.trim()?[_e.trim()]:[],Ie=Rt||zt?Oh(R):null,je={user_prompt:x,agent:S,schedule_type:Ie,schedule_values:xe.length>0?xe:null,schedule_enabled:R==="ondemand"?!0:G,requires_confirmation:Rt?P:!1,foreground_mode:z,command:Qt?F:""};nn&&(je.id=e.id,ht&&(je.custom_name=b.trim()));const yt=await c(nn?"task.update":"task.create",je,{timeout:45e3});if(yt.error){M(yt.error);return}nn||d(f.hostId,S),l(yt)}catch(xe){M(xe instanceof Error?xe.message:String(xe))}finally{W(!1)}}const qe=nn?"Save":(Rt||zt||Qt)&&G?"Schedule":"Save";return y.jsxs("div",{className:"task-form-overlay",children:[y.jsxs("div",{className:"task-form",children:[y.jsx("div",{className:"task-form-header",children:y.jsx("h2",{children:e?"Edit Task":"New Task"})}),D&&y.jsx("div",{className:"form-error",children:D}),nn&&y.jsxs("div",{children:[y.jsxs("label",{className:"form-label task-title-field",children:["Title",y.jsx("input",{className:"form-input",type:"text",value:b,onChange:xe=>g(xe.target.value),placeholder:e.name,maxLength:80,disabled:te})]}),y.jsx("p",{className:"command-help-text task-title-help",children:"Leave empty to use an auto-generated title."})]}),y.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:x,onChange:xe=>v(xe.target.value),placeholder:Qt?"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:te}),y.jsx("div",{className:"plan-actions",children:t.length>0&&y.jsx("div",{className:"agent-picker-section-inline",children:t.length>1?y.jsx("select",{className:"form-select form-select-sm",value:S,onChange:xe=>j(xe.target.value),disabled:te,children:t.map(xe=>y.jsx("option",{value:xe.key,children:xe.label},xe.key))}):y.jsx("span",{className:"agent-picker-single",children:(Yt==null?void 0:Yt.label)??t[0].label})})}),y.jsx("div",{className:"toggles-group",children:y.jsxs("div",{className:"schedule-section",children:[y.jsxs("h3",{className:"schedule-section-title",children:["Schedule ",tn&&y.jsx("span",{className:"schedule-section-hint",children:"based on host time"})]}),y.jsxs("select",{className:"form-select",value:R,onChange:xe=>we(xe.target.value),disabled:te,children:[y.jsx("option",{value:"ondemand",children:"On User Demand"}),y.jsx("option",{value:"specific_times",children:"Specific Times"}),y.jsx("option",{value:"hourly",children:"Hourly"}),y.jsx("option",{value:"daily",children:"Daily"}),y.jsx("option",{value:"weekly",children:"Weekly"}),y.jsx("option",{value:"monthly",children:"Monthly"}),y.jsx("option",{value:"on_new_notification",children:"On New Notification"}),y.jsx("option",{value:"on_new_sms",children:"On New SMS"}),y.jsx("option",{value:"command",children:"On Command Output"})]}),zt&&y.jsxs("div",{className:"schedule-reactive",children:[y.jsxs("p",{className:"command-help-text",children:[R==="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 ",R==="on_new_notification"?"notification":"SMS","”."]}),R==="on_new_notification"&&(()=>{const xe=ke.find(je=>je.packageName===J),Ie=(xe==null?void 0:xe.appName)||J;return y.jsxs(y.Fragment,{children:[s?J.trim()?y.jsxs("div",{className:"app-filter-selected",children:[y.jsx("span",{className:"app-filter-selected-name",children:Ie}),(xe==null?void 0:xe.appName)&&y.jsx("span",{className:"app-filter-selected-pkg",children:xe.packageName}),y.jsx("button",{type:"button",className:"app-filter-selected-clear",onClick:()=>ce(""),"aria-label":"Clear app filter",disabled:te,children:"✕"})]}):y.jsx("button",{type:"button",className:"btn btn-link app-filter-trigger",onClick:()=>{Ee(""),ve(!0)},disabled:te,children:"Select app"}):y.jsx("input",{className:"form-input",type:"text",value:J,onChange:je=>ce(je.target.value),placeholder:"App (optional), e.g. com.google.android.gm",disabled:te}),y.jsx("p",{className:"command-help-text app-filter-help",children:J.trim()?`Only notifications from ${Ie} will trigger this task.`:"Every notification from your device triggers this task."})]})})(),R==="on_new_sms"&&y.jsxs(y.Fragment,{children:[y.jsx("input",{className:"form-input",type:"text",value:_e,onChange:xe=>Fe(xe.target.value),placeholder:"From (optional), e.g. +1 555-1234)",disabled:te}),y.jsx("p",{className:"command-help-text app-filter-help",children:_e.trim()?`Only SMS from ${_e.trim()} will trigger this task. Formatting (spaces, dashes, parens) is ignored.`:"Every SMS that arrives on your device triggers this task."})]})]}),Qt&&y.jsxs("div",{className:"schedule-reactive",children:[y.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."}),y.jsx("input",{ref:Ht,className:"form-input form-input-mono",type:"text",value:F,onChange:xe=>oe(xe.target.value),placeholder:"gws gmail +watch --project my-project",disabled:te})]}),Rt&&R!=="hourly"&&y.jsxs(y.Fragment,{children:[ue.map((xe,Ie)=>y.jsxs("div",{className:"trigger-row-card",children:[y.jsxs("div",{className:"trigger-row-content",children:[R==="daily"&&y.jsx("input",{className:"form-input",type:"time",value:xe.time,onChange:je=>st(Ie,{time:je.target.value})}),R==="weekly"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("select",{className:"form-select",value:xe.dayOfWeek,onChange:je=>st(Ie,{dayOfWeek:je.target.value}),children:qE.map((je,Ge)=>y.jsx("option",{value:String(Ge),children:je},Ge))}),y.jsx("input",{className:"form-input",type:"time",value:xe.time,onChange:je=>st(Ie,{time:je.target.value})})]}),R==="monthly"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("select",{className:"form-select",value:xe.dayOfMonth,onChange:je=>st(Ie,{dayOfMonth:je.target.value}),children:Array.from({length:28},(je,Ge)=>Ge+1).map(je=>y.jsxs("option",{value:String(je),children:["Day ",je]},je))}),y.jsx("input",{className:"form-input",type:"time",value:xe.time,onChange:je=>st(Ie,{time:je.target.value})})]}),R==="specific_times"&&y.jsxs("div",{className:"trigger-row-top",children:[y.jsx("input",{className:"form-input",type:"date",value:xe.onceDate,min:xt.date,onChange:je=>st(Ie,{onceDate:je.target.value})}),y.jsx("input",{className:"form-input",type:"time",value:xe.onceTime,min:xe.onceDate===xt.date?xt.time:void 0,onChange:je=>st(Ie,{onceTime:je.target.value})})]})]}),ue.length>1&&y.jsx("button",{className:"trigger-remove-btn",onClick:()=>sr(Ie),title:"Remove trigger",children:"×"})]},Ie)),y.jsx("button",{className:"trigger-add-btn",onClick:fe,children:"+ Add"})]}),r==="win32"&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:z,onChange:xe=>K(xe.target.checked),disabled:te}),"Run in the foreground (host must login to Windows)"]}),Rt&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:P,onChange:xe=>ee(xe.target.checked),disabled:te}),"Confirm before each run"]}),R!=="ondemand"&&y.jsxs("label",{className:"toggle-label",children:[y.jsx("input",{type:"checkbox",checked:G,onChange:xe=>H(xe.target.checked),disabled:te}),"Enabled"]})]})}),y.jsxs("div",{className:"form-actions",children:[y.jsxs("button",{className:"btn btn-primary",onClick:Qe,disabled:!En||te,children:[te&&y.jsx("span",{className:"btn-spinner"}),qe]}),y.jsx("button",{className:"btn btn-secondary",onClick:()=>{dt&&x.trim()&&!confirm("You have unsaved changes. Discard?")||o()},style:{marginLeft:"auto"},children:"Cancel"})]})]}),N&&(()=>{const xe=Ae.trim().toLowerCase(),Ie=xe?ke.filter(je=>je.packageName.toLowerCase().includes(xe)||je.appName.toLowerCase().includes(xe)):ke;return y.jsx("div",{className:"app-filter-overlay",onClick:le,children:y.jsxs("div",{className:"app-filter-dialog",onClick:je=>je.stopPropagation(),children:[y.jsxs("div",{className:"app-filter-header",children:[y.jsx("h2",{children:"Select app"}),y.jsx("button",{className:"app-filter-close",onClick:le,"aria-label":"Close",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:y.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),y.jsx("input",{className:"form-input app-filter-search",type:"text",value:Ae,onChange:je=>Ee(je.target.value),onKeyDown:je=>{je.key==="Enter"&&Ae.trim()&&(ce(Ae.trim()),le())},placeholder:"Search or type a package name",autoFocus:!0}),y.jsxs("ul",{className:"app-filter-list",children:[L&&ke.length===0?Array.from({length:6}).map((je,Ge)=>y.jsx("li",{className:"app-filter-row app-filter-skeleton",children:y.jsx("div",{className:"app-filter-skeleton-bar"})},`sk-${Ge}`)):Ie.length===0&&!Ae.trim()?y.jsx("li",{className:"app-filter-empty",children:"No apps"}):Ie.map(je=>y.jsx("li",{className:"app-filter-row",onClick:()=>{ce(je.packageName),le()},children:y.jsxs("div",{className:"app-filter-row-labels",children:[y.jsx("div",{className:"app-filter-row-name",children:je.appName||je.packageName}),je.appName&&y.jsx("div",{className:"app-filter-row-pkg",children:je.packageName})]})},je.packageName)),Ae.trim()&&y.jsx("li",{className:"app-filter-row",onClick:()=>{ce(Ae.trim()),le()},children:y.jsx("div",{className:"app-filter-row-labels",children:y.jsx("div",{className:"app-filter-row-name",children:Ae.trim()})})})]})]})})})()]})}function Hx({pullDistance:e,refreshing:t,threshold:r}){const s=e>0||t,l=e>=r;return y.jsx("div",{className:"pull-to-refresh",style:{transform:`translateY(${e}px)`,opacity:s?Math.min(1,e/30):0},"aria-hidden":!s,children:y.jsx("div",{className:"pull-to-refresh-badge",children:t?y.jsx("div",{className:"spinner"}):y.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:[y.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),y.jsx("polyline",{points:"19 12 12 19 5 12"})]})})})}function qx({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),b=E.useRef(0),g=E.useRef(!1),x=E.useRef(e);return E.useEffect(()=>{x.current=e}),E.useEffect(()=>{if(!s)return;const v=D=>{if(g.current||window.scrollY>0){d.current=null;return}if(JE(D.target)){d.current=null;return}d.current=D.touches[0].clientY,m.current=!1,b.current=0},S=D=>{if(g.current||d.current==null)return;const M=D.touches[0].clientY-d.current;if(M<=0){m.current=!1,b.current=0,o(0);return}m.current=!0;const R=Math.min(r,M*.5);b.current=R,o(R),D.cancelable&&D.preventDefault()},j=()=>{if(!m.current){d.current=null,o(0);return}const D=b.current;d.current=null,m.current=!1,b.current=0,D>=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",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 JE(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 XE(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.foreground_mode??!1,e.command??"",e.permissions??null])}function KE({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:o,isNotificationListener:c,onViewRun:f,hostInfoStatus:d,onRetryHostInfo:m}){const[b,g]=E.useState([]),[x,v]=E.useState(!1),[S,j]=E.useState(null),[D,M]=E.useState(new Map),[R,I]=E.useState(!1),[ue,B]=E.useState(void 0),P=E.useCallback(()=>{I(!1),B(void 0)},[]),ee=E.useCallback(async()=>{if(e){v(!0),j(null);try{const oe=(await r("task.list")).tasks??[],te=new Map;for(const W of oe)W.status&&te.set(W.id,W.status);M(te),g(oe)}catch(F){const oe=F instanceof Error?F.message:String(F);oe==="Not connected"||oe.includes("503")||oe.toLowerCase().includes("no responders")?j(null):j(oe),g([])}finally{v(!1)}}},[e,t,r]);E.useEffect(()=>{e?ee():(g([]),v(!1))},[e,t,ee]);const G=E.useRef(!1);E.useEffect(()=>{d==="error"?G.current=!0:d==="ready"&&G.current&&(G.current=!1,ee())},[d,ee]);const H=qx({onRefresh:ee,enabled:e});E.useEffect(()=>!e||!t?void 0:s(t,async oe=>{const te=oe.subject.split(".");if(te.length<3)return;const W=te.slice(2).join(".");let V={};try{V=JSON.parse(new TextDecoder().decode(oe.data))}catch{return}const J=V.event_type;if(!(J!=="running-state"&&J!=="permission-resolved"))try{const ce=await r("task.status",{id:W},{timeout:5e3});if(ce.error)return;M(ke=>{const C=new Map(ke);return C.set(W,ce),C})}catch{}}),[e,t,s,r]);function z(F){g(oe=>{const te=oe.findIndex(W=>W.id===F.id);if(te>=0){const W=[...oe];return W[te]=F,W}return[F,...oe]}),I(!1),B(void 0)}function K(F){g(oe=>oe.filter(te=>te.id!==F)),M(oe=>{const te=new Map(oe);return te.delete(F),te})}return y.jsxs(y.Fragment,{children:[y.jsx(Hx,{pullDistance:H.pullDistance,refreshing:H.refreshing,threshold:H.threshold}),S&&y.jsxs("div",{className:"form-error",children:[S,S.toLowerCase().includes("failed to fetch")&&y.jsxs(y.Fragment,{children:[" ",y.jsx("a",{href:"#",onClick:F=>{F.preventDefault(),window.location.reload()},children:"Reload"})]})]}),x&&!b.length&&d==="ready"?y.jsx("div",{className:"task-list",children:[0,1,2].map(F=>y.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[y.jsx("div",{className:"task-card-header",children:y.jsxs("div",{className:"task-card-title-row",children:[y.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),y.jsx("div",{className:"skeleton-line",style:{width:`${60+F*12}%`}})]})}),y.jsxs("div",{className:"task-card-meta",children:[y.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},F))}):b.length===0?d==="loading"?y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),y.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Retrying automatically — if this persists, run ",y.jsx("code",{children:"palmier restart"})," on the host machine."]}),y.jsx("button",{className:"btn btn-secondary",onClick:m,children:"Retry now"})]}):y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No tasks yet"}),y.jsx("p",{className:"empty-state-hint",children:"Tap the + button to create your first task."})]}):y.jsx("div",{className:"task-list",children:b.map(F=>y.jsx(PE,{task:F,lastEvent:D.get(F.id),onEdit:oe=>{B(oe),I(!0),r("task.get",{id:oe.id}).then(te=>{te.error||B(te)}).catch(()=>{})},onDelete:K,onViewRun:f},F.id))}),y.jsx("button",{className:"fab",onClick:()=>{B(void 0),I(!0)},"aria-label":"New task",title:"New task",children:y.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),y.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),R&&y.jsx(GE,{initial:ue,agents:l,hostPlatform:o,isNotificationListener:c,onSaved:z,onCancel:P},ue?XE(ue):"new")]})}let ba=null;function X0(e){ba&&(e.preventDefault(),e.returnValue="")}function Mh(e){const t=!!ba;ba=e;const r=!!ba;r&&!t?window.addEventListener("beforeunload",X0):!r&&t&&window.removeEventListener("beforeunload",X0)}function _s(){return ba?window.confirm(ba):!0}function QE(){const e=Fr(),t=xr(),{hostId:r}=Yu(),s=t.pathname.endsWith("/tasks"),l=!s;function o(c){_s()&&r&&e(`/hosts/${encodeURIComponent(r)}${c}`)}return y.jsxs(y.Fragment,{children:[y.jsxs("button",{className:`tab-btn ${l?"tab-btn-active":""}`,onClick:()=>o(""),children:[y.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:y.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),y.jsxs("button",{className:`tab-btn ${s?"tab-btn-active":""}`,onClick:()=>o("/tasks"),children:[y.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:[y.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),y.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}function Ix(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=In.isNativePlatform(),ZE=["Device","Data","Messaging"],WE=[{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 eC(){if(!Cu||!Sn)return new Set;try{const{capabilities:e}=await Sn.getCapabilityStatus();return new Set(e.filter(t=>t.enabled).map(t=>t.name))}catch{return new Set}}function Fx({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||!Sn))try{const{capabilities:S}=await Sn.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]);E.useEffect(()=>{d()},[d]),E.useEffect(()=>{if(!Cu)return;const S=gd.addListener("resume",d);return()=>{S.then(j=>j.remove())}},[d]);async function m(S,j){if(Sn){o(S.capability);try{const D=await Sn.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{o(null)}}}function b(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=ZE.map(S=>({group:S,items:WE.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 y.jsx("div",{className:"capability-toggles-loading",children:y.jsx("span",{className:"spinner"})});const v=c&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>f(null),children:y.jsxs("div",{className:"confirm-modal",onClick:S=>S.stopPropagation(),children:[y.jsxs("h2",{className:"confirm-modal-title",children:["Disable ",c.label,"?"]}),y.jsxs("p",{className:"confirm-modal-message",children:["All hosts linked to this device will no longer be able to use ",c.label,"."]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:g,children:"Disable"})]})]})}),document.body);return y.jsxs(y.Fragment,{children:[x.map(({group:S,items:j},D)=>y.jsx("div",{className:D>0?"drawer-toggle-group drawer-toggle-group-divided":"drawer-toggle-group",children:j.map(M=>{const R=r.get(M.capability),I=!!(R!=null&&R.enabled);return y.jsxs("label",{className:"drawer-toggle",children:[y.jsx("span",{className:"drawer-toggle-label",children:M.label}),y.jsx("button",{className:`toggle-switch ${I?"toggle-switch-on":""}`,onClick:()=>b(M),disabled:l===M.capability,role:"switch","aria-checked":I,children:y.jsx("span",{className:"toggle-switch-thumb"})})]},M.capability)})},S)),v]})}function Dh(e){return e.replace(/^https:\/\//,"")}function tC({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,j)=>S.origin===j.origin?S.username.localeCompare(j.username):S.origin.localeCompare(j.origin))):o(!0))}).catch(()=>{x||o(!0)}),()=>{x=!0}},[e]);async function b(){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&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>{d||f(null)},children:y.jsxs("div",{className:"confirm-modal",onClick:x=>x.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Remove password?"}),y.jsxs("p",{className:"confirm-modal-message",children:["The saved password for ",y.jsx("strong",{children:c.username})," on"," ",y.jsx("strong",{children:Dh(c.origin)})," will be removed from this host."]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>f(null),disabled:d,children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:b,disabled:d,children:d?"Removing…":"Remove"})]})]})}),document.body);return pi.createPortal(y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"confirm-modal-overlay",onClick:t,children:y.jsxs("div",{className:"confirm-modal passwords-dialog",onClick:x=>x.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Saved Passwords"}),y.jsx("div",{className:"passwords-dialog-scroll",children:l?y.jsx("p",{className:"passwords-empty",children:"Couldn't load saved passwords."}):r===null?y.jsx("p",{className:"passwords-empty",children:"Loading…"}):r.length===0?y.jsx("p",{className:"passwords-empty",children:"No saved passwords. Passwords are saved when you approve them during a task."}):y.jsx("ul",{className:"passwords-list",children:r.map(x=>y.jsxs("li",{className:"password-item",children:[y.jsxs("div",{className:"password-item-text",children:[y.jsx("span",{className:"password-item-origin",children:Dh(x.origin)}),y.jsx("span",{className:"password-item-username",children:x.username})]}),y.jsx("button",{className:"password-delete-btn",onClick:()=>f(x),"aria-label":`Remove password for ${x.username} on ${Dh(x.origin)}`,children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.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}
|
|
89
|
+
${x.username}`))})}),y.jsx("div",{className:"confirm-modal-actions",children:y.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"),nC=In.isNativePlatform();function Q0({daemonVersion:e,agents:t,playwrightCli:r,linkedClientToken:s,request:l,onEnabledCapabilitiesChange:o,onLinkedClientTokenChange:c}){var nn;const{pairedHosts:f,removePairedHost:d,renamePairedHost:m}=Wi(),{activeHost:b}=xi(),g=Fr(),x=xr(),S=Yu().hostId??null,j=b.clientToken||null,D=!!j&&s===j,M=Ix("(min-width: 768px)"),[R,I]=E.useState(!1),[ue,B]=E.useState(()=>Date.now());E.useEffect(()=>{const Ke=()=>B(Date.now()),ht=6e4-Date.now()%6e4,dt=setTimeout(()=>{Ke();const xt=setInterval(Ke,6e4);dt._iv=xt},ht);return()=>{const xt=dt._iv;xt&&clearInterval(xt),clearTimeout(dt)}},[]);const P=b.timezone?new Date(ue).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:b.timezone}):"";async function ee(){if(!(!Sn||!l||!j)){I(!0);try{const{token:Ke}=await Sn.getFcmToken();if(!Ke)return;await l("device.link",{fcmToken:Ke}),c==null||c(j)}catch(Ke){console.error("Failed to make this the linked device:",Ke)}finally{I(!1)}}}async function G(Ke){const ht=Ke===S;if(ht&&l)try{await l("clients.revoke_self")}catch{}d(Ke),ke(null),ht&&g("/",{replace:!0})}function H(Ke){const dt=x.pathname.endsWith("/tasks")?"/tasks":"";g(`/hosts/${encodeURIComponent(Ke)}${dt}`)}const[z,K]=E.useState(!1),[F,oe]=E.useState(!1),[te,W]=E.useState(null),[V,J]=E.useState(""),[ce,ke]=E.useState(null),[C,L]=E.useState(!1),[X,N]=E.useState(!1),ve=E.useRef(null),Ae=E.useRef(null),Ee=E.useCallback(()=>{oe(!0)},[]);function le(){F&&(K(!1),oe(!1))}function Re(){oe(!1),K(!0)}function _e(Ke,ht){W(Ke),J(ht)}function Fe(){te&&V.trim()&&m(te,V.trim()),W(null),J("")}function Ht(){W(null),J("")}E.useEffect(()=>{te&&Ae.current&&(Ae.current.focus(),Ae.current.select())},[te]),E.useEffect(()=>{if(!z||F)return;function Ke(ht){ht.key==="Escape"&&Ee()}return document.addEventListener("keydown",Ke),()=>{document.removeEventListener("keydown",Ke)}},[z,F,Ee]);const Rt=y.jsxs(y.Fragment,{children:[!M&&y.jsx("button",{className:"drawer-close-btn",onClick:Ee,"aria-label":"Close menu",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:y.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!K0&&f.length>0&&y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),y.jsx("div",{className:"host-picker-inline",children:y.jsx("div",{className:"host-picker-list",role:"listbox",children:f.map(Ke=>{const ht=Ke.hostId===S,dt=te===Ke.hostId,xt=Ke.name||Ke.hostId.slice(0,8);return y.jsx("div",{className:"host-picker-item-wrapper",children:y.jsxs("div",{className:`host-picker-item ${ht?"host-picker-item-active":""}`,onClick:()=>{if(!dt&&!ht){if(!_s())return;H(Ke.hostId),M||Ee()}},role:"option","aria-selected":ht,children:[dt?y.jsx("input",{ref:Ae,className:"form-input host-picker-rename-input",type:"text",value:V,onChange:Gt=>J(Gt.target.value),onKeyDown:Gt=>{Gt.key==="Enter"&&Fe(),Gt.key==="Escape"&&Ht()},onBlur:Fe,onClick:Gt=>Gt.stopPropagation()}):y.jsx("span",{className:"host-picker-item-name",children:xt}),y.jsxs("div",{className:"host-picker-item-actions",children:[ht&&!dt&&y.jsx("button",{className:"host-picker-edit-btn",onClick:Gt=>{Gt.stopPropagation(),_e(Ke.hostId,xt)},"aria-label":"Rename host",children:y.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:y.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"})})}),!ht&&y.jsx("button",{className:"host-picker-delete-btn",onClick:Gt=>{Gt.stopPropagation(),ke(Ke.hostId)},"aria-label":`Unpair ${xt}`,children:y.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:y.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"})})})]})]})},Ke.hostId)})})})]}),!K0&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsx("div",{className:"drawer-section",children:y.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{_s()&&(g("/pair"),M||Ee())},children:"Add New Host"})})]}),nC&&l&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Device Capabilities"}),D?y.jsx(Fx,{onChange:o,confirmDisable:!0}):y.jsxs(y.Fragment,{children:[y.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.)."}),y.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>{s&&s!==j?L(!0):ee()},disabled:R,children:R?"Linking…":"Link the host to this device"})]})]})]}),l&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-divider"}),y.jsxs("div",{className:"drawer-section",children:[y.jsx("h3",{className:"drawer-section-label",children:"Passwords"}),y.jsx("button",{className:"btn btn-link",onClick:()=>N(!0),children:"Manage saved passwords"})]})]}),y.jsxs("div",{className:"drawer-footer",children:[t&&t.length>0&&(()=>{const Ke=t.filter(dt=>dt.version),ht=t.filter(dt=>!dt.version);return y.jsxs("div",{className:"drawer-agents",children:[Ke.length>0&&y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Agents"}),Ke.map(dt=>y.jsxs("div",{className:"drawer-agents-row",children:[y.jsx("span",{children:dt.label}),y.jsxs("span",{className:"drawer-agents-version",children:["v",dt.version]})]},dt.key))]}),ht.length>0&&y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Version not managed by Palmier"}),ht.map(dt=>y.jsx("div",{className:"drawer-agents-row",children:y.jsx("span",{children:dt.label})},dt.key))]})]})})(),r&&y.jsx("div",{className:"drawer-agents",children:y.jsxs("div",{className:"drawer-agents-section",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Browser Automation"}),y.jsxs("div",{className:"drawer-agents-row",children:[y.jsx("span",{children:r.label}),y.jsxs("span",{className:"drawer-agents-version",children:["v",r.version]})]})]})}),(b.timezone||e)&&y.jsxs("div",{className:"drawer-host-info",children:[y.jsx("div",{className:"drawer-agents-heading",children:"Host"}),b.timezone&&y.jsxs("div",{className:"drawer-host-time",children:[P," · ",b.timezone]}),e&&y.jsxs("div",{className:"drawer-version",children:["Version: v",e]})]}),y.jsxs("div",{className:"drawer-legal",children:[y.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),y.jsx("span",{className:"drawer-legal-sep",children:"·"}),y.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),Qt=!!ce&&ce===S&&D,zt=ce&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>ke(null),children:y.jsxs("div",{className:"confirm-modal",onClick:Ke=>Ke.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Remove host?"}),y.jsxs("p",{className:"confirm-modal-message",children:['"',((nn=f.find(Ke=>Ke.hostId===ce))==null?void 0:nn.name)||ce.slice(0,8),'" will be ',Qt?"removed and unlinked":"removed",".",Qt&&y.jsx(y.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."})]}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>ke(null),children:"Cancel"}),y.jsx("button",{className:"btn btn-danger",onClick:()=>G(ce),children:"Remove"})]})]})}),document.body),tn=C&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:()=>L(!1),children:y.jsxs("div",{className:"confirm-modal",onClick:Ke=>Ke.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),y.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."}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:()=>L(!1),children:"Cancel"}),y.jsx("button",{className:"btn btn-primary",onClick:()=>{L(!1),ee()},children:"Link"})]})]})}),document.body),Yt=X&&l&&y.jsx(tC,{request:l,onClose:()=>N(!1)});return M?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:ve,children:Rt}),zt,tn,Yt]}):y.jsxs(y.Fragment,{children:[y.jsx("button",{className:"hamburger-btn",onClick:Re,"aria-label":"Open menu",children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:y.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),z&&pi.createPortal(y.jsx("div",{className:`drawer-overlay ${F?"drawer-overlay-closing":""}`,onClick:Ee,onAnimationEnd:le,children:y.jsx("div",{className:`drawer-panel ${F?"drawer-panel-closing":""}`,ref:ve,onClick:Ke=>Ke.stopPropagation(),children:Rt})}),document.body),zt,tn,Yt]})}const rC=In.isNativePlatform(),Gd={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function iC(){return y.jsxs("svg",{...Gd,"aria-hidden":"true",children:[y.jsx("path",{d:"M3 11 L12 3 L21 11"}),y.jsx("path",{d:"M5 9.5 V21 H19 V9.5"})]})}function Z0(){return y.jsxs("svg",{...Gd,"aria-hidden":"true",children:[y.jsx("circle",{cx:"12",cy:"12",r:"10"}),y.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),y.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 sC(){return y.jsxs("svg",{...Gd,"aria-hidden":"true",children:[y.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"}),y.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),y.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function aC(){const{mode:e}=xi(),[t,r]=E.useState(!1),s=E.useRef(null);if(E.useEffect(()=>{if(!t)return;function f(m){var b;(b=s.current)!=null&&b.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=y.jsx(iC,{}),o="Connected via LAN",c="lan";break;case"nats":l=y.jsx(Z0,{}),o=rC?"Connected via relay":"Connected",c="relay";break;case"disconnected":l=y.jsx(sC,{}),o="Disconnected",c="disconnected";break;case"connecting":default:l=y.jsx(Z0,{}),o="Connecting…",c="connecting";break}return y.jsxs("div",{ref:s,className:`conn-status conn-status--${c}`,children:[y.jsx("button",{type:"button",className:"conn-status-btn","aria-label":o,onClick:()=>r(f=>!f),children:l}),y.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 lC({agents:e,hostPlatform:t,onStarted:r}){const{request:s,activeHost:l}=xi(),{setHostLastAgent:o}=Wi(),[c,f]=E.useState(""),[d,m]=E.useState(()=>W0(e,l.lastAgent)),[b,g]=E.useState(!1),[x,v]=E.useState(null);E.useEffect(()=>{e.length&&(e.find(R=>R.key===d)||m(W0(e,l.lastAgent)))},[e,d,l.lastAgent]),E.useEffect(()=>{const R=c.trim().length>0;return Mh(R?"Your session draft will be lost. Continue?":null),()=>Mh(null)},[c]);const S=e.find(R=>R.key===d),j=!!c.trim()&&!!d&&!b;async function D(){if(j){g(!0),v(null);try{const R=await s("task.run_oneoff",{user_prompt:c,agent:d,...t==="win32"?{foreground_mode:!0}:{}});if(R.error){v(R.error);return}o(l.hostId,d),f(""),Mh(null),R.task_id&&r(R.task_id,R.run_id)}catch(R){v(R instanceof Error?R.message:String(R))}finally{g(!1)}}}function M(R){R.key==="Enter"&&(R.metaKey||R.ctrlKey)&&(R.preventDefault(),D())}return y.jsxs("div",{className:"session-composer",children:[x&&y.jsx("div",{className:"form-error",children:x}),y.jsx("textarea",{className:"session-composer-textarea",value:c,onChange:R=>f(R.target.value),onKeyDown:M,placeholder:"What can I do for you?",rows:3,disabled:b}),y.jsxs("div",{className:"session-composer-controls",children:[e.length>0&&y.jsx("div",{className:"agent-picker-section-inline",children:e.length>1?y.jsx("select",{className:"form-select form-select-sm",value:d,onChange:R=>m(R.target.value),disabled:b,children:e.map(R=>y.jsx("option",{value:R.key,children:R.label},R.key))}):y.jsx("span",{className:"agent-picker-single",children:(S==null?void 0:S.label)??e[0].label})}),y.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:D,disabled:!j,"aria-label":"Run session",title:"Run session",children:b?y.jsx("span",{className:"btn-spinner"}):y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]})}const vs=72,eb=6;function oC({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.",disabled:d=!1}){const m=t===e,[b,g]=E.useState(0),[x,v]=E.useState(!1),S=E.useRef(0),j=E.useRef(0),D=E.useRef(null),M=E.useRef(0),R=E.useRef(!1),I=E.useRef(null);E.useEffect(()=>{m||g(0)},[m]),E.useEffect(()=>{if(!m)return;function H(z){var K;(K=I.current)!=null&&K.contains(z.target)||r(null)}return document.addEventListener("pointerdown",H),()=>document.removeEventListener("pointerdown",H)},[m,r]);function ue(H){H.button!==void 0&&H.button!==0||(S.current=H.clientX,j.current=H.clientY,D.current=null,M.current=m?-vs:0,R.current=!1)}function B(H){if(d||H.pointerType==="mouse"&&H.buttons===0)return;const z=H.clientX-S.current,K=H.clientY-j.current;if(D.current===null){if(Math.abs(z)<eb&&Math.abs(K)<eb)return;if(D.current=Math.abs(z)>Math.abs(K)?"x":"y",D.current==="x")try{H.currentTarget.setPointerCapture(H.pointerId)}catch{}}if(D.current!=="x")return;R.current=!0,x||v(!0);let F=M.current+z;F>0&&(F=F/4),F<-vs&&(F=-vs+(F+vs)/4),g(F)}function P(){if(D.current!=="x"){v(!1);return}D.current=null,v(!1),b<=-36?(g(-vs),r(e)):(g(0),m&&r(null))}function ee(H){if(R.current){R.current=!1,H.stopPropagation(),H.preventDefault();return}m&&(H.stopPropagation(),H.preventDefault(),r(null))}const G=b!==0?b:m?-vs:0;return y.jsxs("div",{ref:I,className:"swipe-row",children:[!d&&y.jsxs("button",{type:"button",className:`swipe-row-action${G<0?"":" swipe-row-action--hidden"}`,style:{width:vs},onClick:H=>{H.stopPropagation(),window.confirm(f)&&s()},tabIndex:m?0:-1,"aria-hidden":!m,"aria-label":c,children:[y.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:[y.jsx("polyline",{points:"3 6 5 6 21 6"}),y.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),y.jsx("path",{d:"M10 11v6M14 11v6"}),y.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]}),y.jsx("span",{className:"swipe-row-action-label",children:c})]}),y.jsx("div",{className:`swipe-row-content ${x?"swipe-row-content-dragging":""}`,style:{transform:`translateX(${G}px)`},onPointerDown:ue,onPointerMove:B,onPointerUp:P,onPointerCancel:P,onClickCapture:ee,onClick:l,children:o})]})}function $x({starred:e,onToggle:t,className:r}){return y.jsx("button",{type:"button",className:`star-button${e?" star-button--on":""}${r?` ${r}`:""}`,onClick:s=>{s.stopPropagation(),t()},"aria-pressed":e,"aria-label":e?"Unstar session":"Star session",title:e?"Unstar":"Star",children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})})}const uC=10;function cC({connected:e,hostId:t,request:r,subscribeEvents:s,agents:l,hostPlatform:o,filterTaskId:c,onClearFilter:f,hostInfoStatus:d,onRetryHostInfo:m}){const b=Yd(),[g,x]=E.useState([]),[v,S]=E.useState(0),[j,D]=E.useState(!1),[M,R]=E.useState(!1),[I,ue]=E.useState(null),B=Fr();async function P(C){const L=`${C.task_id}:${C.run_id}`;x(X=>X.filter(N=>`${N.task_id}:${N.run_id}`!==L)),S(X=>Math.max(0,X-1)),ue(null);try{await r("taskrun.delete",{task_id:C.task_id,run_id:C.run_id})}catch(X){console.error("Failed to delete run:",X),x(N=>[C,...N]),S(N=>N+1)}}async function ee(C){const L=`${C.task_id}:${C.run_id}`,X=!C.starred,N=ve=>x(Ae=>Ae.map(Ee=>`${Ee.task_id}:${Ee.run_id}`===L?{...Ee,starred:ve}:Ee));N(X);try{const ve=await r("taskrun.star",{task_id:C.task_id,run_id:C.run_id,starred:X});if(ve.error)throw new Error(ve.error)}catch(ve){console.error("Failed to update star:",ve),N(!X)}}const G=E.useRef(null),H=E.useCallback(C=>{const L={offset:C,limit:uC};return c&&(L.task_id=c),L},[c]),z=E.useCallback(async(C,L)=>{if(e){L?R(!0):D(!0);try{const X=await r("taskrun.list",H(C)),N=X.entries??[];S(X.total??0),x(L?ve=>{const Ae=new Set(ve.map(le=>`${le.task_id}:${le.run_id}`)),Ee=N.filter(le=>!Ae.has(`${le.task_id}:${le.run_id}`));return[...ve,...Ee]}:N)}catch(X){X instanceof Error&&X.message==="Not connected"||console.error("Failed to load runs:",X)}finally{D(!1),R(!1)}}},[e,r,H]);E.useEffect(()=>{e?(x([]),S(0),z(0,!1)):(x([]),S(0))},[e,t,z,c]);const K=E.useRef(!1);E.useEffect(()=>{d==="error"?K.current=!0:d==="ready"&&K.current&&(K.current=!1,z(0,!1))},[d,z]);const F=qx({onRefresh:()=>z(0,!1),enabled:e});E.useEffect(()=>!e||!t?void 0:s(t,async L=>{try{const X=JSON.parse(new TextDecoder().decode(L.data));if(X.event_type==="running-state"&&X.running_state&&["started","finished","failed","aborted"].includes(X.running_state)){const N=await r("taskrun.list",H(0)),ve=N.entries??[];S(N.total??0),x(Ae=>{const Ee=new Map(ve.map(Fe=>[`${Fe.task_id}:${Fe.run_id}`,Fe])),le=Ae.map(Fe=>{const Ht=`${Fe.task_id}:${Fe.run_id}`;return Ee.get(Ht)??Fe}),Re=new Set(le.map(Fe=>`${Fe.task_id}:${Fe.run_id}`));return[...ve.filter(Fe=>!Re.has(`${Fe.task_id}:${Fe.run_id}`)),...le]})}}catch{}}),[e,t,s,r]),E.useEffect(()=>{const C=G.current;if(!C)return;const L=new IntersectionObserver(X=>{X[0].isIntersecting&&!M&&g.length<v&&z(g.length,!0)},{threshold:.1});return L.observe(C),()=>L.disconnect()},[g.length,v,M,z]);function oe(C,L){if(!C||!L)return"";const X=Math.round((L-C)/1e3);if(X<60)return`${X}s`;const N=Math.floor(X/60),ve=X%60;return`${N}m ${ve}s`}const te={started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function W(C,L){_s()&&t&&B(`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(C)}/${encodeURIComponent(L)}`)}const V=!c&&d==="ready"&&y.jsx(lC,{agents:l,hostPlatform:o,onStarted:(C,L)=>{if(!t)return;const X=`/hosts/${encodeURIComponent(t)}/runs/${encodeURIComponent(C)}`;B(L?`${X}/${encodeURIComponent(L)}`:X)}}),J=y.jsx(Hx,{pullDistance:F.pullDistance,refreshing:F.refreshing,threshold:F.threshold}),ce=c&&f&&y.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:y.jsxs("span",{className:"sessions-filter-chip",children:["Filtered by task",y.jsx("button",{onClick:f,"aria-label":"Clear filter",children:"×"})]})});function ke(C){if(C==="failed")return"var(--color-error)";if(C==="aborted")return"var(--color-warning, #d97706)"}return j&&g.length===0&&e&&d==="ready"?y.jsxs(y.Fragment,{children:[J,V,y.jsx("div",{className:"task-list",children:[0,1,2].map(C=>y.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[y.jsx("div",{className:"task-card-header",children:y.jsx("div",{className:"task-card-title-row",children:y.jsx("div",{className:"skeleton-line",style:{width:`${70+C*10}%`}})})}),y.jsx("div",{className:"task-card-meta",children:y.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},C))})]}):g.length===0?y.jsxs(y.Fragment,{children:[J,V,ce,y.jsx("div",{className:"sessions-view",children:d==="loading"?y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})}):d==="error"?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"Couldn't reach host"}),y.jsxs("p",{className:"empty-state-hint",children:["The host didn't respond. Retrying automatically — if this persists, run ",y.jsx("code",{children:"palmier restart"})," on the host machine."]}),y.jsx("button",{className:"btn btn-secondary",onClick:m,children:"Retry now"})]}):y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),y.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."})]})})]}):y.jsxs(y.Fragment,{children:[J,V,ce,y.jsxs("div",{className:"task-list",children:[g.map((C,L)=>{const X=`${C.task_id}:${C.run_id}`;return y.jsx(oC,{id:X,revealedId:I,setRevealedId:ue,onDelete:()=>P(C),disabled:C.starred,confirmMessage:"Delete this session? Its run history will be removed from the host.",onClick:()=>!C.error&&W(C.task_id,C.run_id),children:y.jsxs("div",{className:"sessions-card",children:[y.jsxs("div",{className:"sessions-card-body",children:[y.jsx("h3",{className:"sessions-card-name",children:C.task_name||C.task_id}),y.jsxs("div",{className:"sessions-card-meta",children:[C.running_state==="started"?y.jsx("span",{className:"status-spinner","aria-label":"Running",children:y.jsx("span",{})}):y.jsx("span",{style:{color:ke(C.running_state)},children:te[C.running_state??""]??C.running_state}),C.end_time&&y.jsx("span",{children:b(C.end_time)}),C.start_time&&C.end_time&&y.jsx("span",{style:{color:"var(--color-muted)"},children:oe(C.start_time,C.end_time)}),C.error&&y.jsx("span",{style:{color:"var(--color-muted)"},children:C.error})]})]}),!C.error&&y.jsx($x,{starred:!!C.starred,onToggle:()=>ee(C)}),y.jsx("span",{className:"sessions-card-chevron",children:"›"})]})},`${X}-${L}`)}),y.jsx("div",{ref:G,style:{height:1}}),M&&y.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:y.jsx("div",{className:"spinner"})})]})]})}function fC(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const hC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mC={};function tb(e,t){return(mC.jsx?dC:hC).test(e)}const pC=/[ \t\n\f\r]/g;function gC(e){return typeof e=="object"?e.type==="text"?nb(e.value):!1:nb(e)}function nb(e){return e.replace(pC,"")===""}class Kl{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}Kl.prototype.normal={};Kl.prototype.property={};Kl.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 Kl(r,s,t)}function bd(e){return e.toLowerCase()}class Fn{constructor(t,r){this.attribute=r,this.property=t}}Fn.prototype.attribute="";Fn.prototype.booleanish=!1;Fn.prototype.boolean=!1;Fn.prototype.commaOrSpaceSeparated=!1;Fn.prototype.commaSeparated=!1;Fn.prototype.defined=!1;Fn.prototype.mustUseProperty=!1;Fn.prototype.number=!1;Fn.prototype.overloadedBoolean=!1;Fn.prototype.property="";Fn.prototype.spaceSeparated=!1;Fn.prototype.space=void 0;let yC=0;const tt=Cs(),on=Cs(),xd=Cs(),Se=Cs(),Lt=Cs(),xa=Cs(),Qn=Cs();function Cs(){return 2**++yC}const vd=Object.freeze(Object.defineProperty({__proto__:null,boolean:tt,booleanish:on,commaOrSpaceSeparated:Qn,commaSeparated:xa,number:Se,overloadedBoolean:xd,spaceSeparated:Lt},Symbol.toStringTag,{value:"Module"})),Lh=Object.keys(vd);class Jd extends Fn{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 Na(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 Kl(t,r,e.space)}const Yx=Na({properties:{ariaActiveDescendant:null,ariaAtomic:on,ariaAutoComplete:null,ariaBusy:on,ariaChecked:on,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Lt,ariaCurrent:null,ariaDescribedBy:Lt,ariaDetails:null,ariaDisabled:on,ariaDropEffect:Lt,ariaErrorMessage:null,ariaExpanded:on,ariaFlowTo:Lt,ariaGrabbed:on,ariaHasPopup:null,ariaHidden:on,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Lt,ariaLevel:Se,ariaLive:null,ariaModal:on,ariaMultiLine:on,ariaMultiSelectable:on,ariaOrientation:null,ariaOwns:Lt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:on,ariaReadOnly:on,ariaRelevant:null,ariaRequired:on,ariaRoleDescription:Lt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:on,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 bC=Na({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xa,acceptCharset:Lt,accessKey:Lt,action:null,allow:null,allowFullScreen:tt,allowPaymentRequest:tt,allowUserMedia:tt,alt:null,as:null,async:tt,autoCapitalize:null,autoComplete:Lt,autoFocus:tt,autoPlay:tt,blocking:Lt,capture:null,charSet:null,checked:tt,cite:null,className:Lt,cols:Se,colSpan:null,content:null,contentEditable:on,controls:tt,controlsList:Lt,coords:Se|xa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:tt,defer:tt,dir:null,dirName:null,disabled:tt,download:xd,draggable:on,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:tt,formTarget:null,headers:Lt,height:Se,hidden:xd,high:Se,href:null,hrefLang:null,htmlFor:Lt,httpEquiv:Lt,id:null,imageSizes:null,imageSrcSet:null,inert:tt,inputMode:null,integrity:null,is:null,isMap:tt,itemId:null,itemProp:Lt,itemRef:Lt,itemScope:tt,itemType:Lt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:tt,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:tt,muted:tt,name:null,nonce:null,noModule:tt,noValidate:tt,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:tt,optimum:Se,pattern:null,ping:Lt,placeholder:null,playsInline:tt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:tt,referrerPolicy:null,rel:Lt,required:tt,reversed:tt,rows:Se,rowSpan:Se,sandbox:Lt,scope:null,scoped:tt,seamless:tt,selected:tt,shadowRootClonable:tt,shadowRootDelegatesFocus:tt,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:on,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:tt,useMap:null,value:on,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Lt,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:tt,declare:tt,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:tt,noHref:tt,noShade:tt,noWrap:tt,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:on,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:tt,disableRemotePlayback:tt,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Jx}),xC=Na({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qn,accentHeight: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:Lt,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:tt,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:xa,g2:xa,glyphName:xa,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:Qn,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:Lt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qn,rev:Qn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qn,requiredFeatures:Qn,requiredFonts:Qn,requiredFormats:Qn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant: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:Qn,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:Qn,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:Qn,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=Na({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=Na({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Jx}),Qx=Na({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vC={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"},wC=/[A-Z]/g,ib=/-[a-z]/g,SC=/^data[-\w.:]+$/i;function _C(e,t){const r=bd(t);let s=t,l=Fn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&SC.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(ib,EC);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!ib.test(o)){let c=o.replace(wC,kC);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=Jd}return new l(s,t)}function kC(e){return"-"+e.toLowerCase()}function EC(e){return e.charAt(1).toUpperCase()}const CC=Vx([Yx,bC,Xx,Kx,Qx],"html"),Xd=Vx([Yx,xC,Xx,Kx,Qx],"svg");function AC(e){return e.join(" ").trim()}var la={},zh,sb;function jC(){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=`
|
|
90
|
+
`,m="/",b="*",g="",x="comment",v="declaration";function S(D,M){if(typeof D!="string")throw new TypeError("First argument must be a string");if(!D)return[];M=M||{};var R=1,I=1;function ue(te){var W=te.match(t);W&&(R+=W.length);var V=te.lastIndexOf(d);I=~V?te.length-V:I+te.length}function B(){var te={line:R,column:I};return function(W){return W.position=new P(te),H(),W}}function P(te){this.start=te,this.end={line:R,column:I},this.source=M.source}P.prototype.content=D;function ee(te){var W=new Error(M.source+":"+R+":"+I+": "+te);if(W.reason=te,W.filename=M.source,W.line=R,W.column=I,W.source=D,!M.silent)throw W}function G(te){var W=te.exec(D);if(W){var V=W[0];return ue(V),D=D.slice(V.length),W}}function H(){G(r)}function z(te){var W;for(te=te||[];W=K();)W!==!1&&te.push(W);return te}function K(){var te=B();if(!(m!=D.charAt(0)||b!=D.charAt(1))){for(var W=2;g!=D.charAt(W)&&(b!=D.charAt(W)||m!=D.charAt(W+1));)++W;if(W+=2,g===D.charAt(W-1))return ee("End of comment missing");var V=D.slice(2,W-2);return I+=2,ue(V),D=D.slice(W),I+=2,te({type:x,comment:V})}}function F(){var te=B(),W=G(s);if(W){if(K(),!G(l))return ee("property missing ':'");var V=G(o),J=te({type:v,property:j(W[0].replace(e,g)),value:V?j(V[0].replace(e,g)):g});return G(c),J}}function oe(){var te=[];z(te);for(var W;W=F();)W!==!1&&(te.push(W),z(te));return te}return H(),oe()}function j(D){return D?D.replace(f,g):g}return zh=S,zh}var ab;function NC(){if(ab)return la;ab=1;var e=la&&la.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(la,"__esModule",{value:!0}),la.default=r;const t=e(jC());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:b}=d;f?l(m,b,d):b&&(o=o||{},o[m]=b)}),o}return la}var _l={},lb;function TC(){if(lb)return _l;lb=1,Object.defineProperty(_l,"__esModule",{value:!0}),_l.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,b){return b.toUpperCase()},f=function(m,b){return"".concat(b,"-")},d=function(m,b){return b===void 0&&(b={}),o(m)?m:(m=m.toLowerCase(),b.reactCompat?m=m.replace(l,f):m=m.replace(s,f),m.replace(t,c))};return _l.camelCase=d,_l}var kl,ob;function OC(){if(ob)return kl;ob=1;var e=kl&&kl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(NC()),r=TC();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,kl=s,kl}var RC=OC();const MC=Vb(RC),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 DC(e){const t=Kd(e),r=Zx(e);if(t&&r)return{start:t,end:r}}function Ll(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 kn 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=Ll(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}}kn.prototype.file="";kn.prototype.name="";kn.prototype.reason="";kn.prototype.message="";kn.prototype.stack="";kn.prototype.column=void 0;kn.prototype.line=void 0;kn.prototype.ancestors=void 0;kn.prototype.cause=void 0;kn.prototype.fatal=void 0;kn.prototype.place=void 0;kn.prototype.ruleId=void 0;kn.prototype.source=void 0;const Qd={}.hasOwnProperty,LC=new Map,zC=/[A-Z]/g,UC=new Set(["table","tbody","thead","tfoot","tr"]),PC=new Set(["td","th"]),e1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function BC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=GC(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=YC(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:CC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=t1(l,e,void 0);return o&&typeof o!="string"?o:l.create(e,l.Fragment,{children:o||void 0},void 0)}function t1(e,t,r){if(t.type==="element")return HC(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return qC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return FC(e,t,r);if(t.type==="mdxjsEsm")return IC(e,t);if(t.type==="root")return $C(e,t,r);if(t.type==="text")return VC(e,t)}function HC(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=r1(e,t.tagName,!1),c=JC(e,t);let f=Wd(e,t);return UC.has(t.tagName)&&(f=f.filter(function(d){return typeof d=="string"?!gC(d):!0})),n1(e,c,o,t),Zd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,r)}function qC(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)}$l(e,t.position)}function IC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);$l(e,t.position)}function FC(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:r1(e,t.name,!0),c=XC(e,t),f=Wd(e,t);return n1(e,c,o,t),Zd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,r)}function $C(e,t,r){const s={};return Zd(s,Wd(e,t)),e.create(t,e.Fragment,s,r)}function VC(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 YC(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 GC(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 JC(e,t){const r={};let s,l;for(l in t.properties)if(l!=="children"&&Qd.call(t.properties,l)){const o=KC(e,l,t.properties[l]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&PC.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 XC(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 $l(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 $l(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:LC;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=t1(e,o,c);f!==void 0&&r.push(f)}return r}function KC(e,t,r){const s=_C(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?fC(r):AC(r)),s.property==="style"){let l=typeof r=="object"?r:QC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=ZC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?vC[s.property]||s.property:s.attribute,r]}}function QC(e,t){try{return MC(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,l=new kn("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 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);$l(e)}function $l(e,t){const r=new kn("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 ZC(e){const t={};let r;for(r in e)Qd.call(e,r)&&(t[WC(r)]=e[r]);return t}function WC(e){let t=e.replace(zC,eA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function eA(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"]},tA={};function em(e,t){const r=tA,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(nA(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]=i1(e[l],t,r);return s.join("")}function nA(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 nr(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 br(e,t){return e.length>0?(nr(e,e.length,0,t),e):t}const db={}.hasOwnProperty;function s1(e){const t={};let r=-1;for(;++r<e.length;)rA(t,e[r]);return t}function rA(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];iA(l[c],Array.isArray(f)?f:f?[f]:[])}}}function iA(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);nr(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 Nr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Rn=ts(/[A-Za-z]/),_n=ts(/[\dA-Za-z]/),sA=ts(/[#-'*+\--9=?A-Z^-~]/);function Hu(e){return e!==null&&(e<32||e===127)}const Sd=ts(/\d/),aA=ts(/[\dA-Fa-f]/),lA=ts(/[!-/:-@[-`{-~]/);function Ye(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const Wu=ts(new RegExp("\\p{P}|\\p{S}","u")),ks=ts(/\s/);function ts(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Ta(e){const t=[];let r=-1,s=0,l=0;for(;++r<e.length;){const o=e.charCodeAt(r);let c="";if(o===37&&_n(e.charCodeAt(r+1))&&_n(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 gt(e,t,r,s){const l=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(d){return ot(d)?(e.enter(r),f(d)):t(d)}function f(d){return ot(d)&&o++<l?(e.consume(d),f):(e.exit(r),t(d))}}const oA={tokenize:uA};function uA(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"),gt(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 Ye(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const cA={tokenize:fA},mb={tokenize:hA};function fA(e){const t=this,r=[];let s=0,l,o,c;return f;function f(I){if(s<r.length){const ue=r[s];return t.containerState=ue[1],e.attempt(ue[0].continuation,d,m)(I)}return m(I)}function d(I){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&R();const ue=t.events.length;let B=ue,P;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){P=t.events[B][1].end;break}M(s);let ee=ue;for(;ee<t.events.length;)t.events[ee][1].end={...P},ee++;return nr(t.events,B+1,0,t.events.slice(ue)),t.events.length=ee,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,b,g)(I)}function b(I){return l&&R(),M(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&&R(),M(0),e.consume(I);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:o}),j(I)}function j(I){if(I===null){D(e.exit("chunkFlow"),!0),M(0),e.consume(I);return}return Ye(I)?(e.consume(I),D(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),j)}function D(I,ue){const B=t.sliceStream(I);if(ue&&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 P=l.events.length;for(;P--;)if(l.events[P][1].start.offset<c&&(!l.events[P][1].end||l.events[P][1].end.offset>c))return;const ee=t.events.length;let G=ee,H,z;for(;G--;)if(t.events[G][0]==="exit"&&t.events[G][1].type==="chunkFlow"){if(H){z=t.events[G][1].end;break}H=!0}for(M(s),P=ee;P<t.events.length;)t.events[P][1].end={...z},P++;nr(t.events,G+1,0,t.events.slice(ee)),t.events.length=P}}function M(I){let ue=r.length;for(;ue-- >I;){const B=r[ue];t.containerState=B[1],B[0].exit.call(t,e)}r.length=I}function R(){l.write([null]),o=void 0,l=void 0,t.containerState._closeFlow=void 0}}function hA(e,t,r){return gt(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ka(e){if(e===null||Dt(e)||ks(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:dA,tokenize:mA};function dA(e,t){let r=-1,s,l,o,c,f,d,m,b;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=br(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=br(m,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",o,t]]),m=br(m,ec(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),m=br(m,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",l,t]]),e[r][1].end.offset-e[r][1].start.offset?(b=2,m=br(m,[["enter",e[r][1],t],["exit",e[r][1],t]])):b=0,nr(e,s-1,r-s+3,m),r=s+m.length-b-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function mA(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,l=ka(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"),b=ka(d),g=!b||b===2&&l||r.includes(d),x=!l||l===2&&b||r.includes(s);return m._open=!!(o===42?g:g&&(l||!x)),m._close=!!(o===42?x:x&&(b||!g)),t(d)}}function pb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const pA={name:"autolink",tokenize:gA};function gA(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 Rn(v)?(e.consume(v),c):v===64?r(v):m(v)}function c(v){return v===43||v===45||v===46||_n(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||_n(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),b):sA(v)?(e.consume(v),m):r(v)}function b(v){return _n(v)?g(v):r(v)}function g(v){return v===46?(e.consume(v),s=0,b):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||_n(v))&&s++<63){const S=v===45?x:g;return e.consume(v),S}return r(v)}}const Ql={partial:!0,tokenize:yA};function yA(e,t,r){return s;function s(o){return ot(o)?gt(e,l,"linePrefix")(o):l(o)}function l(o){return o===null||Ye(o)?t(o):r(o)}}const l1={continuation:{tokenize:xA},exit:vA,name:"blockQuote",tokenize:bA};function bA(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 ot(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function xA(e,t,r){const s=this;return l;function l(c){return ot(c)?gt(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(l1,t,r)(c)}}function vA(e){e.exit("blockQuote")}const o1={name:"characterEscape",tokenize:wA};function wA(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 lA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(o)}}const u1={name:"characterReference",tokenize:SA};function SA(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=_n,b(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=aA,b):(e.enter("characterReferenceValue"),o=7,c=Sd,b(g))}function b(g){if(g===59&&l){const x=e.exit("characterReferenceValue");return c===_n&&!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),b):r(g)}}const gb={partial:!0,tokenize:kA},yb={concrete:!0,name:"codeFenced",tokenize:_A};function _A(e,t,r){const s=this,l={partial:!0,tokenize:B};let o=0,c=0,f;return d;function d(P){return m(P)}function m(P){const ee=s.events[s.events.length-1];return o=ee&&ee[1].type==="linePrefix"?ee[2].sliceSerialize(ee[1],!0).length:0,f=P,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(P)}function b(P){return P===f?(c++,e.consume(P),b):c<3?r(P):(e.exit("codeFencedFenceSequence"),ot(P)?gt(e,g,"whitespace")(P):g(P))}function g(P){return P===null||Ye(P)?(e.exit("codeFencedFence"),s.interrupt?t(P):e.check(gb,j,ue)(P)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(P))}function x(P){return P===null||Ye(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(P)):ot(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),gt(e,v,"whitespace")(P)):P===96&&P===f?r(P):(e.consume(P),x)}function v(P){return P===null||Ye(P)?g(P):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(P))}function S(P){return P===null||Ye(P)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(P)):P===96&&P===f?r(P):(e.consume(P),S)}function j(P){return e.attempt(l,ue,D)(P)}function D(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),M}function M(P){return o>0&&ot(P)?gt(e,R,"linePrefix",o+1)(P):R(P)}function R(P){return P===null||Ye(P)?e.check(gb,j,ue)(P):(e.enter("codeFlowValue"),I(P))}function I(P){return P===null||Ye(P)?(e.exit("codeFlowValue"),R(P)):(e.consume(P),I)}function ue(P){return e.exit("codeFenced"),t(P)}function B(P,ee,G){let H=0;return z;function z(W){return P.enter("lineEnding"),P.consume(W),P.exit("lineEnding"),K}function K(W){return P.enter("codeFencedFence"),ot(W)?gt(P,F,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):F(W)}function F(W){return W===f?(P.enter("codeFencedFenceSequence"),oe(W)):G(W)}function oe(W){return W===f?(H++,P.consume(W),oe):H>=c?(P.exit("codeFencedFenceSequence"),ot(W)?gt(P,te,"whitespace")(W):te(W)):G(W)}function te(W){return W===null||Ye(W)?(P.exit("codeFencedFence"),ee(W)):G(W)}}}function kA(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:CA},EA={partial:!0,tokenize:AA};function CA(e,t,r){const s=this;return l;function l(m){return e.enter("codeIndented"),gt(e,o,"linePrefix",5)(m)}function o(m){const b=s.events[s.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?c(m):r(m)}function c(m){return m===null?d(m):Ye(m)?e.attempt(EA,c,d)(m):(e.enter("codeFlowValue"),f(m))}function f(m){return m===null||Ye(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),f)}function d(m){return e.exit("codeIndented"),t(m)}}function AA(e,t,r){const s=this;return l;function l(c){return s.parser.lazy[s.now().line]?r(c):Ye(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):gt(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):Ye(c)?l(c):r(c)}}const jA={name:"codeText",previous:TA,resolve:NA,tokenize:OA};function NA(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 TA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function OA(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,b(g)):Ye(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||Ye(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),m)}function b(g){return g===96?(e.consume(g),l++,b):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",m(g))}}class RA{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&&El(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),El(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),El(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);El(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);El(this.left,r.reverse())}}}function El(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,o,c,f,d,m;const b=new RA(e);for(;++r<b.length;){for(;r in t;)r=t[r];if(s=b.get(r),r&&s[1].type==="chunkFlow"&&b.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,MA(b,r)),r=t[r],m=!0);else if(s[1]._container){for(o=r,l=void 0;o--;)if(c=b.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(b.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={...b.get(l)[1].start},f=b.slice(l,r),f.unshift(s),b.splice(l,r-l+1,f))}}return nr(e,0,Number.POSITIVE_INFINITY,b.slice(0)),!m}function MA(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 b,g,x=-1,v=r,S=0,j=0;const D=[j];for(;v;){for(;e.get(++l)[1]!==v;);o.push(l),v._tokenizer||(b=s.sliceStream(v),v.next||b.push(null),g&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(b),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 M=f.slice(D[x],D[x+1]),R=o.pop();d.push([R,R+M.length-1]),e.splice(R,2,M)}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 DA={resolve:zA,tokenize:UA},LA={partial:!0,tokenize:PA};function zA(e){return c1(e),e}function UA(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):Ye(f)?e.check(LA,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 PA(e,t,r){const s=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),gt(e,o,"linePrefix")}function o(c){if(c===null||Ye(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,o,c,f,d){const m=d||Number.POSITIVE_INFINITY;let b=0;return g;function g(M){return M===60?(e.enter(s),e.enter(l),e.enter(o),e.consume(M),e.exit(o),x):M===null||M===32||M===41||Hu(M)?r(M):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(M))}function x(M){return M===62?(e.enter(o),e.consume(M),e.exit(o),e.exit(l),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(M))}function v(M){return M===62?(e.exit("chunkString"),e.exit(f),x(M)):M===null||M===60||Ye(M)?r(M):(e.consume(M),M===92?S:v)}function S(M){return M===60||M===62||M===92?(e.consume(M),v):v(M)}function j(M){return!b&&(M===null||M===41||Dt(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(M)):b<m&&M===40?(e.consume(M),b++,j):M===41?(e.consume(M),b--,j):M===null||M===32||M===40||Hu(M)?r(M):(e.consume(M),M===92?D:j)}function D(M){return M===40||M===41||M===92?(e.consume(M),j):j(M)}}function h1(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),b}function b(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):Ye(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),b):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Ye(v)||f++>999?(e.exit("chunkString"),b(v)):(e.consume(v),d||(d=!ot(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,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):Ye(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),gt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),b(x))}function b(x){return x===c||x===null||Ye(x)?(e.exit("chunkString"),m(x)):(e.consume(x),x===92?g:b)}function g(x){return x===c||x===92?(e.consume(x),b):b(x)}}function zl(e,t){let r;return s;function s(l){return Ye(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,s):ot(l)?gt(e,s,r?"linePrefix":"lineSuffix")(l):t(l)}}const BA={name:"definition",tokenize:qA},HA={partial:!0,tokenize:IA};function qA(e,t,r){const s=this;let l;return o;function o(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=Nr(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 Dt(v)?zl(e,m)(v):m(v)}function m(v){return f1(e,b,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function b(v){return e.attempt(HA,g,g)(v)}function g(v){return ot(v)?gt(e,x,"whitespace")(v):x(v)}function x(v){return v===null||Ye(v)?(e.exit("definition"),s.parser.defined.push(l),t(v)):r(v)}}function IA(e,t,r){return s;function s(f){return Dt(f)?zl(e,l)(f):r(f)}function l(f){return d1(e,o,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return ot(f)?gt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Ye(f)?t(f):r(f)}}const FA={name:"hardBreakEscape",tokenize:$A};function $A(e,t,r){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),l}function l(o){return Ye(o)?(e.exit("hardBreakEscape"),t(o)):r(o)}}const VA={name:"headingAtx",resolve:YA,tokenize:GA};function YA(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"},nr(e,s,r-s+1,[["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t]])),e}function GA(e,t,r){let s=0;return l;function l(b){return e.enter("atxHeading"),o(b)}function o(b){return e.enter("atxHeadingSequence"),c(b)}function c(b){return b===35&&s++<6?(e.consume(b),c):b===null||Dt(b)?(e.exit("atxHeadingSequence"),f(b)):r(b)}function f(b){return b===35?(e.enter("atxHeadingSequence"),d(b)):b===null||Ye(b)?(e.exit("atxHeading"),t(b)):ot(b)?gt(e,f,"whitespace")(b):(e.enter("atxHeadingText"),m(b))}function d(b){return b===35?(e.consume(b),d):(e.exit("atxHeadingSequence"),f(b))}function m(b){return b===null||b===35||Dt(b)?(e.exit("atxHeadingText"),f(b)):(e.consume(b),m)}}const JA=["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"],XA={concrete:!0,name:"htmlFlow",resolveTo:ZA,tokenize:WA},KA={partial:!0,tokenize:tj},QA={partial:!0,tokenize:ej};function ZA(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 WA(e,t,r){const s=this;let l,o,c,f,d;return m;function m(N){return b(N)}function b(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),g}function g(N){return N===33?(e.consume(N),x):N===47?(e.consume(N),o=!0,j):N===63?(e.consume(N),l=3,s.interrupt?t:C):Rn(N)?(e.consume(N),c=String.fromCharCode(N),D):r(N)}function x(N){return N===45?(e.consume(N),l=2,v):N===91?(e.consume(N),l=5,f=0,S):Rn(N)?(e.consume(N),l=4,s.interrupt?t:C):r(N)}function v(N){return N===45?(e.consume(N),s.interrupt?t:C):r(N)}function S(N){const ve="CDATA[";return N===ve.charCodeAt(f++)?(e.consume(N),f===ve.length?s.interrupt?t:F:S):r(N)}function j(N){return Rn(N)?(e.consume(N),c=String.fromCharCode(N),D):r(N)}function D(N){if(N===null||N===47||N===62||Dt(N)){const ve=N===47,Ae=c.toLowerCase();return!ve&&!o&&bb.includes(Ae)?(l=1,s.interrupt?t(N):F(N)):JA.includes(c.toLowerCase())?(l=6,ve?(e.consume(N),M):s.interrupt?t(N):F(N)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(N):o?R(N):I(N))}return N===45||_n(N)?(e.consume(N),c+=String.fromCharCode(N),D):r(N)}function M(N){return N===62?(e.consume(N),s.interrupt?t:F):r(N)}function R(N){return ot(N)?(e.consume(N),R):z(N)}function I(N){return N===47?(e.consume(N),z):N===58||N===95||Rn(N)?(e.consume(N),ue):ot(N)?(e.consume(N),I):z(N)}function ue(N){return N===45||N===46||N===58||N===95||_n(N)?(e.consume(N),ue):B(N)}function B(N){return N===61?(e.consume(N),P):ot(N)?(e.consume(N),B):I(N)}function P(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),d=N,ee):ot(N)?(e.consume(N),P):G(N)}function ee(N){return N===d?(e.consume(N),d=null,H):N===null||Ye(N)?r(N):(e.consume(N),ee)}function G(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Dt(N)?B(N):(e.consume(N),G)}function H(N){return N===47||N===62||ot(N)?I(N):r(N)}function z(N){return N===62?(e.consume(N),K):r(N)}function K(N){return N===null||Ye(N)?F(N):ot(N)?(e.consume(N),K):r(N)}function F(N){return N===45&&l===2?(e.consume(N),V):N===60&&l===1?(e.consume(N),J):N===62&&l===4?(e.consume(N),L):N===63&&l===3?(e.consume(N),C):N===93&&l===5?(e.consume(N),ke):Ye(N)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(KA,X,oe)(N)):N===null||Ye(N)?(e.exit("htmlFlowData"),oe(N)):(e.consume(N),F)}function oe(N){return e.check(QA,te,X)(N)}function te(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),W}function W(N){return N===null||Ye(N)?oe(N):(e.enter("htmlFlowData"),F(N))}function V(N){return N===45?(e.consume(N),C):F(N)}function J(N){return N===47?(e.consume(N),c="",ce):F(N)}function ce(N){if(N===62){const ve=c.toLowerCase();return bb.includes(ve)?(e.consume(N),L):F(N)}return Rn(N)&&c.length<8?(e.consume(N),c+=String.fromCharCode(N),ce):F(N)}function ke(N){return N===93?(e.consume(N),C):F(N)}function C(N){return N===62?(e.consume(N),L):N===45&&l===2?(e.consume(N),C):F(N)}function L(N){return N===null||Ye(N)?(e.exit("htmlFlowData"),X(N)):(e.consume(N),L)}function X(N){return e.exit("htmlFlow"),t(N)}}function ej(e,t,r){const s=this;return l;function l(c){return Ye(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 tj(e,t,r){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Ql,t,r)}}const nj={name:"htmlText",tokenize:rj};function rj(e,t,r){const s=this;let l,o,c;return f;function f(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),d}function d(C){return C===33?(e.consume(C),m):C===47?(e.consume(C),B):C===63?(e.consume(C),I):Rn(C)?(e.consume(C),G):r(C)}function m(C){return C===45?(e.consume(C),b):C===91?(e.consume(C),o=0,S):Rn(C)?(e.consume(C),R):r(C)}function b(C){return C===45?(e.consume(C),v):r(C)}function g(C){return C===null?r(C):C===45?(e.consume(C),x):Ye(C)?(c=g,J(C)):(e.consume(C),g)}function x(C){return C===45?(e.consume(C),v):g(C)}function v(C){return C===62?V(C):C===45?x(C):g(C)}function S(C){const L="CDATA[";return C===L.charCodeAt(o++)?(e.consume(C),o===L.length?j:S):r(C)}function j(C){return C===null?r(C):C===93?(e.consume(C),D):Ye(C)?(c=j,J(C)):(e.consume(C),j)}function D(C){return C===93?(e.consume(C),M):j(C)}function M(C){return C===62?V(C):C===93?(e.consume(C),M):j(C)}function R(C){return C===null||C===62?V(C):Ye(C)?(c=R,J(C)):(e.consume(C),R)}function I(C){return C===null?r(C):C===63?(e.consume(C),ue):Ye(C)?(c=I,J(C)):(e.consume(C),I)}function ue(C){return C===62?V(C):I(C)}function B(C){return Rn(C)?(e.consume(C),P):r(C)}function P(C){return C===45||_n(C)?(e.consume(C),P):ee(C)}function ee(C){return Ye(C)?(c=ee,J(C)):ot(C)?(e.consume(C),ee):V(C)}function G(C){return C===45||_n(C)?(e.consume(C),G):C===47||C===62||Dt(C)?H(C):r(C)}function H(C){return C===47?(e.consume(C),V):C===58||C===95||Rn(C)?(e.consume(C),z):Ye(C)?(c=H,J(C)):ot(C)?(e.consume(C),H):V(C)}function z(C){return C===45||C===46||C===58||C===95||_n(C)?(e.consume(C),z):K(C)}function K(C){return C===61?(e.consume(C),F):Ye(C)?(c=K,J(C)):ot(C)?(e.consume(C),K):H(C)}function F(C){return C===null||C===60||C===61||C===62||C===96?r(C):C===34||C===39?(e.consume(C),l=C,oe):Ye(C)?(c=F,J(C)):ot(C)?(e.consume(C),F):(e.consume(C),te)}function oe(C){return C===l?(e.consume(C),l=void 0,W):C===null?r(C):Ye(C)?(c=oe,J(C)):(e.consume(C),oe)}function te(C){return C===null||C===34||C===39||C===60||C===61||C===96?r(C):C===47||C===62||Dt(C)?H(C):(e.consume(C),te)}function W(C){return C===47||C===62||Dt(C)?H(C):r(C)}function V(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):r(C)}function J(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),ce}function ce(C){return ot(C)?gt(e,ke,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ke(C)}function ke(C){return e.enter("htmlTextData"),c(C)}}const nm={name:"labelEnd",resolveAll:lj,resolveTo:oj,tokenize:uj},ij={tokenize:cj},sj={tokenize:fj},aj={tokenize:hj};function lj(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&&nr(e,0,e.length,r),e}function oj(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}},b={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",d,t],["enter",m,t]],f=br(f,e.slice(o+1,o+s+3)),f=br(f,[["enter",b,t]]),f=br(f,ec(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=br(f,[["exit",b,t],e[c-2],e[c-1],["exit",m,t]]),f=br(f,e.slice(c+1)),f=br(f,[["exit",d,t]]),nr(e,o,e.length,f),e}function uj(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(Nr(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(ij,b,c?b:g)(x):x===91?e.attempt(sj,b,c?m:g)(x):c?b(x):g(x)}function m(x){return e.attempt(aj,b,g)(x)}function b(x){return t(x)}function g(x){return o._balanced=!0,r(x)}}function cj(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 Dt(g)?zl(e,o)(g):o(g)}function o(g){return g===41?b(g):f1(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Dt(g)?zl(e,d)(g):b(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):b(g)}function m(g){return Dt(g)?zl(e,b)(g):b(g)}function b(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):r(g)}}function fj(e,t,r){const s=this;return l;function l(f){return h1.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(Nr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):r(f)}function c(f){return r(f)}}function hj(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 dj={name:"labelStartImage",resolveAll:nm.resolveAll,tokenize:mj};function mj(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 pj={name:"labelStartLink",resolveAll:nm.resolveAll,tokenize:gj};function gj(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:yj};function yj(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),gt(e,t,"linePrefix")}}const Au={name:"thematicBreak",tokenize:bj};function bj(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||Ye(m))?(e.exit("thematicBreak"),t(m)):r(m)}function d(m){return m===l?(e.consume(m),s++,d):(e.exit("thematicBreakSequence"),ot(m)?gt(e,f,"whitespace")(m):f(m))}}const qn={continuation:{tokenize:Sj},exit:kj,name:"list",tokenize:wj},xj={partial:!0,tokenize:Ej},vj={partial:!0,tokenize:_j};function wj(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(Ql,s.interrupt?r:b,e.attempt(xj,x,g))}function b(v){return s.containerState.initialBlankLine=!0,o++,x(v)}function g(v){return ot(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 Sj(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Ql,l,o);function l(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,gt(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!ot(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(vj,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,gt(e,e.attempt(qn,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function _j(e,t,r){const s=this;return gt(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 kj(e){e.exit(this.containerState.type)}function Ej(e,t,r){const s=this;return gt(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!ot(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):r(o)}}const xb={name:"setextUnderline",resolveTo:Cj,tokenize:Aj};function Cj(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 Aj(e,t,r){const s=this;let l;return o;function o(m){let b=s.events.length,g;for(;b--;)if(s.events[b][1].type!=="lineEnding"&&s.events[b][1].type!=="linePrefix"&&s.events[b][1].type!=="content"){g=s.events[b][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"),ot(m)?gt(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||Ye(m)?(e.exit("setextHeadingLine"),t(m)):r(m)}}const jj={tokenize:Nj};function Nj(e){const t=this,r=e.attempt(Ql,s,e.attempt(this.parser.constructs.flowInitial,l,gt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(DA,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 Tj={resolveAll:p1()},Oj=m1("string"),Rj=m1("text");function m1(e){return{resolveAll:p1(e==="text"?Mj: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(b){return m(b)?o(b):f(b)}function f(b){if(b===null){r.consume(b);return}return r.enter("data"),r.consume(b),d}function d(b){return m(b)?(r.exit("data"),o(b)):(r.consume(b),d)}function m(b){if(b===null)return!0;const g=l[b];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,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 Mj(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 Dj={42:qn,43:qn,45:qn,48:qn,49:qn,50:qn,51:qn,52:qn,53:qn,54:qn,55:qn,56:qn,57:qn,62:l1},Lj={91:BA},zj={[-2]:Ph,[-1]:Ph,32:Ph},Uj={35:VA,42:Au,45:[xb,Au],60:XA,61:xb,95:Au,96:yb,126:yb},Pj={38:u1,92:o1},Bj={[-5]:Bh,[-4]:Bh,[-3]:Bh,33:dj,38:u1,42:_d,60:[pA,nj],91:pj,92:[FA,o1],93:nm,95:_d,96:jA},Hj={null:[_d,Tj]},qj={null:[42,95]},Ij={null:[]},Fj=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qj,contentInitial:Lj,disable:Ij,document:Dj,flow:Uj,flowInitial:zj,insideSpan:Hj,string:Pj,text:Bj},Symbol.toStringTag,{value:"Module"}));function $j(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:ee(B),check:ee(P),consume:R,enter:I,exit:ue,interrupt:ee(P,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:S,parser:e,previous:null,sliceSerialize:x,sliceStream:v,write:g};let b=t.tokenize.call(m,d);return t.resolveAll&&o.push(t),m;function g(K){return c=br(c,K),D(),c[c.length-1]!==null?[]:(G(t,0),m.events=ec(o,m.events,m),m.events)}function x(K,F){return Yj(v(K),F)}function v(K){return Vj(c,K)}function S(){const{_bufferIndex:K,_index:F,line:oe,column:te,offset:W}=s;return{_bufferIndex:K,_index:F,line:oe,column:te,offset:W}}function j(K){l[K.line]=K.column,z()}function D(){let K;for(;s._index<c.length;){const F=c[s._index];if(typeof F=="string")for(K=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===K&&s._bufferIndex<F.length;)M(F.charCodeAt(s._bufferIndex));else M(F)}}function M(K){b=b(K)}function R(K){Ye(K)?(s.line++,s.column=1,s.offset+=K===-3?2:1,z()):K!==-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=K}function I(K,F){const oe=F||{};return oe.type=K,oe.start=S(),m.events.push(["enter",oe,m]),f.push(oe),oe}function ue(K){const F=f.pop();return F.end=S(),m.events.push(["exit",F,m]),F}function B(K,F){G(K,F.from)}function P(K,F){F.restore()}function ee(K,F){return oe;function oe(te,W,V){let J,ce,ke,C;return Array.isArray(te)?X(te):"tokenize"in te?X([te]):L(te);function L(Ee){return le;function le(Re){const _e=Re!==null&&Ee[Re],Fe=Re!==null&&Ee.null,Ht=[...Array.isArray(_e)?_e:_e?[_e]:[],...Array.isArray(Fe)?Fe:Fe?[Fe]:[]];return X(Ht)(Re)}}function X(Ee){return J=Ee,ce=0,Ee.length===0?V:N(Ee[ce])}function N(Ee){return le;function le(Re){return C=H(),ke=Ee,Ee.partial||(m.currentConstruct=Ee),Ee.name&&m.parser.constructs.disable.null.includes(Ee.name)?Ae():Ee.tokenize.call(F?Object.assign(Object.create(m),F):m,d,ve,Ae)(Re)}}function ve(Ee){return K(ke,C),W}function Ae(Ee){return C.restore(),++ce<J.length?N(J[ce]):V}}}function G(K,F){K.resolveAll&&!o.includes(K)&&o.push(K),K.resolve&&nr(m.events,F,m.events.length-F,K.resolve(m.events.slice(F),m)),K.resolveTo&&(m.events=K.resolveTo(m.events,m))}function H(){const K=S(),F=m.previous,oe=m.currentConstruct,te=m.events.length,W=Array.from(f);return{from:te,restore:V};function V(){s=K,m.previous=F,m.currentConstruct=oe,m.events.length=te,f=W,z()}}function z(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function Vj(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 Yj(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
91
|
`;break}case-3:{c=`\r
|
|
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 Jj(e){const s={constructs:s1([$j,...(e||{}).extensions||[]]),content:l(uA),defined:[],document:l(fA),flow:l(Nj),lazy:{},string:l(Rj),text:l(Mj)};return s;function l(o){return c;function c(f){return Vj(s,o,f)}}}function Xj(e){for(;!c1(e););return e}const wb=/[\0\t\n\r]/g;function Kj(){let e=1,t="",r=!0,s;return l;function l(o,c,f){const d=[];let m,b,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(wb.lastIndex=g,m=wb.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(b=Math.ceil(e/4)*4,d.push(-2);e++<b;)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 Qj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Zj(e){return e.replace(Qj,Wj)}function Wj(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),o=l===120||l===88;return a1(r.slice(o?2:1),o?16:10)}return nm(r)||e}const g1={}.hasOwnProperty;function eN(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),tN(r)(Xj(Jj(r).document().write(Kj()(e,t,!0))))}function tN(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(tt),autolinkProtocol:B,autolinkEmail:B,atxHeading:o(Pt),blockQuote:o(Fe),characterEscape:B,characterReference:B,codeFenced:o(_t),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(_t,c),codeText:o(an,c),codeTextData:B,data:B,codeFlowValue:B,definition:o(tn),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Ft),hardBreakEscape:o(Kt),hardBreakTrailing:o(Kt),htmlFlow:o(Nn,c),htmlFlowData:B,htmlText:o(Nn,c),htmlTextData:B,image:o(qe),label:c,link:o(tt),listItem:o(Mt),listItemValue:x,listOrdered:o(st,g),listUnordered:o(st),paragraph:o(kt),reference:j,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(Pt),strong:o(pn),thematicBreak:o(or)},exit:{atxHeading:d(),atxHeadingSequence:H,autolink:d(),autolinkEmail:_e,autolinkProtocol:Re,blockQuote:d(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:Te,characterReferenceMarkerNumeric:Te,characterReferenceValue:Ce,characterReference:oe,codeFenced:d(D),codeFencedFence:N,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:z,codeIndented:d(M),codeText:d(W),codeTextData:z,data:z,definition:d(),definitionDestinationString:ue,definitionLabelString:P,definitionTitleString:I,emphasis:d(),hardBreakEscape:d(F),hardBreakTrailing:d(F),htmlFlow:d(le),htmlFlowData:z,htmlText:d(ne),htmlTextData:z,image:d(K),label:Ee,labelText:ce,lineEnding:X,link:d(V),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:be,resourceDestinationString:E,resourceTitleString:L,resource:J,setextHeading:d(G),setextHeadingLineSequence:ee,setextHeadingText:O,strong:d(),thematicBreak:d()}};y1(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(fe){let we={type:"root",children:[]};const Be={stack:[we],tokenStack:[],config:t,enter:f,exit:m,buffer:c,resume:b,data:r},Ke=[];let Ie=-1;for(;++Ie<fe.length;)if(fe[Ie][1].type==="listOrdered"||fe[Ie][1].type==="listUnordered")if(fe[Ie][0]==="enter")Ke.push(Ie);else{const zt=Ke.pop();Ie=l(fe,zt,Ie)}for(Ie=-1;++Ie<fe.length;){const zt=t[fe[Ie][0]];g1.call(zt,fe[Ie][1].type)&&zt[fe[Ie][1].type].call(Object.assign({sliceSerialize:fe[Ie][2].sliceSerialize},Be),fe[Ie][1])}if(Be.tokenStack.length>0){const zt=Be.tokenStack[Be.tokenStack.length-1];(zt[1]||Sb).call(Be,void 0,zt[0])}for(we.position={start:Yi(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Yi(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},Ie=-1;++Ie<t.transforms.length;)we=t.transforms[Ie](we)||we;return we}function l(fe,we,Be){let Ke=we-1,Ie=-1,zt=!1,Xt,Qt,mt,Bt;for(;++Ke<=Be;){const ht=fe[Ke];switch(ht[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ht[0]==="enter"?Ie++:Ie--,Bt=void 0;break}case"lineEndingBlank":{ht[0]==="enter"&&(Xt&&!Bt&&!Ie&&!mt&&(mt=Ke),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!Ie&&ht[0]==="enter"&&ht[1].type==="listItemPrefix"||Ie===-1&&ht[0]==="exit"&&(ht[1].type==="listUnordered"||ht[1].type==="listOrdered")){if(Xt){let gn=Ke;for(Qt=void 0;gn--;){const ln=fe[gn];if(ln[1].type==="lineEnding"||ln[1].type==="lineEndingBlank"){if(ln[0]==="exit")continue;Qt&&(fe[Qt][1].type="lineEndingBlank",zt=!0),ln[1].type="lineEnding",Qt=gn}else if(!(ln[1].type==="linePrefix"||ln[1].type==="blockQuotePrefix"||ln[1].type==="blockQuotePrefixWhitespace"||ln[1].type==="blockQuoteMarker"||ln[1].type==="listItemIndent"))break}mt&&(!Qt||mt<Qt)&&(Xt._spread=!0),Xt.end=Object.assign({},Qt?fe[Qt][1].start:ht[1].end),fe.splice(Qt||Ke,0,["exit",Xt,ht[2]]),Ke++,Be++}if(ht[1].type==="listItemPrefix"){const gn={type:"listItem",_spread:!1,start:Object.assign({},ht[1].start),end:void 0};Xt=gn,fe.splice(Ke,0,["enter",gn,ht[2]]),Ke++,Be++,mt=void 0,Bt=!0}}}return fe[we][1]._spread=zt,Be}function o(fe,we){return Be;function Be(Ke){f.call(this,fe(Ke),Ke),we&&we.call(this,Ke)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(fe,we,Be){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([we,Be||void 0]),fe.position={start:Yi(we.start),end:void 0}}function d(fe){return we;function we(Be){fe&&fe.call(this,Be),m.call(this,Be)}}function m(fe,we){const Be=this.stack.pop(),Ke=this.tokenStack.pop();if(Ke)Ke[0].type!==fe.type&&(we?we.call(this,fe,Ke[0]):(Ke[1]||Sb).call(this,fe,Ke[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Ll({start:fe.start,end:fe.end})+"): it’s not open");Be.position.end=Yi(fe.end)}function b(){return tm(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(fe){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function v(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.lang=fe}function S(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.meta=fe}function N(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function D(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe.replace(/(\r?\n|\r)$/g,"")}function P(fe){const we=this.resume(),Be=this.stack[this.stack.length-1];Be.label=we,Be.identifier=Mr(this.sliceSerialize(fe)).toLowerCase()}function I(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.title=fe}function ue(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.url=fe}function H(fe){const we=this.stack[this.stack.length-1];if(!we.depth){const Be=this.sliceSerialize(fe).length;we.depth=Be}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function ee(fe){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function B(fe){const Be=this.stack[this.stack.length-1].children;let Ke=Be[Be.length-1];(!Ke||Ke.type!=="text")&&(Ke=at(),Ke.position={start:Yi(fe.start),end:void 0},Be.push(Ke)),this.stack.push(Ke)}function z(fe){const we=this.stack.pop();we.value+=this.sliceSerialize(fe),we.position.end=Yi(fe.end)}function X(fe){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Be=we.children[we.children.length-1];Be.position.end=Yi(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(we.type)&&(B.call(this,fe),z.call(this,fe))}function F(){this.data.atHardBreak=!0}function le(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function ne(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function W(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function V(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=we,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function K(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=we,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function ce(fe){const we=this.sliceSerialize(fe),Be=this.stack[this.stack.length-2];Be.label=Zj(we),Be.identifier=Mr(we).toLowerCase()}function Ee(){const fe=this.stack[this.stack.length-1],we=this.resume(),Be=this.stack[this.stack.length-1];if(this.data.inReference=!0,Be.type==="link"){const Ke=fe.children;Be.children=Ke}else Be.alt=we}function E(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.url=fe}function L(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.title=fe}function J(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function be(fe){const we=this.resume(),Be=this.stack[this.stack.length-1];Be.label=we,Be.identifier=Mr(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function Te(fe){this.data.characterReferenceType=fe.type}function Ce(fe){const we=this.sliceSerialize(fe),Be=this.data.characterReferenceType;let Ke;Be?(Ke=a1(we,Be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ke=nm(we);const Ie=this.stack[this.stack.length-1];Ie.value+=Ke}function oe(fe){const we=this.stack.pop();we.position.end=Yi(fe.end)}function Re(fe){z.call(this,fe);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(fe)}function _e(fe){z.call(this,fe);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(fe)}function Fe(){return{type:"blockquote",children:[]}}function _t(){return{type:"code",lang:null,meta:null,value:""}}function an(){return{type:"inlineCode",value:""}}function tn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ft(){return{type:"emphasis",children:[]}}function Pt(){return{type:"heading",depth:0,children:[]}}function Kt(){return{type:"break"}}function Nn(){return{type:"html",value:""}}function qe(){return{type:"image",title:null,url:"",alt:null}}function tt(){return{type:"link",title:null,url:"",children:[]}}function st(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function Mt(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function kt(){return{type:"paragraph",children:[]}}function pn(){return{type:"strong",children:[]}}function at(){return{type:"text",value:""}}function or(){return{type:"thematicBreak"}}}function Yi(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):nN(e,s)}}function nN(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 Sb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ll({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ll({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ll({start:t.start,end:t.end})+") is still open")}function rN(e){const t=this;t.parser=r;function r(s){return eN(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function iN(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 sN(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
97
|
-
`}]}function
|
|
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
|
|
92
|
+
`;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 Gj(e){const s={constructs:s1([Fj,...(e||{}).extensions||[]]),content:l(oA),defined:[],document:l(cA),flow:l(jj),lazy:{},string:l(Oj),text:l(Rj)};return s;function l(o){return c;function c(f){return $j(s,o,f)}}}function Jj(e){for(;!c1(e););return e}const vb=/[\0\t\n\r]/g;function Xj(){let e=1,t="",r=!0,s;return l;function l(o,c,f){const d=[];let m,b,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(b=Math.ceil(e/4)*4,d.push(-2);e++<b;)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 Kj=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qj(e){return e.replace(Kj,Zj)}function Zj(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),o=l===120||l===88;return a1(r.slice(o?2:1),o?16:10)}return tm(r)||e}const g1={}.hasOwnProperty;function Wj(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),eN(r)(Jj(Gj(r).document().write(Xj()(e,t,!0))))}function eN(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ht),autolinkProtocol:H,autolinkEmail:H,atxHeading:o(tn),blockQuote:o(Fe),characterEscape:H,characterReference:H,codeFenced:o(Ht),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Ht,c),codeText:o(Rt,c),codeTextData:H,data:H,codeFlowValue:H,definition:o(Qt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(zt),hardBreakEscape:o(Yt),hardBreakTrailing:o(Yt),htmlFlow:o(nn,c),htmlFlowData:H,htmlText:o(nn,c),htmlTextData:H,image:o(Ke),label:c,link:o(ht),listItem:o(xt),listItemValue:x,listOrdered:o(dt,g),listUnordered:o(dt),paragraph:o(Gt),reference:N,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(tn),strong:o(En),thematicBreak:o(sr)},exit:{atxHeading:d(),atxHeadingSequence:B,autolink:d(),autolinkEmail:_e,autolinkProtocol:Re,blockQuote:d(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:Ae,characterReferenceMarkerNumeric:Ae,characterReferenceValue:Ee,characterReference:le,codeFenced:d(D),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:S,codeFlowValue:z,codeIndented:d(M),codeText:d(W),codeTextData:z,data:z,definition:d(),definitionDestinationString:ue,definitionLabelString:R,definitionTitleString:I,emphasis:d(),hardBreakEscape:d(F),hardBreakTrailing:d(F),htmlFlow:d(oe),htmlFlowData:z,htmlText:d(te),htmlTextData:z,image:d(J),label:ke,labelText:ce,lineEnding:K,link:d(V),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ve,resourceDestinationString:C,resourceTitleString:L,resource:X,setextHeading:d(G),setextHeadingLineSequence:ee,setextHeadingText:P,strong:d(),thematicBreak:d()}};y1(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(fe){let we={type:"root",children:[]};const He={stack:[we],tokenStack:[],config:t,enter:f,exit:m,buffer:c,resume:b,data:r},Qe=[];let qe=-1;for(;++qe<fe.length;)if(fe[qe][1].type==="listOrdered"||fe[qe][1].type==="listUnordered")if(fe[qe][0]==="enter")Qe.push(qe);else{const xe=Qe.pop();qe=l(fe,xe,qe)}for(qe=-1;++qe<fe.length;){const xe=t[fe[qe][0]];g1.call(xe,fe[qe][1].type)&&xe[fe[qe][1].type].call(Object.assign({sliceSerialize:fe[qe][2].sliceSerialize},He),fe[qe][1])}if(He.tokenStack.length>0){const xe=He.tokenStack[He.tokenStack.length-1];(xe[1]||wb).call(He,void 0,xe[0])}for(we.position={start:Yi(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:Yi(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<t.transforms.length;)we=t.transforms[qe](we)||we;return we}function l(fe,we,He){let Qe=we-1,qe=-1,xe=!1,Ie,je,Ge,yt;for(;++Qe<=He;){const ut=fe[Qe];switch(ut[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ut[0]==="enter"?qe++:qe--,yt=void 0;break}case"lineEndingBlank":{ut[0]==="enter"&&(Ie&&!yt&&!qe&&!Ge&&(Ge=Qe),yt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:yt=void 0}if(!qe&&ut[0]==="enter"&&ut[1].type==="listItemPrefix"||qe===-1&&ut[0]==="exit"&&(ut[1].type==="listUnordered"||ut[1].type==="listOrdered")){if(Ie){let xn=Qe;for(je=void 0;xn--;){const cn=fe[xn];if(cn[1].type==="lineEnding"||cn[1].type==="lineEndingBlank"){if(cn[0]==="exit")continue;je&&(fe[je][1].type="lineEndingBlank",xe=!0),cn[1].type="lineEnding",je=xn}else if(!(cn[1].type==="linePrefix"||cn[1].type==="blockQuotePrefix"||cn[1].type==="blockQuotePrefixWhitespace"||cn[1].type==="blockQuoteMarker"||cn[1].type==="listItemIndent"))break}Ge&&(!je||Ge<je)&&(Ie._spread=!0),Ie.end=Object.assign({},je?fe[je][1].start:ut[1].end),fe.splice(je||Qe,0,["exit",Ie,ut[2]]),Qe++,He++}if(ut[1].type==="listItemPrefix"){const xn={type:"listItem",_spread:!1,start:Object.assign({},ut[1].start),end:void 0};Ie=xn,fe.splice(Qe,0,["enter",xn,ut[2]]),Qe++,He++,Ge=void 0,yt=!0}}}return fe[we][1]._spread=xe,He}function o(fe,we){return He;function He(Qe){f.call(this,fe(Qe),Qe),we&&we.call(this,Qe)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(fe,we,He){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([we,He||void 0]),fe.position={start:Yi(we.start),end:void 0}}function d(fe){return we;function we(He){fe&&fe.call(this,He),m.call(this,He)}}function m(fe,we){const He=this.stack.pop(),Qe=this.tokenStack.pop();if(Qe)Qe[0].type!==fe.type&&(we?we.call(this,fe,Qe[0]):(Qe[1]||wb).call(this,fe,Qe[0]));else throw new Error("Cannot close `"+fe.type+"` ("+Ll({start:fe.start,end:fe.end})+"): it’s not open");He.position.end=Yi(fe.end)}function b(){return em(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(fe){if(this.data.expectingFirstListItemValue){const we=this.stack[this.stack.length-2];we.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function v(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.lang=fe}function S(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.meta=fe}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function D(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe.replace(/(\r?\n|\r)$/g,"")}function R(fe){const we=this.resume(),He=this.stack[this.stack.length-1];He.label=we,He.identifier=Nr(this.sliceSerialize(fe)).toLowerCase()}function I(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.title=fe}function ue(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.url=fe}function B(fe){const we=this.stack[this.stack.length-1];if(!we.depth){const He=this.sliceSerialize(fe).length;we.depth=He}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function ee(fe){const we=this.stack[this.stack.length-1];we.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function H(fe){const He=this.stack[this.stack.length-1].children;let Qe=He[He.length-1];(!Qe||Qe.type!=="text")&&(Qe=st(),Qe.position={start:Yi(fe.start),end:void 0},He.push(Qe)),this.stack.push(Qe)}function z(fe){const we=this.stack.pop();we.value+=this.sliceSerialize(fe),we.position.end=Yi(fe.end)}function K(fe){const we=this.stack[this.stack.length-1];if(this.data.atHardBreak){const He=we.children[we.children.length-1];He.position.end=Yi(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(we.type)&&(H.call(this,fe),z.call(this,fe))}function F(){this.data.atHardBreak=!0}function oe(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function te(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function W(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.value=fe}function V(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=we,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function J(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const we=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=we,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function ce(fe){const we=this.sliceSerialize(fe),He=this.stack[this.stack.length-2];He.label=Qj(we),He.identifier=Nr(we).toLowerCase()}function ke(){const fe=this.stack[this.stack.length-1],we=this.resume(),He=this.stack[this.stack.length-1];if(this.data.inReference=!0,He.type==="link"){const Qe=fe.children;He.children=Qe}else He.alt=we}function C(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.url=fe}function L(){const fe=this.resume(),we=this.stack[this.stack.length-1];we.title=fe}function X(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function ve(fe){const we=this.resume(),He=this.stack[this.stack.length-1];He.label=we,He.identifier=Nr(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function Ae(fe){this.data.characterReferenceType=fe.type}function Ee(fe){const we=this.sliceSerialize(fe),He=this.data.characterReferenceType;let Qe;He?(Qe=a1(we,He==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Qe=tm(we);const qe=this.stack[this.stack.length-1];qe.value+=Qe}function le(fe){const we=this.stack.pop();we.position.end=Yi(fe.end)}function Re(fe){z.call(this,fe);const we=this.stack[this.stack.length-1];we.url=this.sliceSerialize(fe)}function _e(fe){z.call(this,fe);const we=this.stack[this.stack.length-1];we.url="mailto:"+this.sliceSerialize(fe)}function Fe(){return{type:"blockquote",children:[]}}function Ht(){return{type:"code",lang:null,meta:null,value:""}}function Rt(){return{type:"inlineCode",value:""}}function Qt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function zt(){return{type:"emphasis",children:[]}}function tn(){return{type:"heading",depth:0,children:[]}}function Yt(){return{type:"break"}}function nn(){return{type:"html",value:""}}function Ke(){return{type:"image",title:null,url:"",alt:null}}function ht(){return{type:"link",title:null,url:"",children:[]}}function dt(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function xt(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function Gt(){return{type:"paragraph",children:[]}}function En(){return{type:"strong",children:[]}}function st(){return{type:"text",value:""}}function sr(){return{type:"thematicBreak"}}}function Yi(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):tN(e,s)}}function tN(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 wb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ll({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ll({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ll({start:t.start,end:t.end})+") is still open")}function nN(e){const t=this;t.parser=r;function r(s){return Wj(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rN(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 iN(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
93
|
+
`}]}function sN(e,t){const r=t.value?t.value+`
|
|
94
|
+
`:"",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 aN(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function lN(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function oN(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),l=Ta(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 uN(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 cN(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),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 fN(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return b1(e,t);const l={src:Ta(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 hN(e,t){const r={src:Ta(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 dN(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 mN(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return b1(e,t);const l={href:Ta(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 pN(e,t){const r={href:Ta(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 gN(e,t,r){const s=e.all(t),l=r?yN(r):x1(t),o={},c=[];if(typeof t.checked=="boolean"){const b=s[0];let g;b&&b.type==="element"&&b.tagName==="p"?g=b:(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 b=s[f];(l||f!==0||b.type!=="element"||b.tagName!=="p")&&c.push({type:"text",value:`
|
|
99
95
|
`}),b.type==="element"&&b.tagName==="p"&&!l?c.push(...b.children):c.push(b)}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:o,children:c};return e.patch(t,m),e.applyData(t,m)}function
|
|
96
|
+
`});const m={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,m),e.applyData(t,m)}function yN(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 bN(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 xN(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function vN(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function wN(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function SN(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 o={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,o),e.applyData(t,o)}function _N(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 b={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,b),e.applyData(t,b)}function kN(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 EN(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 CN(e,t){const r={type:"text",value:EN(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function AN(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const jN={blockquote:rN,break:iN,code:sN,delete:aN,emphasis:lN,footnoteReference:oN,heading:uN,html:cN,imageReference:fN,image:hN,inlineCode:dN,linkReference:mN,link:pN,listItem:gN,list:bN,paragraph:xN,root:vN,strong:wN,table:SN,tableCell:kN,tableRow:_N,text:CN,thematicBreak:AN,toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const v1=-1,tc=0,Ul=1,qu=2,rm=3,im=4,sm=5,am=6,w1=7,S1=8,Eb=typeof self=="object"?self:globalThis,NN=(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 v1:return r(c,l);case Ul:{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 Eb[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 Eb[o](c),l)};return s},Cb=e=>NN(new Map,e)(0),oa="",{toString:TN}={},{keys:ON}=Object,Cl=e=>{const t=typeof e;if(t!=="object"||!e)return[tc,t];const r=TN.call(e).slice(8,-1);switch(r){case"Array":return[Ul,oa];case"Object":return[qu,oa];case"Date":return[rm,oa];case"RegExp":return[im,oa];case"Map":return[sm,oa];case"Set":return[am,oa];case"DataView":return[Ul,r]}return r.includes("Array")?[Ul,r]:r.includes("Error")?[w1,r]:[qu,r]},yu=([e,t])=>e===tc&&(t==="function"||t==="symbol"),RN=(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]=Cl(c);switch(f){case tc:{let b=c;switch(d){case"bigint":f=S1,b=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);b=null;break;case"undefined":return l([v1],c)}return l([f,b],c)}case Ul:{if(d){let x=c;return d==="DataView"?x=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(c)),l([d,[...x]],c)}const b=[],g=l([f,b],c);for(const x of c)b.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 b=[],g=l([f,b],c);for(const x of ON(c))(e||!yu(Cl(c[x])))&&b.push([o(x),o(c[x])]);return g}case rm:return l([f,c.toISOString()],c);case im:{const{source:b,flags:g}=c;return l([f,{source:b,flags:g}],c)}case sm:{const b=[],g=l([f,b],c);for(const[x,v]of c)(e||!(yu(Cl(x))||yu(Cl(v))))&&b.push([o(x),o(v)]);return g}case am:{const b=[],g=l([f,b],c);for(const x of c)(e||!yu(Cl(x)))&&b.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 RN(!(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 MN(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 DN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function LN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||MN,s=e.options.footnoteBackLabel||DN,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 b=e.all(m),g=String(m.identifier).toUpperCase(),x=Ta(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 R=typeof r=="string"?r:r(d,v);typeof R=="string"&&(R={type:"text",value:R}),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(R)?R:[R]})}const D=b[b.length-1];if(D&&D.type==="element"&&D.tagName==="p"){const R=D.children[D.children.length-1];R&&R.type==="text"?R.value+=" ":D.children.push({type:"text",value:" "}),D.children.push(...S)}else b.push(...S);const M={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(b,!0)};e.patch(m,M),f.push(M)}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
97
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
102
|
-
`}]}}const nc=(function(e){if(e==null)return
|
|
98
|
+
`}]}}const nc=(function(e){if(e==null)return BN;if(typeof e=="function")return rc(e);if(typeof e=="object")return Array.isArray(e)?zN(e):UN(e);if(typeof e=="string")return PN(e);throw new Error("Expected function, string, or object as test")});function zN(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 UN(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 PN(e){return rc(t);function t(r){return r&&r.type===e}}function rc(e){return t;function t(r,s,l){return!!(HN(r)&&e.call(this,r,typeof s=="number"?s:void 0,l||void 0))}}function BN(){return!0}function HN(e){return e!==null&&typeof e=="object"&&"type"in e}const _1=[],qN=!0,kd=!1,IN="skip";function k1(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,b){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||o(d,m,b[b.length-1]||void 0))&&(v=FN(r(d,b)),v[0]===kd))return v;if("children"in d&&d.children){const M=d;if(M.children&&v[0]!==IN)for(j=(s?M.children.length:-1)+c,D=b.concat(M);j>-1&&j<M.children.length;){const R=M.children[j];if(S=f(R,j,D)(),S[0]===kd)return S;j=typeof S[1]=="number"?S[1]:j+c}}return v}}}function FN(e){return Array.isArray(e)?e:typeof e=="number"?[qN,e]:e==null?_1:[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),k1(e,o,f,l);function f(d,m){const b=m[m.length-1],g=b?b.children.indexOf(d):void 0;return c(d,g,b)}}const Ed={}.hasOwnProperty,$N={};function VN(e,t){const r=t||$N,s=new Map,l=new Map,o=new Map,c={...jN,...r.handlers},f={all:m,applyData:GN,definitionById:s,footnoteById:l,footnoteCounts:o,footnoteOrder:[],handlers:c,one:d,options:r,patch:YN,wrap:XN};return lm(e,function(b){if(b.type==="definition"||b.type==="footnoteDefinition"){const g=b.type==="definition"?s:l,x=String(b.identifier).toUpperCase();g.has(x)||g.set(x,b)}}),f;function d(b,g){const x=b.type,v=f.handlers[x];if(Ed.call(f.handlers,x)&&v)return v(f,b,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in b){const{children:j,...D}=b,M=Iu(D);return M.children=f.all(b),M}return Iu(b)}return(f.options.unknownHandler||JN)(f,b,g)}function m(b){const g=[];if("children"in b){const x=b.children;let v=-1;for(;++v<x.length;){const S=f.one(x[v],b);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 j=S.children[0];j&&j.type==="text"&&(j.value=jb(j.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function YN(e,t){e.position&&(t.position=DC(e))}function GN(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 JN(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 XN(e,t){const r=[];let s=-1;for(t&&r.push({type:"text",value:`
|
|
103
99
|
`});++s<e.length;)s&&r.push({type:"text",value:`
|
|
104
100
|
`}),r.push(e[s]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
105
|
-
`}),r}function
|
|
106
|
-
`},l),o}function QN(e,t){return e&&"run"in e?async function(r,s){const l=Tb(r,{file:s,...t});await e.run(l,s)}:function(r,s){return Tb(r,{file:s,...e||t})}}function Ob(e){if(e)throw e}var Hh,Rb;function ZN(){if(Rb)return Hh;Rb=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 b=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!b&&!g)return!1;var x;for(x in m);return typeof x>"u"||e.call(m,x)},c=function(m,b){r&&b.name==="__proto__"?r(m,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):m[b.name]=b.newValue},f=function(m,b){if(b==="__proto__")if(e.call(m,b)){if(s)return s(m,b).value}else return;return m[b]};return Hh=function d(){var m,b,g,x,v,S,N=arguments[0],D=1,M=arguments.length,P=!1;for(typeof N=="boolean"&&(P=N,N=arguments[1]||{},D=2),(N==null||typeof N!="object"&&typeof N!="function")&&(N={});D<M;++D)if(m=arguments[D],m!=null)for(b in m)g=f(N,b),x=f(m,b),N!==x&&(P&&x&&(o(x)||(v=l(x)))?(v?(v=!1,S=g&&l(g)?g:[]):S=g&&o(g)?g:{},c(N,{name:b,newValue:d(P,S,x)})):typeof x<"u"&&c(N,{name:b,newValue:x}));return N},Hh}var WN=ZN();const qh=Yb(WN);function Ad(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 eT(){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 b=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,b?tT(b,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 tT(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 b=m;if(f&&r)throw b;return l(b)}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 Ir={basename:nT,dirname:rT,extname:iT,join:sT,sep:"/"};function nT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Zl(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 rT(e){if(Zl(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 iT(e){Zl(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 sT(...e){let t=-1,r;for(;++t<e.length;)Zl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":aT(r)}function aT(e){Zl(e);const t=e.codePointAt(0)===47;let r=lT(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function lT(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 Zl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const oT={cwd:uT};function uT(){return"/"}function jd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function cT(e){if(typeof e=="string")e=new URL(e);else if(!jd(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 fT(e)}function fT(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?jd(t)?r={path:t}:typeof t=="string"||hT(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":oT.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"?Ir.basename(this.path):void 0}set basename(t){$h(t,"basename"),Fh(t,"basename"),this.path=Ir.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ir.dirname(this.path):void 0}set dirname(t){Mb(this.basename,"dirname"),this.path=Ir.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ir.extname(this.path):void 0}set extname(t){if(Fh(t,"extname"),Mb(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=Ir.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){jd(t)&&(t=cT(t)),$h(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ir.basename(this.path,this.extname):void 0}set stem(t){$h(t,"stem"),Fh(t,"stem"),this.path=Ir.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 jn(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(Ir.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ir.sep+"`")}function $h(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Mb(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function hT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dT=(function(e){const s=this.constructor.prototype,l=s[e],o=function(){return l.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),mT={}.hasOwnProperty;class um extends dT{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=eT()}copy(){const t=new um;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):mT.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(b,g,x){if(b||!g||!x)return m(b);const v=g,S=s.stringify(v,x);yT(S)?x.value=S:x.result=S,m(b,x)});function m(b,g){b||!g?c(b):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),Lb("processSync","process",r),s;function l(o,c){r=!0,Ob(o),s=c}}run(t,r,s){Db(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(b,g,x){const v=g||t;b?f(b):c?c(v):s(void 0,v,x)}}}runSync(t,r){let s=!1,l;return this.run(t,r,o),Lb("runSync","run",s),l;function o(c,f){Ob(c),l=f,s=!0}}stringify(t,r){this.freeze();const s=bu(r),l=this.compiler||this.Compiler;return Yh("stringify",l),Db(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[b,...g]=m;d(b,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 b=-1;if(m!=null)if(Array.isArray(m))for(;++b<m.length;){const g=m[b];o(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,b){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===m){x=g;break}if(x===-1)s.push([m,...b]);else if(b.length>0){let[v,...S]=b;const N=s[x][1];Ad(N)&&Ad(v)&&(v=qh(!0,N,v)),s[x]=[m,v,...S]}}}}const pT=new um().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 Db(e){if(!Ad(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Lb(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function bu(e){return gT(e)?e:new E1(e)}function gT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function yT(e){return typeof e=="string"||bT(e)}function bT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zb=[],Ub={allowDangerousHtml:!0},vT=/^(https?|ircs?|mailto|xmpp)$/i,wT=[{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 ST(e){const t=_T(e),r=kT(e);return ET(t.runSync(t.parse(r),r),e)}function _T(e){const t=e.rehypePlugins||zb,r=e.remarkPlugins||zb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ub}:Ub;return pT().use(rN).use(r).use(QN,s).use(t)}function kT(e){const t=e.children||"",r=new E1;return typeof t=="string"&&(r.value=t),r}function ET(e,t){const r=t.allowedElements,s=t.allowElement,l=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,d=t.urlTransform||C1;for(const b of wT)Object.hasOwn(t,b.from)&&(""+b.from+(b.to?"use `"+b.to+"` instead":"remove it")+xT+b.id,void 0);return om(e,m),HC(e,{Fragment:y.Fragment,components:l,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function m(b,g,x){if(b.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:b.value},g;if(b.type==="element"){let v;for(v in Uh)if(Object.hasOwn(Uh,v)&&Object.hasOwn(b.properties,v)){const S=b.properties[v],N=Uh[v];(N===null||N.includes(b.tagName))&&(b.properties[v]=d(String(S||""),v,b))}}if(b.type==="element"){let v=r?!r.includes(b.tagName):o?o.includes(b.tagName):!1;if(!v&&s&&typeof g=="number"&&(v=!s(b,g,x)),v&&x&&typeof g=="number")return f&&b.children?x.children.splice(g,1,...b.children):x.children.splice(g,1),g}}}function C1(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||vT.test(e.slice(0,t))?e:""}const CT=/^[a-z][a-z0-9+.-]+:/i;function A1(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(CT.test(t))return null;const r=t.replace(/[?#].*$/,"");try{return decodeURI(r)||null}catch{return r||null}}function AT(e){return A1(e)!==null?e:C1(e)}function jT(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:[\\/]/i.test(e)}function NT(e,t){return!t||jT(e)?e:t.replace(/[^/\\]*$/,"")+e}function TT(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function OT(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 RT(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=OT(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 MT=["application/json","application/x-ndjson","application/xml","application/yaml"];function DT(e){return e==="text/markdown"?"markdown":e==="text/html"?"html":e.startsWith("image/")?"image":e.startsWith("text/")||MT.includes(e)?"text":"binary"}function LT(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Pb(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 zT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function j1(e,t,r){const l=nc((r||{}).ignore||[]),o=UT(t);let c=-1;for(;++c<o.length;)k1(e,"text",f);function f(m,b){let g=-1,x;for(;++g<b.length;){const v=b[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,b)}function d(m,b){const g=b[b.length-1],x=o[c][0],v=o[c][1];let S=0;const D=g.children.indexOf(m);let M=!1,P=[];x.lastIndex=0;let I=x.exec(m.value);for(;I;){const ue=I.index,H={index:I.index,input:I.input,stack:[...b,m]};let O=v(...I,H);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?x.lastIndex=ue+1:(S!==ue&&P.push({type:"text",value:m.value.slice(S,ue)}),Array.isArray(O)?P.push(...O):O&&P.push(O),S=ue+I[0].length,M=!0),!x.global)break;I=x.exec(m.value)}return M?(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 UT(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([PT(l[0]),BT(l[1])])}return t}function PT(e){return typeof e=="string"?new RegExp(zT(e),"g"):e}function BT(e){return typeof e=="function"?e:function(){return e}}const Jh="phrasing",Xh=["autolink","link","image","label"];function HT(){return{transforms:[GT],enter:{literalAutolink:IT,literalAutolinkEmail:Kh,literalAutolinkHttp:Kh,literalAutolinkWww:Kh},exit:{literalAutolink:YT,literalAutolinkEmail:VT,literalAutolinkHttp:FT,literalAutolinkWww:$T}}}function qT(){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 IT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kh(e){this.config.enter.autolinkProtocol.call(this,e)}function FT(e){this.config.exit.autolinkProtocol.call(this,e)}function $T(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 VT(e){this.config.exit.autolinkEmail.call(this,e)}function YT(e){this.exit(e)}function GT(e){j1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,JT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),XT]],{ignore:["link","linkReference"]})}function JT(e,t,r,s,l){let o="";if(!N1(l)||(/^w/i.test(t)&&(r=t+r,t="",o="http://"),!KT(r)))return!1;const c=QT(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 XT(e,t,r,s){return!N1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function KT(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 QT(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=Pb(e,"(");let o=Pb(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 N1(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ks(r)||Wu(r))&&(!t||r!==47)}T1.peek=a3;function ZT(){this.buffer()}function WT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function e3(){this.buffer()}function t3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function n3(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Mr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function r3(e){this.exit(e)}function i3(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Mr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function s3(e){this.exit(e)}function a3(){return"["}function T1(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 l3(){return{enter:{gfmFootnoteCallString:ZT,gfmFootnoteCall:WT,gfmFootnoteDefinitionLabelString:e3,gfmFootnoteDefinition:t3},exit:{gfmFootnoteCallString:n3,gfmFootnoteCall:r3,gfmFootnoteDefinitionLabelString:i3,gfmFootnoteDefinition:s3}}}function o3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:T1},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"),b=o.enter("label");return d+=f.move(o.safe(o.associationId(s),{before:d,after:"]"})),b(),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?O1:
|
|
108
|
-
`)}function
|
|
109
|
-
`&&
|
|
110
|
-
`}function
|
|
101
|
+
`}),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=VN(e,t),s=r.one(e,void 0),l=LN(r),o=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&o.children.push({type:"text",value:`
|
|
102
|
+
`},l),o}function KN(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 QN(){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 b=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!b&&!g)return!1;var x;for(x in m);return typeof x>"u"||e.call(m,x)},c=function(m,b){r&&b.name==="__proto__"?r(m,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):m[b.name]=b.newValue},f=function(m,b){if(b==="__proto__")if(e.call(m,b)){if(s)return s(m,b).value}else return;return m[b]};return Hh=function d(){var m,b,g,x,v,S,j=arguments[0],D=1,M=arguments.length,R=!1;for(typeof j=="boolean"&&(R=j,j=arguments[1]||{},D=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});D<M;++D)if(m=arguments[D],m!=null)for(b in m)g=f(j,b),x=f(m,b),j!==x&&(R&&x&&(o(x)||(v=l(x)))?(v?(v=!1,S=g&&l(g)?g:[]):S=g&&o(g)?g:{},c(j,{name:b,newValue:d(R,S,x)})):typeof x<"u"&&c(j,{name:b,newValue:x}));return j},Hh}var ZN=QN();const qh=Vb(ZN);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 WN(){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 b=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,b?eT(b,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 eT(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 b=m;if(f&&r)throw b;return l(b)}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 Br={basename:tT,dirname:nT,extname:rT,join:iT,sep:"/"};function tT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Zl(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 nT(e){if(Zl(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 rT(e){Zl(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 iT(...e){let t=-1,r;for(;++t<e.length;)Zl(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":sT(r)}function sT(e){Zl(e);const t=e.codePointAt(0)===47;let r=aT(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function aT(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 Zl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const lT={cwd:oT};function oT(){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 uT(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 cT(e)}function cT(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"||fT(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":lT.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"?Br.basename(this.path):void 0}set basename(t){$h(t,"basename"),Fh(t,"basename"),this.path=Br.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Br.dirname(this.path):void 0}set dirname(t){Rb(this.basename,"dirname"),this.path=Br.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Br.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=Br.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ad(t)&&(t=uT(t)),$h(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Br.basename(this.path,this.extname):void 0}set stem(t){$h(t,"stem"),Fh(t,"stem"),this.path=Br.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 kn(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(Br.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Br.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 fT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const hT=(function(e){const s=this.constructor.prototype,l=s[e],o=function(){return l.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),dT={}.hasOwnProperty;class om extends hT{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=WN()}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):dT.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(b,g,x){if(b||!g||!x)return m(b);const v=g,S=s.stringify(v,x);gT(S)?x.value=S:x.result=S,m(b,x)});function m(b,g){b||!g?c(b):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(b,g,x){const v=g||t;b?f(b):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[b,...g]=m;d(b,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 b=-1;if(m!=null)if(Array.isArray(m))for(;++b<m.length;){const g=m[b];o(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,b){let g=-1,x=-1;for(;++g<s.length;)if(s[g][0]===m){x=g;break}if(x===-1)s.push([m,...b]);else if(b.length>0){let[v,...S]=b;const j=s[x][1];Cd(j)&&Cd(v)&&(v=qh(!0,j,v)),s[x]=[m,v,...S]}}}}const mT=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 pT(e)?e:new E1(e)}function pT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function gT(e){return typeof e=="string"||yT(e)}function yT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const bT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Lb=[],zb={allowDangerousHtml:!0},xT=/^(https?|ircs?|mailto|xmpp)$/i,vT=[{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 wT(e){const t=ST(e),r=_T(e);return kT(t.runSync(t.parse(r),r),e)}function ST(e){const t=e.rehypePlugins||Lb,r=e.remarkPlugins||Lb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...zb}:zb;return mT().use(nN).use(r).use(KN,s).use(t)}function _T(e){const t=e.children||"",r=new E1;return typeof t=="string"&&(r.value=t),r}function kT(e,t){const r=t.allowedElements,s=t.allowElement,l=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,d=t.urlTransform||C1;for(const b of vT)Object.hasOwn(t,b.from)&&(""+b.from+(b.to?"use `"+b.to+"` instead":"remove it")+bT+b.id,void 0);return lm(e,m),BC(e,{Fragment:y.Fragment,components:l,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function m(b,g,x){if(b.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:b.value},g;if(b.type==="element"){let v;for(v in Uh)if(Object.hasOwn(Uh,v)&&Object.hasOwn(b.properties,v)){const S=b.properties[v],j=Uh[v];(j===null||j.includes(b.tagName))&&(b.properties[v]=d(String(S||""),v,b))}}if(b.type==="element"){let v=r?!r.includes(b.tagName):o?o.includes(b.tagName):!1;if(!v&&s&&typeof g=="number"&&(v=!s(b,g,x)),v&&x&&typeof g=="number")return f&&b.children?x.children.splice(g,1,...b.children):x.children.splice(g,1),g}}}function C1(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||xT.test(e.slice(0,t))?e:""}const ET=/^[a-z][a-z0-9+.-]+:/i;function A1(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(ET.test(t))return null;const r=t.replace(/[?#].*$/,"");try{return decodeURI(r)||null}catch{return r||null}}function CT(e){return A1(e)!==null?e:C1(e)}function AT(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:[\\/]/i.test(e)}function jT(e,t){return!t||AT(e)?e:t.replace(/[^/\\]*$/,"")+e}function NT(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function TT(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 OT(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=TT(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 RT=["application/json","application/x-ndjson","application/xml","application/yaml"];function MT(e){return e==="text/markdown"?"markdown":e==="text/html"?"html":e.startsWith("image/")?"image":e.startsWith("text/")||RT.includes(e)?"text":"binary"}function DT(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 LT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function j1(e,t,r){const l=nc((r||{}).ignore||[]),o=zT(t);let c=-1;for(;++c<o.length;)k1(e,"text",f);function f(m,b){let g=-1,x;for(;++g<b.length;){const v=b[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,b)}function d(m,b){const g=b[b.length-1],x=o[c][0],v=o[c][1];let S=0;const D=g.children.indexOf(m);let M=!1,R=[];x.lastIndex=0;let I=x.exec(m.value);for(;I;){const ue=I.index,B={index:I.index,input:I.input,stack:[...b,m]};let P=v(...I,B);if(typeof P=="string"&&(P=P.length>0?{type:"text",value:P}:void 0),P===!1?x.lastIndex=ue+1:(S!==ue&&R.push({type:"text",value:m.value.slice(S,ue)}),Array.isArray(P)?R.push(...P):P&&R.push(P),S=ue+I[0].length,M=!0),!x.global)break;I=x.exec(m.value)}return M?(S<m.value.length&&R.push({type:"text",value:m.value.slice(S)}),g.children.splice(D,1,...R)):R=[m],D+R.length}}function zT(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([UT(l[0]),PT(l[1])])}return t}function UT(e){return typeof e=="string"?new RegExp(LT(e),"g"):e}function PT(e){return typeof e=="function"?e:function(){return e}}const Jh="phrasing",Xh=["autolink","link","image","label"];function BT(){return{transforms:[YT],enter:{literalAutolink:qT,literalAutolinkEmail:Kh,literalAutolinkHttp:Kh,literalAutolinkWww:Kh},exit:{literalAutolink:VT,literalAutolinkEmail:$T,literalAutolinkHttp:IT,literalAutolinkWww:FT}}}function HT(){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 qT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kh(e){this.config.enter.autolinkProtocol.call(this,e)}function IT(e){this.config.exit.autolinkProtocol.call(this,e)}function FT(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 $T(e){this.config.exit.autolinkEmail.call(this,e)}function VT(e){this.exit(e)}function YT(e){j1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,GT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),JT]],{ignore:["link","linkReference"]})}function GT(e,t,r,s,l){let o="";if(!N1(l)||(/^w/i.test(t)&&(r=t+r,t="",o="http://"),!XT(r)))return!1;const c=KT(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 JT(e,t,r,s){return!N1(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function XT(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 KT(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 N1(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ks(r)||Wu(r))&&(!t||r!==47)}T1.peek=s3;function QT(){this.buffer()}function ZT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function WT(){this.buffer()}function e3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function t3(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Nr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function n3(e){this.exit(e)}function r3(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Nr(this.sliceSerialize(e)).toLowerCase(),r.label=t}function i3(e){this.exit(e)}function s3(){return"["}function T1(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 a3(){return{enter:{gfmFootnoteCallString:QT,gfmFootnoteCall:ZT,gfmFootnoteDefinitionLabelString:WT,gfmFootnoteDefinition:e3},exit:{gfmFootnoteCallString:t3,gfmFootnoteCall:n3,gfmFootnoteDefinitionLabelString:r3,gfmFootnoteDefinition:i3}}}function l3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:T1},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"),b=o.enter("label");return d+=f.move(o.safe(o.associationId(s),{before:d,after:"]"})),b(),d+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),d+=f.move((t?`
|
|
103
|
+
`:" ")+o.indentLines(o.containerFlow(s,f.current()),t?O1:o3))),m(),d}}function o3(e,t,r){return t===0?e:O1(e,t,r)}function O1(e,t,r){return(r?"":" ")+e}const u3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];R1.peek=m3;function c3(){return{canContainEols:["delete"],enter:{strikethrough:h3},exit:{strikethrough:d3}}}function f3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:u3}],handlers:{delete:R1}}}function h3(e){this.enter({type:"delete",children:[]},e)}function d3(e){this.exit(e)}function R1(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 m3(){return"~"}function p3(e){return e.length}function g3(e,t){const r=t||{},s=(r.align||[]).concat(),l=r.stringLength||p3,o=[],c=[],f=[],d=[];let m=0,b=-1;for(;++b<e.length;){const j=[],D=[];let M=-1;for(e[b].length>m&&(m=e[b].length);++M<e[b].length;){const R=y3(e[b][M]);if(r.alignDelimiters!==!1){const I=l(R);D[M]=I,(d[M]===void 0||I>d[M])&&(d[M]=I)}j.push(R)}c[b]=j,f[b]=D}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<m;)o[g]=Pb(s[g]);else{const j=Pb(s);for(;++g<m;)o[g]=j}g=-1;const x=[],v=[];for(;++g<m;){const j=o[g];let D="",M="";j===99?(D=":",M=":"):j===108?D=":":j===114&&(M=":");let R=r.alignDelimiters===!1?1:Math.max(1,d[g]-D.length-M.length);const I=D+"-".repeat(R)+M;r.alignDelimiters!==!1&&(R=D.length+R+M.length,R>d[g]&&(d[g]=R),v[g]=R),x[g]=I}c.splice(1,0,x),f.splice(1,0,v),b=-1;const S=[];for(;++b<c.length;){const j=c[b],D=f[b];g=-1;const M=[];for(;++g<m;){const R=j[g]||"";let I="",ue="";if(r.alignDelimiters!==!1){const B=d[g]-(D[g]||0),P=o[g];P===114?I=" ".repeat(B):P===99?B%2?(I=" ".repeat(B/2+.5),ue=" ".repeat(B/2-.5)):(I=" ".repeat(B/2),ue=I):ue=" ".repeat(B)}r.delimiterStart!==!1&&!g&&M.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&R==="")&&(r.delimiterStart!==!1||g)&&M.push(" "),r.alignDelimiters!==!1&&M.push(I),M.push(R),r.alignDelimiters!==!1&&M.push(ue),r.padding!==!1&&M.push(" "),(r.delimiterEnd!==!1||g!==m-1)&&M.push("|")}S.push(r.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return S.join(`
|
|
104
|
+
`)}function y3(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 b3(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()),x3);return l(),c}function x3(e,t,r){return">"+(r?"":" ")+e}function v3(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===`
|
|
105
|
+
`&&v3(r.stack,r.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
106
|
+
`}function w3(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 S3(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 _3(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 k3(e,t,r,s){const l=_3(r),o=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(S3(e,r)){const g=r.enter("codeIndented"),x=r.indentLines(o,E3);return g(),x}const f=r.createTracker(s),d=l.repeat(Math.max(w3(o,l)+1,3)),m=r.enter("codeFenced");let b=f.move(d);if(e.lang){const g=r.enter(`codeFencedLang${c}`);b+=f.move(r.safe(e.lang,{before:b,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${c}`);b+=f.move(" "),b+=f.move(r.safe(e.meta,{before:b,after:`
|
|
111
107
|
`,encode:["`"],...f.current()})),g()}return b+=f.move(`
|
|
112
108
|
`),o&&(b+=f.move(o+`
|
|
113
|
-
`)),b+=f.move(d),m(),b}function
|
|
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
|
|
109
|
+
`)),b+=f.move(d),m(),b}function E3(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 C3(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?" ":`
|
|
110
|
+
`,...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 A3(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 Vl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Fu(e,t,r){const s=ka(e),l=ka(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}}M1.peek=j3;function M1(e,t,r,s){const l=A3(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),b=Fu(s.before.charCodeAt(s.before.length-1),m,l);b.inside&&(d=Vl(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)+Vl(g));const v=c.move(l);return o(),r.attentionEncodeSurroundingInfo={after:x.outside,before:b.outside},f+d+v}function j3(e,t,r){return r.options.emphasis||"*"}function N3(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 T3(e,t,r,s){const l=Math.max(Math.min(6,e.depth||1),1),o=r.createTracker(s);if(N3(e,r)){const b=r.enter("headingSetext"),g=r.enter("phrasing"),x=r.containerPhrasing(e,{...o.current(),before:`
|
|
115
111
|
`,after:`
|
|
116
112
|
`});return g(),b(),x+`
|
|
117
113
|
`+(l===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
118
114
|
`))+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=Vl(m.charCodeAt(0))+m.slice(1)),m=m?c+" "+m:c,r.options.closeAtx&&(m+=" "+c),d(),f(),m}D1.peek=
|
|
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,
|
|
121
|
-
`))}function d(v,S,N,D){const M=N.enter("tableCell"),P=N.enter("phrasing"),I=N.containerPhrasing(v,{...D,before:o,after:o});return P(),M(),I}function m(v,S){return y3(v,{align:S,alignDelimiters:s,padding:r,stringLength:l})}function b(v,S,N){const D=v.children;let M=-1;const P=[],I=S.enter("table");for(;++M<D.length;)P[M]=g(D[M],S,N);return I(),P}function g(v,S,N){const D=v.children;let M=-1;const P=[],I=S.enter("tableRow");for(;++M<D.length;)P[M]=d(D[M],v,S,N);return I(),P}function x(v,S,N){let D=F1.inlineCode(v,S,N);return N.stack.includes("tableCell")&&(D=D.replace(/\|/g,"\\$&")),D}}function iO(){return{exit:{taskListCheckValueChecked:Fb,taskListCheckValueUnchecked:Fb,paragraph:aO}}}function sO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:lO}}}function Fb(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function aO(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 lO(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=F1.listItem(e,t,r,{...s,...f.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(b){return b+c}}function oO(){return[HT(),l3(),f3(),Q3(),iO()]}function uO(e){return{extensions:[qT(),o3(e),h3(),rO(e),sO()]}}const cO={tokenize:gO,partial:!0},$1={tokenize:yO,partial:!0},V1={tokenize:bO,partial:!0},Y1={tokenize:xO,partial:!0},fO={tokenize:vO,partial:!0},G1={name:"wwwAutolink",tokenize:mO,previous:X1},J1={name:"protocolAutolink",tokenize:pO,previous:K1},wi={name:"emailAutolink",tokenize:dO,previous:Q1},Gr={};function hO(){return{text:Gr}}let ws=48;for(;ws<123;)Gr[ws]=wi,ws++,ws===58?ws=65:ws===91&&(ws=97);Gr[43]=wi;Gr[45]=wi;Gr[46]=wi;Gr[95]=wi;Gr[72]=[wi,J1];Gr[104]=[wi,J1];Gr[87]=[wi,G1];Gr[119]=[wi,G1];function dO(e,t,r){const s=this;let l,o;return c;function c(g){return!Nd(g)||!Q1.call(s,s.previous)||hm(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Nd(g)?(e.consume(g),f):g===64?(e.consume(g),d):r(g)}function d(g){return g===46?e.check(fO,b,m)(g):g===45||g===95||An(g)?(o=!0,e.consume(g),d):b(g)}function m(g){return e.consume(g),l=!0,d}function b(g){return o&&l&&Ln(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function mO(e,t,r){const s=this;return l;function l(c){return c!==87&&c!==119||!X1.call(s,s.previous)||hm(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(cO,e.attempt($1,e.attempt(V1,o),r),r)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function pO(e,t,r){const s=this;let l="",o=!1;return c;function c(g){return(g===72||g===104)&&K1.call(s,s.previous)&&!hm(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(Ln(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)||ks(g)||Wu(g)?r(g):e.attempt($1,e.attempt(V1,b),r)(g)}function b(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function gO(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 yO(e,t,r){let s,l,o;return c;function c(m){return m===46||m===95?e.check(Y1,d,f)(m):m===null||Lt(m)||ks(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 bO(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(Y1,t,o)(c):c===null||Lt(c)||ks(c)?t(c):(e.consume(c),l)}function o(c){return c===41&&s++,e.consume(c),l}}function xO(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)||ks(f)?t(f):r(f)}function l(f){return f===null||f===40||f===91||Lt(f)||ks(f)?t(f):s(f)}function o(f){return Ln(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):Ln(f)?(e.consume(f),c):r(f)}}function vO(e,t,r){return s;function s(o){return e.consume(o),l}function l(o){return An(o)?r(o):t(o)}}function X1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Lt(e)}function K1(e){return!Ln(e)}function Q1(e){return!(e===47||Nd(e))}function Nd(e){return e===43||e===45||e===46||e===95||An(e)}function hm(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 wO={tokenize:NO,partial:!0};function SO(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:CO,continuation:{tokenize:AO},exit:jO}},text:{91:{name:"gfmFootnoteCall",tokenize:EO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:_O,resolveTo:kO}}}}function _O(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=Mr(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 kO(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 EO(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(Mr(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?b:m}function b(g){return g===91||g===92||g===93?(e.consume(g),o++,m):m(g)}}function CO(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",b):r(S)}function b(S){if(c>999||S===93&&!f||S===null||S===91||Lt(S))return r(S);if(S===93){e.exit("chunkString");const N=e.exit("gfmFootnoteDefinitionLabelString");return o=Mr(s.sliceSerialize(N)),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:b}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,b):b(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),l.includes(o)||l.push(o),yt(e,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return t(S)}}function AO(e,t,r){return e.check(Ql,t,e.attempt(wO,t,r))}function jO(e){e.exit("gfmFootnoteDefinition")}function NO(e,t,r){const s=this;return yt(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 TO(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 b={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",b,f],["enter",c[m][1],f],["exit",c[m][1],f],["enter",g,f]],v=f.parser.constructs.insideSpan.null;v&&sr(x,x.length,0,ec(v,c.slice(m+1,d),f)),sr(x,x.length,0,[["exit",g,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",b,f]]),sr(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,b=this.events;let g=0;return x;function x(S){return m===126&&b[b.length-1][1].type!=="characterEscape"?d(S):(c.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const N=ka(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"),M=ka(S);return D._open=!M||M===2&&!!N,D._close=!N||N===2&&!!M,f(S)}}}class OO{constructor(){this.map=[]}add(t,r,s){RO(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 RO(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 MO(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 DO(){return{flow:{null:{name:"table",tokenize:LO,resolveAll:zO}}}}function LO(e,t,r){const s=this;let l=0,o=0,c;return f;function f(z){let X=s.events.length-1;for(;X>-1;){const ne=s.events[X][1].type;if(ne==="lineEnding"||ne==="linePrefix")X--;else break}const F=X>-1?s.events[X][1].type:null,le=F==="tableHead"||F==="tableRow"?O:d;return le===O&&s.parser.lazy[s.now().line]?r(z):le(z)}function d(z){return e.enter("tableHead"),e.enter("tableRow"),m(z)}function m(z){return z===124||(c=!0,o+=1),b(z)}function b(z){return z===null?r(z):Ye(z)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),v):r(z):ut(z)?yt(e,b,"whitespace")(z):(o+=1,c&&(c=!1,l+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),c=!0,b):(e.enter("data"),g(z)))}function g(z){return z===null||z===124||Lt(z)?(e.exit("data"),b(z)):(e.consume(z),z===92?x:g)}function x(z){return z===92||z===124?(e.consume(z),g):g(z)}function v(z){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(z):(e.enter("tableDelimiterRow"),c=!1,ut(z)?yt(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):S(z))}function S(z){return z===45||z===58?D(z):z===124?(c=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),N):H(z)}function N(z){return ut(z)?yt(e,D,"whitespace")(z):D(z)}function D(z){return z===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),M):z===45?(o+=1,M(z)):z===null||Ye(z)?ue(z):H(z)}function M(z){return z===45?(e.enter("tableDelimiterFiller"),P(z)):H(z)}function P(z){return z===45?(e.consume(z),P):z===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(z))}function I(z){return ut(z)?yt(e,ue,"whitespace")(z):ue(z)}function ue(z){return z===124?S(z):z===null||Ye(z)?!c||l!==o?H(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):H(z)}function H(z){return r(z)}function O(z){return e.enter("tableRow"),ee(z)}function ee(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),ee):z===null||Ye(z)?(e.exit("tableRow"),t(z)):ut(z)?yt(e,ee,"whitespace")(z):(e.enter("data"),G(z))}function G(z){return z===null||z===124||Lt(z)?(e.exit("data"),ee(z)):(e.consume(z),z===92?B:G)}function B(z){return z===92||z===124?(e.consume(z),G):G(z)}}function zO(e,t){let r=-1,s=!0,l=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,m,b,g;const x=new OO;for(;++r<e.length;){const v=e[r],S=v[1];v[0]==="enter"?S.type==="tableHead"?(f=!1,d!==0&&($b(x,t,d,m,b),b=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,b={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",b,t]])),l=S.type==="tableDelimiterRow"?2:b?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&&$b(x,t,d,m,b),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=MO(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({},ca(t.events,r[0])),e.add(r[0],0,[["exit",o,t]]));const d=ca(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=ca(t.events,r[2]),b=ca(t.events,r[3]),g={type:f,start:Object.assign({},m),end:Object.assign({},b)};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,N=r[3]-r[2]-1;e.add(S,N,[])}}e.add(r[3]+1,0,[["exit",g,t]])}return l!==void 0&&(o.end=Object.assign({},ca(t.events,l)),e.add(l,0,[["exit",o,t]]),o=void 0),o}function $b(e,t,r,s,l){const o=[],c=ca(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 ca(e,t){const r=e[t],s=r[0]==="enter"?"start":"end";return r[1][s]}const UO={name:"tasklistCheck",tokenize:BO};function PO(){return{text:{91:UO}}}function BO(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 Ye(d)?t(d):ut(d)?e.check({tokenize:HO},t,r)(d):r(d)}}function HO(e,t,r){return yt(e,s,"whitespace");function s(l){return l===null?r(l):t(l)}}function qO(e){return s1([hO(),SO(),TO(e),DO(),PO()])}const IO={};function FO(e){const t=this,r=e||IO,s=t.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(qO(r)),o.push(oO()),c.push(uO(r))}function $O(e){j1(e,[/\r?\n|\r/g,VO])}function VO(){return{type:"break"}}function YO(){return function(e){$O(e)}}const dm=k.createContext(null);function Z1(e,t){const r=A1(t);return e&&r!==null?NT(r,e.baseFile):null}function GO({node:e,href:t,...r}){const s=k.useContext(dm),l=Z1(s,t);return!s||l===null?y.jsx("a",{...r,href:t,target:"_blank",rel:"noopener noreferrer"}):y.jsx("a",{...r,href:t,className:"md-file-link",onClick:o=>{o.preventDefault(),s.openFile(l)}})}function JO({node:e,src:t,alt:r,...s}){const l=k.useContext(dm),o=Z1(l,typeof t=="string"?t:void 0),[c,f]=k.useState(),[d,m]=k.useState(!1),b=l==null?void 0:l.loadFile;return k.useEffect(()=>{if(o===null||!b)return;let g=!1,x;return m(!1),b(o).then(v=>{g||(x=URL.createObjectURL(v),f(x))}).catch(()=>{g||m(!0)}),()=>{g=!0,x&&URL.revokeObjectURL(x)}},[o,b]),!l||o===null?y.jsx("img",{...s,src:t,alt:r}):d?y.jsx("span",{className:"md-image-missing",children:r||o}):c?y.jsx("img",{...s,src:c,alt:r,className:"md-file-image",onClick:()=>l.openFile(o)}):y.jsx("span",{className:"md-image-loading skeleton-line"})}const XO={a:GO,img:JO};function W1({content:e,files:t,baseFile:r}){const s=k.useMemo(()=>({openFile:t.openFile,loadFile:t.loadFile,baseFile:r}),[t.openFile,t.loadFile,r]);return y.jsx(dm.Provider,{value:s,children:y.jsx(ST,{remarkPlugins:[FO,YO],urlTransform:AT,components:XO,children:e})})}function KO({filePath:e,files:t,onClose:r}){const[s,l]=k.useState(null),[o,c]=k.useState(null),{loadFile:f}=t;k.useEffect(()=>{let b=!1,g;return l(null),c(null),(async()=>{try{const x=await f(e),v=DT(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),b){g&&URL.revokeObjectURL(g);return}l(S)}catch(x){b||c(x instanceof Error?x.message:"Failed to load file.")}})(),()=>{b=!0,g&&URL.revokeObjectURL(g)}},[e,f]);const d=TT(e);function m(){if(o)return y.jsx("p",{className:"file-viewer-message",children:o});if(!s)return y.jsxs("div",{className:"file-viewer-loading",children:[y.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem"}})]});switch(s.kind){case"markdown":return y.jsx(W1,{content:s.text??"",files:t,baseFile:e});case"text":return y.jsx("pre",{className:"file-viewer-text",children:s.text});case"html":return y.jsx("iframe",{className:"file-viewer-frame",sandbox:"",srcDoc:s.text,title:d});case"image":return y.jsx("img",{src:s.objectUrl,alt:d,style:{maxWidth:"100%",height:"auto"}});case"binary":return Vn.isNativePlatform()?y.jsx("p",{className:"file-viewer-message",children:"Downloading this file type isn't supported in the app yet."}):y.jsxs("div",{className:"file-viewer-download",children:[y.jsxs("p",{className:"file-viewer-message",children:["This file can't be previewed (",LT(s.size),")."]}),y.jsx("a",{className:"btn btn-primary",href:s.objectUrl,download:d,children:"Download"})]})}}return y.jsx("div",{className:"report-dialog-overlay",onClick:r,children:y.jsxs("div",{className:"report-dialog",onClick:b=>b.stopPropagation(),children:[y.jsxs("div",{className:"report-dialog-header",children:[y.jsx("span",{className:"report-dialog-title",children:d}),y.jsx("button",{className:"report-dialog-close",onClick:r,"aria-label":"Close",children:y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),y.jsx("div",{className:`report-dialog-body${(s==null?void 0:s.kind)==="html"?" report-dialog-body--frame":""}`,children:m()})]})})}function QO({connected:e,hostId:t,request:r,subscribeEvents:s,taskId:l,runId:o}){const c=Yr(),f=Gd(),[d,m]=k.useState(!0),[b,g]=k.useState([]),[x,v]=k.useState(),[S,N]=k.useState(),[D,M]=k.useState(),[P,I]=k.useState(!1),ue=x==="started",H=x==="followup",O=x==="started"||x==="followup",[ee,G]=k.useState(null);bd(ee!==null,()=>G(null));const[B,z]=k.useState(!1),[X,F]=k.useState(""),[le,ne]=k.useState(!1),W=k.useRef(null),V=k.useRef(null),K=k.useRef(null),[ce,Ee]=k.useState(o==="latest"?void 0:o),E=o==="latest"&&ce===null;k.useEffect(()=>{if(o!=="latest"){Ee(o);return}e&&(Ee(void 0),r("taskrun.list",{task_id:l,limit:1}).then(oe=>{var Re,_e;return Ee(((_e=(Re=oe.entries)==null?void 0:Re[0])==null?void 0:_e.run_id)??null)}).catch(()=>Ee(null)))},[o,l,e,r]);async function L(){if(ce)try{const oe=await r("task.result",{id:l,run_id:ce});if(oe.error){console.error("No result:",oe.error),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0});return}g(oe.messages??[]),v(oe.running_state),N(oe.agent),M(oe.agent_version),I(!!oe.starred)}catch(oe){console.error("Failed to load result:",oe),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0})}finally{m(!1)}}async function J(){if(!ce)return;const oe=!P;I(oe);try{const Re=await r("taskrun.star",{task_id:l,run_id:ce,starred:oe});if(Re.error)throw new Error(Re.error)}catch(Re){console.error("Failed to update star:",Re),I(!oe)}}const j=k.useCallback(oe=>ce?RT(r,l,ce,oe):Promise.reject(new Error("Run not loaded.")),[r,l,ce]),be=k.useMemo(()=>({openFile:G,loadFile:j}),[j]);k.useEffect(()=>{!e||!ce||(m(!0),L())},[e,l,ce]),k.useEffect(()=>!e||!t||!ce?void 0:s(t,async Re=>{try{const _e=JSON.parse(new TextDecoder().decode(Re.data));if(_e.event_type!=="running-state"&&_e.event_type!=="result-updated"||Re.subject.split(".").pop()!==l||_e.event_type==="result-updated"&&_e.run_id&&_e.run_id!==ce)return;L()}catch{}}),[e,t,l,ce,s,r]),k.useEffect(()=>{W.current&&(W.current.scrollTop=W.current.scrollHeight)},[b]),k.useEffect(()=>{d||E||!ce||K.current!==ce&&(K.current=ce,requestAnimationFrame(()=>{W.current&&(W.current.scrollTop=W.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[d,E,ce]);function Te(oe){if(oe==="input")return"User Input";if(oe==="permission")return"Permission";if(oe==="confirmation")return"Confirmation"}function Ce(oe){return oe==="started"?"Task started":oe==="finished"?"Task finished":oe==="failed"?"Task failed":oe==="error"?"Command failed":oe==="aborted"?"Task aborted":oe==="confirmation"?"Task confirmed":oe==="stopped"?"Follow-up stopped":oe??""}return y.jsxs("div",{className:"run-detail",children:[y.jsxs("div",{className:"run-detail-header",children:[y.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),!d&&!E&&y.jsx($x,{starred:P,onToggle:J})]}),E?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No runs yet"}),y.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?y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[y.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"chat-thread",ref:W,children:[b.map((oe,Re)=>{const _e=O&&oe.role==="assistant"&&!b.slice(Re+1).some(Fe=>Fe.role==="assistant"||Fe.role==="user");return oe.role==="status"?y.jsxs("div",{className:`chat-status${oe.type==="error"?" chat-status--error":""}`,children:[y.jsxs("div",{children:[Ce(oe.type),oe.time>0&&y.jsx("span",{className:"chat-status-time",children:f(oe.time)})]}),oe.content&&y.jsx("pre",{className:"chat-status-detail",children:oe.content})]},Re):y.jsxs("div",{className:`chat-message chat-message--${oe.role}${oe.role==="assistant"&&oe.stream==="stderr"?" chat-message--stderr":""}`,children:[oe.role==="assistant"&&S&&y.jsxs("div",{className:"chat-message-agent",children:[yd(S),D&&y.jsxs("span",{className:"chat-message-agent-version",children:[" v",D]})]}),y.jsxs("div",{className:"chat-message-content",children:[y.jsx(W1,{content:oe.content,files:be}),_e&&y.jsxs("div",{className:"chat-typing-indicator",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})]}),oe.attachments&&oe.attachments.length>0&&y.jsx("div",{className:"chat-message-attachments",children:oe.attachments.map(Fe=>y.jsx("button",{className:"chat-attachment-chip",onClick:()=>G(Fe),children:Fe},Fe))}),y.jsxs("div",{className:"chat-message-meta",children:[Te(oe.type)&&y.jsx("span",{className:"chat-message-type",children:Te(oe.type)}),oe.model&&y.jsxs("span",{children:[oe.model," ·"]}),oe.time>0&&y.jsx("span",{children:f(oe.time)})]})]},Re)}),O&&(()=>{const oe=b.filter(Re=>Re.role!=="status");return oe.length===0||oe[oe.length-1].role!=="assistant"})()&&y.jsxs("div",{className:"chat-message chat-message--assistant",children:[S&&y.jsxs("div",{className:"chat-message-agent",children:[yd(S),D&&y.jsxs("span",{className:"chat-message-agent-version",children:[" v",D]})]}),y.jsxs("div",{className:"chat-typing-indicator",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})]})]}),ue||H?y.jsx("div",{className:"chat-input-bar",children:y.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:B,"aria-label":"Abort task",onClick:async()=>{if(confirm("Abort this task?")){z(!0);try{await r("task.abort",{id:l})}catch(oe){console.error("Abort failed:",oe)}finally{z(!1)}}},children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):y.jsxs("form",{className:"chat-input-bar",onSubmit:async oe=>{oe.preventDefault();const Re=X.trim();if(!(!Re||le)){ne(!0);try{await r("task.followup",{id:l,run_id:ce,message:Re}),F("")}catch(_e){console.error("Follow-up failed:",_e)}finally{ne(!1)}}},children:[y.jsx("input",{ref:V,className:"chat-input",type:"text",placeholder:"Follow-up message",value:X,onChange:oe=>F(oe.target.value),disabled:le}),y.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!X.trim()||le,children:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),y.jsxs("button",{className:"run-detail-back run-detail-back--footer",onClick:()=>c(-1),children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]})]}),ee&&y.jsx(KO,{filePath:ee,files:be,onClose:()=>G(null)})]})}function Zh({title:e,message:t,onUpdate:r,onDismiss:s}){return y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:e}),y.jsx("p",{className:"confirm-modal-message",children:t}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-primary",onClick:r,children:"Update Now"}),s&&y.jsx("button",{className:"btn btn-secondary",onClick:s,children:"Dismiss"})]})]})})}function ZO(){const{activeHost:e}=vi(),t=k.useRef(null);k.useEffect(()=>{if(Vn.isNativePlatform()||e.directUrl||t.current===e.hostId)return;async function r(){var s;try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("[Push] Push notifications not supported");return}const l=await navigator.serviceWorker.ready;(s=l.active)==null||s.postMessage({type:"set-host-id",hostId:e.hostId});let o=await l.pushManager.getSubscription();if(!o){const{publicKey:f}=await SE("/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 wE("/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 WO="0.9.9",Wh=13e4;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}=Wi(),{connected:s,request:l,subscribeEvents:o,unauthorized:c,activeHost:f}=vi(),d=f.hostId,m=f.clientToken||null,b=Yr(),g=_r(),x=Yu(),v=Ix("(min-width: 768px)"),S=g.pathname.endsWith("/tasks"),N=x.runId?void 0:x.taskId,D=!!(x.taskId&&x.runId),[M,P]=k.useState(!1),[I,ue]=k.useState(!1),[H,O]=k.useState(null),[ee,G]=k.useState(null),[B,z]=k.useState(null),[X,F]=k.useState(null),[le,ne]=k.useState({}),[W,V]=k.useState({}),[K,ce]=k.useState(null),[Ee,E]=k.useState(null),[L,J]=k.useState(null),[j,be]=k.useState(null),[Te,Ce]=k.useState(new Set),[oe,Re]=k.useState([]),[_e,Fe]=k.useState(),[_t,an]=k.useState("loading"),[tn,Ft]=k.useState(0),Pt=k.useRef(0),Kt=k.useCallback(()=>{Pt.current=0,an("loading"),Ft(he=>he+1)},[]),Nn=!!m&&j===m,[qe,tt]=k.useState(new Map),[st,Mt]=k.useState(new Map),[kt,pn]=k.useState(new Map),[at,or]=k.useState(new Map),[fe,we]=k.useState(new Map),[Be,Ke]=k.useState(new Map),[Ie,zt]=k.useState(new Map),[Xt,Qt]=k.useState(new Map);ZO(),k.useEffect(()=>{window.scrollTo(0,0)},[d]),k.useEffect(()=>{let he=!1;return tC().then(Ae=>{he||Ce(Ae)}),()=>{he=!0}},[]),k.useEffect(()=>{if(!s){Pt.current=0,an("loading");return}an(De=>De==="error"?De:"loading");let he=!1,Ae;return l("host.info",void 0,{timeout:15e3}).then(De=>{var rt,xt,$t,Un,ns,rs,Zt,Xr,C;if(he)return;Re(De.agents??[]),ce(De.playwright_cli??null),Fe(De.host_platform),be(De.linked_client_token??null),zE(De.agents??[]);const Ge=De.version??null;G(Ge),P(!!Ge&&vu(Ge,WO)),t(d,De.lan_url??void 0),r(d,De.host_timezone);const Ve=new Map,gt=new Map,nt=new Map,He=new Map,Ue=new Map;for(const T of De.pending_prompts??[])if(T.type==="confirmation")Ve.set(T.key,{description:((rt=T.meta)==null?void 0:rt.description)??"",sessionName:(xt=T.meta)==null?void 0:xt.session_name});else if(T.type==="choice")gt.set(T.key,{question:(($t=T.meta)==null?void 0:$t.description)??"",options:T.params??[],sessionName:(Un=T.meta)==null?void 0:Un.session_name});else if(T.type==="permission")nt.set(T.key,{permissions:T.params??[],sessionName:(ns=T.meta)==null?void 0:ns.session_name});else if(T.type==="input"){const R=T.params??((rs=T.meta)==null?void 0:rs.input_questions)??[];He.set(T.key,{questions:R,description:(Zt=T.meta)==null?void 0:Zt.description,sessionName:(Xr=T.meta)==null?void 0:Xr.session_name,secret:(C=T.meta)==null?void 0:C.secret}),Ue.set(T.key,new Array(R.length).fill(""))}tt(Ve),Mt(gt),pn(nt),or(He),we(Ue),Pt.current=0,an("ready")}).catch(()=>{if(he)return;an("error");const De=Math.min(2e3*2**Pt.current,3e4);Pt.current++,Ae=window.setTimeout(()=>Ft(Ge=>Ge+1),De)}),()=>{he=!0,clearTimeout(Ae)}},[s,d,l,t,r,tn]),k.useEffect(()=>{if(_t!=="error")return;function he(){document.visibilityState==="visible"&&Kt()}return document.addEventListener("visibilitychange",he),()=>document.removeEventListener("visibilitychange",he)},[_t,Kt]),k.useEffect(()=>s?o(d,Ae=>{const De=Ae.subject.split(".");if(De.length<3)return;const Ge=De.slice(2).join(".");let Ve={};try{Ve=JSON.parse(new TextDecoder().decode(Ae.data))}catch{return}const gt=Ve.event_type,nt=Ve.session_id;if(gt==="input-request"&&nt){const He=Ve.input_questions,Ue=Ve.session_name,rt=Ve.description,xt=Ve.secret;He!=null&&He.length&&(or($t=>{if($t.has(nt))return $t;const Un=new Map($t);return Un.set(nt,{questions:He,description:rt,sessionName:Ue,secret:xt}),Un}),we($t=>{if($t.has(nt))return $t;const Un=new Map($t);return Un.set(nt,new Array(He.length).fill("")),Un}));return}if(gt==="input-resolved"&&nt){or(He=>{if(!He.has(nt))return He;const Ue=new Map(He);return Ue.delete(nt),Ue}),we(He=>{const Ue=new Map(He);return Ue.delete(nt),Ue}),Ke(He=>{if(!He.has(nt))return He;const Ue=new Map(He);return Ue.delete(nt),Ue});return}if(gt==="confirm-request"&&nt){const He=Ve.description,Ue=Ve.session_name;He&&tt(rt=>{if(rt.has(nt))return rt;const xt=new Map(rt);return xt.set(nt,{description:He,sessionName:Ue}),xt});return}if(gt==="confirm-resolved"&&nt){tt(He=>{if(!He.has(nt))return He;const Ue=new Map(He);return Ue.delete(nt),Ue});return}if(gt==="choice-request"&&nt){const He=Ve.description,Ue=Ve.options,rt=Ve.session_name;He&&(Ue!=null&&Ue.length)&&Mt(xt=>{if(xt.has(nt))return xt;const $t=new Map(xt);return $t.set(nt,{question:He,options:Ue,sessionName:rt}),$t});return}if(gt==="choice-resolved"&&nt){Mt(He=>{if(!He.has(nt))return He;const Ue=new Map(He);return Ue.delete(nt),Ue});return}if(gt==="permission-request"){const He=Ve.required_permissions,Ue=Ve.session_name;He!=null&&He.length&&pn(rt=>{if(rt.has(Ge))return rt;const xt=new Map(rt);return xt.set(Ge,{permissions:He,sessionName:Ue}),xt});return}if(gt==="permission-resolved"){pn(He=>{if(!He.has(Ge))return He;const Ue=new Map(He);return Ue.delete(Ge),Ue});return}}):void 0,[s,d,o]);async function mt(he,Ae,De,Ge){if(!Ie.has(he)){zt(Ve=>new Map(Ve).set(he,Ae)),Qt(Ve=>{const gt=new Map(Ve);return gt.delete(he),gt});try{await l("task.user_input",{id:he,value:De},{timeout:3e4}),Ge()}catch(Ve){console.error("[Dashboard] Failed to send user input:",Ve),Qt(gt=>new Map(gt).set(he,"Couldn't reach the host. Try again."))}finally{zt(Ve=>{const gt=new Map(Ve);return gt.delete(he),gt})}}}function Bt(he,Ae){mt(he,Ae,[Ae],()=>{tt(De=>{const Ge=new Map(De);return Ge.delete(he),Ge})})}function ht(he,Ae){mt(he,Ae,[Ae],()=>{Mt(De=>{const Ge=new Map(De);return Ge.delete(he),Ge})})}function gn(he,Ae){mt(he,Ae,[Ae],()=>{pn(De=>{const Ge=new Map(De);return Ge.delete(he),Ge})})}function ln(he,Ae,De){mt(he,Ae,De,()=>{or(Ge=>{const Ve=new Map(Ge);return Ve.delete(he),Ve}),we(Ge=>{const Ve=new Map(Ge);return Ve.delete(he),Ve}),Ke(Ge=>{const Ve=new Map(Ge);return Ve.delete(he),Ve})})}function kr(he,Ae){if(!_s())return;const De=`/hosts/${encodeURIComponent(d)}/runs/${encodeURIComponent(he)}`;b(Ae?`${De}/${encodeURIComponent(Ae)}`:De)}k.useEffect(()=>{if(!ee)return;let he=!1;return fetch("https://registry.npmjs.org/palmier/latest").then(Ae=>Ae.ok?Ae.json():null).then(Ae=>{!he&&(Ae!=null&&Ae.version)&&z(Ae.version)}).catch(()=>{}),()=>{he=!0}},[ee]),k.useEffect(()=>{let he=!1;for(const Ae of oe)!Ae.version||!Ae.npmPackage||fetch(`https://registry.npmjs.org/${Ae.npmPackage}/latest`).then(De=>De.ok?De.json():null).then(De=>{he||!(De!=null&&De.version)||ne(Ge=>Ge[Ae.key]===De.version?Ge:{...Ge,[Ae.key]:De.version})}).catch(()=>{});return()=>{he=!0}},[oe]);const ve=oe.find(he=>{if(!he.version)return!1;const Ae=le[he.key];return!Ae||!vu(he.version,Ae)?!1:W[he.key]!==Ae});function Xe(he,Ae){V(De=>({...De,[he]:Ae}))}async function Oe(he){ue("agent"),O(null);try{const Ae=await l("host.updateAgent",{key:he},{timeout:Wh});if(Ae.error){O(Ae.error),ue(!1);return}const De=await l("host.info");De.agents&&Re(De.agents)}catch(Ae){O(Ae instanceof Error?Ae.message:String(Ae))}finally{ue(!1)}}k.useEffect(()=>{if(!(K!=null&&K.npmPackage))return;let he=!1;return fetch(`https://registry.npmjs.org/${K.npmPackage}/latest`).then(Ae=>Ae.ok?Ae.json():null).then(Ae=>{!he&&(Ae!=null&&Ae.version)&&E(Ae.version)}).catch(()=>{}),()=>{he=!0}},[K==null?void 0:K.npmPackage,K==null?void 0:K.version]);const pt=K&&Ee&&vu(K.version,Ee)&&L!==Ee?K:null;function on(he){J(he)}async function ur(){ue("playwright"),O(null);try{const he=await l("host.updatePlaywrightCli",void 0,{timeout:Wh});if(he.error){O(he.error),ue(!1);return}const Ae=await l("host.info");ce(Ae.playwright_cli??null)}catch(he){O(he instanceof Error?he.message:String(he))}finally{ue(!1)}}const Jr=!M&&!!ee&&!!B&&vu(ee,B)&&X!==B;function Si(){B&&F(B)}async function zr(){ue("daemon"),O(null);try{const he=await l("host.update",void 0,{timeout:Wh});if(he.error){O(he.error),ue(!1);return}}catch{}setTimeout(()=>window.location.reload(),3e4)}const Tn=qe.size>0||st.size>0||kt.size>0||at.size>0,Ur=s&&!c;return y.jsxs("div",{className:"dashboard",children:[v&&y.jsx(Z0,{daemonVersion:ee,agents:oe,playwrightCli:K,linkedClientToken:j,request:l,onEnabledCapabilitiesChange:Ce,onLinkedClientTokenChange:be}),y.jsxs("div",{className:"dashboard-content",children:[y.jsxs("header",{className:"app-header",children:[y.jsxs("div",{className:"app-title-bar",children:[!v&&y.jsx(Z0,{daemonVersion:ee,agents:oe,playwrightCli:K,linkedClientToken:j,request:l,onEnabledCapabilitiesChange:Ce,onLinkedClientTokenChange:be}),y.jsx("h1",{className:"app-title",children:"Palmier"}),y.jsx(lC,{})]}),y.jsx("div",{className:"tab-bar",children:y.jsx(ZE,{})})]}),y.jsx("main",{className:"dashboard-main",children:c?y.jsxs("div",{className:"revoked-state",children:[y.jsx("div",{className:"revoked-icon",children:y.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),y.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),y.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),y.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),y.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),y.jsx("div",{className:"revoked-command",children:y.jsx("code",{children:"palmier pair"})}),y.jsxs("div",{className:"revoked-actions",children:[y.jsx("button",{className:"btn btn-primary",onClick:()=>{_s()&&b("/pair")},children:"Re-pair Device"}),y.jsx("button",{className:"btn btn-secondary",onClick:()=>{e(d),b("/",{replace:!0})},children:"Remove Host"})]})]}):Ur?y.jsxs(y.Fragment,{children:[S&&!D&&y.jsx(QE,{connected:s,hostId:d,request:l,subscribeEvents:o,agents:oe,hostPlatform:_e,isNotificationListener:Nn&&Te.has("notifications"),onViewRun:kr,hostInfoStatus:_t,onRetryHostInfo:Kt}),D?y.jsx(QO,{connected:s,hostId:d,request:l,subscribeEvents:o,taskId:x.taskId,runId:decodeURIComponent(x.runId)}):S?null:y.jsx(fC,{connected:s,hostId:d,request:l,subscribeEvents:o,agents:oe,hostPlatform:_e,filterTaskId:N,onClearFilter:()=>{_s()&&b(`/hosts/${encodeURIComponent(d)}`)},hostInfoStatus:_t,onRetryHostInfo:Kt})]}):y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})})}),(M||Jr)&&!I&&!H&&!Tn&&y.jsx(Zh,{title:M?"Update Required":"Update Available",message:M?`Your Palmier host${ee?` (v${ee})`:""} is too old for this version of the app. Please update to continue.`:`A new version of Palmier (v${B}) is available. You're running v${ee}.`,onUpdate:zr,onDismiss:M?void 0:Si}),!M&&!Jr&&ve&&!I&&!H&&!Tn&&y.jsx(Zh,{title:"Agent Update Available",message:`A new version of ${ve.label} (v${le[ve.key]}) is available. You're running v${ve.version}.`,onUpdate:()=>Oe(ve.key),onDismiss:()=>Xe(ve.key,le[ve.key])}),!M&&!Jr&&!ve&&pt&&Ee&&!I&&!H&&!Tn&&y.jsx(Zh,{title:"Browser Automation Update Available",message:`A new version of ${pt.label} (v${Ee}) is available. You're running v${pt.version}.`,onUpdate:ur,onDismiss:()=>on(Ee)}),I&&y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),y.jsx("p",{className:"confirm-modal-message",children:I==="daemon"?"Installing update and restarting daemon. Please wait...":"Installing update. Please wait..."})]})}),H&&y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),y.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:H}),y.jsx("div",{className:"confirm-modal-actions",children:y.jsx("button",{className:"btn btn-secondary",onClick:()=>{O(null)},children:"Retry"})})]})})]}),gi.createPortal(y.jsxs(y.Fragment,{children:[[...qe.entries()].map(([he,{description:Ae,sessionName:De}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),De&&y.jsx("p",{className:"confirm-modal-subtitle",children:De}),y.jsx("p",{className:"confirm-modal-message",children:Ae}),Xt.has(he)&&y.jsx("p",{className:"form-error",children:Xt.get(he)}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsxs("button",{className:"btn btn-primary",disabled:Ie.has(he),onClick:()=>Bt(he,"confirmed"),children:[Ie.get(he)==="confirmed"&&y.jsx("span",{className:"btn-spinner"}),"Confirm"]}),y.jsxs("button",{className:"btn btn-secondary",disabled:Ie.has(he),onClick:()=>Bt(he,"aborted"),children:[Ie.get(he)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})]})},he)),[...st.entries()].map(([he,{question:Ae,options:De,sessionName:Ge}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Question"}),Ge&&y.jsx("p",{className:"confirm-modal-subtitle",children:Ge}),y.jsx("p",{className:"confirm-modal-message",children:Ae}),Xt.has(he)&&y.jsx("p",{className:"form-error",children:Xt.get(he)}),y.jsx("div",{className:`confirm-modal-actions${De.length===2&&De.every(Ve=>Ve.length<=16)?"":" choice-options-stacked"}`,children:De.map((Ve,gt)=>y.jsxs("button",{className:"btn btn-secondary",disabled:Ie.has(he),onClick:()=>ht(he,String(gt)),children:[Ie.get(he)===String(gt)&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),Ve]},gt))}),y.jsxs("button",{className:"permission-abort-link",disabled:Ie.has(he),onClick:()=>ht(he,"aborted"),children:[Ie.get(he)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort Task"]})]})},he)),[...kt.entries()].map(([he,{permissions:Ae,sessionName:De}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal permission-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),y.jsx("p",{className:"confirm-modal-message",children:y.jsx("strong",{children:De||he})}),y.jsx("div",{className:"permission-list",children:Ae.map((Ge,Ve)=>y.jsxs("div",{className:"permission-item",children:[y.jsx("span",{className:"permission-name",children:Ge.name}),Ge.description&&y.jsx("span",{className:"permission-desc",children:Ge.description})]},Ve))}),Xt.has(he)&&y.jsx("p",{className:"form-error",children:Xt.get(he)}),y.jsxs("div",{className:"permission-actions",children:[y.jsxs("button",{className:"btn btn-primary",disabled:Ie.has(he),onClick:()=>gn(he,"granted"),children:[Ie.get(he)==="granted"&&y.jsx("span",{className:"btn-spinner"}),"Allow Once"]}),y.jsxs("button",{className:"btn btn-secondary",disabled:Ie.has(he),onClick:()=>gn(he,"granted_all"),children:[Ie.get(he)==="granted_all"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Allow Always"]})]}),y.jsxs("button",{className:"permission-abort-link",disabled:Ie.has(he),onClick:()=>gn(he,"aborted"),children:[Ie.get(he)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Deny & Abort Task"]})]})},he)),[...at.entries()].map(([he,{questions:Ae,description:De,sessionName:Ge,secret:Ve}])=>{const gt=fe.get(he)??new Array(Ae.length).fill("");return y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal input-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:Ve?"Password Required":"Input Required"}),Ge&&y.jsx("p",{className:"confirm-modal-subtitle",children:Ge}),De&&y.jsx("p",{className:"confirm-modal-message",children:De}),y.jsx("div",{className:"input-list",children:Ae.map((nt,He)=>y.jsxs("div",{className:"input-item",children:[y.jsx("label",{className:"input-label",children:nt}),y.jsx("input",{type:Ve?"password":"text",autoComplete:Ve?"off":void 0,className:"input-field",value:gt[He]??"",onChange:Ue=>{we(rt=>{const xt=new Map(rt),$t=[...xt.get(he)??[]];return $t[He]=Ue.target.value,xt.set(he,$t),xt})},disabled:Ie.has(he),autoFocus:He===0})]},He))}),Ve&&y.jsxs("label",{className:"toggle-label input-save-toggle",children:[y.jsx("input",{type:"checkbox",checked:Be.get(he)??!0,disabled:Ie.has(he),onChange:nt=>Ke(He=>new Map(He).set(he,nt.target.checked))}),"Save this password"]}),Xt.has(he)&&y.jsx("p",{className:"form-error",children:Xt.get(he)}),y.jsx("div",{className:"input-actions",children:y.jsxs("button",{className:"btn btn-primary",disabled:Ie.has(he)||gt.some(nt=>!nt.trim()),onClick:()=>{const nt=Ve?[...gt,Be.get(he)??!0?"save":"nosave"]:gt;ln(he,"submit",nt)},children:[Ie.get(he)==="submit"&&y.jsx("span",{className:"btn-spinner"}),"Submit"]})}),y.jsxs("button",{className:"permission-abort-link",disabled:Ie.has(he),onClick:()=>ln(he,"aborted",["aborted"]),children:[Ie.get(he)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})},he)})]}),document.body)]})}const e4=Es("Preferences",{web:()=>Yd(()=>import("./web-DQDmufih.js"),[]).then(e=>new e.PreferencesWeb)}),Al=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),Vb=Vn.isNativePlatform();function t4(){const[e,t]=k.useState(""),[r,s]=k.useState(!0),[l,o]=k.useState(!1),[c,f]=k.useState(null),{addPairedHost:d,pairedHosts:m}=Wi(),b=Yr();async function g(){const x=e.trim().toUpperCase();if(!x){f("Enter a pairing code.");return}o(!0),f(null);try{let v;if(Al){const D=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:x,label:navigator.userAgent})});if(!D.ok){const M=await D.json().catch(()=>({error:"Connection failed"}));throw new Error(M.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 M=await D.json();if(!M.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const P=await Lx({servers:M.natsWsUrl,authenticator:Cx(M.natsJwt,new TextEncoder().encode(M.natsNkeySeed))}),I=Ru(),ue=`pair.${x}`,H=await P.request(ue,I.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});v=JSON.parse(I.decode(H.data)),await P.close()}const S={hostId:v.hostId,clientToken:v.clientToken,directUrl:Al?window.location.origin:void 0,...v.hostName?{name:v.hostName}:{}};if(d(S),Vn.isNativePlatform()&&Cn){await e4.set({key:"hostId",value:v.hostId});try{const{token:D}=await Cn.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 N=`/hosts/${encodeURIComponent(v.hostId)}`;b(Vb&&r?`${N}/pair/setup`:N)}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 y.jsx("div",{className:"pair-page",children:y.jsxs("div",{className:"pair-card",children:[y.jsxs("div",{className:"pair-header",children:[y.jsx("h1",{className:"pair-title",children:Al?"Pair":"Pair with Host"}),y.jsx("p",{className:"pair-subtitle",children:Al?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!Al&&y.jsxs("div",{className:"pair-instructions",children:[y.jsxs("div",{className:"pair-instruction-block",children:[y.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),y.jsxs("ol",{className:"pair-steps",children:[y.jsxs("li",{children:["Install Palmier on your host machine.",y.jsx("span",{className:"pair-platform-label",children:"Linux / macOS:"}),y.jsx("code",{className:"pair-command",children:"curl -fsSL https://palmier.me/install.sh | bash"}),y.jsx("span",{className:"pair-platform-label",children:"Windows (PowerShell):"}),y.jsx("code",{className:"pair-command",children:"irm https://palmier.me/install.ps1 | iex"})]}),y.jsxs("li",{children:["Run the setup wizard:",y.jsx("code",{className:"pair-command",children:"palmier init"})]}),y.jsx("li",{children:"A pairing code will display automatically"})]})]}),y.jsx("div",{className:"pair-instruction-divider"}),y.jsxs("div",{className:"pair-instruction-block",children:[y.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),y.jsxs("ol",{className:"pair-steps",children:[y.jsxs("li",{children:["Run ",y.jsx("code",{children:"palmier pair"})," on the host machine"]}),y.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),y.jsxs("div",{className:"pair-form",children:[y.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",y.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})]}),Vb&&y.jsxs("label",{className:"pair-checkbox",children:[y.jsx("input",{type:"checkbox",checked:r,onChange:x=>s(x.target.checked),disabled:l}),y.jsxs("span",{className:"pair-checkbox-text",children:[y.jsx("span",{className:"pair-checkbox-title",children:"Link the host to this device"}),y.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&&y.jsx("p",{className:"pair-error",children:c}),y.jsxs("button",{className:"btn btn-primary btn-full",onClick:g,disabled:l||!e.trim(),children:[l&&y.jsx("span",{className:"btn-spinner"}),l?"Pairing...":"Pair"]}),m.length>0&&y.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>b("/"),disabled:l,children:"Cancel"}),y.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",y.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",y.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function n4(){const e=Yr(),{connected:t,request:r,activeHost:s}=vi(),{setHostLanUrl:l,pairedHosts:o}=Wi(),c=o.length<=1,[f,d]=k.useState("loading"),[m,b]=k.useState(null),[g,x]=k.useState(null);function v(){e(`/hosts/${encodeURIComponent(s.hostId)}`,{replace:!0})}k.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 ue=I.linked_client_token??null;b(ue);const H=!!ue&&ue!==s.clientToken;d(H?"confirming":"linking")}),()=>{P=!0}},[t,f,s,r,l]),k.useEffect(()=>{if(f!=="linking")return;let P=!1;return(async()=>{try{if(Cn){const{token:I}=await Cn.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 N(){v()}function D(){x(null),d("linking")}const M=f==="confirming"&&gi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:N,children:y.jsxs("div",{className:"confirm-modal",onClick:P=>P.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),y.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."}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:N,children:"Cancel"}),y.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 y.jsxs("div",{className:"pair-setup",children:[y.jsxs("div",{className:"pair-setup-inner",children:[P&&y.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),y.jsxs("div",{className:"pair-setup-loading",children:[I&&y.jsx("span",{className:"spinner spinner-lg"}),f==="loading"&&y.jsx("span",{children:"Connecting to host…"}),f==="confirming"&&y.jsx("span",{children:"Awaiting confirmation…"}),f==="linking"&&y.jsx("span",{children:"Linking device…"}),f==="linkError"&&y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"pair-error",children:g}),y.jsx("button",{className:"btn btn-primary",onClick:D,children:"Retry"}),y.jsx("button",{className:"btn btn-secondary",onClick:v,children:"Skip linking"})]})]})]}),M]})}return y.jsx("div",{className:"pair-setup",children:y.jsxs("div",{className:"pair-setup-inner",children:[y.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),y.jsx("p",{className:"pair-setup-description",children:"Choose what the host can use this device for. You can change these later from the menu."}),y.jsx(Fx,{}),y.jsx("div",{className:"pair-setup-actions",children:y.jsx("button",{className:"btn btn-primary btn-full",onClick:v,children:"Finish"})})]})})}function r4(){const e=Yr();return k.useEffect(()=>{if(!Cn)return;const t=Cn.addListener("deepLink",({path:r})=>e(r));return()=>{t.then(r=>r.remove())}},[e]),null}function i4(){const{pairedHosts:e,lastHostId:t}=Wi();if(e.length===0)return y.jsx(Bl,{to:"/pair",replace:!0});const r=e.find(s=>s.hostId===t)??e[0];return y.jsx(Bl,{to:`/hosts/${encodeURIComponent(r.hostId)}`,replace:!0})}function s4(){const{hostId:e}=Yu(),{pairedHosts:t,setLastHostId:r}=Wi(),s=t.find(l=>l.hostId===e)??null;return k.useEffect(()=>{s&&r(s.hostId)},[s==null?void 0:s.hostId,r]),s?y.jsx(CE,{activeHost:s,children:y.jsxs(lx,{children:[y.jsx(Tr,{index:!0,element:y.jsx(wu,{},e)}),y.jsx(Tr,{path:"tasks",element:y.jsx(wu,{},e)}),y.jsx(Tr,{path:"runs/:taskId",element:y.jsx(wu,{},e)}),y.jsx(Tr,{path:"runs/:taskId/:runId",element:y.jsx(wu,{},e)}),y.jsx(Tr,{path:"pair/setup",element:y.jsx(n4,{})}),y.jsx(Tr,{path:"*",element:y.jsx(Bl,{to:".",replace:!0})})]})},`${s.hostId}|${s.clientToken}`):y.jsx(Bl,{to:"/",replace:!0})}function a4(){return y.jsxs(K_,{children:[y.jsx(r4,{}),y.jsxs(lx,{children:[y.jsx(Tr,{path:"/",element:y.jsx(i4,{})}),y.jsx(Tr,{path:"/pair",element:y.jsx(t4,{})}),y.jsx(Tr,{path:"/hosts/:hostId/*",element:y.jsx(s4,{})}),y.jsx(Tr,{path:"*",element:y.jsx(Bl,{to:"/",replace:!0})})]})]})}yS.createRoot(document.getElementById("root")).render(y.jsx(k.StrictMode,{children:y.jsx(U_,{children:y.jsx(a4,{})})}));export{Vd as W};
|
|
115
|
+
`,...o.current()});return/^[\t ]/.test(m)&&(m=Vl(m.charCodeAt(0))+m.slice(1)),m=m?c+" "+m:c,r.options.closeAtx&&(m+=" "+c),d(),f(),m}D1.peek=O3;function D1(e){return e.value||""}function O3(){return"<"}L1.peek=R3;function L1(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 R3(){return"!"}z1.peek=M3;function z1(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 b=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=b,o(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function M3(){return"!"}U1.peek=D3;function U1(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 D3(){return"`"}function P1(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))}B1.peek=L3;function B1(e,t,r,s){const l=um(r),o=l==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let f,d;if(P1(e,r)){const b=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=b,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 L3(e,t,r){return P1(e,r)?"<":"["}H1.peek=z3;function H1(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 b=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:d,after:"]",...f.current()});return c(),r.stack=b,o(),l==="full"||!m||m!==g?d+=f.move(g+"]"):l==="shortcut"?d=d.slice(0,-1):d+=f.move("]"),d}function z3(){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 U3(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 P3(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 q1(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 B3(e,t,r,s){const l=r.enter("list"),o=r.bulletCurrent;let c=e.ordered?P3(r):cm(r);const f=e.ordered?c==="."?")":".":U3(r);let d=t&&r.bulletLastUsed?c===r.bulletLastUsed:!1;if(!e.ordered){const b=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&b&&(!b.children||!b.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),q1(r)===c&&b){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 H3(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 q3(e,t,r,s){const l=H3(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()),b);return d(),m;function b(g,x,v){return x?(v?"":" ".repeat(c))+g:(v?o:o+" ".repeat(c-o.length))+g}}function I3(e,t,r,s){const l=r.enter("paragraph"),o=r.enter("phrasing"),c=r.containerPhrasing(e,s);return o(),l(),c}const F3=nc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function $3(e,t,r,s){return(e.children.some(function(c){return F3(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function V3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}I1.peek=Y3;function I1(e,t,r,s){const l=V3(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),b=Fu(s.before.charCodeAt(s.before.length-1),m,l);b.inside&&(d=Vl(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)+Vl(g));const v=c.move(l+l);return o(),r.attentionEncodeSurroundingInfo={after:x.outside,before:b.outside},f+d+v}function Y3(e,t,r){return r.options.strong||"*"}function G3(e,t,r,s){return r.safe(e.value,s)}function J3(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 X3(e,t,r){const s=(q1(r)+(r.options.ruleSpaces?" ":"")).repeat(J3(r));return r.options.ruleSpaces?s.slice(0,-1):s}const F1={blockquote:b3,break:Hb,code:k3,definition:C3,emphasis:M1,hardBreak:Hb,heading:T3,html:D1,image:L1,imageReference:z1,inlineCode:U1,link:B1,linkReference:H1,list:B3,listItem:q3,paragraph:I3,root:$3,strong:I1,text:G3,thematicBreak:X3};function K3(){return{enter:{table:Q3,tableData:qb,tableHeader:qb,tableRow:W3},exit:{codeText:eO,table:Z3,tableData:Qh,tableHeader:Qh,tableRow:Qh}}}function Q3(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 Z3(e){this.exit(e),this.data.inTable=void 0}function W3(e){this.enter({type:"tableRow",children:[]},e)}function Qh(e){this.exit(e)}function qb(e){this.enter({type:"tableCell",children:[]},e)}function eO(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,tO));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function tO(e,t){return t==="|"?t:e}function nO(e){const t=e||{},r=t.tableCellPadding,s=t.tablePipeAlign,l=t.stringLength,o=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
116
|
+
`,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(b(v,j,D),v.align)}function f(v,S,j,D){const M=g(v,j,D),R=m([M]);return R.slice(0,R.indexOf(`
|
|
117
|
+
`))}function d(v,S,j,D){const M=j.enter("tableCell"),R=j.enter("phrasing"),I=j.containerPhrasing(v,{...D,before:o,after:o});return R(),M(),I}function m(v,S){return g3(v,{align:S,alignDelimiters:s,padding:r,stringLength:l})}function b(v,S,j){const D=v.children;let M=-1;const R=[],I=S.enter("table");for(;++M<D.length;)R[M]=g(D[M],S,j);return I(),R}function g(v,S,j){const D=v.children;let M=-1;const R=[],I=S.enter("tableRow");for(;++M<D.length;)R[M]=d(D[M],v,S,j);return I(),R}function x(v,S,j){let D=F1.inlineCode(v,S,j);return j.stack.includes("tableCell")&&(D=D.replace(/\|/g,"\\$&")),D}}function rO(){return{exit:{taskListCheckValueChecked:Ib,taskListCheckValueUnchecked:Ib,paragraph:sO}}}function iO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:aO}}}function Ib(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function sO(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 aO(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=F1.listItem(e,t,r,{...s,...f.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),d;function m(b){return b+c}}function lO(){return[BT(),a3(),c3(),K3(),rO()]}function oO(e){return{extensions:[HT(),l3(e),f3(),nO(e),iO()]}}const uO={tokenize:pO,partial:!0},$1={tokenize:gO,partial:!0},V1={tokenize:yO,partial:!0},Y1={tokenize:bO,partial:!0},cO={tokenize:xO,partial:!0},G1={name:"wwwAutolink",tokenize:dO,previous:X1},J1={name:"protocolAutolink",tokenize:mO,previous:K1},vi={name:"emailAutolink",tokenize:hO,previous:Q1},$r={};function fO(){return{text:$r}}let ws=48;for(;ws<123;)$r[ws]=vi,ws++,ws===58?ws=65:ws===91&&(ws=97);$r[43]=vi;$r[45]=vi;$r[46]=vi;$r[95]=vi;$r[72]=[vi,J1];$r[104]=[vi,J1];$r[87]=[vi,G1];$r[119]=[vi,G1];function hO(e,t,r){const s=this;let l,o;return c;function c(g){return!jd(g)||!Q1.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(cO,b,m)(g):g===45||g===95||_n(g)?(o=!0,e.consume(g),d):b(g)}function m(g){return e.consume(g),l=!0,d}function b(g){return o&&l&&Rn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function dO(e,t,r){const s=this;return l;function l(c){return c!==87&&c!==119||!X1.call(s,s.previous)||fm(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(uO,e.attempt($1,e.attempt(V1,o),r),r)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function mO(e,t,r){const s=this;let l="",o=!1;return c;function c(g){return(g===72||g===104)&&K1.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(Rn(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)||Dt(g)||ks(g)||Wu(g)?r(g):e.attempt($1,e.attempt(V1,b),r)(g)}function b(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function pO(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 gO(e,t,r){let s,l,o;return c;function c(m){return m===46||m===95?e.check(Y1,d,f)(m):m===null||Dt(m)||ks(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 yO(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(Y1,t,o)(c):c===null||Dt(c)||ks(c)?t(c):(e.consume(c),l)}function o(c){return c===41&&s++,e.consume(c),l}}function bO(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||Dt(f)||ks(f)?t(f):r(f)}function l(f){return f===null||f===40||f===91||Dt(f)||ks(f)?t(f):s(f)}function o(f){return Rn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),s):Rn(f)?(e.consume(f),c):r(f)}}function xO(e,t,r){return s;function s(o){return e.consume(o),l}function l(o){return _n(o)?r(o):t(o)}}function X1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Dt(e)}function K1(e){return!Rn(e)}function Q1(e){return!(e===47||jd(e))}function jd(e){return e===43||e===45||e===46||e===95||_n(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 vO={tokenize:jO,partial:!0};function wO(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:EO,continuation:{tokenize:CO},exit:AO}},text:{91:{name:"gfmFootnoteCall",tokenize:kO},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:SO,resolveTo:_O}}}}function SO(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=Nr(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 _O(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 kO(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||Dt(g))return r(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return l.includes(Nr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return Dt(g)||(c=!0),o++,e.consume(g),g===92?b:m}function b(g){return g===91||g===92||g===93?(e.consume(g),o++,m):m(g)}}function EO(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",b):r(S)}function b(S){if(c>999||S===93&&!f||S===null||S===91||Dt(S))return r(S);if(S===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=Nr(s.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Dt(S)||(f=!0),c++,e.consume(S),S===92?g:b}function g(S){return S===91||S===92||S===93?(e.consume(S),c++,b):b(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),l.includes(o)||l.push(o),gt(e,v,"gfmFootnoteDefinitionWhitespace")):r(S)}function v(S){return t(S)}}function CO(e,t,r){return e.check(Ql,t,e.attempt(vO,t,r))}function AO(e){e.exit("gfmFootnoteDefinition")}function jO(e,t,r){const s=this;return gt(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 NO(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 b={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",b,f],["enter",c[m][1],f],["exit",c[m][1],f],["enter",g,f]],v=f.parser.constructs.insideSpan.null;v&&nr(x,x.length,0,ec(v,c.slice(m+1,d),f)),nr(x,x.length,0,[["exit",g,f],["enter",c[d][1],f],["exit",c[d][1],f],["exit",b,f]]),nr(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,b=this.events;let g=0;return x;function x(S){return m===126&&b[b.length-1][1].type!=="characterEscape"?d(S):(c.enter("strikethroughSequenceTemporary"),v(S))}function v(S){const j=ka(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"),M=ka(S);return D._open=!M||M===2&&!!j,D._close=!j||j===2&&!!M,f(S)}}}class TO{constructor(){this.map=[]}add(t,r,s){OO(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 OO(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 RO(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 MO(){return{flow:{null:{name:"table",tokenize:DO,resolveAll:LO}}}}function DO(e,t,r){const s=this;let l=0,o=0,c;return f;function f(z){let K=s.events.length-1;for(;K>-1;){const te=s.events[K][1].type;if(te==="lineEnding"||te==="linePrefix")K--;else break}const F=K>-1?s.events[K][1].type:null,oe=F==="tableHead"||F==="tableRow"?P:d;return oe===P&&s.parser.lazy[s.now().line]?r(z):oe(z)}function d(z){return e.enter("tableHead"),e.enter("tableRow"),m(z)}function m(z){return z===124||(c=!0,o+=1),b(z)}function b(z){return z===null?r(z):Ye(z)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),v):r(z):ot(z)?gt(e,b,"whitespace")(z):(o+=1,c&&(c=!1,l+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),c=!0,b):(e.enter("data"),g(z)))}function g(z){return z===null||z===124||Dt(z)?(e.exit("data"),b(z)):(e.consume(z),z===92?x:g)}function x(z){return z===92||z===124?(e.consume(z),g):g(z)}function v(z){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(z):(e.enter("tableDelimiterRow"),c=!1,ot(z)?gt(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):S(z))}function S(z){return z===45||z===58?D(z):z===124?(c=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),j):B(z)}function j(z){return ot(z)?gt(e,D,"whitespace")(z):D(z)}function D(z){return z===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),M):z===45?(o+=1,M(z)):z===null||Ye(z)?ue(z):B(z)}function M(z){return z===45?(e.enter("tableDelimiterFiller"),R(z)):B(z)}function R(z){return z===45?(e.consume(z),R):z===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(z))}function I(z){return ot(z)?gt(e,ue,"whitespace")(z):ue(z)}function ue(z){return z===124?S(z):z===null||Ye(z)?!c||l!==o?B(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):B(z)}function B(z){return r(z)}function P(z){return e.enter("tableRow"),ee(z)}function ee(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),ee):z===null||Ye(z)?(e.exit("tableRow"),t(z)):ot(z)?gt(e,ee,"whitespace")(z):(e.enter("data"),G(z))}function G(z){return z===null||z===124||Dt(z)?(e.exit("data"),ee(z)):(e.consume(z),z===92?H:G)}function H(z){return z===92||z===124?(e.consume(z),G):G(z)}}function LO(e,t){let r=-1,s=!0,l=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,d=0,m,b,g;const x=new TO;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,b),b=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,b={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(r,0,[["enter",b,t]])),l=S.type==="tableDelimiterRow"?2:b?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,b),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=RO(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({},ca(t.events,r[0])),e.add(r[0],0,[["exit",o,t]]));const d=ca(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=ca(t.events,r[2]),b=ca(t.events,r[3]),g={type:f,start:Object.assign({},m),end:Object.assign({},b)};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&&(o.end=Object.assign({},ca(t.events,l)),e.add(l,0,[["exit",o,t]]),o=void 0),o}function Fb(e,t,r,s,l){const o=[],c=ca(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 ca(e,t){const r=e[t],s=r[0]==="enter"?"start":"end";return r[1][s]}const zO={name:"tasklistCheck",tokenize:PO};function UO(){return{text:{91:zO}}}function PO(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 Dt(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 Ye(d)?t(d):ot(d)?e.check({tokenize:BO},t,r)(d):r(d)}}function BO(e,t,r){return gt(e,s,"whitespace");function s(l){return l===null?r(l):t(l)}}function HO(e){return s1([fO(),wO(),NO(e),MO(),UO()])}const qO={};function IO(e){const t=this,r=e||qO,s=t.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(HO(r)),o.push(lO()),c.push(oO(r))}function FO(e){j1(e,[/\r?\n|\r/g,$O])}function $O(){return{type:"break"}}function VO(){return function(e){FO(e)}}const hm=E.createContext(null);function Z1(e,t){const r=A1(t);return e&&r!==null?jT(r,e.baseFile):null}function YO({node:e,href:t,...r}){const s=E.useContext(hm),l=Z1(s,t);return!s||l===null?y.jsx("a",{...r,href:t,target:"_blank",rel:"noopener noreferrer"}):y.jsx("a",{...r,href:t,className:"md-file-link",onClick:o=>{o.preventDefault(),s.openFile(l)}})}function GO({node:e,src:t,alt:r,...s}){const l=E.useContext(hm),o=Z1(l,typeof t=="string"?t:void 0),[c,f]=E.useState(),[d,m]=E.useState(!1),b=l==null?void 0:l.loadFile;return E.useEffect(()=>{if(o===null||!b)return;let g=!1,x;return m(!1),b(o).then(v=>{g||(x=URL.createObjectURL(v),f(x))}).catch(()=>{g||m(!0)}),()=>{g=!0,x&&URL.revokeObjectURL(x)}},[o,b]),!l||o===null?y.jsx("img",{...s,src:t,alt:r}):d?y.jsx("span",{className:"md-image-missing",children:r||o}):c?y.jsx("img",{...s,src:c,alt:r,className:"md-file-image",onClick:()=>l.openFile(o)}):y.jsx("span",{className:"md-image-loading skeleton-line"})}const JO={a:YO,img:GO};function W1({content:e,files:t,baseFile:r}){const s=E.useMemo(()=>({openFile:t.openFile,loadFile:t.loadFile,baseFile:r}),[t.openFile,t.loadFile,r]);return y.jsx(hm.Provider,{value:s,children:y.jsx(wT,{remarkPlugins:[IO,VO],urlTransform:CT,components:JO,children:e})})}function XO({filePath:e,files:t,onClose:r}){const[s,l]=E.useState(null),[o,c]=E.useState(null),{loadFile:f}=t;E.useEffect(()=>{let b=!1,g;return l(null),c(null),(async()=>{try{const x=await f(e),v=MT(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),b){g&&URL.revokeObjectURL(g);return}l(S)}catch(x){b||c(x instanceof Error?x.message:"Failed to load file.")}})(),()=>{b=!0,g&&URL.revokeObjectURL(g)}},[e,f]);const d=NT(e);function m(){if(o)return y.jsx("p",{className:"file-viewer-message",children:o});if(!s)return y.jsxs("div",{className:"file-viewer-loading",children:[y.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem"}})]});switch(s.kind){case"markdown":return y.jsx(W1,{content:s.text??"",files:t,baseFile:e});case"text":return y.jsx("pre",{className:"file-viewer-text",children:s.text});case"html":return y.jsx("iframe",{className:"file-viewer-frame",sandbox:"",srcDoc:s.text,title:d});case"image":return y.jsx("img",{src:s.objectUrl,alt:d,style:{maxWidth:"100%",height:"auto"}});case"binary":return In.isNativePlatform()?y.jsx("p",{className:"file-viewer-message",children:"Downloading this file type isn't supported in the app yet."}):y.jsxs("div",{className:"file-viewer-download",children:[y.jsxs("p",{className:"file-viewer-message",children:["This file can't be previewed (",DT(s.size),")."]}),y.jsx("a",{className:"btn btn-primary",href:s.objectUrl,download:d,children:"Download"})]})}}return y.jsx("div",{className:"report-dialog-overlay",onClick:r,children:y.jsxs("div",{className:"report-dialog",onClick:b=>b.stopPropagation(),children:[y.jsxs("div",{className:"report-dialog-header",children:[y.jsx("span",{className:"report-dialog-title",children:d}),y.jsx("button",{className:"report-dialog-close",onClick:r,"aria-label":"Close",children:y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),y.jsx("div",{className:`report-dialog-body${(s==null?void 0:s.kind)==="html"?" report-dialog-body--frame":""}`,children:m()})]})})}function KO({connected:e,hostId:t,request:r,subscribeEvents:s,taskId:l,runId:o}){const c=Fr(),f=Yd(),[d,m]=E.useState(!0),[b,g]=E.useState([]),[x,v]=E.useState(),[S,j]=E.useState(),[D,M]=E.useState(),[R,I]=E.useState(!1),ue=x==="started",B=x==="followup",P=x==="started"||x==="followup",[ee,G]=E.useState(null);Px(ee!==null,()=>G(null));const[H,z]=E.useState(!1),[K,F]=E.useState(""),[oe,te]=E.useState(!1),W=E.useRef(null),V=E.useRef(null),J=E.useRef(null),[ce,ke]=E.useState(o==="latest"?void 0:o),C=o==="latest"&&ce===null;E.useEffect(()=>{if(o!=="latest"){ke(o);return}e&&(ke(void 0),r("taskrun.list",{task_id:l,limit:1}).then(le=>{var Re,_e;return ke(((_e=(Re=le.entries)==null?void 0:Re[0])==null?void 0:_e.run_id)??null)}).catch(()=>ke(null)))},[o,l,e,r]);async function L(){if(ce)try{const le=await r("task.result",{id:l,run_id:ce});if(le.error){console.error("No result:",le.error),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0});return}g(le.messages??[]),v(le.running_state),j(le.agent),M(le.agent_version),I(!!le.starred)}catch(le){console.error("Failed to load result:",le),c(t?`/hosts/${encodeURIComponent(t)}`:"/",{replace:!0})}finally{m(!1)}}async function X(){if(!ce)return;const le=!R;I(le);try{const Re=await r("taskrun.star",{task_id:l,run_id:ce,starred:le});if(Re.error)throw new Error(Re.error)}catch(Re){console.error("Failed to update star:",Re),I(!le)}}const N=E.useCallback(le=>ce?OT(r,l,ce,le):Promise.reject(new Error("Run not loaded.")),[r,l,ce]),ve=E.useMemo(()=>({openFile:G,loadFile:N}),[N]);E.useEffect(()=>{!e||!ce||(m(!0),L())},[e,l,ce]),E.useEffect(()=>!e||!t||!ce?void 0:s(t,async Re=>{try{const _e=JSON.parse(new TextDecoder().decode(Re.data));if(_e.event_type!=="running-state"&&_e.event_type!=="result-updated"||Re.subject.split(".").pop()!==l||_e.event_type==="result-updated"&&_e.run_id&&_e.run_id!==ce)return;L()}catch{}}),[e,t,l,ce,s,r]),E.useEffect(()=>{W.current&&(W.current.scrollTop=W.current.scrollHeight)},[b]),E.useEffect(()=>{d||C||!ce||J.current!==ce&&(J.current=ce,requestAnimationFrame(()=>{W.current&&(W.current.scrollTop=W.current.scrollHeight),window.scrollTo({top:document.documentElement.scrollHeight,behavior:"auto"})}))},[d,C,ce]);function Ae(le){if(le==="input")return"User Input";if(le==="permission")return"Permission";if(le==="confirmation")return"Confirmation"}function Ee(le){return le==="started"?"Task started":le==="finished"?"Task finished":le==="failed"?"Task failed":le==="error"?"Command failed":le==="aborted"?"Task aborted":le==="confirmation"?"Task confirmed":le==="stopped"?"Follow-up stopped":le??""}return y.jsxs("div",{className:"run-detail",children:[y.jsxs("div",{className:"run-detail-header",children:[y.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),!d&&!C&&y.jsx($x,{starred:R,onToggle:X})]}),C?y.jsxs("div",{className:"empty-state",children:[y.jsx("p",{className:"empty-state-text",children:"No runs yet"}),y.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?y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[y.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),y.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"chat-thread",ref:W,children:[b.map((le,Re)=>{const _e=P&&le.role==="assistant"&&!b.slice(Re+1).some(Fe=>Fe.role==="assistant"||Fe.role==="user");return le.role==="status"?y.jsxs("div",{className:`chat-status${le.type==="error"?" chat-status--error":""}`,children:[y.jsxs("div",{children:[Ee(le.type),le.time>0&&y.jsx("span",{className:"chat-status-time",children:f(le.time)})]}),le.content&&y.jsx("pre",{className:"chat-status-detail",children:le.content})]},Re):y.jsxs("div",{className:`chat-message chat-message--${le.role}${le.role==="assistant"&&le.stream==="stderr"?" chat-message--stderr":""}`,children:[le.role==="assistant"&&S&&y.jsxs("div",{className:"chat-message-agent",children:[yd(S),D&&y.jsxs("span",{className:"chat-message-agent-version",children:[" v",D]})]}),y.jsxs("div",{className:"chat-message-content",children:[y.jsx(W1,{content:le.content,files:ve}),_e&&y.jsxs("div",{className:"chat-typing-indicator",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})]}),le.attachments&&le.attachments.length>0&&y.jsx("div",{className:"chat-message-attachments",children:le.attachments.map(Fe=>y.jsx("button",{className:"chat-attachment-chip",onClick:()=>G(Fe),children:Fe},Fe))}),y.jsxs("div",{className:"chat-message-meta",children:[Ae(le.type)&&y.jsx("span",{className:"chat-message-type",children:Ae(le.type)}),le.model&&y.jsxs("span",{children:[le.model," ·"]}),le.time>0&&y.jsx("span",{children:f(le.time)})]})]},Re)}),P&&(()=>{const le=b.filter(Re=>Re.role!=="status");return le.length===0||le[le.length-1].role!=="assistant"})()&&y.jsxs("div",{className:"chat-message chat-message--assistant",children:[S&&y.jsxs("div",{className:"chat-message-agent",children:[yd(S),D&&y.jsxs("span",{className:"chat-message-agent-version",children:[" v",D]})]}),y.jsxs("div",{className:"chat-typing-indicator",children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})]})]}),ue||B?y.jsx("div",{className:"chat-input-bar",children:y.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:H,"aria-label":"Abort task",onClick:async()=>{if(confirm("Abort this task?")){z(!0);try{await r("task.abort",{id:l})}catch(le){console.error("Abort failed:",le)}finally{z(!1)}}},children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):y.jsxs("form",{className:"chat-input-bar",onSubmit:async le=>{le.preventDefault();const Re=K.trim();if(!(!Re||oe)){te(!0);try{await r("task.followup",{id:l,run_id:ce,message:Re}),F("")}catch(_e){console.error("Follow-up failed:",_e)}finally{te(!1)}}},children:[y.jsx("input",{ref:V,className:"chat-input",type:"text",placeholder:"Follow-up message",value:K,onChange:le=>F(le.target.value),disabled:oe}),y.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!K.trim()||oe,children:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),y.jsxs("button",{className:"run-detail-back run-detail-back--footer",onClick:()=>c(-1),children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:y.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]})]}),ee&&y.jsx(XO,{filePath:ee,files:ve,onClose:()=>G(null)})]})}function Zh({title:e,message:t,onUpdate:r,onDismiss:s}){return y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:e}),y.jsx("p",{className:"confirm-modal-message",children:t}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-primary",onClick:r,children:"Update Now"}),s&&y.jsx("button",{className:"btn btn-secondary",onClick:s,children:"Dismiss"})]})]})})}function QO(){const{activeHost:e}=xi(),t=E.useRef(null);E.useEffect(()=>{if(In.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 SE("/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 wE("/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 ZO="0.9.9",Wh=13e4;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}=Wi(),{connected:s,request:l,subscribeEvents:o,unauthorized:c,activeHost:f}=xi(),d=f.hostId,m=f.clientToken||null,b=Fr(),g=xr(),x=Yu(),v=Ix("(min-width: 768px)"),S=g.pathname.endsWith("/tasks"),j=x.runId?void 0:x.taskId,D=!!(x.taskId&&x.runId),[M,R]=E.useState(!1),[I,ue]=E.useState(!1),[B,P]=E.useState(null),[ee,G]=E.useState(null),[H,z]=E.useState(null),[K,F]=E.useState(null),[oe,te]=E.useState({}),[W,V]=E.useState({}),[J,ce]=E.useState(null),[ke,C]=E.useState(null),[L,X]=E.useState(null),[N,ve]=E.useState(null),[Ae,Ee]=E.useState(new Set),[le,Re]=E.useState([]),[_e,Fe]=E.useState(),[Ht,Rt]=E.useState("loading"),[Qt,zt]=E.useState(0),tn=E.useRef(0),Yt=E.useCallback(()=>{tn.current=0,Rt("loading"),zt(he=>he+1)},[]),nn=!!m&&N===m,[Ke,ht]=E.useState(new Map),[dt,xt]=E.useState(new Map),[Gt,En]=E.useState(new Map),[st,sr]=E.useState(new Map),[fe,we]=E.useState(new Map),[He,Qe]=E.useState(new Map),[qe,xe]=E.useState(new Map),[Ie,je]=E.useState(new Map);QO(),E.useEffect(()=>{window.scrollTo(0,0)},[d]),E.useEffect(()=>{let he=!1;return eC().then(Ne=>{he||Ee(Ne)}),()=>{he=!0}},[]),E.useEffect(()=>{if(!s){tn.current=0,Rt("loading");return}Rt(De=>De==="error"?De:"loading");let he=!1,Ne;return l("host.info",void 0,{timeout:15e3}).then(De=>{var rt,vt,qt,Dn,ns,rs,Jt,Jr,k;if(he)return;Re(De.agents??[]),ce(De.playwright_cli??null),Fe(De.host_platform),ve(De.linked_client_token??null),zE(De.agents??[]);const Je=De.version??null;G(Je),R(!!Je&&vu(Je,ZO)),t(d,De.lan_url??void 0),r(d,De.host_timezone);const Ve=new Map,pt=new Map,nt=new Map,Be=new Map,Ue=new Map;for(const T of De.pending_prompts??[])if(T.type==="confirmation")Ve.set(T.key,{description:((rt=T.meta)==null?void 0:rt.description)??"",sessionName:(vt=T.meta)==null?void 0:vt.session_name});else if(T.type==="choice")pt.set(T.key,{question:((qt=T.meta)==null?void 0:qt.description)??"",options:T.params??[],sessionName:(Dn=T.meta)==null?void 0:Dn.session_name});else if(T.type==="permission")nt.set(T.key,{permissions:T.params??[],sessionName:(ns=T.meta)==null?void 0:ns.session_name});else if(T.type==="input"){const O=T.params??((rs=T.meta)==null?void 0:rs.input_questions)??[];Be.set(T.key,{questions:O,description:(Jt=T.meta)==null?void 0:Jt.description,sessionName:(Jr=T.meta)==null?void 0:Jr.session_name,secret:(k=T.meta)==null?void 0:k.secret}),Ue.set(T.key,new Array(O.length).fill(""))}ht(Ve),xt(pt),En(nt),sr(Be),we(Ue),tn.current=0,Rt("ready")}).catch(()=>{if(he)return;Rt("error");const De=Math.min(2e3*2**tn.current,3e4);tn.current++,Ne=window.setTimeout(()=>zt(Je=>Je+1),De)}),()=>{he=!0,clearTimeout(Ne)}},[s,d,l,t,r,Qt]),E.useEffect(()=>{if(Ht!=="error")return;function he(){document.visibilityState==="visible"&&Yt()}return document.addEventListener("visibilitychange",he),()=>document.removeEventListener("visibilitychange",he)},[Ht,Yt]),E.useEffect(()=>s?o(d,Ne=>{const De=Ne.subject.split(".");if(De.length<3)return;const Je=De.slice(2).join(".");let Ve={};try{Ve=JSON.parse(new TextDecoder().decode(Ne.data))}catch{return}const pt=Ve.event_type,nt=Ve.session_id;if(pt==="input-request"&&nt){const Be=Ve.input_questions,Ue=Ve.session_name,rt=Ve.description,vt=Ve.secret;Be!=null&&Be.length&&(sr(qt=>{if(qt.has(nt))return qt;const Dn=new Map(qt);return Dn.set(nt,{questions:Be,description:rt,sessionName:Ue,secret:vt}),Dn}),we(qt=>{if(qt.has(nt))return qt;const Dn=new Map(qt);return Dn.set(nt,new Array(Be.length).fill("")),Dn}));return}if(pt==="input-resolved"&&nt){sr(Be=>{if(!Be.has(nt))return Be;const Ue=new Map(Be);return Ue.delete(nt),Ue}),we(Be=>{const Ue=new Map(Be);return Ue.delete(nt),Ue}),Qe(Be=>{if(!Be.has(nt))return Be;const Ue=new Map(Be);return Ue.delete(nt),Ue});return}if(pt==="confirm-request"&&nt){const Be=Ve.description,Ue=Ve.session_name;Be&&ht(rt=>{if(rt.has(nt))return rt;const vt=new Map(rt);return vt.set(nt,{description:Be,sessionName:Ue}),vt});return}if(pt==="confirm-resolved"&&nt){ht(Be=>{if(!Be.has(nt))return Be;const Ue=new Map(Be);return Ue.delete(nt),Ue});return}if(pt==="choice-request"&&nt){const Be=Ve.description,Ue=Ve.options,rt=Ve.session_name;Be&&(Ue!=null&&Ue.length)&&xt(vt=>{if(vt.has(nt))return vt;const qt=new Map(vt);return qt.set(nt,{question:Be,options:Ue,sessionName:rt}),qt});return}if(pt==="choice-resolved"&&nt){xt(Be=>{if(!Be.has(nt))return Be;const Ue=new Map(Be);return Ue.delete(nt),Ue});return}if(pt==="permission-request"){const Be=Ve.required_permissions,Ue=Ve.session_name;Be!=null&&Be.length&&En(rt=>{if(rt.has(Je))return rt;const vt=new Map(rt);return vt.set(Je,{permissions:Be,sessionName:Ue}),vt});return}if(pt==="permission-resolved"){En(Be=>{if(!Be.has(Je))return Be;const Ue=new Map(Be);return Ue.delete(Je),Ue});return}}):void 0,[s,d,o]);async function Ge(he,Ne,De,Je){if(!qe.has(he)){xe(Ve=>new Map(Ve).set(he,Ne)),je(Ve=>{const pt=new Map(Ve);return pt.delete(he),pt});try{await l("task.user_input",{id:he,value:De},{timeout:3e4}),Je()}catch(Ve){console.error("[Dashboard] Failed to send user input:",Ve),je(pt=>new Map(pt).set(he,"Couldn't reach the host. Try again."))}finally{xe(Ve=>{const pt=new Map(Ve);return pt.delete(he),pt})}}}function yt(he,Ne){Ge(he,Ne,[Ne],()=>{ht(De=>{const Je=new Map(De);return Je.delete(he),Je})})}function ut(he,Ne){Ge(he,Ne,[Ne],()=>{xt(De=>{const Je=new Map(De);return Je.delete(he),Je})})}function xn(he,Ne){Ge(he,Ne,[Ne],()=>{En(De=>{const Je=new Map(De);return Je.delete(he),Je})})}function cn(he,Ne,De){Ge(he,Ne,De,()=>{sr(Je=>{const Ve=new Map(Je);return Ve.delete(he),Ve}),we(Je=>{const Ve=new Map(Je);return Ve.delete(he),Ve}),Qe(Je=>{const Ve=new Map(Je);return Ve.delete(he),Ve})})}function wi(he,Ne){if(!_s())return;const De=`/hosts/${encodeURIComponent(d)}/runs/${encodeURIComponent(he)}`;b(Ne?`${De}/${encodeURIComponent(Ne)}`:De)}E.useEffect(()=>{if(!ee)return;let he=!1;return fetch("https://registry.npmjs.org/palmier/latest").then(Ne=>Ne.ok?Ne.json():null).then(Ne=>{!he&&(Ne!=null&&Ne.version)&&z(Ne.version)}).catch(()=>{}),()=>{he=!0}},[ee]),E.useEffect(()=>{let he=!1;for(const Ne of le)!Ne.version||!Ne.npmPackage||fetch(`https://registry.npmjs.org/${Ne.npmPackage}/latest`).then(De=>De.ok?De.json():null).then(De=>{he||!(De!=null&&De.version)||te(Je=>Je[Ne.key]===De.version?Je:{...Je,[Ne.key]:De.version})}).catch(()=>{});return()=>{he=!0}},[le]);const mn=le.find(he=>{if(!he.version)return!1;const Ne=oe[he.key];return!Ne||!vu(he.version,Ne)?!1:W[he.key]!==Ne});function vr(he,Ne){V(De=>({...De,[he]:Ne}))}async function Rr(he){ue("agent"),P(null);try{const Ne=await l("host.updateAgent",{key:he},{timeout:Wh});if(Ne.error){P(Ne.error),ue(!1);return}const De=await l("host.info");De.agents&&Re(De.agents)}catch(Ne){P(Ne instanceof Error?Ne.message:String(Ne))}finally{ue(!1)}}E.useEffect(()=>{if(!(J!=null&&J.npmPackage))return;let he=!1;return fetch(`https://registry.npmjs.org/${J.npmPackage}/latest`).then(Ne=>Ne.ok?Ne.json():null).then(Ne=>{!he&&(Ne!=null&&Ne.version)&&C(Ne.version)}).catch(()=>{}),()=>{he=!0}},[J==null?void 0:J.npmPackage,J==null?void 0:J.version]);const Cn=J&&ke&&vu(J.version,ke)&&L!==ke?J:null;function Vr(he){X(he)}async function Yr(){ue("playwright"),P(null);try{const he=await l("host.updatePlaywrightCli",void 0,{timeout:Wh});if(he.error){P(he.error),ue(!1);return}const Ne=await l("host.info");ce(Ne.playwright_cli??null)}catch(he){P(he instanceof Error?he.message:String(he))}finally{ue(!1)}}const Gr=!M&&!!ee&&!!H&&vu(ee,H)&&K!==H;function Si(){H&&F(H)}async function Mr(){ue("daemon"),P(null);try{const he=await l("host.update",void 0,{timeout:Wh});if(he.error){P(he.error),ue(!1);return}}catch{}setTimeout(()=>window.location.reload(),3e4)}const An=Ke.size>0||dt.size>0||Gt.size>0||st.size>0,Dr=s&&!c;return y.jsxs("div",{className:"dashboard",children:[v&&y.jsx(Q0,{daemonVersion:ee,agents:le,playwrightCli:J,linkedClientToken:N,request:l,onEnabledCapabilitiesChange:Ee,onLinkedClientTokenChange:ve}),y.jsxs("div",{className:"dashboard-content",children:[y.jsxs("header",{className:"app-header",children:[y.jsxs("div",{className:"app-title-bar",children:[!v&&y.jsx(Q0,{daemonVersion:ee,agents:le,playwrightCli:J,linkedClientToken:N,request:l,onEnabledCapabilitiesChange:Ee,onLinkedClientTokenChange:ve}),y.jsx("h1",{className:"app-title",children:"Palmier"}),y.jsx(aC,{})]}),y.jsx("div",{className:"tab-bar",children:y.jsx(QE,{})})]}),y.jsx("main",{className:"dashboard-main",children:c?y.jsxs("div",{className:"revoked-state",children:[y.jsx("div",{className:"revoked-icon",children:y.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[y.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),y.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),y.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),y.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),y.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),y.jsx("div",{className:"revoked-command",children:y.jsx("code",{children:"palmier pair"})}),y.jsxs("div",{className:"revoked-actions",children:[y.jsx("button",{className:"btn btn-primary",onClick:()=>{_s()&&b("/pair")},children:"Re-pair Device"}),y.jsx("button",{className:"btn btn-secondary",onClick:()=>{e(d),b("/",{replace:!0})},children:"Remove Host"})]})]}):Dr?y.jsxs(y.Fragment,{children:[S&&!D&&y.jsx(KE,{connected:s,hostId:d,request:l,subscribeEvents:o,agents:le,hostPlatform:_e,isNotificationListener:nn&&Ae.has("notifications"),onViewRun:wi,hostInfoStatus:Ht,onRetryHostInfo:Yt}),D?y.jsx(KO,{connected:s,hostId:d,request:l,subscribeEvents:o,taskId:x.taskId,runId:decodeURIComponent(x.runId)}):S?null:y.jsx(cC,{connected:s,hostId:d,request:l,subscribeEvents:o,agents:le,hostPlatform:_e,filterTaskId:j,onClearFilter:()=>{_s()&&b(`/hosts/${encodeURIComponent(d)}`)},hostInfoStatus:Ht,onRetryHostInfo:Yt})]}):y.jsx("div",{className:"empty-state",children:y.jsx("p",{className:"empty-state-text",children:"Connecting to host…"})})}),(M||Gr)&&!I&&!B&&!An&&y.jsx(Zh,{title:M?"Update Required":"Update Available",message:M?`Your Palmier host${ee?` (v${ee})`:""} is too old for this version of the app. Please update to continue.`:`A new version of Palmier (v${H}) is available. You're running v${ee}.`,onUpdate:Mr,onDismiss:M?void 0:Si}),!M&&!Gr&&mn&&!I&&!B&&!An&&y.jsx(Zh,{title:"Agent Update Available",message:`A new version of ${mn.label} (v${oe[mn.key]}) is available. You're running v${mn.version}.`,onUpdate:()=>Rr(mn.key),onDismiss:()=>vr(mn.key,oe[mn.key])}),!M&&!Gr&&!mn&&Cn&&ke&&!I&&!B&&!An&&y.jsx(Zh,{title:"Browser Automation Update Available",message:`A new version of ${Cn.label} (v${ke}) is available. You're running v${Cn.version}.`,onUpdate:Yr,onDismiss:()=>Vr(ke)}),I&&y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),y.jsx("p",{className:"confirm-modal-message",children:I==="daemon"?"Installing update and restarting daemon. Please wait...":"Installing update. Please wait..."})]})}),B&&y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),y.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:B}),y.jsx("div",{className:"confirm-modal-actions",children:y.jsx("button",{className:"btn btn-secondary",onClick:()=>{P(null)},children:"Retry"})})]})})]}),pi.createPortal(y.jsxs(y.Fragment,{children:[[...Ke.entries()].map(([he,{description:Ne,sessionName:De}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),De&&y.jsx("p",{className:"confirm-modal-subtitle",children:De}),y.jsx("p",{className:"confirm-modal-message",children:Ne}),Ie.has(he)&&y.jsx("p",{className:"form-error",children:Ie.get(he)}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsxs("button",{className:"btn btn-primary",disabled:qe.has(he),onClick:()=>yt(he,"confirmed"),children:[qe.get(he)==="confirmed"&&y.jsx("span",{className:"btn-spinner"}),"Confirm"]}),y.jsxs("button",{className:"btn btn-secondary",disabled:qe.has(he),onClick:()=>yt(he,"aborted"),children:[qe.get(he)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})]})},he)),[...dt.entries()].map(([he,{question:Ne,options:De,sessionName:Je}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Question"}),Je&&y.jsx("p",{className:"confirm-modal-subtitle",children:Je}),y.jsx("p",{className:"confirm-modal-message",children:Ne}),Ie.has(he)&&y.jsx("p",{className:"form-error",children:Ie.get(he)}),y.jsx("div",{className:`confirm-modal-actions${De.length===2&&De.every(Ve=>Ve.length<=16)?"":" choice-options-stacked"}`,children:De.map((Ve,pt)=>y.jsxs("button",{className:"btn btn-secondary",disabled:qe.has(he),onClick:()=>ut(he,String(pt)),children:[qe.get(he)===String(pt)&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),Ve]},pt))}),y.jsxs("button",{className:"permission-abort-link",disabled:qe.has(he),onClick:()=>ut(he,"aborted"),children:[qe.get(he)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort Task"]})]})},he)),[...Gt.entries()].map(([he,{permissions:Ne,sessionName:De}])=>y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal permission-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),y.jsx("p",{className:"confirm-modal-message",children:y.jsx("strong",{children:De||he})}),y.jsx("div",{className:"permission-list",children:Ne.map((Je,Ve)=>y.jsxs("div",{className:"permission-item",children:[y.jsx("span",{className:"permission-name",children:Je.name}),Je.description&&y.jsx("span",{className:"permission-desc",children:Je.description})]},Ve))}),Ie.has(he)&&y.jsx("p",{className:"form-error",children:Ie.get(he)}),y.jsxs("div",{className:"permission-actions",children:[y.jsxs("button",{className:"btn btn-primary",disabled:qe.has(he),onClick:()=>xn(he,"granted"),children:[qe.get(he)==="granted"&&y.jsx("span",{className:"btn-spinner"}),"Allow Once"]}),y.jsxs("button",{className:"btn btn-secondary",disabled:qe.has(he),onClick:()=>xn(he,"granted_all"),children:[qe.get(he)==="granted_all"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Allow Always"]})]}),y.jsxs("button",{className:"permission-abort-link",disabled:qe.has(he),onClick:()=>xn(he,"aborted"),children:[qe.get(he)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Deny & Abort Task"]})]})},he)),[...st.entries()].map(([he,{questions:Ne,description:De,sessionName:Je,secret:Ve}])=>{const pt=fe.get(he)??new Array(Ne.length).fill("");return y.jsx("div",{className:"confirm-modal-overlay",children:y.jsxs("div",{className:"confirm-modal input-modal",children:[y.jsx("h2",{className:"confirm-modal-title",children:Ve?"Password Required":"Input Required"}),Je&&y.jsx("p",{className:"confirm-modal-subtitle",children:Je}),De&&y.jsx("p",{className:"confirm-modal-message",children:De}),y.jsx("div",{className:"input-list",children:Ne.map((nt,Be)=>y.jsxs("div",{className:"input-item",children:[y.jsx("label",{className:"input-label",children:nt}),y.jsx("input",{type:Ve?"password":"text",autoComplete:Ve?"off":void 0,className:"input-field",value:pt[Be]??"",onChange:Ue=>{we(rt=>{const vt=new Map(rt),qt=[...vt.get(he)??[]];return qt[Be]=Ue.target.value,vt.set(he,qt),vt})},disabled:qe.has(he),autoFocus:Be===0})]},Be))}),Ve&&y.jsxs("label",{className:"toggle-label input-save-toggle",children:[y.jsx("input",{type:"checkbox",checked:He.get(he)??!0,disabled:qe.has(he),onChange:nt=>Qe(Be=>new Map(Be).set(he,nt.target.checked))}),"Save this password"]}),Ie.has(he)&&y.jsx("p",{className:"form-error",children:Ie.get(he)}),y.jsx("div",{className:"input-actions",children:y.jsxs("button",{className:"btn btn-primary",disabled:qe.has(he)||pt.some(nt=>!nt.trim()),onClick:()=>{const nt=Ve?[...pt,He.get(he)??!0?"save":"nosave"]:pt;cn(he,"submit",nt)},children:[qe.get(he)==="submit"&&y.jsx("span",{className:"btn-spinner"}),"Submit"]})}),y.jsxs("button",{className:"permission-abort-link",disabled:qe.has(he),onClick:()=>cn(he,"aborted",["aborted"]),children:[qe.get(he)==="aborted"&&y.jsx("span",{className:"btn-spinner btn-spinner-current"}),"Abort"]})]})},he)})]}),document.body)]})}const WO=Es("Preferences",{web:()=>Vd(()=>import("./web-miCfAJBc.js"),[]).then(e=>new e.PreferencesWeb)}),Al=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),$b=In.isNativePlatform();function e4(){const[e,t]=E.useState(""),[r,s]=E.useState(!0),[l,o]=E.useState(!1),[c,f]=E.useState(null),{addPairedHost:d,pairedHosts:m}=Wi(),b=Fr();async function g(){const x=e.trim().toUpperCase();if(!x){f("Enter a pairing code.");return}o(!0),f(null);try{let v;if(Al){const D=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:x,label:navigator.userAgent})});if(!D.ok){const M=await D.json().catch(()=>({error:"Connection failed"}));throw new Error(M.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 M=await D.json();if(!M.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const R=await Dx({servers:M.natsWsUrl,authenticator:Ex(M.natsJwt,new TextEncoder().encode(M.natsNkeySeed))}),I=Ru(),ue=`pair.${x}`,B=await R.request(ue,I.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});v=JSON.parse(I.decode(B.data)),await R.close()}const S={hostId:v.hostId,clientToken:v.clientToken,directUrl:Al?window.location.origin:void 0,...v.hostName?{name:v.hostName}:{}};if(d(S),In.isNativePlatform()&&Sn){await WO.set({key:"hostId",value:v.hostId});try{const{token:D}=await Sn.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)}`;b($b&&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{o(!1)}}return y.jsx("div",{className:"pair-page",children:y.jsxs("div",{className:"pair-card",children:[y.jsxs("div",{className:"pair-header",children:[y.jsx("h1",{className:"pair-title",children:Al?"Pair":"Pair with Host"}),y.jsx("p",{className:"pair-subtitle",children:Al?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!Al&&y.jsxs("div",{className:"pair-instructions",children:[y.jsxs("div",{className:"pair-instruction-block",children:[y.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),y.jsxs("ol",{className:"pair-steps",children:[y.jsxs("li",{children:["Install Palmier on your host machine.",y.jsx("span",{className:"pair-platform-label",children:"Linux / macOS:"}),y.jsx("code",{className:"pair-command",children:"curl -fsSL https://palmier.me/install.sh | bash"}),y.jsx("span",{className:"pair-platform-label",children:"Windows (PowerShell):"}),y.jsx("code",{className:"pair-command",children:"irm https://palmier.me/install.ps1 | iex"})]}),y.jsxs("li",{children:["Run the setup wizard:",y.jsx("code",{className:"pair-command",children:"palmier init"})]}),y.jsx("li",{children:"A pairing code will display automatically"})]})]}),y.jsx("div",{className:"pair-instruction-divider"}),y.jsxs("div",{className:"pair-instruction-block",children:[y.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),y.jsxs("ol",{className:"pair-steps",children:[y.jsxs("li",{children:["Run ",y.jsx("code",{children:"palmier pair"})," on the host machine"]}),y.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),y.jsxs("div",{className:"pair-form",children:[y.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",y.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&&y.jsxs("label",{className:"pair-checkbox",children:[y.jsx("input",{type:"checkbox",checked:r,onChange:x=>s(x.target.checked),disabled:l}),y.jsxs("span",{className:"pair-checkbox-text",children:[y.jsx("span",{className:"pair-checkbox-title",children:"Link the host to this device"}),y.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&&y.jsx("p",{className:"pair-error",children:c}),y.jsxs("button",{className:"btn btn-primary btn-full",onClick:g,disabled:l||!e.trim(),children:[l&&y.jsx("span",{className:"btn-spinner"}),l?"Pairing...":"Pair"]}),m.length>0&&y.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>b("/"),disabled:l,children:"Cancel"}),y.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",y.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",y.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function t4(){const e=Fr(),{connected:t,request:r,activeHost:s}=xi(),{setHostLanUrl:l,pairedHosts:o}=Wi(),c=o.length<=1,[f,d]=E.useState("loading"),[m,b]=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 R=!1;return r("host.info").catch(()=>({})).then(I=>{if(R)return;l(s.hostId,I.lan_url??void 0);const ue=I.linked_client_token??null;b(ue);const B=!!ue&&ue!==s.clientToken;d(B?"confirming":"linking")}),()=>{R=!0}},[t,f,s,r,l]),E.useEffect(()=>{if(f!=="linking")return;let R=!1;return(async()=>{try{if(Sn){const{token:I}=await Sn.getFcmToken();if(!I)throw new Error("Could not read FCM token");await r("device.link",{fcmToken:I})}if(R)return;c?d("wizard"):v()}catch(I){if(R)return;x(I instanceof Error?I.message:String(I)),d("linkError")}})(),()=>{R=!0}},[f]);function S(){d("linking")}function j(){v()}function D(){x(null),d("linking")}const M=f==="confirming"&&pi.createPortal(y.jsx("div",{className:"confirm-modal-overlay",onClick:j,children:y.jsxs("div",{className:"confirm-modal",onClick:R=>R.stopPropagation(),children:[y.jsx("h2",{className:"confirm-modal-title",children:"Link the host to this device?"}),y.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."}),y.jsxs("div",{className:"confirm-modal-actions",children:[y.jsx("button",{className:"btn btn-secondary",onClick:j,children:"Cancel"}),y.jsx("button",{className:"btn btn-primary",onClick:S,children:"Link"})]})]})}),document.body);if(f==="loading"||f==="confirming"||f==="linking"||f==="linkError"){const R=c,I=f==="loading"||f==="confirming"||f==="linking";return y.jsxs("div",{className:"pair-setup",children:[y.jsxs("div",{className:"pair-setup-inner",children:[R&&y.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),y.jsxs("div",{className:"pair-setup-loading",children:[I&&y.jsx("span",{className:"spinner spinner-lg"}),f==="loading"&&y.jsx("span",{children:"Connecting to host…"}),f==="confirming"&&y.jsx("span",{children:"Awaiting confirmation…"}),f==="linking"&&y.jsx("span",{children:"Linking device…"}),f==="linkError"&&y.jsxs(y.Fragment,{children:[y.jsx("p",{className:"pair-error",children:g}),y.jsx("button",{className:"btn btn-primary",onClick:D,children:"Retry"}),y.jsx("button",{className:"btn btn-secondary",onClick:v,children:"Skip linking"})]})]})]}),M]})}return y.jsx("div",{className:"pair-setup",children:y.jsxs("div",{className:"pair-setup-inner",children:[y.jsx("h1",{className:"pair-setup-title",children:"Device Capabilities"}),y.jsx("p",{className:"pair-setup-description",children:"Choose what the host can use this device for. You can change these later from the menu."}),y.jsx(Fx,{}),y.jsx("div",{className:"pair-setup-actions",children:y.jsx("button",{className:"btn btn-primary btn-full",onClick:v,children:"Finish"})})]})})}function n4(){const e=Fr();return E.useEffect(()=>{if(!Sn)return;const t=Sn.addListener("deepLink",({path:r})=>e(r));return()=>{t.then(r=>r.remove())}},[e]),null}function r4(){const{pairedHosts:e,lastHostId:t}=Wi();if(e.length===0)return y.jsx(Bl,{to:"/pair",replace:!0});const r=e.find(s=>s.hostId===t)??e[0];return y.jsx(Bl,{to:`/hosts/${encodeURIComponent(r.hostId)}`,replace:!0})}function i4(){const{hostId:e}=Yu(),{pairedHosts:t,setLastHostId:r}=Wi(),s=t.find(l=>l.hostId===e)??null;return E.useEffect(()=>{s&&r(s.hostId)},[s==null?void 0:s.hostId,r]),s?y.jsx(CE,{activeHost:s,children:y.jsxs(ax,{children:[y.jsx(Cr,{index:!0,element:y.jsx(wu,{},e)}),y.jsx(Cr,{path:"tasks",element:y.jsx(wu,{},e)}),y.jsx(Cr,{path:"runs/:taskId",element:y.jsx(wu,{},e)}),y.jsx(Cr,{path:"runs/:taskId/:runId",element:y.jsx(wu,{},e)}),y.jsx(Cr,{path:"pair/setup",element:y.jsx(t4,{})}),y.jsx(Cr,{path:"*",element:y.jsx(Bl,{to:".",replace:!0})})]})},`${s.hostId}|${s.clientToken}`):y.jsx(Bl,{to:"/",replace:!0})}function s4(){return y.jsxs(K_,{children:[y.jsx(n4,{}),y.jsxs(ax,{children:[y.jsx(Cr,{path:"/",element:y.jsx(r4,{})}),y.jsx(Cr,{path:"/pair",element:y.jsx(e4,{})}),y.jsx(Cr,{path:"/hosts/:hostId/*",element:y.jsx(i4,{})}),y.jsx(Cr,{path:"*",element:y.jsx(Bl,{to:"/",replace:!0})})]})]})}yS.createRoot(document.getElementById("root")).render(y.jsx(E.StrictMode,{children:y.jsx(U_,{children:y.jsx(s4,{})})}));export{$d as W};
|