palmier 0.7.8 → 0.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/mcp-tools.d.ts +2 -0
  3. package/dist/mcp-tools.js +4 -2
  4. package/dist/platform/linux.js +11 -8
  5. package/dist/platform/windows.d.ts +5 -6
  6. package/dist/platform/windows.js +15 -12
  7. package/dist/pwa/assets/index-FP1Mipr6.js +120 -0
  8. package/dist/pwa/assets/index-bLTn8zBj.css +1 -0
  9. package/dist/pwa/assets/{web-BNr628AV.js → web-BpM3fNCn.js} +1 -1
  10. package/dist/pwa/assets/{web-DyQPewAi.js → web-CF-N8Di6.js} +1 -1
  11. package/dist/pwa/index.html +2 -2
  12. package/dist/pwa/service-worker.js +1 -1
  13. package/dist/rpc-handler.js +23 -8
  14. package/dist/task.js +1 -1
  15. package/dist/transports/http-transport.js +3 -5
  16. package/dist/types.d.ts +9 -6
  17. package/package.json +1 -1
  18. package/palmier-server/README.md +3 -3
  19. package/palmier-server/pwa/src/App.css +117 -36
  20. package/palmier-server/pwa/src/components/PullToRefreshIndicator.tsx +46 -0
  21. package/palmier-server/pwa/src/components/RunDetailView.tsx +58 -15
  22. package/palmier-server/pwa/src/components/SessionComposer.tsx +20 -10
  23. package/palmier-server/pwa/src/components/{RunsView.tsx → SessionsView.tsx} +33 -25
  24. package/palmier-server/pwa/src/components/TaskCard.tsx +33 -35
  25. package/palmier-server/pwa/src/components/TaskForm.tsx +274 -293
  26. package/palmier-server/pwa/src/components/{TaskListView.tsx → TasksView.tsx} +20 -13
  27. package/palmier-server/pwa/src/contexts/HostStoreContext.tsx +16 -8
  28. package/palmier-server/pwa/src/hooks/usePullToRefresh.ts +102 -0
  29. package/palmier-server/pwa/src/pages/Dashboard.tsx +9 -26
  30. package/palmier-server/pwa/src/types.ts +5 -9
  31. package/palmier-server/spec.md +23 -23
  32. package/src/mcp-tools.ts +6 -2
  33. package/src/platform/linux.ts +10 -8
  34. package/src/platform/windows.ts +15 -12
  35. package/src/rpc-handler.ts +26 -10
  36. package/src/task.ts +1 -1
  37. package/src/transports/http-transport.ts +3 -5
  38. package/src/types.ts +9 -7
  39. package/dist/pwa/assets/index-8cTctVnD.js +0 -120
  40. package/dist/pwa/assets/index-CSUkBBsQ.css +0 -1
@@ -1,120 +0,0 @@
1
- var Iw=Object.defineProperty;var Fw=(e,n,r)=>n in e?Iw(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var E=(e,n,r)=>Fw(e,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function r(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function a(l){if(l.ep)return;l.ep=!0;const u=r(l);fetch(l.href,u)}})();function zb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ah={exports:{}},cl={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var $y;function $w(){if($y)return cl;$y=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(a,l,u){var c=null;if(u!==void 0&&(c=""+u),l.key!==void 0&&(c=""+l.key),"key"in l){u={};for(var f in l)f!=="key"&&(u[f]=l[f])}else u=l;return l=u.ref,{$$typeof:e,type:a,key:c,ref:l!==void 0?l:null,props:u}}return cl.Fragment=n,cl.jsx=r,cl.jsxs=r,cl}var Gy;function Gw(){return Gy||(Gy=1,ah.exports=$w()),ah.exports}var v=Gw(),sh={exports:{}},$e={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Yy;function Yw(){if(Yy)return $e;Yy=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function w(P){return P===null||typeof P!="object"?null:(P=b&&P[b]||P["@@iterator"],typeof P=="function"?P:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,U={};function T(P,re,j){this.props=P,this.context=re,this.refs=U,this.updater=j||k}T.prototype.isReactComponent={},T.prototype.setState=function(P,re){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,re,"setState")},T.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function F(){}F.prototype=T.prototype;function V(P,re,j){this.props=P,this.context=re,this.refs=U,this.updater=j||k}var le=V.prototype=new F;le.constructor=V,R(le,T.prototype),le.isPureReactComponent=!0;var L=Array.isArray;function D(){}var J={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function q(P,re,j){var be=j.ref;return{$$typeof:e,type:P,key:re,ref:be!==void 0?be:null,props:j}}function A(P,re){return q(P.type,re,P.props)}function K(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function Z(P){var re={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(j){return re[j]})}var ue=/\/+/g;function he(P,re){return typeof P=="object"&&P!==null&&P.key!=null?Z(""+P.key):re.toString(36)}function I(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(D,D):(P.status="pending",P.then(function(re){P.status==="pending"&&(P.status="fulfilled",P.value=re)},function(re){P.status==="pending"&&(P.status="rejected",P.reason=re)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function Y(P,re,j,be,Re){var Te=typeof P;(Te==="undefined"||Te==="boolean")&&(P=null);var De=!1;if(P===null)De=!0;else switch(Te){case"bigint":case"string":case"number":De=!0;break;case"object":switch(P.$$typeof){case e:case n:De=!0;break;case y:return De=P._init,Y(De(P._payload),re,j,be,Re)}}if(De)return Re=Re(P),De=be===""?"."+he(P,0):be,L(Re)?(j="",De!=null&&(j=De.replace(ue,"$&/")+"/"),Y(Re,re,j,"",function(tt){return tt})):Re!=null&&(K(Re)&&(Re=A(Re,j+(Re.key==null||P&&P.key===Re.key?"":(""+Re.key).replace(ue,"$&/")+"/")+De)),re.push(Re)),1;De=0;var Fe=be===""?".":be+":";if(L(P))for(var Ce=0;Ce<P.length;Ce++)be=P[Ce],Te=Fe+he(be,Ce),De+=Y(be,re,j,Te,Re);else if(Ce=w(P),typeof Ce=="function")for(P=Ce.call(P),Ce=0;!(be=P.next()).done;)be=be.value,Te=Fe+he(be,Ce++),De+=Y(be,re,j,Te,Re);else if(Te==="object"){if(typeof P.then=="function")return Y(I(P),re,j,be,Re);throw re=String(P),Error("Objects are not valid as a React child (found: "+(re==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":re)+"). If you meant to render a collection of children, use an array instead.")}return De}function ae(P,re,j){if(P==null)return P;var be=[],Re=0;return Y(P,be,"","",function(Te){return re.call(j,Te,Re++)}),be}function ce(P){if(P._status===-1){var re=P._result;re=re(),re.then(function(j){(P._status===0||P._status===-1)&&(P._status=1,P._result=j)},function(j){(P._status===0||P._status===-1)&&(P._status=2,P._result=j)}),P._status===-1&&(P._status=0,P._result=re)}if(P._status===1)return P._result.default;throw P._result}var Ae=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var re=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(re))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},O={map:ae,forEach:function(P,re,j){ae(P,function(){re.apply(this,arguments)},j)},count:function(P){var re=0;return ae(P,function(){re++}),re},toArray:function(P){return ae(P,function(re){return re})||[]},only:function(P){if(!K(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return $e.Activity=g,$e.Children=O,$e.Component=T,$e.Fragment=r,$e.Profiler=l,$e.PureComponent=V,$e.StrictMode=a,$e.Suspense=m,$e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=J,$e.__COMPILER_RUNTIME={__proto__:null,c:function(P){return J.H.useMemoCache(P)}},$e.cache=function(P){return function(){return P.apply(null,arguments)}},$e.cacheSignal=function(){return null},$e.cloneElement=function(P,re,j){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var be=R({},P.props),Re=P.key;if(re!=null)for(Te in re.key!==void 0&&(Re=""+re.key),re)!B.call(re,Te)||Te==="key"||Te==="__self"||Te==="__source"||Te==="ref"&&re.ref===void 0||(be[Te]=re[Te]);var Te=arguments.length-2;if(Te===1)be.children=j;else if(1<Te){for(var De=Array(Te),Fe=0;Fe<Te;Fe++)De[Fe]=arguments[Fe+2];be.children=De}return q(P.type,Re,be)},$e.createContext=function(P){return P={$$typeof:c,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:u,_context:P},P},$e.createElement=function(P,re,j){var be,Re={},Te=null;if(re!=null)for(be in re.key!==void 0&&(Te=""+re.key),re)B.call(re,be)&&be!=="key"&&be!=="__self"&&be!=="__source"&&(Re[be]=re[be]);var De=arguments.length-2;if(De===1)Re.children=j;else if(1<De){for(var Fe=Array(De),Ce=0;Ce<De;Ce++)Fe[Ce]=arguments[Ce+2];Re.children=Fe}if(P&&P.defaultProps)for(be in De=P.defaultProps,De)Re[be]===void 0&&(Re[be]=De[be]);return q(P,Te,Re)},$e.createRef=function(){return{current:null}},$e.forwardRef=function(P){return{$$typeof:f,render:P}},$e.isValidElement=K,$e.lazy=function(P){return{$$typeof:y,_payload:{_status:-1,_result:P},_init:ce}},$e.memo=function(P,re){return{$$typeof:d,type:P,compare:re===void 0?null:re}},$e.startTransition=function(P){var re=J.T,j={};J.T=j;try{var be=P(),Re=J.S;Re!==null&&Re(j,be),typeof be=="object"&&be!==null&&typeof be.then=="function"&&be.then(D,Ae)}catch(Te){Ae(Te)}finally{re!==null&&j.types!==null&&(re.types=j.types),J.T=re}},$e.unstable_useCacheRefresh=function(){return J.H.useCacheRefresh()},$e.use=function(P){return J.H.use(P)},$e.useActionState=function(P,re,j){return J.H.useActionState(P,re,j)},$e.useCallback=function(P,re){return J.H.useCallback(P,re)},$e.useContext=function(P){return J.H.useContext(P)},$e.useDebugValue=function(){},$e.useDeferredValue=function(P,re){return J.H.useDeferredValue(P,re)},$e.useEffect=function(P,re){return J.H.useEffect(P,re)},$e.useEffectEvent=function(P){return J.H.useEffectEvent(P)},$e.useId=function(){return J.H.useId()},$e.useImperativeHandle=function(P,re,j){return J.H.useImperativeHandle(P,re,j)},$e.useInsertionEffect=function(P,re){return J.H.useInsertionEffect(P,re)},$e.useLayoutEffect=function(P,re){return J.H.useLayoutEffect(P,re)},$e.useMemo=function(P,re){return J.H.useMemo(P,re)},$e.useOptimistic=function(P,re){return J.H.useOptimistic(P,re)},$e.useReducer=function(P,re,j){return J.H.useReducer(P,re,j)},$e.useRef=function(P){return J.H.useRef(P)},$e.useState=function(P){return J.H.useState(P)},$e.useSyncExternalStore=function(P,re,j){return J.H.useSyncExternalStore(P,re,j)},$e.useTransition=function(){return J.H.useTransition()},$e.version="19.2.4",$e}var Vy;function kd(){return Vy||(Vy=1,sh.exports=Yw()),sh.exports}var z=kd(),lh={exports:{}},fl={},oh={exports:{}},uh={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var Jy;function Vw(){return Jy||(Jy=1,(function(e){function n(Y,ae){var ce=Y.length;Y.push(ae);e:for(;0<ce;){var Ae=ce-1>>>1,O=Y[Ae];if(0<l(O,ae))Y[Ae]=ae,Y[ce]=O,ce=Ae;else break e}}function r(Y){return Y.length===0?null:Y[0]}function a(Y){if(Y.length===0)return null;var ae=Y[0],ce=Y.pop();if(ce!==ae){Y[0]=ce;e:for(var Ae=0,O=Y.length,P=O>>>1;Ae<P;){var re=2*(Ae+1)-1,j=Y[re],be=re+1,Re=Y[be];if(0>l(j,ce))be<O&&0>l(Re,j)?(Y[Ae]=Re,Y[be]=ce,Ae=be):(Y[Ae]=j,Y[re]=ce,Ae=re);else if(be<O&&0>l(Re,ce))Y[Ae]=Re,Y[be]=ce,Ae=be;else break e}}return ae}function l(Y,ae){var ce=Y.sortIndex-ae.sortIndex;return ce!==0?ce:Y.id-ae.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],d=[],y=1,g=null,b=3,w=!1,k=!1,R=!1,U=!1,T=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function le(Y){for(var ae=r(d);ae!==null;){if(ae.callback===null)a(d);else if(ae.startTime<=Y)a(d),ae.sortIndex=ae.expirationTime,n(m,ae);else break;ae=r(d)}}function L(Y){if(R=!1,le(Y),!k)if(r(m)!==null)k=!0,D||(D=!0,Z());else{var ae=r(d);ae!==null&&I(L,ae.startTime-Y)}}var D=!1,J=-1,B=5,q=-1;function A(){return U?!0:!(e.unstable_now()-q<B)}function K(){if(U=!1,D){var Y=e.unstable_now();q=Y;var ae=!0;try{e:{k=!1,R&&(R=!1,F(J),J=-1),w=!0;var ce=b;try{t:{for(le(Y),g=r(m);g!==null&&!(g.expirationTime>Y&&A());){var Ae=g.callback;if(typeof Ae=="function"){g.callback=null,b=g.priorityLevel;var O=Ae(g.expirationTime<=Y);if(Y=e.unstable_now(),typeof O=="function"){g.callback=O,le(Y),ae=!0;break t}g===r(m)&&a(m),le(Y)}else a(m);g=r(m)}if(g!==null)ae=!0;else{var P=r(d);P!==null&&I(L,P.startTime-Y),ae=!1}}break e}finally{g=null,b=ce,w=!1}ae=void 0}}finally{ae?Z():D=!1}}}var Z;if(typeof V=="function")Z=function(){V(K)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,he=ue.port2;ue.port1.onmessage=K,Z=function(){he.postMessage(null)}}else Z=function(){T(K,0)};function I(Y,ae){J=T(function(){Y(e.unstable_now())},ae)}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(Y){Y.callback=null},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(Y){switch(b){case 1:case 2:case 3:var ae=3;break;default:ae=b}var ce=b;b=ae;try{return Y()}finally{b=ce}},e.unstable_requestPaint=function(){U=!0},e.unstable_runWithPriority=function(Y,ae){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var ce=b;b=Y;try{return ae()}finally{b=ce}},e.unstable_scheduleCallback=function(Y,ae,ce){var Ae=e.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?Ae+ce:Ae):ce=Ae,Y){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=ce+O,Y={id:y++,callback:ae,priorityLevel:Y,startTime:ce,expirationTime:O,sortIndex:-1},ce>Ae?(Y.sortIndex=ce,n(d,Y),r(m)===null&&Y===r(d)&&(R?(F(J),J=-1):R=!0,I(L,ce-Ae))):(Y.sortIndex=O,n(m,Y),k||w||(k=!0,D||(D=!0,Z()))),Y},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(Y){var ae=b;return function(){var ce=b;b=ae;try{return Y.apply(this,arguments)}finally{b=ce}}}})(uh)),uh}var Xy;function Jw(){return Xy||(Xy=1,oh.exports=Vw()),oh.exports}var ch={exports:{}},dn={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var Ky;function Xw(){if(Ky)return dn;Ky=1;var e=kd();function n(m){var d="https://react.dev/errors/"+m;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)d+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+m+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(m,d,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:m,containerInfo:d,implementation:y}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,d){if(m==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,dn.createPortal=function(m,d){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(n(299));return u(m,d,null,y)},dn.flushSync=function(m){var d=c.T,y=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=d,a.p=y,a.d.f()}},dn.preconnect=function(m,d){typeof m=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,a.d.C(m,d))},dn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},dn.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,w=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;y==="style"?a.d.S(m,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:w}):y==="script"&&a.d.X(m,{crossOrigin:g,integrity:b,fetchPriority:w,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},dn.preinitModule=function(m,d){if(typeof m=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var y=f(d.as,d.crossOrigin);a.d.M(m,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&a.d.M(m)},dn.preload=function(m,d){if(typeof m=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin);a.d.L(m,y,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},dn.preloadModule=function(m,d){if(typeof m=="string")if(d){var y=f(d.as,d.crossOrigin);a.d.m(m,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else a.d.m(m)},dn.requestFormReset=function(m){a.d.r(m)},dn.unstable_batchedUpdates=function(m,d){return m(d)},dn.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},dn.useFormStatus=function(){return c.H.useHostTransitionStatus()},dn.version="19.2.4",dn}var Qy;function Lb(){if(Qy)return ch.exports;Qy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),ch.exports=Xw(),ch.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var Zy;function Kw(){if(Zy)return fl;Zy=1;var e=Jw(),n=kd(),r=Lb();function a(t){var i="https://react.dev/errors/"+t;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)i+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var i=t,s=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(s=i.return),t=i.return;while(t)}return i.tag===3?s:null}function c(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function f(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function m(t){if(u(t)!==t)throw Error(a(188))}function d(t){var i=t.alternate;if(!i){if(i=u(t),i===null)throw Error(a(188));return i!==t?null:t}for(var s=t,o=i;;){var h=s.return;if(h===null)break;var p=h.alternate;if(p===null){if(o=h.return,o!==null){s=o;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===s)return m(h),t;if(p===o)return m(h),i;p=p.sibling}throw Error(a(188))}if(s.return!==o.return)s=h,o=p;else{for(var x=!1,S=h.child;S;){if(S===s){x=!0,s=h,o=p;break}if(S===o){x=!0,o=h,s=p;break}S=S.sibling}if(!x){for(S=p.child;S;){if(S===s){x=!0,s=p,o=h;break}if(S===o){x=!0,o=p,s=h;break}S=S.sibling}if(!x)throw Error(a(189))}}if(s.alternate!==o)throw Error(a(190))}if(s.tag!==3)throw Error(a(188));return s.stateNode.current===s?t:i}function y(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=y(t),i!==null)return i;t=t.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),V=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),A=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=K&&t[K]||t["@@iterator"],typeof t=="function"?t:null)}var ue=Symbol.for("react.client.reference");function he(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ue?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case R:return"Fragment";case T:return"Profiler";case U:return"StrictMode";case L:return"Suspense";case D:return"SuspenseList";case q:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case V:return t.displayName||"Context";case F:return(t._context.displayName||"Context")+".Consumer";case le:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case J:return i=t.displayName||null,i!==null?i:he(t.type)||"Memo";case B:i=t._payload,t=t._init;try{return he(t(i))}catch{}}return null}var I=Array.isArray,Y=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},Ae=[],O=-1;function P(t){return{current:t}}function re(t){0>O||(t.current=Ae[O],Ae[O]=null,O--)}function j(t,i){O++,Ae[O]=t.current,t.current=i}var be=P(null),Re=P(null),Te=P(null),De=P(null);function Fe(t,i){switch(j(Te,i),j(Re,t),j(be,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?dy(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=dy(i),t=my(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}re(be),j(be,t)}function Ce(){re(be),re(Re),re(Te)}function tt(t){t.memoizedState!==null&&j(De,t);var i=be.current,s=my(i,t.type);i!==s&&(j(Re,t),j(be,s))}function It(t){Re.current===t&&(re(be),re(Re)),De.current===t&&(re(De),sl._currentValue=ce)}var _e,qe;function ge(t){if(_e===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);_e=i&&i[1]||"",qe=-1<s.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+_e+t+qe}var Le=!1;function Ke(t,i){if(!t||Le)return"";Le=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(se){var te=se}Reflect.construct(t,[],pe)}else{try{pe.call()}catch(se){te=se}t.call(pe.prototype)}}else{try{throw Error()}catch(se){te=se}(pe=t())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(se){if(se&&te&&typeof se.stack=="string")return[se.stack,te.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),x=p[0],S=p[1];if(x&&S){var H=x.split(`
44
- `),ee=S.split(`
45
- `);for(h=o=0;o<H.length&&!H[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ee.length&&!ee[h].includes("DetermineComponentFrameRoot");)h++;if(o===H.length||h===ee.length)for(o=H.length-1,h=ee.length-1;1<=o&&0<=h&&H[o]!==ee[h];)h--;for(;1<=o&&0<=h;o--,h--)if(H[o]!==ee[h]){if(o!==1||h!==1)do if(o--,h--,0>h||H[o]!==ee[h]){var oe=`
46
- `+H[o].replace(" at new "," at ");return t.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",t.displayName)),oe}while(1<=o&&0<=h);break}}}finally{Le=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?ge(s):""}function kt(t,i){switch(t.tag){case 26:case 27:case 5:return ge(t.type);case 16:return ge("Lazy");case 13:return t.child!==i&&i!==null?ge("Suspense Fallback"):ge("Suspense");case 19:return ge("SuspenseList");case 0:case 15:return Ke(t.type,!1);case 11:return Ke(t.type.render,!1);case 1:return Ke(t.type,!0);case 31:return ge("Activity");default:return""}}function bt(t){try{var i="",s=null;do i+=kt(t,s),s=t,t=t.return;while(t);return i}catch(o){return`
47
- Error generating stack: `+o.message+`
48
- `+o.stack}}var Mt=Object.prototype.hasOwnProperty,it=e.unstable_scheduleCallback,Ie=e.unstable_cancelCallback,ht=e.unstable_shouldYield,Et=e.unstable_requestPaint,He=e.unstable_now,ln=e.unstable_getCurrentPriorityLevel,ie=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,Ue=e.unstable_NormalPriority,Ve=e.unstable_LowPriority,st=e.unstable_IdlePriority,tn=e.log,Sn=e.unstable_setDisableYieldValue,Vt=null,mt=null;function Bt(t){if(typeof tn=="function"&&Sn(t),mt&&typeof mt.setStrictMode=="function")try{mt.setStrictMode(Vt,t)}catch{}}var xe=Math.clz32?Math.clz32:Vn,Ge=Math.log,ut=Math.LN2;function Vn(t){return t>>>=0,t===0?32:31-(Ge(t)/ut|0)|0}var Ft=256,Rr=262144,ri=4194304;function ur(t){var i=t&42;if(i!==0)return i;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function qi(t,i,s){var o=t.pendingLanes;if(o===0)return 0;var h=0,p=t.suspendedLanes,x=t.pingedLanes;t=t.warmLanes;var S=o&134217727;return S!==0?(o=S&~p,o!==0?h=ur(o):(x&=S,x!==0?h=ur(x):s||(s=S&~t,s!==0&&(h=ur(s))))):(S=o&~p,S!==0?h=ur(S):x!==0?h=ur(x):s||(s=o&~t,s!==0&&(h=ur(s)))),h===0?0:i!==0&&i!==h&&(i&p)===0&&(p=h&-h,s=i&-i,p>=s||p===32&&(s&4194048)!==0)?i:h}function Ii(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function vs(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pa(){var t=ri;return ri<<=1,(ri&62914560)===0&&(ri=4194304),t}function ii(t){for(var i=[],s=0;31>s;s++)i.push(t);return i}function cr(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ai(t,i,s,o,h,p){var x=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var S=t.entanglements,H=t.expirationTimes,ee=t.hiddenUpdates;for(s=x&~s;0<s;){var oe=31-xe(s),pe=1<<oe;S[oe]=0,H[oe]=-1;var te=ee[oe];if(te!==null)for(ee[oe]=null,oe=0;oe<te.length;oe++){var se=te[oe];se!==null&&(se.lane&=-536870913)}s&=~pe}o!==0&&si(t,o,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(x&~i))}function si(t,i,s){t.pendingLanes|=i,t.suspendedLanes&=~i;var o=31-xe(i);t.entangledLanes|=i,t.entanglements[o]=t.entanglements[o]|1073741824|s&261930}function Fi(t,i){var s=t.entangledLanes|=i;for(t=t.entanglements;s;){var o=31-xe(s),h=1<<o;h&i|t[o]&i&&(t[o]|=i),s&=~h}}function li(t,i){var s=i&-i;return s=(s&42)!==0?1:Mr(s),(s&(t.suspendedLanes|i))!==0?0:s}function Mr(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function $i(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ws(){var t=ae.p;return t!==0?t:(t=window.event,t===void 0?32:Uy(t.type))}function Yl(t,i){var s=ae.p;try{return ae.p=t,i()}finally{ae.p=s}}var xr=Math.random().toString(36).slice(2),Ct="__reactFiber$"+xr,Pt="__reactProps$"+xr,Rn="__reactContainer$"+xr,Gi="__reactEvents$"+xr,Ss="__reactListeners$"+xr,Vl="__reactHandles$"+xr,Jl="__reactResources$"+xr,Wt="__reactMarker$"+xr;function ga(t){delete t[Ct],delete t[Pt],delete t[Gi],delete t[Ss],delete t[Vl]}function _(t){var i=t[Ct];if(i)return i;for(var s=t.parentNode;s;){if(i=s[Rn]||s[Ct]){if(s=i.alternate,i.child!==null||s!==null&&s.child!==null)for(t=wy(t);t!==null;){if(s=t[Ct])return s;t=wy(t)}return i}t=s,s=t.parentNode}return null}function N(t){if(t=t[Ct]||t[Rn]){var i=t.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return t}return null}function C(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t.stateNode;throw Error(a(33))}function M(t){var i=t[Jl];return i||(i=t[Jl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function $(t){t[Wt]=!0}var Q=new Set,me={};function ye(t,i){ne(t,i),ne(t+"Capture",i)}function ne(t,i){for(me[t]=i,t=0;t<i.length;t++)Q.add(i[t])}var de=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ne={},Qe={};function Nt(t){return Mt.call(Qe,t)?!0:Mt.call(Ne,t)?!1:de.test(t)?Qe[t]=!0:(Ne[t]=!0,!1)}function hn(t,i,s){if(Nt(i))if(s===null)t.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){t.removeAttribute(i);return}}t.setAttribute(i,""+s)}}function fr(t,i,s){if(s===null)t.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,""+s)}}function Dr(t,i,s,o){if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(i,s,""+o)}}function Jn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function am(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function z1(t,i,s){var o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i);if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return h.call(this)},set:function(x){s=""+x,p.call(this,x)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return s},setValue:function(x){s=""+x},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function Qu(t){if(!t._valueTracker){var i=am(t)?"checked":"value";t._valueTracker=z1(t,i,""+t[i])}}function sm(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var s=i.getValue(),o="";return t&&(o=am(t)?t.checked?"true":"false":t.value),t=o,t!==s?(i.setValue(t),!0):!1}function Xl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var L1=/[\n"\\]/g;function Xn(t){return t.replace(L1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Zu(t,i,s,o,h,p,x,S){t.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?t.type=x:t.removeAttribute("type"),i!=null?x==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+Jn(i)):t.value!==""+Jn(i)&&(t.value=""+Jn(i)):x!=="submit"&&x!=="reset"||t.removeAttribute("value"),i!=null?Wu(t,x,Jn(i)):s!=null?Wu(t,x,Jn(s)):o!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.name=""+Jn(S):t.removeAttribute("name")}function lm(t,i,s,o,h,p,x,S){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),i!=null||s!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){Qu(t);return}s=s!=null?""+Jn(s):"",i=i!=null?""+Jn(i):s,S||i===t.value||(t.value=i),t.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=S?t.checked:!!o,t.defaultChecked=!!o,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(t.name=x),Qu(t)}function Wu(t,i,s){i==="number"&&Xl(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function ya(t,i,s,o){if(t=t.options,i){i={};for(var h=0;h<s.length;h++)i["$"+s[h]]=!0;for(s=0;s<t.length;s++)h=i.hasOwnProperty("$"+t[s].value),t[s].selected!==h&&(t[s].selected=h),h&&o&&(t[s].defaultSelected=!0)}else{for(s=""+Jn(s),i=null,h=0;h<t.length;h++){if(t[h].value===s){t[h].selected=!0,o&&(t[h].defaultSelected=!0);return}i!==null||t[h].disabled||(i=t[h])}i!==null&&(i.selected=!0)}}function om(t,i,s){if(i!=null&&(i=""+Jn(i),i!==t.value&&(t.value=i),s==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=s!=null?""+Jn(s):""}function um(t,i,s,o){if(i==null){if(o!=null){if(s!=null)throw Error(a(92));if(I(o)){if(1<o.length)throw Error(a(93));o=o[0]}s=o}s==null&&(s=""),i=s}s=Jn(i),t.defaultValue=s,o=t.textContent,o===s&&o!==""&&o!==null&&(t.value=o),Qu(t)}function ba(t,i){if(i){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=i;return}}t.textContent=i}var U1=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function cm(t,i,s){var o=i.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?o?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":o?t.setProperty(i,s):typeof s!="number"||s===0||U1.has(i)?i==="float"?t.cssFloat=s:t[i]=(""+s).trim():t[i]=s+"px"}function fm(t,i,s){if(i!=null&&typeof i!="object")throw Error(a(62));if(t=t.style,s!=null){for(var o in s)!s.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&s[h]!==o&&cm(t,h,o)}else for(var p in i)i.hasOwnProperty(p)&&cm(t,p,i[p])}function ec(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var B1=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"]]),P1=/^[\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 Kl(t){return P1.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function zr(){}var tc=null;function nc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var xa=null,va=null;function hm(t){var i=N(t);if(i&&(t=i.stateNode)){var s=t[Pt]||null;e:switch(t=i.stateNode,i.type){case"input":if(Zu(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),i=s.name,s.type==="radio"&&i!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Xn(""+i)+'"][type="radio"]'),i=0;i<s.length;i++){var o=s[i];if(o!==t&&o.form===t.form){var h=o[Pt]||null;if(!h)throw Error(a(90));Zu(o,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<s.length;i++)o=s[i],o.form===t.form&&sm(o)}break e;case"textarea":om(t,s.value,s.defaultValue);break e;case"select":i=s.value,i!=null&&ya(t,!!s.multiple,i,!1)}}}var rc=!1;function dm(t,i,s){if(rc)return t(i,s);rc=!0;try{var o=t(i);return o}finally{if(rc=!1,(xa!==null||va!==null)&&(Bo(),xa&&(i=xa,t=va,va=xa=null,hm(i),t)))for(i=0;i<t.length;i++)hm(t[i])}}function _s(t,i){var s=t.stateNode;if(s===null)return null;var o=s[Pt]||null;if(o===null)return null;s=o[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(a(231,i,typeof s));return s}var Lr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ic=!1;if(Lr)try{var ks={};Object.defineProperty(ks,"passive",{get:function(){ic=!0}}),window.addEventListener("test",ks,ks),window.removeEventListener("test",ks,ks)}catch{ic=!1}var oi=null,ac=null,Ql=null;function mm(){if(Ql)return Ql;var t,i=ac,s=i.length,o,h="value"in oi?oi.value:oi.textContent,p=h.length;for(t=0;t<s&&i[t]===h[t];t++);var x=s-t;for(o=1;o<=x&&i[s-o]===h[p-o];o++);return Ql=h.slice(t,1<o?1-o:void 0)}function Zl(t){var i=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&i===13&&(t=13)):t=i,t===10&&(t=13),32<=t||t===13?t:0}function Wl(){return!0}function pm(){return!1}function _n(t){function i(s,o,h,p,x){this._reactName=s,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=x,this.currentTarget=null;for(var S in t)t.hasOwnProperty(S)&&(s=t[S],this[S]=s?s(p):p[S]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Wl:pm,this.isPropagationStopped=pm,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Wl)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Wl)},persist:function(){},isPersistent:Wl}),i}var Yi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eo=_n(Yi),Es=g({},Yi,{view:0,detail:0}),H1=_n(Es),sc,lc,Cs,to=g({},Es,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Cs&&(Cs&&t.type==="mousemove"?(sc=t.screenX-Cs.screenX,lc=t.screenY-Cs.screenY):lc=sc=0,Cs=t),sc)},movementY:function(t){return"movementY"in t?t.movementY:lc}}),gm=_n(to),q1=g({},to,{dataTransfer:0}),I1=_n(q1),F1=g({},Es,{relatedTarget:0}),oc=_n(F1),$1=g({},Yi,{animationName:0,elapsedTime:0,pseudoElement:0}),G1=_n($1),Y1=g({},Yi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),V1=_n(Y1),J1=g({},Yi,{data:0}),ym=_n(J1),X1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},K1={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"},Q1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Z1(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=Q1[t])?!!i[t]:!1}function uc(){return Z1}var W1=g({},Es,{key:function(t){if(t.key){var i=X1[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=Zl(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?K1[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uc,charCode:function(t){return t.type==="keypress"?Zl(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Zl(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ev=_n(W1),tv=g({},to,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bm=_n(tv),nv=g({},Es,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uc}),rv=_n(nv),iv=g({},Yi,{propertyName:0,elapsedTime:0,pseudoElement:0}),av=_n(iv),sv=g({},to,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),lv=_n(sv),ov=g({},Yi,{newState:0,oldState:0}),uv=_n(ov),cv=[9,13,27,32],cc=Lr&&"CompositionEvent"in window,As=null;Lr&&"documentMode"in document&&(As=document.documentMode);var fv=Lr&&"TextEvent"in window&&!As,xm=Lr&&(!cc||As&&8<As&&11>=As),vm=" ",wm=!1;function Sm(t,i){switch(t){case"keyup":return cv.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _m(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var wa=!1;function hv(t,i){switch(t){case"compositionend":return _m(i);case"keypress":return i.which!==32?null:(wm=!0,vm);case"textInput":return t=i.data,t===vm&&wm?null:t;default:return null}}function dv(t,i){if(wa)return t==="compositionend"||!cc&&Sm(t,i)?(t=mm(),Ql=ac=oi=null,wa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return xm&&i.locale!=="ko"?null:i.data;default:return null}}var 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 km(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!mv[t.type]:i==="textarea"}function Em(t,i,s,o){xa?va?va.push(o):va=[o]:xa=o,i=Go(i,"onChange"),0<i.length&&(s=new eo("onChange","change",null,s,o),t.push({event:s,listeners:i}))}var Ts=null,js=null;function pv(t){ly(t,0)}function no(t){var i=C(t);if(sm(i))return t}function Cm(t,i){if(t==="change")return i}var Am=!1;if(Lr){var fc;if(Lr){var hc="oninput"in document;if(!hc){var Tm=document.createElement("div");Tm.setAttribute("oninput","return;"),hc=typeof Tm.oninput=="function"}fc=hc}else fc=!1;Am=fc&&(!document.documentMode||9<document.documentMode)}function jm(){Ts&&(Ts.detachEvent("onpropertychange",Nm),js=Ts=null)}function Nm(t){if(t.propertyName==="value"&&no(js)){var i=[];Em(i,js,t,nc(t)),dm(pv,i)}}function gv(t,i,s){t==="focusin"?(jm(),Ts=i,js=s,Ts.attachEvent("onpropertychange",Nm)):t==="focusout"&&jm()}function yv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return no(js)}function bv(t,i){if(t==="click")return no(i)}function xv(t,i){if(t==="input"||t==="change")return no(i)}function vv(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var Mn=typeof Object.is=="function"?Object.is:vv;function Ns(t,i){if(Mn(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var s=Object.keys(t),o=Object.keys(i);if(s.length!==o.length)return!1;for(o=0;o<s.length;o++){var h=s[o];if(!Mt.call(i,h)||!Mn(t[h],i[h]))return!1}return!0}function Om(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Rm(t,i){var s=Om(t);t=0;for(var o;s;){if(s.nodeType===3){if(o=t+s.textContent.length,t<=i&&o>=i)return{node:s,offset:i-t};t=o}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Om(s)}}function Mm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Mm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Dm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Xl(t.document);i instanceof t.HTMLIFrameElement;){try{var s=typeof i.contentWindow.location.href=="string"}catch{s=!1}if(s)t=i.contentWindow;else break;i=Xl(t.document)}return i}function dc(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var wv=Lr&&"documentMode"in document&&11>=document.documentMode,Sa=null,mc=null,Os=null,pc=!1;function zm(t,i,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;pc||Sa==null||Sa!==Xl(o)||(o=Sa,"selectionStart"in o&&dc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Os&&Ns(Os,o)||(Os=o,o=Go(mc,"onSelect"),0<o.length&&(i=new eo("onSelect","select",null,i,s),t.push({event:i,listeners:o}),i.target=Sa)))}function Vi(t,i){var s={};return s[t.toLowerCase()]=i.toLowerCase(),s["Webkit"+t]="webkit"+i,s["Moz"+t]="moz"+i,s}var _a={animationend:Vi("Animation","AnimationEnd"),animationiteration:Vi("Animation","AnimationIteration"),animationstart:Vi("Animation","AnimationStart"),transitionrun:Vi("Transition","TransitionRun"),transitionstart:Vi("Transition","TransitionStart"),transitioncancel:Vi("Transition","TransitionCancel"),transitionend:Vi("Transition","TransitionEnd")},gc={},Lm={};Lr&&(Lm=document.createElement("div").style,"AnimationEvent"in window||(delete _a.animationend.animation,delete _a.animationiteration.animation,delete _a.animationstart.animation),"TransitionEvent"in window||delete _a.transitionend.transition);function Ji(t){if(gc[t])return gc[t];if(!_a[t])return t;var i=_a[t],s;for(s in i)if(i.hasOwnProperty(s)&&s in Lm)return gc[t]=i[s];return t}var Um=Ji("animationend"),Bm=Ji("animationiteration"),Pm=Ji("animationstart"),Sv=Ji("transitionrun"),_v=Ji("transitionstart"),kv=Ji("transitioncancel"),Hm=Ji("transitionend"),qm=new Map,yc="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(" ");yc.push("scrollEnd");function hr(t,i){qm.set(t,i),ye(i,[t])}var ro=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Kn=[],ka=0,bc=0;function io(){for(var t=ka,i=bc=ka=0;i<t;){var s=Kn[i];Kn[i++]=null;var o=Kn[i];Kn[i++]=null;var h=Kn[i];Kn[i++]=null;var p=Kn[i];if(Kn[i++]=null,o!==null&&h!==null){var x=o.pending;x===null?h.next=h:(h.next=x.next,x.next=h),o.pending=h}p!==0&&Im(s,h,p)}}function ao(t,i,s,o){Kn[ka++]=t,Kn[ka++]=i,Kn[ka++]=s,Kn[ka++]=o,bc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function xc(t,i,s,o){return ao(t,i,s,o),so(t)}function Xi(t,i){return ao(t,null,null,i),so(t)}function Im(t,i,s){t.lanes|=s;var o=t.alternate;o!==null&&(o.lanes|=s);for(var h=!1,p=t.return;p!==null;)p.childLanes|=s,o=p.alternate,o!==null&&(o.childLanes|=s),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&i!==null&&(h=31-xe(s),t=p.hiddenUpdates,o=t[h],o===null?t[h]=[i]:o.push(i),i.lane=s|536870912),p):null}function so(t){if(50<Ws)throw Ws=0,jf=null,Error(a(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var Ea={};function Ev(t,i,s,o){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dn(t,i,s,o){return new Ev(t,i,s,o)}function vc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Ur(t,i){var s=t.alternate;return s===null?(s=Dn(t.tag,i,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=i,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,i=t.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function Fm(t,i){t.flags&=65011714;var s=t.alternate;return s===null?(t.childLanes=0,t.lanes=i,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,i=s.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function lo(t,i,s,o,h,p){var x=0;if(o=t,typeof t=="function")vc(t)&&(x=1);else if(typeof t=="string")x=Nw(t,s,be.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case q:return t=Dn(31,s,i,h),t.elementType=q,t.lanes=p,t;case R:return Ki(s.children,h,p,i);case U:x=8,h|=24;break;case T:return t=Dn(12,s,i,h|2),t.elementType=T,t.lanes=p,t;case L:return t=Dn(13,s,i,h),t.elementType=L,t.lanes=p,t;case D:return t=Dn(19,s,i,h),t.elementType=D,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case V:x=10;break e;case F:x=9;break e;case le:x=11;break e;case J:x=14;break e;case B:x=16,o=null;break e}x=29,s=Error(a(130,t===null?"null":typeof t,"")),o=null}return i=Dn(x,s,i,h),i.elementType=t,i.type=o,i.lanes=p,i}function Ki(t,i,s,o){return t=Dn(7,t,o,i),t.lanes=s,t}function wc(t,i,s){return t=Dn(6,t,null,i),t.lanes=s,t}function $m(t){var i=Dn(18,null,null,0);return i.stateNode=t,i}function Sc(t,i,s){return i=Dn(4,t.children!==null?t.children:[],t.key,i),i.lanes=s,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var Gm=new WeakMap;function Qn(t,i){if(typeof t=="object"&&t!==null){var s=Gm.get(t);return s!==void 0?s:(i={value:t,source:i,stack:bt(i)},Gm.set(t,i),i)}return{value:t,source:i,stack:bt(i)}}var Ca=[],Aa=0,oo=null,Rs=0,Zn=[],Wn=0,ui=null,vr=1,wr="";function Br(t,i){Ca[Aa++]=Rs,Ca[Aa++]=oo,oo=t,Rs=i}function Ym(t,i,s){Zn[Wn++]=vr,Zn[Wn++]=wr,Zn[Wn++]=ui,ui=t;var o=vr;t=wr;var h=32-xe(o)-1;o&=~(1<<h),s+=1;var p=32-xe(i)+h;if(30<p){var x=h-h%5;p=(o&(1<<x)-1).toString(32),o>>=x,h-=x,vr=1<<32-xe(i)+h|s<<h|o,wr=p+t}else vr=1<<p|s<<h|o,wr=t}function _c(t){t.return!==null&&(Br(t,1),Ym(t,1,0))}function kc(t){for(;t===oo;)oo=Ca[--Aa],Ca[Aa]=null,Rs=Ca[--Aa],Ca[Aa]=null;for(;t===ui;)ui=Zn[--Wn],Zn[Wn]=null,wr=Zn[--Wn],Zn[Wn]=null,vr=Zn[--Wn],Zn[Wn]=null}function Vm(t,i){Zn[Wn++]=vr,Zn[Wn++]=wr,Zn[Wn++]=ui,vr=i.id,wr=i.overflow,ui=t}var on=null,Ot=null,at=!1,ci=null,er=!1,Ec=Error(a(519));function fi(t){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ms(Qn(i,t)),Ec}function Jm(t){var i=t.stateNode,s=t.type,o=t.memoizedProps;switch(i[Ct]=t,i[Pt]=o,s){case"dialog":We("cancel",i),We("close",i);break;case"iframe":case"object":case"embed":We("load",i);break;case"video":case"audio":for(s=0;s<tl.length;s++)We(tl[s],i);break;case"source":We("error",i);break;case"img":case"image":case"link":We("error",i),We("load",i);break;case"details":We("toggle",i);break;case"input":We("invalid",i),lm(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":We("invalid",i);break;case"textarea":We("invalid",i),um(i,o.value,o.defaultValue,o.children)}s=o.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||i.textContent===""+s||o.suppressHydrationWarning===!0||fy(i.textContent,s)?(o.popover!=null&&(We("beforetoggle",i),We("toggle",i)),o.onScroll!=null&&We("scroll",i),o.onScrollEnd!=null&&We("scrollend",i),o.onClick!=null&&(i.onclick=zr),i=!0):i=!1,i||fi(t,!0)}function Xm(t){for(on=t.return;on;)switch(on.tag){case 5:case 31:case 13:er=!1;return;case 27:case 3:er=!0;return;default:on=on.return}}function Ta(t){if(t!==on)return!1;if(!at)return Xm(t),at=!0,!1;var i=t.tag,s;if((s=i!==3&&i!==27)&&((s=i===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||$f(t.type,t.memoizedProps)),s=!s),s&&Ot&&fi(t),Xm(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));Ot=vy(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));Ot=vy(t)}else i===27?(i=Ot,Ei(t.type)?(t=Xf,Xf=null,Ot=t):Ot=i):Ot=on?nr(t.stateNode.nextSibling):null;return!0}function Qi(){Ot=on=null,at=!1}function Cc(){var t=ci;return t!==null&&(An===null?An=t:An.push.apply(An,t),ci=null),t}function Ms(t){ci===null?ci=[t]:ci.push(t)}var Ac=P(null),Zi=null,Pr=null;function hi(t,i,s){j(Ac,i._currentValue),i._currentValue=s}function Hr(t){t._currentValue=Ac.current,re(Ac)}function Tc(t,i,s){for(;t!==null;){var o=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),t===s)break;t=t.return}}function jc(t,i,s,o){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var p=h.dependencies;if(p!==null){var x=h.child;p=p.firstContext;e:for(;p!==null;){var S=p;p=h;for(var H=0;H<i.length;H++)if(S.context===i[H]){p.lanes|=s,S=p.alternate,S!==null&&(S.lanes|=s),Tc(p.return,s,t),o||(x=null);break e}p=S.next}}else if(h.tag===18){if(x=h.return,x===null)throw Error(a(341));x.lanes|=s,p=x.alternate,p!==null&&(p.lanes|=s),Tc(x,s,t),x=null}else x=h.child;if(x!==null)x.return=h;else for(x=h;x!==null;){if(x===t){x=null;break}if(h=x.sibling,h!==null){h.return=x.return,x=h;break}x=x.return}h=x}}function ja(t,i,s,o){t=null;for(var h=i,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var x=h.alternate;if(x===null)throw Error(a(387));if(x=x.memoizedProps,x!==null){var S=h.type;Mn(h.pendingProps.value,x.value)||(t!==null?t.push(S):t=[S])}}else if(h===De.current){if(x=h.alternate,x===null)throw Error(a(387));x.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(sl):t=[sl])}h=h.return}t!==null&&jc(i,t,s,o),i.flags|=262144}function uo(t){for(t=t.firstContext;t!==null;){if(!Mn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Wi(t){Zi=t,Pr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function un(t){return Km(Zi,t)}function co(t,i){return Zi===null&&Wi(t),Km(t,i)}function Km(t,i){var s=i._currentValue;if(i={context:i,memoizedValue:s,next:null},Pr===null){if(t===null)throw Error(a(308));Pr=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else Pr=Pr.next=i;return s}var Cv=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(s,o){t.push(o)}};this.abort=function(){i.aborted=!0,t.forEach(function(s){return s()})}},Av=e.unstable_scheduleCallback,Tv=e.unstable_NormalPriority,Jt={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Nc(){return{controller:new Cv,data:new Map,refCount:0}}function Ds(t){t.refCount--,t.refCount===0&&Av(Tv,function(){t.controller.abort()})}var zs=null,Oc=0,Na=0,Oa=null;function jv(t,i){if(zs===null){var s=zs=[];Oc=0,Na=zf(),Oa={status:"pending",value:void 0,then:function(o){s.push(o)}}}return Oc++,i.then(Qm,Qm),i}function Qm(){if(--Oc===0&&zs!==null){Oa!==null&&(Oa.status="fulfilled");var t=zs;zs=null,Na=0,Oa=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function Nv(t,i){var s=[],o={status:"pending",value:null,reason:null,then:function(h){s.push(h)}};return t.then(function(){o.status="fulfilled",o.value=i;for(var h=0;h<s.length;h++)(0,s[h])(i)},function(h){for(o.status="rejected",o.reason=h,h=0;h<s.length;h++)(0,s[h])(void 0)}),o}var Zm=Y.S;Y.S=function(t,i){zg=He(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&jv(t,i),Zm!==null&&Zm(t,i)};var ea=P(null);function Rc(){var t=ea.current;return t!==null?t:At.pooledCache}function fo(t,i){i===null?j(ea,ea.current):j(ea,i.pool)}function Wm(){var t=Rc();return t===null?null:{parent:Jt._currentValue,pool:t}}var Ra=Error(a(460)),Mc=Error(a(474)),ho=Error(a(542)),mo={then:function(){}};function ep(t){return t=t.status,t==="fulfilled"||t==="rejected"}function tp(t,i,s){switch(s=t[s],s===void 0?t.push(i):s!==i&&(i.then(zr,zr),i=s),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,rp(t),t;default:if(typeof i.status=="string")i.then(zr,zr);else{if(t=At,t!==null&&100<t.shellSuspendCounter)throw Error(a(482));t=i,t.status="pending",t.then(function(o){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=o}},function(o){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=o}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,rp(t),t}throw na=i,Ra}}function ta(t){try{var i=t._init;return i(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(na=s,Ra):s}}var na=null;function np(){if(na===null)throw Error(a(459));var t=na;return na=null,t}function rp(t){if(t===Ra||t===ho)throw Error(a(483))}var Ma=null,Ls=0;function po(t){var i=Ls;return Ls+=1,Ma===null&&(Ma=[]),tp(Ma,t,i)}function Us(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function go(t,i){throw i.$$typeof===b?Error(a(525)):(t=Object.prototype.toString.call(i),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function ip(t){function i(X,G){if(t){var W=X.deletions;W===null?(X.deletions=[G],X.flags|=16):W.push(G)}}function s(X,G){if(!t)return null;for(;G!==null;)i(X,G),G=G.sibling;return null}function o(X){for(var G=new Map;X!==null;)X.key!==null?G.set(X.key,X):G.set(X.index,X),X=X.sibling;return G}function h(X,G){return X=Ur(X,G),X.index=0,X.sibling=null,X}function p(X,G,W){return X.index=W,t?(W=X.alternate,W!==null?(W=W.index,W<G?(X.flags|=67108866,G):W):(X.flags|=67108866,G)):(X.flags|=1048576,G)}function x(X){return t&&X.alternate===null&&(X.flags|=67108866),X}function S(X,G,W,fe){return G===null||G.tag!==6?(G=wc(W,X.mode,fe),G.return=X,G):(G=h(G,W),G.return=X,G)}function H(X,G,W,fe){var ze=W.type;return ze===R?oe(X,G,W.props.children,fe,W.key):G!==null&&(G.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===B&&ta(ze)===G.type)?(G=h(G,W.props),Us(G,W),G.return=X,G):(G=lo(W.type,W.key,W.props,null,X.mode,fe),Us(G,W),G.return=X,G)}function ee(X,G,W,fe){return G===null||G.tag!==4||G.stateNode.containerInfo!==W.containerInfo||G.stateNode.implementation!==W.implementation?(G=Sc(W,X.mode,fe),G.return=X,G):(G=h(G,W.children||[]),G.return=X,G)}function oe(X,G,W,fe,ze){return G===null||G.tag!==7?(G=Ki(W,X.mode,fe,ze),G.return=X,G):(G=h(G,W),G.return=X,G)}function pe(X,G,W){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=wc(""+G,X.mode,W),G.return=X,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return W=lo(G.type,G.key,G.props,null,X.mode,W),Us(W,G),W.return=X,W;case k:return G=Sc(G,X.mode,W),G.return=X,G;case B:return G=ta(G),pe(X,G,W)}if(I(G)||Z(G))return G=Ki(G,X.mode,W,null),G.return=X,G;if(typeof G.then=="function")return pe(X,po(G),W);if(G.$$typeof===V)return pe(X,co(X,G),W);go(X,G)}return null}function te(X,G,W,fe){var ze=G!==null?G.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return ze!==null?null:S(X,G,""+W,fe);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case w:return W.key===ze?H(X,G,W,fe):null;case k:return W.key===ze?ee(X,G,W,fe):null;case B:return W=ta(W),te(X,G,W,fe)}if(I(W)||Z(W))return ze!==null?null:oe(X,G,W,fe,null);if(typeof W.then=="function")return te(X,G,po(W),fe);if(W.$$typeof===V)return te(X,G,co(X,W),fe);go(X,W)}return null}function se(X,G,W,fe,ze){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return X=X.get(W)||null,S(G,X,""+fe,ze);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case w:return X=X.get(fe.key===null?W:fe.key)||null,H(G,X,fe,ze);case k:return X=X.get(fe.key===null?W:fe.key)||null,ee(G,X,fe,ze);case B:return fe=ta(fe),se(X,G,W,fe,ze)}if(I(fe)||Z(fe))return X=X.get(W)||null,oe(G,X,fe,ze,null);if(typeof fe.then=="function")return se(X,G,W,po(fe),ze);if(fe.$$typeof===V)return se(X,G,W,co(G,fe),ze);go(G,fe)}return null}function Oe(X,G,W,fe){for(var ze=null,ct=null,Me=G,Je=G=0,rt=null;Me!==null&&Je<W.length;Je++){Me.index>Je?(rt=Me,Me=null):rt=Me.sibling;var ft=te(X,Me,W[Je],fe);if(ft===null){Me===null&&(Me=rt);break}t&&Me&&ft.alternate===null&&i(X,Me),G=p(ft,G,Je),ct===null?ze=ft:ct.sibling=ft,ct=ft,Me=rt}if(Je===W.length)return s(X,Me),at&&Br(X,Je),ze;if(Me===null){for(;Je<W.length;Je++)Me=pe(X,W[Je],fe),Me!==null&&(G=p(Me,G,Je),ct===null?ze=Me:ct.sibling=Me,ct=Me);return at&&Br(X,Je),ze}for(Me=o(Me);Je<W.length;Je++)rt=se(Me,X,Je,W[Je],fe),rt!==null&&(t&&rt.alternate!==null&&Me.delete(rt.key===null?Je:rt.key),G=p(rt,G,Je),ct===null?ze=rt:ct.sibling=rt,ct=rt);return t&&Me.forEach(function(Ni){return i(X,Ni)}),at&&Br(X,Je),ze}function Pe(X,G,W,fe){if(W==null)throw Error(a(151));for(var ze=null,ct=null,Me=G,Je=G=0,rt=null,ft=W.next();Me!==null&&!ft.done;Je++,ft=W.next()){Me.index>Je?(rt=Me,Me=null):rt=Me.sibling;var Ni=te(X,Me,ft.value,fe);if(Ni===null){Me===null&&(Me=rt);break}t&&Me&&Ni.alternate===null&&i(X,Me),G=p(Ni,G,Je),ct===null?ze=Ni:ct.sibling=Ni,ct=Ni,Me=rt}if(ft.done)return s(X,Me),at&&Br(X,Je),ze;if(Me===null){for(;!ft.done;Je++,ft=W.next())ft=pe(X,ft.value,fe),ft!==null&&(G=p(ft,G,Je),ct===null?ze=ft:ct.sibling=ft,ct=ft);return at&&Br(X,Je),ze}for(Me=o(Me);!ft.done;Je++,ft=W.next())ft=se(Me,X,Je,ft.value,fe),ft!==null&&(t&&ft.alternate!==null&&Me.delete(ft.key===null?Je:ft.key),G=p(ft,G,Je),ct===null?ze=ft:ct.sibling=ft,ct=ft);return t&&Me.forEach(function(qw){return i(X,qw)}),at&&Br(X,Je),ze}function wt(X,G,W,fe){if(typeof W=="object"&&W!==null&&W.type===R&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case w:e:{for(var ze=W.key;G!==null;){if(G.key===ze){if(ze=W.type,ze===R){if(G.tag===7){s(X,G.sibling),fe=h(G,W.props.children),fe.return=X,X=fe;break e}}else if(G.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===B&&ta(ze)===G.type){s(X,G.sibling),fe=h(G,W.props),Us(fe,W),fe.return=X,X=fe;break e}s(X,G);break}else i(X,G);G=G.sibling}W.type===R?(fe=Ki(W.props.children,X.mode,fe,W.key),fe.return=X,X=fe):(fe=lo(W.type,W.key,W.props,null,X.mode,fe),Us(fe,W),fe.return=X,X=fe)}return x(X);case k:e:{for(ze=W.key;G!==null;){if(G.key===ze)if(G.tag===4&&G.stateNode.containerInfo===W.containerInfo&&G.stateNode.implementation===W.implementation){s(X,G.sibling),fe=h(G,W.children||[]),fe.return=X,X=fe;break e}else{s(X,G);break}else i(X,G);G=G.sibling}fe=Sc(W,X.mode,fe),fe.return=X,X=fe}return x(X);case B:return W=ta(W),wt(X,G,W,fe)}if(I(W))return Oe(X,G,W,fe);if(Z(W)){if(ze=Z(W),typeof ze!="function")throw Error(a(150));return W=ze.call(W),Pe(X,G,W,fe)}if(typeof W.then=="function")return wt(X,G,po(W),fe);if(W.$$typeof===V)return wt(X,G,co(X,W),fe);go(X,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,G!==null&&G.tag===6?(s(X,G.sibling),fe=h(G,W),fe.return=X,X=fe):(s(X,G),fe=wc(W,X.mode,fe),fe.return=X,X=fe),x(X)):s(X,G)}return function(X,G,W,fe){try{Ls=0;var ze=wt(X,G,W,fe);return Ma=null,ze}catch(Me){if(Me===Ra||Me===ho)throw Me;var ct=Dn(29,Me,null,X.mode);return ct.lanes=fe,ct.return=X,ct}finally{}}}var ra=ip(!0),ap=ip(!1),di=!1;function Dc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zc(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function mi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function pi(t,i,s){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(dt&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=so(t),Im(t,null,s),i}return ao(t,o,i,s),so(t)}function Bs(t,i,s){if(i=i.updateQueue,i!==null&&(i=i.shared,(s&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Fi(t,s)}}function Lc(t,i){var s=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,s===o)){var h=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var x={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};p===null?h=p=x:p=p.next=x,s=s.next}while(s!==null);p===null?h=p=i:p=p.next=i}else h=p=i;s={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=i:t.next=i,s.lastBaseUpdate=i}var Uc=!1;function Ps(){if(Uc){var t=Oa;if(t!==null)throw t}}function Hs(t,i,s,o){Uc=!1;var h=t.updateQueue;di=!1;var p=h.firstBaseUpdate,x=h.lastBaseUpdate,S=h.shared.pending;if(S!==null){h.shared.pending=null;var H=S,ee=H.next;H.next=null,x===null?p=ee:x.next=ee,x=H;var oe=t.alternate;oe!==null&&(oe=oe.updateQueue,S=oe.lastBaseUpdate,S!==x&&(S===null?oe.firstBaseUpdate=ee:S.next=ee,oe.lastBaseUpdate=H))}if(p!==null){var pe=h.baseState;x=0,oe=ee=H=null,S=p;do{var te=S.lane&-536870913,se=te!==S.lane;if(se?(nt&te)===te:(o&te)===te){te!==0&&te===Na&&(Uc=!0),oe!==null&&(oe=oe.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Oe=t,Pe=S;te=i;var wt=s;switch(Pe.tag){case 1:if(Oe=Pe.payload,typeof Oe=="function"){pe=Oe.call(wt,pe,te);break e}pe=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=Pe.payload,te=typeof Oe=="function"?Oe.call(wt,pe,te):Oe,te==null)break e;pe=g({},pe,te);break e;case 2:di=!0}}te=S.callback,te!==null&&(t.flags|=64,se&&(t.flags|=8192),se=h.callbacks,se===null?h.callbacks=[te]:se.push(te))}else se={lane:te,tag:S.tag,payload:S.payload,callback:S.callback,next:null},oe===null?(ee=oe=se,H=pe):oe=oe.next=se,x|=te;if(S=S.next,S===null){if(S=h.shared.pending,S===null)break;se=S,S=se.next,se.next=null,h.lastBaseUpdate=se,h.shared.pending=null}}while(!0);oe===null&&(H=pe),h.baseState=H,h.firstBaseUpdate=ee,h.lastBaseUpdate=oe,p===null&&(h.shared.lanes=0),vi|=x,t.lanes=x,t.memoizedState=pe}}function sp(t,i){if(typeof t!="function")throw Error(a(191,t));t.call(i)}function lp(t,i){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)sp(s[t],i)}var Da=P(null),yo=P(0);function op(t,i){t=Xr,j(yo,t),j(Da,i),Xr=t|i.baseLanes}function Bc(){j(yo,Xr),j(Da,Da.current)}function Pc(){Xr=yo.current,re(Da),re(yo)}var zn=P(null),tr=null;function gi(t){var i=t.alternate;j($t,$t.current&1),j(zn,t),tr===null&&(i===null||Da.current!==null||i.memoizedState!==null)&&(tr=t)}function Hc(t){j($t,$t.current),j(zn,t),tr===null&&(tr=t)}function up(t){t.tag===22?(j($t,$t.current),j(zn,t),tr===null&&(tr=t)):yi()}function yi(){j($t,$t.current),j(zn,zn.current)}function Ln(t){re(zn),tr===t&&(tr=null),re($t)}var $t=P(0);function bo(t){for(var i=t;i!==null;){if(i.tag===13){var s=i.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Vf(s)||Jf(s)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var qr=0,Ye=null,xt=null,Xt=null,xo=!1,za=!1,ia=!1,vo=0,qs=0,La=null,Ov=0;function Ht(){throw Error(a(321))}function qc(t,i){if(i===null)return!1;for(var s=0;s<i.length&&s<t.length;s++)if(!Mn(t[s],i[s]))return!1;return!0}function Ic(t,i,s,o,h,p){return qr=p,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,Y.H=t===null||t.memoizedState===null?Yp:rf,ia=!1,p=s(o,h),ia=!1,za&&(p=fp(i,s,o,h)),cp(t),p}function cp(t){Y.H=$s;var i=xt!==null&&xt.next!==null;if(qr=0,Xt=xt=Ye=null,xo=!1,qs=0,La=null,i)throw Error(a(300));t===null||Kt||(t=t.dependencies,t!==null&&uo(t)&&(Kt=!0))}function fp(t,i,s,o){Ye=t;var h=0;do{if(za&&(La=null),qs=0,za=!1,25<=h)throw Error(a(301));if(h+=1,Xt=xt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}Y.H=Vp,p=i(s,o)}while(za);return p}function Rv(){var t=Y.H,i=t.useState()[0];return i=typeof i.then=="function"?Is(i):i,t=t.useState()[0],(xt!==null?xt.memoizedState:null)!==t&&(Ye.flags|=1024),i}function Fc(){var t=vo!==0;return vo=0,t}function $c(t,i,s){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~s}function Gc(t){if(xo){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}xo=!1}qr=0,Xt=xt=Ye=null,za=!1,qs=vo=0,La=null}function gn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Ye.memoizedState=Xt=t:Xt=Xt.next=t,Xt}function Gt(){if(xt===null){var t=Ye.alternate;t=t!==null?t.memoizedState:null}else t=xt.next;var i=Xt===null?Ye.memoizedState:Xt.next;if(i!==null)Xt=i,xt=t;else{if(t===null)throw Ye.alternate===null?Error(a(467)):Error(a(310));xt=t,t={memoizedState:xt.memoizedState,baseState:xt.baseState,baseQueue:xt.baseQueue,queue:xt.queue,next:null},Xt===null?Ye.memoizedState=Xt=t:Xt=Xt.next=t}return Xt}function wo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Is(t){var i=qs;return qs+=1,La===null&&(La=[]),t=tp(La,t,i),i=Ye,(Xt===null?i.memoizedState:Xt.next)===null&&(i=i.alternate,Y.H=i===null||i.memoizedState===null?Yp:rf),t}function So(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Is(t);if(t.$$typeof===V)return un(t)}throw Error(a(438,String(t)))}function Yc(t){var i=null,s=Ye.updateQueue;if(s!==null&&(i=s.memoCache),i==null){var o=Ye.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(i={data:o.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),s===null&&(s=wo(),Ye.updateQueue=s),s.memoCache=i,s=i.data[i.index],s===void 0)for(s=i.data[i.index]=Array(t),o=0;o<t;o++)s[o]=A;return i.index++,s}function Ir(t,i){return typeof i=="function"?i(t):i}function _o(t){var i=Gt();return Vc(i,xt,t)}function Vc(t,i,s){var o=t.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=s;var h=t.baseQueue,p=o.pending;if(p!==null){if(h!==null){var x=h.next;h.next=p.next,p.next=x}i.baseQueue=h=p,o.pending=null}if(p=t.baseState,h===null)t.memoizedState=p;else{i=h.next;var S=x=null,H=null,ee=i,oe=!1;do{var pe=ee.lane&-536870913;if(pe!==ee.lane?(nt&pe)===pe:(qr&pe)===pe){var te=ee.revertLane;if(te===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),pe===Na&&(oe=!0);else if((qr&te)===te){ee=ee.next,te===Na&&(oe=!0);continue}else pe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(S=H=pe,x=p):H=H.next=pe,Ye.lanes|=te,vi|=te;pe=ee.action,ia&&s(p,pe),p=ee.hasEagerState?ee.eagerState:s(p,pe)}else te={lane:pe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(S=H=te,x=p):H=H.next=te,Ye.lanes|=pe,vi|=pe;ee=ee.next}while(ee!==null&&ee!==i);if(H===null?x=p:H.next=S,!Mn(p,t.memoizedState)&&(Kt=!0,oe&&(s=Oa,s!==null)))throw s;t.memoizedState=p,t.baseState=x,t.baseQueue=H,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Jc(t){var i=Gt(),s=i.queue;if(s===null)throw Error(a(311));s.lastRenderedReducer=t;var o=s.dispatch,h=s.pending,p=i.memoizedState;if(h!==null){s.pending=null;var x=h=h.next;do p=t(p,x.action),x=x.next;while(x!==h);Mn(p,i.memoizedState)||(Kt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),s.lastRenderedState=p}return[p,o]}function hp(t,i,s){var o=Ye,h=Gt(),p=at;if(p){if(s===void 0)throw Error(a(407));s=s()}else s=i();var x=!Mn((xt||h).memoizedState,s);if(x&&(h.memoizedState=s,Kt=!0),h=h.queue,Qc(pp.bind(null,o,h,t),[t]),h.getSnapshot!==i||x||Xt!==null&&Xt.memoizedState.tag&1){if(o.flags|=2048,Ua(9,{destroy:void 0},mp.bind(null,o,h,s,i),null),At===null)throw Error(a(349));p||(qr&127)!==0||dp(o,i,s)}return s}function dp(t,i,s){t.flags|=16384,t={getSnapshot:i,value:s},i=Ye.updateQueue,i===null?(i=wo(),Ye.updateQueue=i,i.stores=[t]):(s=i.stores,s===null?i.stores=[t]:s.push(t))}function mp(t,i,s,o){i.value=s,i.getSnapshot=o,gp(i)&&yp(t)}function pp(t,i,s){return s(function(){gp(i)&&yp(t)})}function gp(t){var i=t.getSnapshot;t=t.value;try{var s=i();return!Mn(t,s)}catch{return!0}}function yp(t){var i=Xi(t,2);i!==null&&Tn(i,t,2)}function Xc(t){var i=gn();if(typeof t=="function"){var s=t;if(t=s(),ia){Bt(!0);try{s()}finally{Bt(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:t},i}function bp(t,i,s,o){return t.baseState=s,Vc(t,xt,typeof o=="function"?o:Ir)}function Mv(t,i,s,o,h){if(Co(t))throw Error(a(485));if(t=i.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){p.listeners.push(x)}};Y.T!==null?s(!0):p.isTransition=!1,o(p),s=i.pending,s===null?(p.next=i.pending=p,xp(i,p)):(p.next=s.next,i.pending=s.next=p)}}function xp(t,i){var s=i.action,o=i.payload,h=t.state;if(i.isTransition){var p=Y.T,x={};Y.T=x;try{var S=s(h,o),H=Y.S;H!==null&&H(x,S),vp(t,i,S)}catch(ee){Kc(t,i,ee)}finally{p!==null&&x.types!==null&&(p.types=x.types),Y.T=p}}else try{p=s(h,o),vp(t,i,p)}catch(ee){Kc(t,i,ee)}}function vp(t,i,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(o){wp(t,i,o)},function(o){return Kc(t,i,o)}):wp(t,i,s)}function wp(t,i,s){i.status="fulfilled",i.value=s,Sp(i),t.state=s,i=t.pending,i!==null&&(s=i.next,s===i?t.pending=null:(s=s.next,i.next=s,xp(t,s)))}function Kc(t,i,s){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=s,Sp(i),i=i.next;while(i!==o)}t.action=null}function Sp(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function _p(t,i){return i}function kp(t,i){if(at){var s=At.formState;if(s!==null){e:{var o=Ye;if(at){if(Ot){t:{for(var h=Ot,p=er;h.nodeType!==8;){if(!p){h=null;break t}if(h=nr(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Ot=nr(h.nextSibling),o=h.data==="F!";break e}}fi(o)}o=!1}o&&(i=s[0])}}return s=gn(),s.memoizedState=s.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_p,lastRenderedState:i},s.queue=o,s=Fp.bind(null,Ye,o),o.dispatch=s,o=Xc(!1),p=nf.bind(null,Ye,!1,o.queue),o=gn(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,s=Mv.bind(null,Ye,h,p,s),h.dispatch=s,o.memoizedState=t,[i,s,!1]}function Ep(t){var i=Gt();return Cp(i,xt,t)}function Cp(t,i,s){if(i=Vc(t,i,_p)[0],t=_o(Ir)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Is(i)}catch(x){throw x===Ra?ho:x}else o=i;i=Gt();var h=i.queue,p=h.dispatch;return s!==i.memoizedState&&(Ye.flags|=2048,Ua(9,{destroy:void 0},Dv.bind(null,h,s),null)),[o,p,t]}function Dv(t,i){t.action=i}function Ap(t){var i=Gt(),s=xt;if(s!==null)return Cp(i,s,t);Gt(),i=i.memoizedState,s=Gt();var o=s.queue.dispatch;return s.memoizedState=t,[i,o,!1]}function Ua(t,i,s,o){return t={tag:t,create:s,deps:o,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=wo(),Ye.updateQueue=i),s=i.lastEffect,s===null?i.lastEffect=t.next=t:(o=s.next,s.next=t,t.next=o,i.lastEffect=t),t}function Tp(){return Gt().memoizedState}function ko(t,i,s,o){var h=gn();Ye.flags|=t,h.memoizedState=Ua(1|i,{destroy:void 0},s,o===void 0?null:o)}function Eo(t,i,s,o){var h=Gt();o=o===void 0?null:o;var p=h.memoizedState.inst;xt!==null&&o!==null&&qc(o,xt.memoizedState.deps)?h.memoizedState=Ua(i,p,s,o):(Ye.flags|=t,h.memoizedState=Ua(1|i,p,s,o))}function jp(t,i){ko(8390656,8,t,i)}function Qc(t,i){Eo(2048,8,t,i)}function zv(t){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=wo(),Ye.updateQueue=i,i.events=[t];else{var s=i.events;s===null?i.events=[t]:s.push(t)}}function Np(t){var i=Gt().memoizedState;return zv({ref:i,nextImpl:t}),function(){if((dt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function Op(t,i){return Eo(4,2,t,i)}function Rp(t,i){return Eo(4,4,t,i)}function Mp(t,i){if(typeof i=="function"){t=t();var s=i(t);return function(){typeof s=="function"?s():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function Dp(t,i,s){s=s!=null?s.concat([t]):null,Eo(4,4,Mp.bind(null,i,t),s)}function Zc(){}function zp(t,i){var s=Gt();i=i===void 0?null:i;var o=s.memoizedState;return i!==null&&qc(i,o[1])?o[0]:(s.memoizedState=[t,i],t)}function Lp(t,i){var s=Gt();i=i===void 0?null:i;var o=s.memoizedState;if(i!==null&&qc(i,o[1]))return o[0];if(o=t(),ia){Bt(!0);try{t()}finally{Bt(!1)}}return s.memoizedState=[o,i],o}function Wc(t,i,s){return s===void 0||(qr&1073741824)!==0&&(nt&261930)===0?t.memoizedState=i:(t.memoizedState=s,t=Ug(),Ye.lanes|=t,vi|=t,s)}function Up(t,i,s,o){return Mn(s,i)?s:Da.current!==null?(t=Wc(t,s,o),Mn(t,i)||(Kt=!0),t):(qr&42)===0||(qr&1073741824)!==0&&(nt&261930)===0?(Kt=!0,t.memoizedState=s):(t=Ug(),Ye.lanes|=t,vi|=t,i)}function Bp(t,i,s,o,h){var p=ae.p;ae.p=p!==0&&8>p?p:8;var x=Y.T,S={};Y.T=S,nf(t,!1,i,s);try{var H=h(),ee=Y.S;if(ee!==null&&ee(S,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var oe=Nv(H,o);Fs(t,i,oe,Pn(t))}else Fs(t,i,o,Pn(t))}catch(pe){Fs(t,i,{then:function(){},status:"rejected",reason:pe},Pn())}finally{ae.p=p,x!==null&&S.types!==null&&(x.types=S.types),Y.T=x}}function Lv(){}function ef(t,i,s,o){if(t.tag!==5)throw Error(a(476));var h=Pp(t).queue;Bp(t,h,i,ce,s===null?Lv:function(){return Hp(t),s(o)})}function Pp(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:ce},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ir,lastRenderedState:s},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function Hp(t){var i=Pp(t);i.next===null&&(i=t.alternate.memoizedState),Fs(t,i.next.queue,{},Pn())}function tf(){return un(sl)}function qp(){return Gt().memoizedState}function Ip(){return Gt().memoizedState}function Uv(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var s=Pn();t=mi(s);var o=pi(i,t,s);o!==null&&(Tn(o,i,s),Bs(o,i,s)),i={cache:Nc()},t.payload=i;return}i=i.return}}function Bv(t,i,s){var o=Pn();s={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Co(t)?$p(i,s):(s=xc(t,i,s,o),s!==null&&(Tn(s,t,o),Gp(s,i,o)))}function Fp(t,i,s){var o=Pn();Fs(t,i,s,o)}function Fs(t,i,s,o){var h={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Co(t))$p(i,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var x=i.lastRenderedState,S=p(x,s);if(h.hasEagerState=!0,h.eagerState=S,Mn(S,x))return ao(t,i,h,0),At===null&&io(),!1}catch{}finally{}if(s=xc(t,i,h,o),s!==null)return Tn(s,t,o),Gp(s,i,o),!0}return!1}function nf(t,i,s,o){if(o={lane:2,revertLane:zf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Co(t)){if(i)throw Error(a(479))}else i=xc(t,s,o,2),i!==null&&Tn(i,t,2)}function Co(t){var i=t.alternate;return t===Ye||i!==null&&i===Ye}function $p(t,i){za=xo=!0;var s=t.pending;s===null?i.next=i:(i.next=s.next,s.next=i),t.pending=i}function Gp(t,i,s){if((s&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Fi(t,s)}}var $s={readContext:un,use:So,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};$s.useEffectEvent=Ht;var Yp={readContext:un,use:So,useCallback:function(t,i){return gn().memoizedState=[t,i===void 0?null:i],t},useContext:un,useEffect:jp,useImperativeHandle:function(t,i,s){s=s!=null?s.concat([t]):null,ko(4194308,4,Mp.bind(null,i,t),s)},useLayoutEffect:function(t,i){return ko(4194308,4,t,i)},useInsertionEffect:function(t,i){ko(4,2,t,i)},useMemo:function(t,i){var s=gn();i=i===void 0?null:i;var o=t();if(ia){Bt(!0);try{t()}finally{Bt(!1)}}return s.memoizedState=[o,i],o},useReducer:function(t,i,s){var o=gn();if(s!==void 0){var h=s(i);if(ia){Bt(!0);try{s(i)}finally{Bt(!1)}}}else h=i;return o.memoizedState=o.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},o.queue=t,t=t.dispatch=Bv.bind(null,Ye,t),[o.memoizedState,t]},useRef:function(t){var i=gn();return t={current:t},i.memoizedState=t},useState:function(t){t=Xc(t);var i=t.queue,s=Fp.bind(null,Ye,i);return i.dispatch=s,[t.memoizedState,s]},useDebugValue:Zc,useDeferredValue:function(t,i){var s=gn();return Wc(s,t,i)},useTransition:function(){var t=Xc(!1);return t=Bp.bind(null,Ye,t.queue,!0,!1),gn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,s){var o=Ye,h=gn();if(at){if(s===void 0)throw Error(a(407));s=s()}else{if(s=i(),At===null)throw Error(a(349));(nt&127)!==0||dp(o,i,s)}h.memoizedState=s;var p={value:s,getSnapshot:i};return h.queue=p,jp(pp.bind(null,o,p,t),[t]),o.flags|=2048,Ua(9,{destroy:void 0},mp.bind(null,o,p,s,i),null),s},useId:function(){var t=gn(),i=At.identifierPrefix;if(at){var s=wr,o=vr;s=(o&~(1<<32-xe(o)-1)).toString(32)+s,i="_"+i+"R_"+s,s=vo++,0<s&&(i+="H"+s.toString(32)),i+="_"}else s=Ov++,i="_"+i+"r_"+s.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:tf,useFormState:kp,useActionState:kp,useOptimistic:function(t){var i=gn();i.memoizedState=i.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=s,i=nf.bind(null,Ye,!0,s),s.dispatch=i,[t,i]},useMemoCache:Yc,useCacheRefresh:function(){return gn().memoizedState=Uv.bind(null,Ye)},useEffectEvent:function(t){var i=gn(),s={impl:t};return i.memoizedState=s,function(){if((dt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}},rf={readContext:un,use:So,useCallback:zp,useContext:un,useEffect:Qc,useImperativeHandle:Dp,useInsertionEffect:Op,useLayoutEffect:Rp,useMemo:Lp,useReducer:_o,useRef:Tp,useState:function(){return _o(Ir)},useDebugValue:Zc,useDeferredValue:function(t,i){var s=Gt();return Up(s,xt.memoizedState,t,i)},useTransition:function(){var t=_o(Ir)[0],i=Gt().memoizedState;return[typeof t=="boolean"?t:Is(t),i]},useSyncExternalStore:hp,useId:qp,useHostTransitionStatus:tf,useFormState:Ep,useActionState:Ep,useOptimistic:function(t,i){var s=Gt();return bp(s,xt,t,i)},useMemoCache:Yc,useCacheRefresh:Ip};rf.useEffectEvent=Np;var Vp={readContext:un,use:So,useCallback:zp,useContext:un,useEffect:Qc,useImperativeHandle:Dp,useInsertionEffect:Op,useLayoutEffect:Rp,useMemo:Lp,useReducer:Jc,useRef:Tp,useState:function(){return Jc(Ir)},useDebugValue:Zc,useDeferredValue:function(t,i){var s=Gt();return xt===null?Wc(s,t,i):Up(s,xt.memoizedState,t,i)},useTransition:function(){var t=Jc(Ir)[0],i=Gt().memoizedState;return[typeof t=="boolean"?t:Is(t),i]},useSyncExternalStore:hp,useId:qp,useHostTransitionStatus:tf,useFormState:Ap,useActionState:Ap,useOptimistic:function(t,i){var s=Gt();return xt!==null?bp(s,xt,t,i):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:Yc,useCacheRefresh:Ip};Vp.useEffectEvent=Np;function af(t,i,s,o){i=t.memoizedState,s=s(o,i),s=s==null?i:g({},i,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var sf={enqueueSetState:function(t,i,s){t=t._reactInternals;var o=Pn(),h=mi(o);h.payload=i,s!=null&&(h.callback=s),i=pi(t,h,o),i!==null&&(Tn(i,t,o),Bs(i,t,o))},enqueueReplaceState:function(t,i,s){t=t._reactInternals;var o=Pn(),h=mi(o);h.tag=1,h.payload=i,s!=null&&(h.callback=s),i=pi(t,h,o),i!==null&&(Tn(i,t,o),Bs(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var s=Pn(),o=mi(s);o.tag=2,i!=null&&(o.callback=i),i=pi(t,o,s),i!==null&&(Tn(i,t,s),Bs(i,t,s))}};function Jp(t,i,s,o,h,p,x){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,p,x):i.prototype&&i.prototype.isPureReactComponent?!Ns(s,o)||!Ns(h,p):!0}function Xp(t,i,s,o){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(s,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(s,o),i.state!==t&&sf.enqueueReplaceState(i,i.state,null)}function aa(t,i){var s=i;if("ref"in i){s={};for(var o in i)o!=="ref"&&(s[o]=i[o])}if(t=t.defaultProps){s===i&&(s=g({},s));for(var h in t)s[h]===void 0&&(s[h]=t[h])}return s}function Kp(t){ro(t)}function Qp(t){console.error(t)}function Zp(t){ro(t)}function Ao(t,i){try{var s=t.onUncaughtError;s(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Wp(t,i,s){try{var o=t.onCaughtError;o(s.value,{componentStack:s.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function lf(t,i,s){return s=mi(s),s.tag=3,s.payload={element:null},s.callback=function(){Ao(t,i)},s}function eg(t){return t=mi(t),t.tag=3,t}function tg(t,i,s,o){var h=s.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;t.payload=function(){return h(p)},t.callback=function(){Wp(i,s,o)}}var x=s.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(t.callback=function(){Wp(i,s,o),typeof h!="function"&&(wi===null?wi=new Set([this]):wi.add(this));var S=o.stack;this.componentDidCatch(o.value,{componentStack:S!==null?S:""})})}function Pv(t,i,s,o,h){if(s.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=s.alternate,i!==null&&ja(i,s,h,!0),s=zn.current,s!==null){switch(s.tag){case 31:case 13:return tr===null?Po():s.alternate===null&&qt===0&&(qt=3),s.flags&=-257,s.flags|=65536,s.lanes=h,o===mo?s.flags|=16384:(i=s.updateQueue,i===null?s.updateQueue=new Set([o]):i.add(o),Rf(t,o,h)),!1;case 22:return s.flags|=65536,o===mo?s.flags|=16384:(i=s.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([o])},s.updateQueue=i):(s=i.retryQueue,s===null?i.retryQueue=new Set([o]):s.add(o)),Rf(t,o,h)),!1}throw Error(a(435,s.tag))}return Rf(t,o,h),Po(),!1}if(at)return i=zn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Ec&&(t=Error(a(422),{cause:o}),Ms(Qn(t,s)))):(o!==Ec&&(i=Error(a(423),{cause:o}),Ms(Qn(i,s))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=Qn(o,s),h=lf(t.stateNode,o,h),Lc(t,h),qt!==4&&(qt=2)),!1;var p=Error(a(520),{cause:o});if(p=Qn(p,s),Zs===null?Zs=[p]:Zs.push(p),qt!==4&&(qt=2),i===null)return!0;o=Qn(o,s),s=i;do{switch(s.tag){case 3:return s.flags|=65536,t=h&-h,s.lanes|=t,t=lf(s.stateNode,o,t),Lc(s,t),!1;case 1:if(i=s.type,p=s.stateNode,(s.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(wi===null||!wi.has(p))))return s.flags|=65536,h&=-h,s.lanes|=h,h=eg(h),tg(h,t,s,o),Lc(s,h),!1}s=s.return}while(s!==null);return!1}var of=Error(a(461)),Kt=!1;function cn(t,i,s,o){i.child=t===null?ap(i,null,s,o):ra(i,t.child,s,o)}function ng(t,i,s,o,h){s=s.render;var p=i.ref;if("ref"in o){var x={};for(var S in o)S!=="ref"&&(x[S]=o[S])}else x=o;return Wi(i),o=Ic(t,i,s,x,p,h),S=Fc(),t!==null&&!Kt?($c(t,i,h),Fr(t,i,h)):(at&&S&&_c(i),i.flags|=1,cn(t,i,o,h),i.child)}function rg(t,i,s,o,h){if(t===null){var p=s.type;return typeof p=="function"&&!vc(p)&&p.defaultProps===void 0&&s.compare===null?(i.tag=15,i.type=p,ig(t,i,p,o,h)):(t=lo(s.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(p=t.child,!gf(t,h)){var x=p.memoizedProps;if(s=s.compare,s=s!==null?s:Ns,s(x,o)&&t.ref===i.ref)return Fr(t,i,h)}return i.flags|=1,t=Ur(p,o),t.ref=i.ref,t.return=i,i.child=t}function ig(t,i,s,o,h){if(t!==null){var p=t.memoizedProps;if(Ns(p,o)&&t.ref===i.ref)if(Kt=!1,i.pendingProps=o=p,gf(t,h))(t.flags&131072)!==0&&(Kt=!0);else return i.lanes=t.lanes,Fr(t,i,h)}return uf(t,i,s,o,h)}function ag(t,i,s,o){var h=o.children,p=t!==null?t.memoizedState:null;if(t===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((i.flags&128)!==0){if(p=p!==null?p.baseLanes|s:s,t!==null){for(o=i.child=t.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,i.child=null;return sg(t,i,p,s,o)}if((s&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&fo(i,p!==null?p.cachePool:null),p!==null?op(i,p):Bc(),up(i);else return o=i.lanes=536870912,sg(t,i,p!==null?p.baseLanes|s:s,s,o)}else p!==null?(fo(i,p.cachePool),op(i,p),yi(),i.memoizedState=null):(t!==null&&fo(i,null),Bc(),yi());return cn(t,i,h,s),i.child}function Gs(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function sg(t,i,s,o,h){var p=Rc();return p=p===null?null:{parent:Jt._currentValue,pool:p},i.memoizedState={baseLanes:s,cachePool:p},t!==null&&fo(i,null),Bc(),up(i),t!==null&&ja(t,i,o,!0),i.childLanes=h,null}function To(t,i){return i=No({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function lg(t,i,s){return ra(i,t.child,null,s),t=To(i,i.pendingProps),t.flags|=2,Ln(i),i.memoizedState=null,t}function Hv(t,i,s){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(at){if(o.mode==="hidden")return t=To(i,o),i.lanes=536870912,Gs(null,t);if(Hc(i),(t=Ot)?(t=xy(t,er),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ui!==null?{id:vr,overflow:wr}:null,retryLane:536870912,hydrationErrors:null},s=$m(t),s.return=i,i.child=s,on=i,Ot=null)):t=null,t===null)throw fi(i);return i.lanes=536870912,null}return To(i,o)}var p=t.memoizedState;if(p!==null){var x=p.dehydrated;if(Hc(i),h)if(i.flags&256)i.flags&=-257,i=lg(t,i,s);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(a(558));else if(Kt||ja(t,i,s,!1),h=(s&t.childLanes)!==0,Kt||h){if(o=At,o!==null&&(x=li(o,s),x!==0&&x!==p.retryLane))throw p.retryLane=x,Xi(t,x),Tn(o,t,x),of;Po(),i=lg(t,i,s)}else t=p.treeContext,Ot=nr(x.nextSibling),on=i,at=!0,ci=null,er=!1,t!==null&&Vm(i,t),i=To(i,o),i.flags|=4096;return i}return t=Ur(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function jo(t,i){var s=i.ref;if(s===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(a(284));(t===null||t.ref!==s)&&(i.flags|=4194816)}}function uf(t,i,s,o,h){return Wi(i),s=Ic(t,i,s,o,void 0,h),o=Fc(),t!==null&&!Kt?($c(t,i,h),Fr(t,i,h)):(at&&o&&_c(i),i.flags|=1,cn(t,i,s,h),i.child)}function og(t,i,s,o,h,p){return Wi(i),i.updateQueue=null,s=fp(i,o,s,h),cp(t),o=Fc(),t!==null&&!Kt?($c(t,i,p),Fr(t,i,p)):(at&&o&&_c(i),i.flags|=1,cn(t,i,s,p),i.child)}function ug(t,i,s,o,h){if(Wi(i),i.stateNode===null){var p=Ea,x=s.contextType;typeof x=="object"&&x!==null&&(p=un(x)),p=new s(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=sf,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Dc(i),x=s.contextType,p.context=typeof x=="object"&&x!==null?un(x):Ea,p.state=i.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(af(i,s,x,o),p.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(x=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),x!==p.state&&sf.enqueueReplaceState(p,p.state,null),Hs(i,o,p,h),Ps(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(t===null){p=i.stateNode;var S=i.memoizedProps,H=aa(s,S);p.props=H;var ee=p.context,oe=s.contextType;x=Ea,typeof oe=="object"&&oe!==null&&(x=un(oe));var pe=s.getDerivedStateFromProps;oe=typeof pe=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=i.pendingProps!==S,oe||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||ee!==x)&&Xp(i,p,o,x),di=!1;var te=i.memoizedState;p.state=te,Hs(i,o,p,h),Ps(),ee=i.memoizedState,S||te!==ee||di?(typeof pe=="function"&&(af(i,s,pe,o),ee=i.memoizedState),(H=di||Jp(i,s,H,o,te,ee,x))?(oe||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(i.flags|=4194308)):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=o,i.memoizedState=ee),p.props=o,p.state=ee,p.context=x,o=H):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,zc(t,i),x=i.memoizedProps,oe=aa(s,x),p.props=oe,pe=i.pendingProps,te=p.context,ee=s.contextType,H=Ea,typeof ee=="object"&&ee!==null&&(H=un(ee)),S=s.getDerivedStateFromProps,(ee=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==pe||te!==H)&&Xp(i,p,o,H),di=!1,te=i.memoizedState,p.state=te,Hs(i,o,p,h),Ps();var se=i.memoizedState;x!==pe||te!==se||di||t!==null&&t.dependencies!==null&&uo(t.dependencies)?(typeof S=="function"&&(af(i,s,S,o),se=i.memoizedState),(oe=di||Jp(i,s,oe,o,te,se,H)||t!==null&&t.dependencies!==null&&uo(t.dependencies))?(ee||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,se,H),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,se,H)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===t.memoizedProps&&te===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&te===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=se),p.props=o,p.state=se,p.context=H,o=oe):(typeof p.componentDidUpdate!="function"||x===t.memoizedProps&&te===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&te===t.memoizedState||(i.flags|=1024),o=!1)}return p=o,jo(t,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,s=o&&typeof s.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,t!==null&&o?(i.child=ra(i,t.child,null,h),i.child=ra(i,null,s,h)):cn(t,i,s,h),i.memoizedState=p.state,t=i.child):t=Fr(t,i,h),t}function cg(t,i,s,o){return Qi(),i.flags|=256,cn(t,i,s,o),i.child}var cf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ff(t){return{baseLanes:t,cachePool:Wm()}}function hf(t,i,s){return t=t!==null?t.childLanes&~s:0,i&&(t|=Bn),t}function fg(t,i,s){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,x;if((x=p)||(x=t!==null&&t.memoizedState===null?!1:($t.current&2)!==0),x&&(h=!0,i.flags&=-129),x=(i.flags&32)!==0,i.flags&=-33,t===null){if(at){if(h?gi(i):yi(),(t=Ot)?(t=xy(t,er),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ui!==null?{id:vr,overflow:wr}:null,retryLane:536870912,hydrationErrors:null},s=$m(t),s.return=i,i.child=s,on=i,Ot=null)):t=null,t===null)throw fi(i);return Jf(t)?i.lanes=32:i.lanes=536870912,null}var S=o.children;return o=o.fallback,h?(yi(),h=i.mode,S=No({mode:"hidden",children:S},h),o=Ki(o,h,s,null),S.return=i,o.return=i,S.sibling=o,i.child=S,o=i.child,o.memoizedState=ff(s),o.childLanes=hf(t,x,s),i.memoizedState=cf,Gs(null,o)):(gi(i),df(i,S))}var H=t.memoizedState;if(H!==null&&(S=H.dehydrated,S!==null)){if(p)i.flags&256?(gi(i),i.flags&=-257,i=mf(t,i,s)):i.memoizedState!==null?(yi(),i.child=t.child,i.flags|=128,i=null):(yi(),S=o.fallback,h=i.mode,o=No({mode:"visible",children:o.children},h),S=Ki(S,h,s,null),S.flags|=2,o.return=i,S.return=i,o.sibling=S,i.child=o,ra(i,t.child,null,s),o=i.child,o.memoizedState=ff(s),o.childLanes=hf(t,x,s),i.memoizedState=cf,i=Gs(null,o));else if(gi(i),Jf(S)){if(x=S.nextSibling&&S.nextSibling.dataset,x)var ee=x.dgst;x=ee,o=Error(a(419)),o.stack="",o.digest=x,Ms({value:o,source:null,stack:null}),i=mf(t,i,s)}else if(Kt||ja(t,i,s,!1),x=(s&t.childLanes)!==0,Kt||x){if(x=At,x!==null&&(o=li(x,s),o!==0&&o!==H.retryLane))throw H.retryLane=o,Xi(t,o),Tn(x,t,o),of;Vf(S)||Po(),i=mf(t,i,s)}else Vf(S)?(i.flags|=192,i.child=t.child,i=null):(t=H.treeContext,Ot=nr(S.nextSibling),on=i,at=!0,ci=null,er=!1,t!==null&&Vm(i,t),i=df(i,o.children),i.flags|=4096);return i}return h?(yi(),S=o.fallback,h=i.mode,H=t.child,ee=H.sibling,o=Ur(H,{mode:"hidden",children:o.children}),o.subtreeFlags=H.subtreeFlags&65011712,ee!==null?S=Ur(ee,S):(S=Ki(S,h,s,null),S.flags|=2),S.return=i,o.return=i,o.sibling=S,i.child=o,Gs(null,o),o=i.child,S=t.child.memoizedState,S===null?S=ff(s):(h=S.cachePool,h!==null?(H=Jt._currentValue,h=h.parent!==H?{parent:H,pool:H}:h):h=Wm(),S={baseLanes:S.baseLanes|s,cachePool:h}),o.memoizedState=S,o.childLanes=hf(t,x,s),i.memoizedState=cf,Gs(t.child,o)):(gi(i),s=t.child,t=s.sibling,s=Ur(s,{mode:"visible",children:o.children}),s.return=i,s.sibling=null,t!==null&&(x=i.deletions,x===null?(i.deletions=[t],i.flags|=16):x.push(t)),i.child=s,i.memoizedState=null,s)}function df(t,i){return i=No({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function No(t,i){return t=Dn(22,t,null,i),t.lanes=0,t}function mf(t,i,s){return ra(i,t.child,null,s),t=df(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function hg(t,i,s){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),Tc(t.return,i,s)}function pf(t,i,s,o,h,p){var x=t.memoizedState;x===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:s,tailMode:h,treeForkCount:p}:(x.isBackwards=i,x.rendering=null,x.renderingStartTime=0,x.last=o,x.tail=s,x.tailMode=h,x.treeForkCount=p)}function dg(t,i,s){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var x=$t.current,S=(x&2)!==0;if(S?(x=x&1|2,i.flags|=128):x&=1,j($t,x),cn(t,i,o,s),o=at?Rs:0,!S&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&hg(t,s,i);else if(t.tag===19)hg(t,s,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break e;for(;t.sibling===null;){if(t.return===null||t.return===i)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(s=i.child,h=null;s!==null;)t=s.alternate,t!==null&&bo(t)===null&&(h=s),s=s.sibling;s=h,s===null?(h=i.child,i.child=null):(h=s.sibling,s.sibling=null),pf(i,!1,h,s,p,o);break;case"backwards":case"unstable_legacy-backwards":for(s=null,h=i.child,i.child=null;h!==null;){if(t=h.alternate,t!==null&&bo(t)===null){i.child=h;break}t=h.sibling,h.sibling=s,s=h,h=t}pf(i,!0,s,null,p,o);break;case"together":pf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Fr(t,i,s){if(t!==null&&(i.dependencies=t.dependencies),vi|=i.lanes,(s&i.childLanes)===0)if(t!==null){if(ja(t,i,s,!1),(s&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(a(153));if(i.child!==null){for(t=i.child,s=Ur(t,t.pendingProps),i.child=s,s.return=i;t.sibling!==null;)t=t.sibling,s=s.sibling=Ur(t,t.pendingProps),s.return=i;s.sibling=null}return i.child}function gf(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&uo(t)))}function qv(t,i,s){switch(i.tag){case 3:Fe(i,i.stateNode.containerInfo),hi(i,Jt,t.memoizedState.cache),Qi();break;case 27:case 5:tt(i);break;case 4:Fe(i,i.stateNode.containerInfo);break;case 10:hi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Hc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(gi(i),i.flags|=128,null):(s&i.child.childLanes)!==0?fg(t,i,s):(gi(i),t=Fr(t,i,s),t!==null?t.sibling:null);gi(i);break;case 19:var h=(t.flags&128)!==0;if(o=(s&i.childLanes)!==0,o||(ja(t,i,s,!1),o=(s&i.childLanes)!==0),h){if(o)return dg(t,i,s);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),j($t,$t.current),o)break;return null;case 22:return i.lanes=0,ag(t,i,s,i.pendingProps);case 24:hi(i,Jt,t.memoizedState.cache)}return Fr(t,i,s)}function mg(t,i,s){if(t!==null)if(t.memoizedProps!==i.pendingProps)Kt=!0;else{if(!gf(t,s)&&(i.flags&128)===0)return Kt=!1,qv(t,i,s);Kt=(t.flags&131072)!==0}else Kt=!1,at&&(i.flags&1048576)!==0&&Ym(i,Rs,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(t=ta(i.elementType),i.type=t,typeof t=="function")vc(t)?(o=aa(t,o),i.tag=1,i=ug(null,i,t,o,s)):(i.tag=0,i=uf(null,i,t,o,s));else{if(t!=null){var h=t.$$typeof;if(h===le){i.tag=11,i=ng(null,i,t,o,s);break e}else if(h===J){i.tag=14,i=rg(null,i,t,o,s);break e}}throw i=he(t)||t,Error(a(306,i,""))}}return i;case 0:return uf(t,i,i.type,i.pendingProps,s);case 1:return o=i.type,h=aa(o,i.pendingProps),ug(t,i,o,h,s);case 3:e:{if(Fe(i,i.stateNode.containerInfo),t===null)throw Error(a(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,zc(t,i),Hs(i,o,null,s);var x=i.memoizedState;if(o=x.cache,hi(i,Jt,o),o!==p.cache&&jc(i,[Jt],s,!0),Ps(),o=x.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:x.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=cg(t,i,o,s);break e}else if(o!==h){h=Qn(Error(a(424)),i),Ms(h),i=cg(t,i,o,s);break e}else{switch(t=i.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Ot=nr(t.firstChild),on=i,at=!0,ci=null,er=!0,s=ap(i,null,o,s),i.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(Qi(),o===h){i=Fr(t,i,s);break e}cn(t,i,o,s)}i=i.child}return i;case 26:return jo(t,i),t===null?(s=Ey(i.type,null,i.pendingProps,null))?i.memoizedState=s:at||(s=i.type,t=i.pendingProps,o=Yo(Te.current).createElement(s),o[Ct]=i,o[Pt]=t,fn(o,s,t),$(o),i.stateNode=o):i.memoizedState=Ey(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return tt(i),t===null&&at&&(o=i.stateNode=Sy(i.type,i.pendingProps,Te.current),on=i,er=!0,h=Ot,Ei(i.type)?(Xf=h,Ot=nr(o.firstChild)):Ot=h),cn(t,i,i.pendingProps.children,s),jo(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&at&&((h=o=Ot)&&(o=yw(o,i.type,i.pendingProps,er),o!==null?(i.stateNode=o,on=i,Ot=nr(o.firstChild),er=!1,h=!0):h=!1),h||fi(i)),tt(i),h=i.type,p=i.pendingProps,x=t!==null?t.memoizedProps:null,o=p.children,$f(h,p)?o=null:x!==null&&$f(h,x)&&(i.flags|=32),i.memoizedState!==null&&(h=Ic(t,i,Rv,null,null,s),sl._currentValue=h),jo(t,i),cn(t,i,o,s),i.child;case 6:return t===null&&at&&((t=s=Ot)&&(s=bw(s,i.pendingProps,er),s!==null?(i.stateNode=s,on=i,Ot=null,t=!0):t=!1),t||fi(i)),null;case 13:return fg(t,i,s);case 4:return Fe(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=ra(i,null,o,s):cn(t,i,o,s),i.child;case 11:return ng(t,i,i.type,i.pendingProps,s);case 7:return cn(t,i,i.pendingProps,s),i.child;case 8:return cn(t,i,i.pendingProps.children,s),i.child;case 12:return cn(t,i,i.pendingProps.children,s),i.child;case 10:return o=i.pendingProps,hi(i,i.type,o.value),cn(t,i,o.children,s),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,Wi(i),h=un(h),o=o(h),i.flags|=1,cn(t,i,o,s),i.child;case 14:return rg(t,i,i.type,i.pendingProps,s);case 15:return ig(t,i,i.type,i.pendingProps,s);case 19:return dg(t,i,s);case 31:return Hv(t,i,s);case 22:return ag(t,i,s,i.pendingProps);case 24:return Wi(i),o=un(Jt),t===null?(h=Rc(),h===null&&(h=At,p=Nc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=s),h=p),i.memoizedState={parent:o,cache:h},Dc(i),hi(i,Jt,h)):((t.lanes&s)!==0&&(zc(t,i),Hs(i,null,null,s),Ps()),h=t.memoizedState,p=i.memoizedState,h.parent!==o?(h={parent:o,cache:o},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),hi(i,Jt,o)):(o=p.cache,hi(i,Jt,o),o!==h.cache&&jc(i,[Jt],s,!0))),cn(t,i,i.pendingProps.children,s),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function $r(t){t.flags|=4}function yf(t,i,s,o,h){if((i=(t.mode&32)!==0)&&(i=!1),i){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(qg())t.flags|=8192;else throw na=mo,Mc}else t.flags&=-16777217}function pg(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Ny(i))if(qg())t.flags|=8192;else throw na=mo,Mc}function Oo(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?pa():536870912,t.lanes|=i,qa|=i)}function Ys(t,i){if(!at)switch(t.tailMode){case"hidden":i=t.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?i||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function Rt(t){var i=t.alternate!==null&&t.alternate.child===t.child,s=0,o=0;if(i)for(var h=t.child;h!==null;)s|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)s|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=o,t.childLanes=s,i}function Iv(t,i,s){var o=i.pendingProps;switch(kc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(i),null;case 1:return Rt(i),null;case 3:return s=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Hr(Jt),Ce(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(Ta(i)?$r(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Cc())),Rt(i),null;case 26:var h=i.type,p=i.memoizedState;return t===null?($r(i),p!==null?(Rt(i),pg(i,p)):(Rt(i),yf(i,h,null,o,s))):p?p!==t.memoizedState?($r(i),Rt(i),pg(i,p)):(Rt(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&$r(i),Rt(i),yf(i,h,t,o,s)),null;case 27:if(It(i),s=Te.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&$r(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Rt(i),null}t=be.current,Ta(i)?Jm(i):(t=Sy(h,o,s),i.stateNode=t,$r(i))}return Rt(i),null;case 5:if(It(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&$r(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Rt(i),null}if(p=be.current,Ta(i))Jm(i);else{var x=Yo(Te.current);switch(p){case 1:p=x.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=x.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=x.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=x.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=x.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?x.createElement("select",{is:o.is}):x.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?x.createElement(h,{is:o.is}):x.createElement(h)}}p[Ct]=i,p[Pt]=o;e:for(x=i.child;x!==null;){if(x.tag===5||x.tag===6)p.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===i)break e;for(;x.sibling===null;){if(x.return===null||x.return===i)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}i.stateNode=p;e:switch(fn(p,h,o),h){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&$r(i)}}return Rt(i),yf(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,s),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&$r(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(a(166));if(t=Te.current,Ta(i)){if(t=i.stateNode,s=i.memoizedProps,o=null,h=on,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[Ct]=i,t=!!(t.nodeValue===s||o!==null&&o.suppressHydrationWarning===!0||fy(t.nodeValue,s)),t||fi(i,!0)}else t=Yo(t).createTextNode(o),t[Ct]=i,i.stateNode=t}return Rt(i),null;case 31:if(s=i.memoizedState,t===null||t.memoizedState!==null){if(o=Ta(i),s!==null){if(t===null){if(!o)throw Error(a(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(557));t[Ct]=i}else Qi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Rt(i),t=!1}else s=Cc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return i.flags&256?(Ln(i),i):(Ln(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Rt(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Ta(i),o!==null&&o.dehydrated!==null){if(t===null){if(!h)throw Error(a(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[Ct]=i}else Qi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Rt(i),h=!1}else h=Cc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Ln(i),i):(Ln(i),null)}return Ln(i),(i.flags&128)!==0?(i.lanes=s,i):(s=o!==null,t=t!==null&&t.memoizedState!==null,s&&(o=i.child,h=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(h=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==h&&(o.flags|=2048)),s!==t&&s&&(i.child.flags|=8192),Oo(i,i.updateQueue),Rt(i),null);case 4:return Ce(),t===null&&Pf(i.stateNode.containerInfo),Rt(i),null;case 10:return Hr(i.type),Rt(i),null;case 19:if(re($t),o=i.memoizedState,o===null)return Rt(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)Ys(o,!1);else{if(qt!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(p=bo(t),p!==null){for(i.flags|=128,Ys(o,!1),t=p.updateQueue,i.updateQueue=t,Oo(i,t),i.subtreeFlags=0,t=s,s=i.child;s!==null;)Fm(s,t),s=s.sibling;return j($t,$t.current&1|2),at&&Br(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&He()>Lo&&(i.flags|=128,h=!0,Ys(o,!1),i.lanes=4194304)}else{if(!h)if(t=bo(p),t!==null){if(i.flags|=128,h=!0,t=t.updateQueue,i.updateQueue=t,Oo(i,t),Ys(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!at)return Rt(i),null}else 2*He()-o.renderingStartTime>Lo&&s!==536870912&&(i.flags|=128,h=!0,Ys(o,!1),i.lanes=4194304);o.isBackwards?(p.sibling=i.child,i.child=p):(t=o.last,t!==null?t.sibling=p:i.child=p,o.last=p)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=He(),t.sibling=null,s=$t.current,j($t,h?s&1|2:s&1),at&&Br(i,o.treeForkCount),t):(Rt(i),null);case 22:case 23:return Ln(i),Pc(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(s&536870912)!==0&&(i.flags&128)===0&&(Rt(i),i.subtreeFlags&6&&(i.flags|=8192)):Rt(i),s=i.updateQueue,s!==null&&Oo(i,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==s&&(i.flags|=2048),t!==null&&re(ea),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),Hr(Jt),Rt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function Fv(t,i){switch(kc(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Hr(Jt),Ce(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return It(i),null;case 31:if(i.memoizedState!==null){if(Ln(i),i.alternate===null)throw Error(a(340));Qi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(Ln(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Qi()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return re($t),null;case 4:return Ce(),null;case 10:return Hr(i.type),null;case 22:case 23:return Ln(i),Pc(),t!==null&&re(ea),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return Hr(Jt),null;case 25:return null;default:return null}}function gg(t,i){switch(kc(i),i.tag){case 3:Hr(Jt),Ce();break;case 26:case 27:case 5:It(i);break;case 4:Ce();break;case 31:i.memoizedState!==null&&Ln(i);break;case 13:Ln(i);break;case 19:re($t);break;case 10:Hr(i.type);break;case 22:case 23:Ln(i),Pc(),t!==null&&re(ea);break;case 24:Hr(Jt)}}function Vs(t,i){try{var s=i.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var h=o.next;s=h;do{if((s.tag&t)===t){o=void 0;var p=s.create,x=s.inst;o=p(),x.destroy=o}s=s.next}while(s!==h)}}catch(S){yt(i,i.return,S)}}function bi(t,i,s){try{var o=i.updateQueue,h=o!==null?o.lastEffect:null;if(h!==null){var p=h.next;o=p;do{if((o.tag&t)===t){var x=o.inst,S=x.destroy;if(S!==void 0){x.destroy=void 0,h=i;var H=s,ee=S;try{ee()}catch(oe){yt(h,H,oe)}}}o=o.next}while(o!==p)}}catch(oe){yt(i,i.return,oe)}}function yg(t){var i=t.updateQueue;if(i!==null){var s=t.stateNode;try{lp(i,s)}catch(o){yt(t,t.return,o)}}}function bg(t,i,s){s.props=aa(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(o){yt(t,i,o)}}function Js(t,i){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof s=="function"?t.refCleanup=s(o):s.current=o}}catch(h){yt(t,i,h)}}function Sr(t,i){var s=t.ref,o=t.refCleanup;if(s!==null)if(typeof o=="function")try{o()}catch(h){yt(t,i,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){yt(t,i,h)}else s.current=null}function xg(t){var i=t.type,s=t.memoizedProps,o=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":s.autoFocus&&o.focus();break e;case"img":s.src?o.src=s.src:s.srcSet&&(o.srcset=s.srcSet)}}catch(h){yt(t,t.return,h)}}function bf(t,i,s){try{var o=t.stateNode;fw(o,t.type,s,i),o[Pt]=i}catch(h){yt(t,t.return,h)}}function vg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ei(t.type)||t.tag===4}function xf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||vg(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ei(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function vf(t,i,s){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,i):(i=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,i.appendChild(t),s=s._reactRootContainer,s!=null||i.onclick!==null||(i.onclick=zr));else if(o!==4&&(o===27&&Ei(t.type)&&(s=t.stateNode,i=null),t=t.child,t!==null))for(vf(t,i,s),t=t.sibling;t!==null;)vf(t,i,s),t=t.sibling}function Ro(t,i,s){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?s.insertBefore(t,i):s.appendChild(t);else if(o!==4&&(o===27&&Ei(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(Ro(t,i,s),t=t.sibling;t!==null;)Ro(t,i,s),t=t.sibling}function wg(t){var i=t.stateNode,s=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);fn(i,o,s),i[Ct]=t,i[Pt]=s}catch(p){yt(t,t.return,p)}}var Gr=!1,Qt=!1,wf=!1,Sg=typeof WeakSet=="function"?WeakSet:Set,nn=null;function $v(t,i){if(t=t.containerInfo,If=Wo,t=Dm(t),dc(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var o=s.getSelection&&s.getSelection();if(o&&o.rangeCount!==0){s=o.anchorNode;var h=o.anchorOffset,p=o.focusNode;o=o.focusOffset;try{s.nodeType,p.nodeType}catch{s=null;break e}var x=0,S=-1,H=-1,ee=0,oe=0,pe=t,te=null;t:for(;;){for(var se;pe!==s||h!==0&&pe.nodeType!==3||(S=x+h),pe!==p||o!==0&&pe.nodeType!==3||(H=x+o),pe.nodeType===3&&(x+=pe.nodeValue.length),(se=pe.firstChild)!==null;)te=pe,pe=se;for(;;){if(pe===t)break t;if(te===s&&++ee===h&&(S=x),te===p&&++oe===o&&(H=x),(se=pe.nextSibling)!==null)break;pe=te,te=pe.parentNode}pe=se}s=S===-1||H===-1?null:{start:S,end:H}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ff={focusedElem:t,selectionRange:s},Wo=!1,nn=i;nn!==null;)if(i=nn,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,nn=t;else for(;nn!==null;){switch(i=nn,p=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s<t.length;s++)h=t[s],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,s=i,h=p.memoizedProps,p=p.memoizedState,o=s.stateNode;try{var Oe=aa(s.type,h);t=o.getSnapshotBeforeUpdate(Oe,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(Pe){yt(s,s.return,Pe)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,s=t.nodeType,s===9)Yf(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Yf(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(a(163))}if(t=i.sibling,t!==null){t.return=i.return,nn=t;break}nn=i.return}}function _g(t,i,s){var o=s.flags;switch(s.tag){case 0:case 11:case 15:Vr(t,s),o&4&&Vs(5,s);break;case 1:if(Vr(t,s),o&4)if(t=s.stateNode,i===null)try{t.componentDidMount()}catch(x){yt(s,s.return,x)}else{var h=aa(s.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(x){yt(s,s.return,x)}}o&64&&yg(s),o&512&&Js(s,s.return);break;case 3:if(Vr(t,s),o&64&&(t=s.updateQueue,t!==null)){if(i=null,s.child!==null)switch(s.child.tag){case 27:case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}try{lp(t,i)}catch(x){yt(s,s.return,x)}}break;case 27:i===null&&o&4&&wg(s);case 26:case 5:Vr(t,s),i===null&&o&4&&xg(s),o&512&&Js(s,s.return);break;case 12:Vr(t,s);break;case 31:Vr(t,s),o&4&&Cg(t,s);break;case 13:Vr(t,s),o&4&&Ag(t,s),o&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=Wv.bind(null,s),xw(t,s))));break;case 22:if(o=s.memoizedState!==null||Gr,!o){i=i!==null&&i.memoizedState!==null||Qt,h=Gr;var p=Qt;Gr=o,(Qt=i)&&!p?Jr(t,s,(s.subtreeFlags&8772)!==0):Vr(t,s),Gr=h,Qt=p}break;case 30:break;default:Vr(t,s)}}function kg(t){var i=t.alternate;i!==null&&(t.alternate=null,kg(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&ga(i)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Dt=null,kn=!1;function Yr(t,i,s){for(s=s.child;s!==null;)Eg(t,i,s),s=s.sibling}function Eg(t,i,s){if(mt&&typeof mt.onCommitFiberUnmount=="function")try{mt.onCommitFiberUnmount(Vt,s)}catch{}switch(s.tag){case 26:Qt||Sr(s,i),Yr(t,i,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Qt||Sr(s,i);var o=Dt,h=kn;Ei(s.type)&&(Dt=s.stateNode,kn=!1),Yr(t,i,s),rl(s.stateNode),Dt=o,kn=h;break;case 5:Qt||Sr(s,i);case 6:if(o=Dt,h=kn,Dt=null,Yr(t,i,s),Dt=o,kn=h,Dt!==null)if(kn)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(s.stateNode)}catch(p){yt(s,i,p)}else try{Dt.removeChild(s.stateNode)}catch(p){yt(s,i,p)}break;case 18:Dt!==null&&(kn?(t=Dt,yy(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),Xa(t)):yy(Dt,s.stateNode));break;case 4:o=Dt,h=kn,Dt=s.stateNode.containerInfo,kn=!0,Yr(t,i,s),Dt=o,kn=h;break;case 0:case 11:case 14:case 15:bi(2,s,i),Qt||bi(4,s,i),Yr(t,i,s);break;case 1:Qt||(Sr(s,i),o=s.stateNode,typeof o.componentWillUnmount=="function"&&bg(s,i,o)),Yr(t,i,s);break;case 21:Yr(t,i,s);break;case 22:Qt=(o=Qt)||s.memoizedState!==null,Yr(t,i,s),Qt=o;break;default:Yr(t,i,s)}}function Cg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Xa(t)}catch(s){yt(i,i.return,s)}}}function Ag(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Xa(t)}catch(s){yt(i,i.return,s)}}function Gv(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new Sg),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new Sg),i;default:throw Error(a(435,t.tag))}}function Mo(t,i){var s=Gv(t);i.forEach(function(o){if(!s.has(o)){s.add(o);var h=ew.bind(null,t,o);o.then(h,h)}})}function En(t,i){var s=i.deletions;if(s!==null)for(var o=0;o<s.length;o++){var h=s[o],p=t,x=i,S=x;e:for(;S!==null;){switch(S.tag){case 27:if(Ei(S.type)){Dt=S.stateNode,kn=!1;break e}break;case 5:Dt=S.stateNode,kn=!1;break e;case 3:case 4:Dt=S.stateNode.containerInfo,kn=!0;break e}S=S.return}if(Dt===null)throw Error(a(160));Eg(p,x,h),Dt=null,kn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Tg(i,t),i=i.sibling}var dr=null;function Tg(t,i){var s=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:En(i,t),Cn(t),o&4&&(bi(3,t,t.return),Vs(3,t),bi(5,t,t.return));break;case 1:En(i,t),Cn(t),o&512&&(Qt||s===null||Sr(s,s.return)),o&64&&Gr&&(t=t.updateQueue,t!==null&&(o=t.callbacks,o!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?o:s.concat(o))));break;case 26:var h=dr;if(En(i,t),Cn(t),o&512&&(Qt||s===null||Sr(s,s.return)),o&4){var p=s!==null?s.memoizedState:null;if(o=t.memoizedState,s===null)if(o===null)if(t.stateNode===null){e:{o=t.type,s=t.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[Wt]||p[Ct]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),fn(p,o,s),p[Ct]=t,$(p),o=p;break e;case"link":var x=Ty("link","href",h).get(o+(s.href||""));if(x){for(var S=0;S<x.length;S++)if(p=x[S],p.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&p.getAttribute("rel")===(s.rel==null?null:s.rel)&&p.getAttribute("title")===(s.title==null?null:s.title)&&p.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){x.splice(S,1);break t}}p=h.createElement(o),fn(p,o,s),h.head.appendChild(p);break;case"meta":if(x=Ty("meta","content",h).get(o+(s.content||""))){for(S=0;S<x.length;S++)if(p=x[S],p.getAttribute("content")===(s.content==null?null:""+s.content)&&p.getAttribute("name")===(s.name==null?null:s.name)&&p.getAttribute("property")===(s.property==null?null:s.property)&&p.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&p.getAttribute("charset")===(s.charSet==null?null:s.charSet)){x.splice(S,1);break t}}p=h.createElement(o),fn(p,o,s),h.head.appendChild(p);break;default:throw Error(a(468,o))}p[Ct]=t,$(p),o=p}t.stateNode=o}else jy(h,t.type,t.stateNode);else t.stateNode=Ay(h,o,t.memoizedProps);else p!==o?(p===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):p.count--,o===null?jy(h,t.type,t.stateNode):Ay(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&bf(t,t.memoizedProps,s.memoizedProps)}break;case 27:En(i,t),Cn(t),o&512&&(Qt||s===null||Sr(s,s.return)),s!==null&&o&4&&bf(t,t.memoizedProps,s.memoizedProps);break;case 5:if(En(i,t),Cn(t),o&512&&(Qt||s===null||Sr(s,s.return)),t.flags&32){h=t.stateNode;try{ba(h,"")}catch(Oe){yt(t,t.return,Oe)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,bf(t,h,s!==null?s.memoizedProps:h)),o&1024&&(wf=!0);break;case 6:if(En(i,t),Cn(t),o&4){if(t.stateNode===null)throw Error(a(162));o=t.memoizedProps,s=t.stateNode;try{s.nodeValue=o}catch(Oe){yt(t,t.return,Oe)}}break;case 3:if(Xo=null,h=dr,dr=Vo(i.containerInfo),En(i,t),dr=h,Cn(t),o&4&&s!==null&&s.memoizedState.isDehydrated)try{Xa(i.containerInfo)}catch(Oe){yt(t,t.return,Oe)}wf&&(wf=!1,jg(t));break;case 4:o=dr,dr=Vo(t.stateNode.containerInfo),En(i,t),Cn(t),dr=o;break;case 12:En(i,t),Cn(t);break;case 31:En(i,t),Cn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Mo(t,o)));break;case 13:En(i,t),Cn(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(zo=He()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Mo(t,o)));break;case 22:h=t.memoizedState!==null;var H=s!==null&&s.memoizedState!==null,ee=Gr,oe=Qt;if(Gr=ee||h,Qt=oe||H,En(i,t),Qt=oe,Gr=ee,Cn(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(s===null||H||Gr||Qt||sa(t)),s=null,i=t;;){if(i.tag===5||i.tag===26){if(s===null){H=s=i;try{if(p=H.stateNode,h)x=p.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{S=H.stateNode;var pe=H.memoizedProps.style,te=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;S.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(Oe){yt(H,H.return,Oe)}}}else if(i.tag===6){if(s===null){H=i;try{H.stateNode.nodeValue=h?"":H.memoizedProps}catch(Oe){yt(H,H.return,Oe)}}}else if(i.tag===18){if(s===null){H=i;try{var se=H.stateNode;h?by(se,!0):by(H.stateNode,!1)}catch(Oe){yt(H,H.return,Oe)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===t)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;s===i&&(s=null),i=i.return}s===i&&(s=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=t.updateQueue,o!==null&&(s=o.retryQueue,s!==null&&(o.retryQueue=null,Mo(t,s))));break;case 19:En(i,t),Cn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,Mo(t,o)));break;case 30:break;case 21:break;default:En(i,t),Cn(t)}}function Cn(t){var i=t.flags;if(i&2){try{for(var s,o=t.return;o!==null;){if(vg(o)){s=o;break}o=o.return}if(s==null)throw Error(a(160));switch(s.tag){case 27:var h=s.stateNode,p=xf(t);Ro(t,p,h);break;case 5:var x=s.stateNode;s.flags&32&&(ba(x,""),s.flags&=-33);var S=xf(t);Ro(t,S,x);break;case 3:case 4:var H=s.stateNode.containerInfo,ee=xf(t);vf(t,ee,H);break;default:throw Error(a(161))}}catch(oe){yt(t,t.return,oe)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function jg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;jg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Vr(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)_g(t,i.alternate,i),i=i.sibling}function sa(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:bi(4,i,i.return),sa(i);break;case 1:Sr(i,i.return);var s=i.stateNode;typeof s.componentWillUnmount=="function"&&bg(i,i.return,s),sa(i);break;case 27:rl(i.stateNode);case 26:case 5:Sr(i,i.return),sa(i);break;case 22:i.memoizedState===null&&sa(i);break;case 30:sa(i);break;default:sa(i)}t=t.sibling}}function Jr(t,i,s){for(s=s&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,h=t,p=i,x=p.flags;switch(p.tag){case 0:case 11:case 15:Jr(h,p,s),Vs(4,p);break;case 1:if(Jr(h,p,s),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ee){yt(o,o.return,ee)}if(o=p,h=o.updateQueue,h!==null){var S=o.stateNode;try{var H=h.shared.hiddenCallbacks;if(H!==null)for(h.shared.hiddenCallbacks=null,h=0;h<H.length;h++)sp(H[h],S)}catch(ee){yt(o,o.return,ee)}}s&&x&64&&yg(p),Js(p,p.return);break;case 27:wg(p);case 26:case 5:Jr(h,p,s),s&&o===null&&x&4&&xg(p),Js(p,p.return);break;case 12:Jr(h,p,s);break;case 31:Jr(h,p,s),s&&x&4&&Cg(h,p);break;case 13:Jr(h,p,s),s&&x&4&&Ag(h,p);break;case 22:p.memoizedState===null&&Jr(h,p,s),Js(p,p.return);break;case 30:break;default:Jr(h,p,s)}i=i.sibling}}function Sf(t,i){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&Ds(s))}function _f(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Ds(t))}function mr(t,i,s,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Ng(t,i,s,o),i=i.sibling}function Ng(t,i,s,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:mr(t,i,s,o),h&2048&&Vs(9,i);break;case 1:mr(t,i,s,o);break;case 3:mr(t,i,s,o),h&2048&&(t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Ds(t)));break;case 12:if(h&2048){mr(t,i,s,o),t=i.stateNode;try{var p=i.memoizedProps,x=p.id,S=p.onPostCommit;typeof S=="function"&&S(x,i.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(H){yt(i,i.return,H)}}else mr(t,i,s,o);break;case 31:mr(t,i,s,o);break;case 13:mr(t,i,s,o);break;case 23:break;case 22:p=i.stateNode,x=i.alternate,i.memoizedState!==null?p._visibility&2?mr(t,i,s,o):Xs(t,i):p._visibility&2?mr(t,i,s,o):(p._visibility|=2,Ba(t,i,s,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Sf(x,i);break;case 24:mr(t,i,s,o),h&2048&&_f(i.alternate,i);break;default:mr(t,i,s,o)}}function Ba(t,i,s,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=t,x=i,S=s,H=o,ee=x.flags;switch(x.tag){case 0:case 11:case 15:Ba(p,x,S,H,h),Vs(8,x);break;case 23:break;case 22:var oe=x.stateNode;x.memoizedState!==null?oe._visibility&2?Ba(p,x,S,H,h):Xs(p,x):(oe._visibility|=2,Ba(p,x,S,H,h)),h&&ee&2048&&Sf(x.alternate,x);break;case 24:Ba(p,x,S,H,h),h&&ee&2048&&_f(x.alternate,x);break;default:Ba(p,x,S,H,h)}i=i.sibling}}function Xs(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var s=t,o=i,h=o.flags;switch(o.tag){case 22:Xs(s,o),h&2048&&Sf(o.alternate,o);break;case 24:Xs(s,o),h&2048&&_f(o.alternate,o);break;default:Xs(s,o)}i=i.sibling}}var Ks=8192;function Pa(t,i,s){if(t.subtreeFlags&Ks)for(t=t.child;t!==null;)Og(t,i,s),t=t.sibling}function Og(t,i,s){switch(t.tag){case 26:Pa(t,i,s),t.flags&Ks&&t.memoizedState!==null&&Ow(s,dr,t.memoizedState,t.memoizedProps);break;case 5:Pa(t,i,s);break;case 3:case 4:var o=dr;dr=Vo(t.stateNode.containerInfo),Pa(t,i,s),dr=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Ks,Ks=16777216,Pa(t,i,s),Ks=o):Pa(t,i,s));break;default:Pa(t,i,s)}}function Rg(t){var i=t.alternate;if(i!==null&&(t=i.child,t!==null)){i.child=null;do i=t.sibling,t.sibling=null,t=i;while(t!==null)}}function Qs(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];nn=o,Dg(o,t)}Rg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Mg(t),t=t.sibling}function Mg(t){switch(t.tag){case 0:case 11:case 15:Qs(t),t.flags&2048&&bi(9,t,t.return);break;case 3:Qs(t);break;case 12:Qs(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,Do(t)):Qs(t);break;default:Qs(t)}}function Do(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];nn=o,Dg(o,t)}Rg(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:bi(8,i,i.return),Do(i);break;case 22:s=i.stateNode,s._visibility&2&&(s._visibility&=-3,Do(i));break;default:Do(i)}t=t.sibling}}function Dg(t,i){for(;nn!==null;){var s=nn;switch(s.tag){case 0:case 11:case 15:bi(8,s,i);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var o=s.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Ds(s.memoizedState.cache)}if(o=s.child,o!==null)o.return=s,nn=o;else e:for(s=t;nn!==null;){o=nn;var h=o.sibling,p=o.return;if(kg(o),o===s){nn=null;break e}if(h!==null){h.return=p,nn=h;break e}nn=p}}}var Yv={getCacheForType:function(t){var i=un(Jt),s=i.data.get(t);return s===void 0&&(s=t(),i.data.set(t,s)),s},cacheSignal:function(){return un(Jt).controller.signal}},Vv=typeof WeakMap=="function"?WeakMap:Map,dt=0,At=null,Ze=null,nt=0,gt=0,Un=null,xi=!1,Ha=!1,kf=!1,Xr=0,qt=0,vi=0,la=0,Ef=0,Bn=0,qa=0,Zs=null,An=null,Cf=!1,zo=0,zg=0,Lo=1/0,Uo=null,wi=null,en=0,Si=null,Ia=null,Kr=0,Af=0,Tf=null,Lg=null,Ws=0,jf=null;function Pn(){return(dt&2)!==0&&nt!==0?nt&-nt:Y.T!==null?zf():ws()}function Ug(){if(Bn===0)if((nt&536870912)===0||at){var t=Rr;Rr<<=1,(Rr&3932160)===0&&(Rr=262144),Bn=t}else Bn=536870912;return t=zn.current,t!==null&&(t.flags|=32),Bn}function Tn(t,i,s){(t===At&&(gt===2||gt===9)||t.cancelPendingCommit!==null)&&(Fa(t,0),_i(t,nt,Bn,!1)),cr(t,s),((dt&2)===0||t!==At)&&(t===At&&((dt&2)===0&&(la|=s),qt===4&&_i(t,nt,Bn,!1)),_r(t))}function Bg(t,i,s){if((dt&6)!==0)throw Error(a(327));var o=!s&&(i&127)===0&&(i&t.expiredLanes)===0||Ii(t,i),h=o?Kv(t,i):Of(t,i,!0),p=o;do{if(h===0){Ha&&!o&&_i(t,i,0,!1);break}else{if(s=t.current.alternate,p&&!Jv(s)){h=Of(t,i,!1),p=!1;continue}if(h===2){if(p=i,t.errorRecoveryDisabledLanes&p)var x=0;else x=t.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){i=x;e:{var S=t;h=Zs;var H=S.current.memoizedState.isDehydrated;if(H&&(Fa(S,x).flags|=256),x=Of(S,x,!1),x!==2){if(kf&&!H){S.errorRecoveryDisabledLanes|=p,la|=p,h=4;break e}p=An,An=h,p!==null&&(An===null?An=p:An.push.apply(An,p))}h=x}if(p=!1,h!==2)continue}}if(h===1){Fa(t,0),_i(t,i,0,!0);break}e:{switch(o=t,p=h,p){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:_i(o,i,Bn,!xi);break e;case 2:An=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(h=zo+300-He(),10<h)){if(_i(o,i,Bn,!xi),qi(o,0,!0)!==0)break e;Kr=i,o.timeoutHandle=py(Pg.bind(null,o,s,An,Uo,Cf,i,Bn,la,qa,xi,p,"Throttled",-0,0),h);break e}Pg(o,s,An,Uo,Cf,i,Bn,la,qa,xi,p,null,-0,0)}}break}while(!0);_r(t)}function Pg(t,i,s,o,h,p,x,S,H,ee,oe,pe,te,se){if(t.timeoutHandle=-1,pe=i.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zr},Og(i,p,pe);var Oe=(p&62914560)===p?zo-He():(p&4194048)===p?zg-He():0;if(Oe=Rw(pe,Oe),Oe!==null){Kr=p,t.cancelPendingCommit=Oe(Vg.bind(null,t,i,p,s,o,h,x,S,H,oe,pe,null,te,se)),_i(t,p,x,!ee);return}}Vg(t,i,p,s,o,h,x,S,H)}function Jv(t){for(var i=t;;){var s=i.tag;if((s===0||s===11||s===15)&&i.flags&16384&&(s=i.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var o=0;o<s.length;o++){var h=s[o],p=h.getSnapshot;h=h.value;try{if(!Mn(p(),h))return!1}catch{return!1}}if(s=i.child,i.subtreeFlags&16384&&s!==null)s.return=i,i=s;else{if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function _i(t,i,s,o){i&=~Ef,i&=~la,t.suspendedLanes|=i,t.pingedLanes&=~i,o&&(t.warmLanes|=i),o=t.expirationTimes;for(var h=i;0<h;){var p=31-xe(h),x=1<<p;o[p]=-1,h&=~x}s!==0&&si(t,s,i)}function Bo(){return(dt&6)===0?(el(0),!1):!0}function Nf(){if(Ze!==null){if(gt===0)var t=Ze.return;else t=Ze,Pr=Zi=null,Gc(t),Ma=null,Ls=0,t=Ze;for(;t!==null;)gg(t.alternate,t),t=t.return;Ze=null}}function Fa(t,i){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,mw(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),Kr=0,Nf(),At=t,Ze=s=Ur(t.current,null),nt=i,gt=0,Un=null,xi=!1,Ha=Ii(t,i),kf=!1,qa=Bn=Ef=la=vi=qt=0,An=Zs=null,Cf=!1,(i&8)!==0&&(i|=i&32);var o=t.entangledLanes;if(o!==0)for(t=t.entanglements,o&=i;0<o;){var h=31-xe(o),p=1<<h;i|=t[h],o&=~p}return Xr=i,io(),s}function Hg(t,i){Ye=null,Y.H=$s,i===Ra||i===ho?(i=np(),gt=3):i===Mc?(i=np(),gt=4):gt=i===of?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Un=i,Ze===null&&(qt=1,Ao(t,Qn(i,t.current)))}function qg(){var t=zn.current;return t===null?!0:(nt&4194048)===nt?tr===null:(nt&62914560)===nt||(nt&536870912)!==0?t===tr:!1}function Ig(){var t=Y.H;return Y.H=$s,t===null?$s:t}function Fg(){var t=Y.A;return Y.A=Yv,t}function Po(){qt=4,xi||(nt&4194048)!==nt&&zn.current!==null||(Ha=!0),(vi&134217727)===0&&(la&134217727)===0||At===null||_i(At,nt,Bn,!1)}function Of(t,i,s){var o=dt;dt|=2;var h=Ig(),p=Fg();(At!==t||nt!==i)&&(Uo=null,Fa(t,i)),i=!1;var x=qt;e:do try{if(gt!==0&&Ze!==null){var S=Ze,H=Un;switch(gt){case 8:Nf(),x=6;break e;case 3:case 2:case 9:case 6:zn.current===null&&(i=!0);var ee=gt;if(gt=0,Un=null,$a(t,S,H,ee),s&&Ha){x=0;break e}break;default:ee=gt,gt=0,Un=null,$a(t,S,H,ee)}}Xv(),x=qt;break}catch(oe){Hg(t,oe)}while(!0);return i&&t.shellSuspendCounter++,Pr=Zi=null,dt=o,Y.H=h,Y.A=p,Ze===null&&(At=null,nt=0,io()),x}function Xv(){for(;Ze!==null;)$g(Ze)}function Kv(t,i){var s=dt;dt|=2;var o=Ig(),h=Fg();At!==t||nt!==i?(Uo=null,Lo=He()+500,Fa(t,i)):Ha=Ii(t,i);e:do try{if(gt!==0&&Ze!==null){i=Ze;var p=Un;t:switch(gt){case 1:gt=0,Un=null,$a(t,i,p,1);break;case 2:case 9:if(ep(p)){gt=0,Un=null,Gg(i);break}i=function(){gt!==2&&gt!==9||At!==t||(gt=7),_r(t)},p.then(i,i);break e;case 3:gt=7;break e;case 4:gt=5;break e;case 7:ep(p)?(gt=0,Un=null,Gg(i)):(gt=0,Un=null,$a(t,i,p,7));break;case 5:var x=null;switch(Ze.tag){case 26:x=Ze.memoizedState;case 5:case 27:var S=Ze;if(x?Ny(x):S.stateNode.complete){gt=0,Un=null;var H=S.sibling;if(H!==null)Ze=H;else{var ee=S.return;ee!==null?(Ze=ee,Ho(ee)):Ze=null}break t}}gt=0,Un=null,$a(t,i,p,5);break;case 6:gt=0,Un=null,$a(t,i,p,6);break;case 8:Nf(),qt=6;break e;default:throw Error(a(462))}}Qv();break}catch(oe){Hg(t,oe)}while(!0);return Pr=Zi=null,Y.H=o,Y.A=h,dt=s,Ze!==null?0:(At=null,nt=0,io(),qt)}function Qv(){for(;Ze!==null&&!ht();)$g(Ze)}function $g(t){var i=mg(t.alternate,t,Xr);t.memoizedProps=t.pendingProps,i===null?Ho(t):Ze=i}function Gg(t){var i=t,s=i.alternate;switch(i.tag){case 15:case 0:i=og(s,i,i.pendingProps,i.type,void 0,nt);break;case 11:i=og(s,i,i.pendingProps,i.type.render,i.ref,nt);break;case 5:Gc(i);default:gg(s,i),i=Ze=Fm(i,Xr),i=mg(s,i,Xr)}t.memoizedProps=t.pendingProps,i===null?Ho(t):Ze=i}function $a(t,i,s,o){Pr=Zi=null,Gc(i),Ma=null,Ls=0;var h=i.return;try{if(Pv(t,h,i,s,nt)){qt=1,Ao(t,Qn(s,t.current)),Ze=null;return}}catch(p){if(h!==null)throw Ze=h,p;qt=1,Ao(t,Qn(s,t.current)),Ze=null;return}i.flags&32768?(at||o===1?t=!0:Ha||(nt&536870912)!==0?t=!1:(xi=t=!0,(o===2||o===9||o===3||o===6)&&(o=zn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Yg(i,t)):Ho(i)}function Ho(t){var i=t;do{if((i.flags&32768)!==0){Yg(i,xi);return}t=i.return;var s=Iv(i.alternate,i,Xr);if(s!==null){Ze=s;return}if(i=i.sibling,i!==null){Ze=i;return}Ze=i=t}while(i!==null);qt===0&&(qt=5)}function Yg(t,i){do{var s=Fv(t.alternate,t);if(s!==null){s.flags&=32767,Ze=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!i&&(t=t.sibling,t!==null)){Ze=t;return}Ze=t=s}while(t!==null);qt=6,Ze=null}function Vg(t,i,s,o,h,p,x,S,H){t.cancelPendingCommit=null;do qo();while(en!==0);if((dt&6)!==0)throw Error(a(327));if(i!==null){if(i===t.current)throw Error(a(177));if(p=i.lanes|i.childLanes,p|=bc,ai(t,s,p,x,S,H),t===At&&(Ze=At=null,nt=0),Ia=i,Si=t,Kr=s,Af=p,Tf=h,Lg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,tw(Ue,function(){return Zg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=Y.T,Y.T=null,h=ae.p,ae.p=2,x=dt,dt|=4;try{$v(t,i,s)}finally{dt=x,ae.p=h,Y.T=o}}en=1,Jg(),Xg(),Kg()}}function Jg(){if(en===1){en=0;var t=Si,i=Ia,s=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||s){s=Y.T,Y.T=null;var o=ae.p;ae.p=2;var h=dt;dt|=4;try{Tg(i,t);var p=Ff,x=Dm(t.containerInfo),S=p.focusedElem,H=p.selectionRange;if(x!==S&&S&&S.ownerDocument&&Mm(S.ownerDocument.documentElement,S)){if(H!==null&&dc(S)){var ee=H.start,oe=H.end;if(oe===void 0&&(oe=ee),"selectionStart"in S)S.selectionStart=ee,S.selectionEnd=Math.min(oe,S.value.length);else{var pe=S.ownerDocument||document,te=pe&&pe.defaultView||window;if(te.getSelection){var se=te.getSelection(),Oe=S.textContent.length,Pe=Math.min(H.start,Oe),wt=H.end===void 0?Pe:Math.min(H.end,Oe);!se.extend&&Pe>wt&&(x=wt,wt=Pe,Pe=x);var X=Rm(S,Pe),G=Rm(S,wt);if(X&&G&&(se.rangeCount!==1||se.anchorNode!==X.node||se.anchorOffset!==X.offset||se.focusNode!==G.node||se.focusOffset!==G.offset)){var W=pe.createRange();W.setStart(X.node,X.offset),se.removeAllRanges(),Pe>wt?(se.addRange(W),se.extend(G.node,G.offset)):(W.setEnd(G.node,G.offset),se.addRange(W))}}}}for(pe=[],se=S;se=se.parentNode;)se.nodeType===1&&pe.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<pe.length;S++){var fe=pe[S];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Wo=!!If,Ff=If=null}finally{dt=h,ae.p=o,Y.T=s}}t.current=i,en=2}}function Xg(){if(en===2){en=0;var t=Si,i=Ia,s=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||s){s=Y.T,Y.T=null;var o=ae.p;ae.p=2;var h=dt;dt|=4;try{_g(t,i.alternate,i)}finally{dt=h,ae.p=o,Y.T=s}}en=3}}function Kg(){if(en===4||en===3){en=0,Et();var t=Si,i=Ia,s=Kr,o=Lg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?en=5:(en=0,Ia=Si=null,Qg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(wi=null),$i(s),i=i.stateNode,mt&&typeof mt.onCommitFiberRoot=="function")try{mt.onCommitFiberRoot(Vt,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=Y.T,h=ae.p,ae.p=2,Y.T=null;try{for(var p=t.onRecoverableError,x=0;x<o.length;x++){var S=o[x];p(S.value,{componentStack:S.stack})}}finally{Y.T=i,ae.p=h}}(Kr&3)!==0&&qo(),_r(t),h=t.pendingLanes,(s&261930)!==0&&(h&42)!==0?t===jf?Ws++:(Ws=0,jf=t):Ws=0,el(0)}}function Qg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,Ds(i)))}function qo(){return Jg(),Xg(),Kg(),Zg()}function Zg(){if(en!==5)return!1;var t=Si,i=Af;Af=0;var s=$i(Kr),o=Y.T,h=ae.p;try{ae.p=32>s?32:s,Y.T=null,s=Tf,Tf=null;var p=Si,x=Kr;if(en=0,Ia=Si=null,Kr=0,(dt&6)!==0)throw Error(a(331));var S=dt;if(dt|=4,Mg(p.current),Ng(p,p.current,x,s),dt=S,el(0,!1),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(Vt,p)}catch{}return!0}finally{ae.p=h,Y.T=o,Qg(t,i)}}function Wg(t,i,s){i=Qn(s,i),i=lf(t.stateNode,i,2),t=pi(t,i,2),t!==null&&(cr(t,2),_r(t))}function yt(t,i,s){if(t.tag===3)Wg(t,t,s);else for(;i!==null;){if(i.tag===3){Wg(i,t,s);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(wi===null||!wi.has(o))){t=Qn(s,t),s=eg(2),o=pi(i,s,2),o!==null&&(tg(s,o,i,t),cr(o,2),_r(o));break}}i=i.return}}function Rf(t,i,s){var o=t.pingCache;if(o===null){o=t.pingCache=new Vv;var h=new Set;o.set(i,h)}else h=o.get(i),h===void 0&&(h=new Set,o.set(i,h));h.has(s)||(kf=!0,h.add(s),t=Zv.bind(null,t,i,s),i.then(t,t))}function Zv(t,i,s){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,At===t&&(nt&s)===s&&(qt===4||qt===3&&(nt&62914560)===nt&&300>He()-zo?(dt&2)===0&&Fa(t,0):Ef|=s,qa===nt&&(qa=0)),_r(t)}function ey(t,i){i===0&&(i=pa()),t=Xi(t,i),t!==null&&(cr(t,i),_r(t))}function Wv(t){var i=t.memoizedState,s=0;i!==null&&(s=i.retryLane),ey(t,s)}function ew(t,i){var s=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(s=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(i),ey(t,s)}function tw(t,i){return it(t,i)}var Io=null,Ga=null,Mf=!1,Fo=!1,Df=!1,ki=0;function _r(t){t!==Ga&&t.next===null&&(Ga===null?Io=Ga=t:Ga=Ga.next=t),Fo=!0,Mf||(Mf=!0,rw())}function el(t,i){if(!Df&&Fo){Df=!0;do for(var s=!1,o=Io;o!==null;){if(t!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var x=o.suspendedLanes,S=o.pingedLanes;p=(1<<31-xe(42|t)+1)-1,p&=h&~(x&~S),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(s=!0,iy(o,p))}else p=nt,p=qi(o,o===At?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Ii(o,p)||(s=!0,iy(o,p));o=o.next}while(s);Df=!1}}function nw(){ty()}function ty(){Fo=Mf=!1;var t=0;ki!==0&&dw()&&(t=ki);for(var i=He(),s=null,o=Io;o!==null;){var h=o.next,p=ny(o,i);p===0?(o.next=null,s===null?Io=h:s.next=h,h===null&&(Ga=s)):(s=o,(t!==0||(p&3)!==0)&&(Fo=!0)),o=h}en!==0&&en!==5||el(t),ki!==0&&(ki=0)}function ny(t,i){for(var s=t.suspendedLanes,o=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var x=31-xe(p),S=1<<x,H=h[x];H===-1?((S&s)===0||(S&o)!==0)&&(h[x]=vs(S,i)):H<=i&&(t.expiredLanes|=S),p&=~S}if(i=At,s=nt,s=qi(t,t===i?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,s===0||t===i&&(gt===2||gt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&Ie(o),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||Ii(t,s)){if(i=s&-s,i===t.callbackPriority)return i;switch(o!==null&&Ie(o),$i(s)){case 2:case 8:s=ve;break;case 32:s=Ue;break;case 268435456:s=st;break;default:s=Ue}return o=ry.bind(null,t),s=it(s,o),t.callbackPriority=i,t.callbackNode=s,i}return o!==null&&o!==null&&Ie(o),t.callbackPriority=2,t.callbackNode=null,2}function ry(t,i){if(en!==0&&en!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(qo()&&t.callbackNode!==s)return null;var o=nt;return o=qi(t,t===At?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(Bg(t,o,i),ny(t,He()),t.callbackNode!=null&&t.callbackNode===s?ry.bind(null,t):null)}function iy(t,i){if(qo())return null;Bg(t,i,!0)}function rw(){pw(function(){(dt&6)!==0?it(ie,nw):ty()})}function zf(){if(ki===0){var t=Na;t===0&&(t=Ft,Ft<<=1,(Ft&261888)===0&&(Ft=256)),ki=t}return ki}function ay(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Kl(""+t)}function sy(t,i){var s=i.ownerDocument.createElement("input");return s.name=i.name,s.value=i.value,t.id&&s.setAttribute("form",t.id),i.parentNode.insertBefore(s,i),t=new FormData(t),s.parentNode.removeChild(s),t}function iw(t,i,s,o,h){if(i==="submit"&&s&&s.stateNode===h){var p=ay((h[Pt]||null).action),x=o.submitter;x&&(i=(i=x[Pt]||null)?ay(i.formAction):x.getAttribute("formAction"),i!==null&&(p=i,x=null));var S=new eo("action","action",null,o,h);t.push({event:S,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(ki!==0){var H=x?sy(h,x):new FormData(h);ef(s,{pending:!0,data:H,method:h.method,action:p},null,H)}}else typeof p=="function"&&(S.preventDefault(),H=x?sy(h,x):new FormData(h),ef(s,{pending:!0,data:H,method:h.method,action:p},p,H))},currentTarget:h}]})}}for(var Lf=0;Lf<yc.length;Lf++){var Uf=yc[Lf],aw=Uf.toLowerCase(),sw=Uf[0].toUpperCase()+Uf.slice(1);hr(aw,"on"+sw)}hr(Um,"onAnimationEnd"),hr(Bm,"onAnimationIteration"),hr(Pm,"onAnimationStart"),hr("dblclick","onDoubleClick"),hr("focusin","onFocus"),hr("focusout","onBlur"),hr(Sv,"onTransitionRun"),hr(_v,"onTransitionStart"),hr(kv,"onTransitionCancel"),hr(Hm,"onTransitionEnd"),ne("onMouseEnter",["mouseout","mouseover"]),ne("onMouseLeave",["mouseout","mouseover"]),ne("onPointerEnter",["pointerout","pointerover"]),ne("onPointerLeave",["pointerout","pointerover"]),ye("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ye("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ye("onBeforeInput",["compositionend","keypress","textInput","paste"]),ye("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tl="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(" "),lw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(tl));function ly(t,i){i=(i&4)!==0;for(var s=0;s<t.length;s++){var o=t[s],h=o.event;o=o.listeners;e:{var p=void 0;if(i)for(var x=o.length-1;0<=x;x--){var S=o[x],H=S.instance,ee=S.currentTarget;if(S=S.listener,H!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=ee;try{p(h)}catch(oe){ro(oe)}h.currentTarget=null,p=H}else for(x=0;x<o.length;x++){if(S=o[x],H=S.instance,ee=S.currentTarget,S=S.listener,H!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=ee;try{p(h)}catch(oe){ro(oe)}h.currentTarget=null,p=H}}}}function We(t,i){var s=i[Gi];s===void 0&&(s=i[Gi]=new Set);var o=t+"__bubble";s.has(o)||(oy(i,t,2,!1),s.add(o))}function Bf(t,i,s){var o=0;i&&(o|=4),oy(s,t,o,i)}var $o="_reactListening"+Math.random().toString(36).slice(2);function Pf(t){if(!t[$o]){t[$o]=!0,Q.forEach(function(s){s!=="selectionchange"&&(lw.has(s)||Bf(s,!1,t),Bf(s,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[$o]||(i[$o]=!0,Bf("selectionchange",!1,i))}}function oy(t,i,s,o){switch(Uy(i)){case 2:var h=zw;break;case 8:h=Lw;break;default:h=eh}s=h.bind(null,i,s,t),h=void 0,!ic||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?t.addEventListener(i,s,{capture:!0,passive:h}):t.addEventListener(i,s,!0):h!==void 0?t.addEventListener(i,s,{passive:h}):t.addEventListener(i,s,!1)}function Hf(t,i,s,o,h){var p=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var x=o.tag;if(x===3||x===4){var S=o.stateNode.containerInfo;if(S===h)break;if(x===4)for(x=o.return;x!==null;){var H=x.tag;if((H===3||H===4)&&x.stateNode.containerInfo===h)return;x=x.return}for(;S!==null;){if(x=_(S),x===null)return;if(H=x.tag,H===5||H===6||H===26||H===27){o=p=x;continue e}S=S.parentNode}}o=o.return}dm(function(){var ee=p,oe=nc(s),pe=[];e:{var te=qm.get(t);if(te!==void 0){var se=eo,Oe=t;switch(t){case"keypress":if(Zl(s)===0)break e;case"keydown":case"keyup":se=ev;break;case"focusin":Oe="focus",se=oc;break;case"focusout":Oe="blur",se=oc;break;case"beforeblur":case"afterblur":se=oc;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=gm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=I1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=rv;break;case Um:case Bm:case Pm:se=G1;break;case Hm:se=av;break;case"scroll":case"scrollend":se=H1;break;case"wheel":se=lv;break;case"copy":case"cut":case"paste":se=V1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=bm;break;case"toggle":case"beforetoggle":se=uv}var Pe=(i&4)!==0,wt=!Pe&&(t==="scroll"||t==="scrollend"),X=Pe?te!==null?te+"Capture":null:te;Pe=[];for(var G=ee,W;G!==null;){var fe=G;if(W=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||W===null||X===null||(fe=_s(G,X),fe!=null&&Pe.push(nl(G,fe,W))),wt)break;G=G.return}0<Pe.length&&(te=new se(te,Oe,null,s,oe),pe.push({event:te,listeners:Pe}))}}if((i&7)===0){e:{if(te=t==="mouseover"||t==="pointerover",se=t==="mouseout"||t==="pointerout",te&&s!==tc&&(Oe=s.relatedTarget||s.fromElement)&&(_(Oe)||Oe[Rn]))break e;if((se||te)&&(te=oe.window===oe?oe:(te=oe.ownerDocument)?te.defaultView||te.parentWindow:window,se?(Oe=s.relatedTarget||s.toElement,se=ee,Oe=Oe?_(Oe):null,Oe!==null&&(wt=u(Oe),Pe=Oe.tag,Oe!==wt||Pe!==5&&Pe!==27&&Pe!==6)&&(Oe=null)):(se=null,Oe=ee),se!==Oe)){if(Pe=gm,fe="onMouseLeave",X="onMouseEnter",G="mouse",(t==="pointerout"||t==="pointerover")&&(Pe=bm,fe="onPointerLeave",X="onPointerEnter",G="pointer"),wt=se==null?te:C(se),W=Oe==null?te:C(Oe),te=new Pe(fe,G+"leave",se,s,oe),te.target=wt,te.relatedTarget=W,fe=null,_(oe)===ee&&(Pe=new Pe(X,G+"enter",Oe,s,oe),Pe.target=W,Pe.relatedTarget=wt,fe=Pe),wt=fe,se&&Oe)t:{for(Pe=ow,X=se,G=Oe,W=0,fe=X;fe;fe=Pe(fe))W++;fe=0;for(var ze=G;ze;ze=Pe(ze))fe++;for(;0<W-fe;)X=Pe(X),W--;for(;0<fe-W;)G=Pe(G),fe--;for(;W--;){if(X===G||G!==null&&X===G.alternate){Pe=X;break t}X=Pe(X),G=Pe(G)}Pe=null}else Pe=null;se!==null&&uy(pe,te,se,Pe,!1),Oe!==null&&wt!==null&&uy(pe,wt,Oe,Pe,!0)}}e:{if(te=ee?C(ee):window,se=te.nodeName&&te.nodeName.toLowerCase(),se==="select"||se==="input"&&te.type==="file")var ct=Cm;else if(km(te))if(Am)ct=xv;else{ct=yv;var Me=gv}else se=te.nodeName,!se||se.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?ee&&ec(ee.elementType)&&(ct=Cm):ct=bv;if(ct&&(ct=ct(t,ee))){Em(pe,ct,s,oe);break e}Me&&Me(t,te,ee),t==="focusout"&&ee&&te.type==="number"&&ee.memoizedProps.value!=null&&Wu(te,"number",te.value)}switch(Me=ee?C(ee):window,t){case"focusin":(km(Me)||Me.contentEditable==="true")&&(Sa=Me,mc=ee,Os=null);break;case"focusout":Os=mc=Sa=null;break;case"mousedown":pc=!0;break;case"contextmenu":case"mouseup":case"dragend":pc=!1,zm(pe,s,oe);break;case"selectionchange":if(wv)break;case"keydown":case"keyup":zm(pe,s,oe)}var Je;if(cc)e:{switch(t){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else wa?Sm(t,s)&&(rt="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(rt="onCompositionStart");rt&&(xm&&s.locale!=="ko"&&(wa||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&wa&&(Je=mm()):(oi=oe,ac="value"in oi?oi.value:oi.textContent,wa=!0)),Me=Go(ee,rt),0<Me.length&&(rt=new ym(rt,t,null,s,oe),pe.push({event:rt,listeners:Me}),Je?rt.data=Je:(Je=_m(s),Je!==null&&(rt.data=Je)))),(Je=fv?hv(t,s):dv(t,s))&&(rt=Go(ee,"onBeforeInput"),0<rt.length&&(Me=new ym("onBeforeInput","beforeinput",null,s,oe),pe.push({event:Me,listeners:rt}),Me.data=Je)),iw(pe,t,ee,s,oe)}ly(pe,i)})}function nl(t,i,s){return{instance:t,listener:i,currentTarget:s}}function Go(t,i){for(var s=i+"Capture",o=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=_s(t,s),h!=null&&o.unshift(nl(t,h,p)),h=_s(t,i),h!=null&&o.push(nl(t,h,p))),t.tag===3)return o;t=t.return}return[]}function ow(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function uy(t,i,s,o,h){for(var p=i._reactName,x=[];s!==null&&s!==o;){var S=s,H=S.alternate,ee=S.stateNode;if(S=S.tag,H!==null&&H===o)break;S!==5&&S!==26&&S!==27||ee===null||(H=ee,h?(ee=_s(s,p),ee!=null&&x.unshift(nl(s,ee,H))):h||(ee=_s(s,p),ee!=null&&x.push(nl(s,ee,H)))),s=s.return}x.length!==0&&t.push({event:i,listeners:x})}var uw=/\r\n?/g,cw=/\u0000|\uFFFD/g;function cy(t){return(typeof t=="string"?t:""+t).replace(uw,`
49
- `).replace(cw,"")}function fy(t,i){return i=cy(i),cy(t)===i}function vt(t,i,s,o,h,p){switch(s){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||ba(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&ba(t,""+o);break;case"className":fr(t,"class",o);break;case"tabIndex":fr(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":fr(t,s,o);break;case"style":fm(t,o,p);break;case"data":if(i!=="object"){fr(t,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||s!=="href")){t.removeAttribute(s);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=Kl(""+o),t.setAttribute(s,o);break;case"action":case"formAction":if(typeof o=="function"){t.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(s==="formAction"?(i!=="input"&&vt(t,i,"name",h.name,h,null),vt(t,i,"formEncType",h.formEncType,h,null),vt(t,i,"formMethod",h.formMethod,h,null),vt(t,i,"formTarget",h.formTarget,h,null)):(vt(t,i,"encType",h.encType,h,null),vt(t,i,"method",h.method,h,null),vt(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=Kl(""+o),t.setAttribute(s,o);break;case"onClick":o!=null&&(t.onclick=zr);break;case"onScroll":o!=null&&We("scroll",t);break;case"onScrollEnd":o!=null&&We("scrollend",t);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(s=o.__html,s!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=s}}break;case"multiple":t.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":t.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){t.removeAttribute("xlink:href");break}s=Kl(""+o),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,""+o):t.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":o===!0?t.setAttribute(s,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?t.setAttribute(s,o):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?t.setAttribute(s,o):t.removeAttribute(s);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?t.removeAttribute(s):t.setAttribute(s,o);break;case"popover":We("beforetoggle",t),We("toggle",t),hn(t,"popover",o);break;case"xlinkActuate":Dr(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Dr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Dr(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Dr(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Dr(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Dr(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Dr(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Dr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Dr(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":hn(t,"is",o);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=B1.get(s)||s,hn(t,s,o))}}function qf(t,i,s,o,h,p){switch(s){case"style":fm(t,o,p);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(a(61));if(s=o.__html,s!=null){if(h.children!=null)throw Error(a(60));t.innerHTML=s}}break;case"children":typeof o=="string"?ba(t,o):(typeof o=="number"||typeof o=="bigint")&&ba(t,""+o);break;case"onScroll":o!=null&&We("scroll",t);break;case"onScrollEnd":o!=null&&We("scrollend",t);break;case"onClick":o!=null&&(t.onclick=zr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!me.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(h=s.endsWith("Capture"),i=s.slice(2,h?s.length-7:void 0),p=t[Pt]||null,p=p!=null?p[s]:null,typeof p=="function"&&t.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(i,o,h);break e}s in t?t[s]=o:o===!0?t.setAttribute(s,""):hn(t,s,o)}}}function fn(t,i,s){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":We("error",t),We("load",t);var o=!1,h=!1,p;for(p in s)if(s.hasOwnProperty(p)){var x=s[p];if(x!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:vt(t,i,p,x,s,null)}}h&&vt(t,i,"srcSet",s.srcSet,s,null),o&&vt(t,i,"src",s.src,s,null);return;case"input":We("invalid",t);var S=p=x=h=null,H=null,ee=null;for(o in s)if(s.hasOwnProperty(o)){var oe=s[o];if(oe!=null)switch(o){case"name":h=oe;break;case"type":x=oe;break;case"checked":H=oe;break;case"defaultChecked":ee=oe;break;case"value":p=oe;break;case"defaultValue":S=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,i));break;default:vt(t,i,o,oe,s,null)}}lm(t,p,S,H,ee,x,h,!1);return;case"select":We("invalid",t),o=x=p=null;for(h in s)if(s.hasOwnProperty(h)&&(S=s[h],S!=null))switch(h){case"value":p=S;break;case"defaultValue":x=S;break;case"multiple":o=S;default:vt(t,i,h,S,s,null)}i=p,s=x,t.multiple=!!o,i!=null?ya(t,!!o,i,!1):s!=null&&ya(t,!!o,s,!0);return;case"textarea":We("invalid",t),p=h=o=null;for(x in s)if(s.hasOwnProperty(x)&&(S=s[x],S!=null))switch(x){case"value":o=S;break;case"defaultValue":h=S;break;case"children":p=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(a(91));break;default:vt(t,i,x,S,s,null)}um(t,o,h,p);return;case"option":for(H in s)if(s.hasOwnProperty(H)&&(o=s[H],o!=null))switch(H){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:vt(t,i,H,o,s,null)}return;case"dialog":We("beforetoggle",t),We("toggle",t),We("cancel",t),We("close",t);break;case"iframe":case"object":We("load",t);break;case"video":case"audio":for(o=0;o<tl.length;o++)We(tl[o],t);break;case"image":We("error",t),We("load",t);break;case"details":We("toggle",t);break;case"embed":case"source":case"link":We("error",t),We("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in s)if(s.hasOwnProperty(ee)&&(o=s[ee],o!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:vt(t,i,ee,o,s,null)}return;default:if(ec(i)){for(oe in s)s.hasOwnProperty(oe)&&(o=s[oe],o!==void 0&&qf(t,i,oe,o,s,void 0));return}}for(S in s)s.hasOwnProperty(S)&&(o=s[S],o!=null&&vt(t,i,S,o,s,null))}function fw(t,i,s,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,x=null,S=null,H=null,ee=null,oe=null;for(se in s){var pe=s[se];if(s.hasOwnProperty(se)&&pe!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":H=pe;default:o.hasOwnProperty(se)||vt(t,i,se,null,o,pe)}}for(var te in o){var se=o[te];if(pe=s[te],o.hasOwnProperty(te)&&(se!=null||pe!=null))switch(te){case"type":p=se;break;case"name":h=se;break;case"checked":ee=se;break;case"defaultChecked":oe=se;break;case"value":x=se;break;case"defaultValue":S=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,i));break;default:se!==pe&&vt(t,i,te,se,o,pe)}}Zu(t,x,S,H,ee,oe,p,h);return;case"select":se=x=S=te=null;for(p in s)if(H=s[p],s.hasOwnProperty(p)&&H!=null)switch(p){case"value":break;case"multiple":se=H;default:o.hasOwnProperty(p)||vt(t,i,p,null,o,H)}for(h in o)if(p=o[h],H=s[h],o.hasOwnProperty(h)&&(p!=null||H!=null))switch(h){case"value":te=p;break;case"defaultValue":S=p;break;case"multiple":x=p;default:p!==H&&vt(t,i,h,p,o,H)}i=S,s=x,o=se,te!=null?ya(t,!!s,te,!1):!!o!=!!s&&(i!=null?ya(t,!!s,i,!0):ya(t,!!s,s?[]:"",!1));return;case"textarea":se=te=null;for(S in s)if(h=s[S],s.hasOwnProperty(S)&&h!=null&&!o.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:vt(t,i,S,null,o,h)}for(x in o)if(h=o[x],p=s[x],o.hasOwnProperty(x)&&(h!=null||p!=null))switch(x){case"value":te=h;break;case"defaultValue":se=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(a(91));break;default:h!==p&&vt(t,i,x,h,o,p)}om(t,te,se);return;case"option":for(var Oe in s)if(te=s[Oe],s.hasOwnProperty(Oe)&&te!=null&&!o.hasOwnProperty(Oe))switch(Oe){case"selected":t.selected=!1;break;default:vt(t,i,Oe,null,o,te)}for(H in o)if(te=o[H],se=s[H],o.hasOwnProperty(H)&&te!==se&&(te!=null||se!=null))switch(H){case"selected":t.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:vt(t,i,H,te,o,se)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Pe in s)te=s[Pe],s.hasOwnProperty(Pe)&&te!=null&&!o.hasOwnProperty(Pe)&&vt(t,i,Pe,null,o,te);for(ee in o)if(te=o[ee],se=s[ee],o.hasOwnProperty(ee)&&te!==se&&(te!=null||se!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(a(137,i));break;default:vt(t,i,ee,te,o,se)}return;default:if(ec(i)){for(var wt in s)te=s[wt],s.hasOwnProperty(wt)&&te!==void 0&&!o.hasOwnProperty(wt)&&qf(t,i,wt,void 0,o,te);for(oe in o)te=o[oe],se=s[oe],!o.hasOwnProperty(oe)||te===se||te===void 0&&se===void 0||qf(t,i,oe,te,o,se);return}}for(var X in s)te=s[X],s.hasOwnProperty(X)&&te!=null&&!o.hasOwnProperty(X)&&vt(t,i,X,null,o,te);for(pe in o)te=o[pe],se=s[pe],!o.hasOwnProperty(pe)||te===se||te==null&&se==null||vt(t,i,pe,te,o,se)}function hy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function hw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,i=0,s=performance.getEntriesByType("resource"),o=0;o<s.length;o++){var h=s[o],p=h.transferSize,x=h.initiatorType,S=h.duration;if(p&&S&&hy(x)){for(x=0,S=h.responseEnd,o+=1;o<s.length;o++){var H=s[o],ee=H.startTime;if(ee>S)break;var oe=H.transferSize,pe=H.initiatorType;oe&&hy(pe)&&(H=H.responseEnd,x+=oe*(H<S?1:(S-ee)/(H-ee)))}if(--o,i+=8*(p+x)/(h.duration/1e3),t++,10<t)break}}if(0<t)return i/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var If=null,Ff=null;function Yo(t){return t.nodeType===9?t:t.ownerDocument}function dy(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function my(t,i){if(t===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&i==="foreignObject"?0:t}function $f(t,i){return t==="textarea"||t==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Gf=null;function dw(){var t=window.event;return t&&t.type==="popstate"?t===Gf?!1:(Gf=t,!0):(Gf=null,!1)}var py=typeof setTimeout=="function"?setTimeout:void 0,mw=typeof clearTimeout=="function"?clearTimeout:void 0,gy=typeof Promise=="function"?Promise:void 0,pw=typeof queueMicrotask=="function"?queueMicrotask:typeof gy<"u"?function(t){return gy.resolve(null).then(t).catch(gw)}:py;function gw(t){setTimeout(function(){throw t})}function Ei(t){return t==="head"}function yy(t,i){var s=i,o=0;do{var h=s.nextSibling;if(t.removeChild(s),h&&h.nodeType===8)if(s=h.data,s==="/$"||s==="/&"){if(o===0){t.removeChild(h),Xa(i);return}o--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")o++;else if(s==="html")rl(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,rl(s);for(var p=s.firstChild;p;){var x=p.nextSibling,S=p.nodeName;p[Wt]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&p.rel.toLowerCase()==="stylesheet"||s.removeChild(p),p=x}}else s==="body"&&rl(t.ownerDocument.body);s=h}while(s);Xa(i)}function by(t,i){var s=t;t=0;do{var o=s.nextSibling;if(s.nodeType===1?i?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(i?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),o&&o.nodeType===8)if(s=o.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=o}while(s)}function Yf(t){var i=t.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var s=i;switch(i=i.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Yf(s),ga(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function yw(t,i,s,o){for(;t.nodeType===1;){var h=s;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(o){if(!t[Wt])switch(i){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(i==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=nr(t.nextSibling),t===null)break}return null}function bw(t,i,s){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=nr(t.nextSibling),t===null))return null;return t}function xy(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=nr(t.nextSibling),t===null))return null;return t}function Vf(t){return t.data==="$?"||t.data==="$~"}function Jf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function xw(t,i){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||s.readyState!=="loading")i();else{var o=function(){i(),s.removeEventListener("DOMContentLoaded",o)};s.addEventListener("DOMContentLoaded",o),t._reactRetry=o}}function nr(t){for(;t!=null;t=t.nextSibling){var i=t.nodeType;if(i===1||i===3)break;if(i===8){if(i=t.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return t}var Xf=null;function vy(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(i===0)return nr(t.nextSibling);i--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||i++}t=t.nextSibling}return null}function wy(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(i===0)return t;i--}else s!=="/$"&&s!=="/&"||i++}t=t.previousSibling}return null}function Sy(t,i,s){switch(i=Yo(s),t){case"html":if(t=i.documentElement,!t)throw Error(a(452));return t;case"head":if(t=i.head,!t)throw Error(a(453));return t;case"body":if(t=i.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function rl(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);ga(t)}var rr=new Map,_y=new Set;function Vo(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Qr=ae.d;ae.d={f:vw,r:ww,D:Sw,C:_w,L:kw,m:Ew,X:Aw,S:Cw,M:Tw};function vw(){var t=Qr.f(),i=Bo();return t||i}function ww(t){var i=N(t);i!==null&&i.tag===5&&i.type==="form"?Hp(i):Qr.r(t)}var Ya=typeof document>"u"?null:document;function ky(t,i,s){var o=Ya;if(o&&typeof i=="string"&&i){var h=Xn(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),_y.has(h)||(_y.add(h),t={rel:t,crossOrigin:s,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),fn(i,"link",t),$(i),o.head.appendChild(i)))}}function Sw(t){Qr.D(t),ky("dns-prefetch",t,null)}function _w(t,i){Qr.C(t,i),ky("preconnect",t,i)}function kw(t,i,s){Qr.L(t,i,s);var o=Ya;if(o&&t&&i){var h='link[rel="preload"][as="'+Xn(i)+'"]';i==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+Xn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+Xn(s.imageSizes)+'"]')):h+='[href="'+Xn(t)+'"]';var p=h;switch(i){case"style":p=Va(t);break;case"script":p=Ja(t)}rr.has(p)||(t=g({rel:"preload",href:i==="image"&&s&&s.imageSrcSet?void 0:t,as:i},s),rr.set(p,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(il(p))||i==="script"&&o.querySelector(al(p))||(i=o.createElement("link"),fn(i,"link",t),$(i),o.head.appendChild(i)))}}function Ew(t,i){Qr.m(t,i);var s=Ya;if(s&&t){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Xn(o)+'"][href="'+Xn(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Ja(t)}if(!rr.has(p)&&(t=g({rel:"modulepreload",href:t},i),rr.set(p,t),s.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(al(p)))return}o=s.createElement("link"),fn(o,"link",t),$(o),s.head.appendChild(o)}}}function Cw(t,i,s){Qr.S(t,i,s);var o=Ya;if(o&&t){var h=M(o).hoistableStyles,p=Va(t);i=i||"default";var x=h.get(p);if(!x){var S={loading:0,preload:null};if(x=o.querySelector(il(p)))S.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":i},s),(s=rr.get(p))&&Kf(t,s);var H=x=o.createElement("link");$(H),fn(H,"link",t),H._p=new Promise(function(ee,oe){H.onload=ee,H.onerror=oe}),H.addEventListener("load",function(){S.loading|=1}),H.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Jo(x,i,o)}x={type:"stylesheet",instance:x,count:1,state:S},h.set(p,x)}}}function Aw(t,i){Qr.X(t,i);var s=Ya;if(s&&t){var o=M(s).hoistableScripts,h=Ja(t),p=o.get(h);p||(p=s.querySelector(al(h)),p||(t=g({src:t,async:!0},i),(i=rr.get(h))&&Qf(t,i),p=s.createElement("script"),$(p),fn(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Tw(t,i){Qr.M(t,i);var s=Ya;if(s&&t){var o=M(s).hoistableScripts,h=Ja(t),p=o.get(h);p||(p=s.querySelector(al(h)),p||(t=g({src:t,async:!0,type:"module"},i),(i=rr.get(h))&&Qf(t,i),p=s.createElement("script"),$(p),fn(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Ey(t,i,s,o){var h=(h=Te.current)?Vo(h):null;if(!h)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(i=Va(s.href),s=M(h).hoistableStyles,o=s.get(i),o||(o={type:"style",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=Va(s.href);var p=M(h).hoistableStyles,x=p.get(t);if(x||(h=h.ownerDocument||h,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,x),(p=h.querySelector(il(t)))&&!p._p&&(x.instance=p,x.state.loading=5),rr.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},rr.set(t,s),p||jw(h,t,s,x.state))),i&&o===null)throw Error(a(528,""));return x}if(i&&o!==null)throw Error(a(529,""));return null;case"script":return i=s.async,s=s.src,typeof s=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Ja(s),s=M(h).hoistableScripts,o=s.get(i),o||(o={type:"script",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function Va(t){return'href="'+Xn(t)+'"'}function il(t){return'link[rel="stylesheet"]['+t+"]"}function Cy(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function jw(t,i,s,o){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=t.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),fn(i,"link",s),$(i),t.head.appendChild(i))}function Ja(t){return'[src="'+Xn(t)+'"]'}function al(t){return"script[async]"+t}function Ay(t,i,s){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Xn(s.href)+'"]');if(o)return i.instance=o,$(o),o;var h=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),$(o),fn(o,"style",h),Jo(o,s.precedence,t),i.instance=o;case"stylesheet":h=Va(s.href);var p=t.querySelector(il(h));if(p)return i.state.loading|=4,i.instance=p,$(p),p;o=Cy(s),(h=rr.get(h))&&Kf(o,h),p=(t.ownerDocument||t).createElement("link"),$(p);var x=p;return x._p=new Promise(function(S,H){x.onload=S,x.onerror=H}),fn(p,"link",o),i.state.loading|=4,Jo(p,s.precedence,t),i.instance=p;case"script":return p=Ja(s.src),(h=t.querySelector(al(p)))?(i.instance=h,$(h),h):(o=s,(h=rr.get(p))&&(o=g({},s),Qf(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),$(h),fn(h,"link",o),t.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Jo(o,s.precedence,t));return i.instance}function Jo(t,i,s){for(var o=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=o.length?o[o.length-1]:null,p=h,x=0;x<o.length;x++){var S=o[x];if(S.dataset.precedence===i)p=S;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(i=s.nodeType===9?s.head:s,i.insertBefore(t,i.firstChild))}function Kf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function Qf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var Xo=null;function Ty(t,i,s){if(Xo===null){var o=new Map,h=Xo=new Map;h.set(s,o)}else h=Xo,o=h.get(s),o||(o=new Map,h.set(s,o));if(o.has(t))return o;for(o.set(t,null),s=s.getElementsByTagName(t),h=0;h<s.length;h++){var p=s[h];if(!(p[Wt]||p[Ct]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var x=p.getAttribute(i)||"";x=t+x;var S=o.get(x);S?S.push(p):o.set(x,[p])}}return o}function jy(t,i,s){t=t.ownerDocument||t,t.head.insertBefore(s,i==="title"?t.querySelector("head > title"):null)}function Nw(t,i,s){if(s===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return t=i.disabled,typeof i.precedence=="string"&&t==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Ny(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Ow(t,i,s,o){if(s.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=Va(o.href),p=i.querySelector(il(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=Ko.bind(t),i.then(t,t)),s.state.loading|=4,s.instance=p,$(p);return}p=i.ownerDocument||i,o=Cy(o),(h=rr.get(h))&&Kf(o,h),p=p.createElement("link"),$(p);var x=p;x._p=new Promise(function(S,H){x.onload=S,x.onerror=H}),fn(p,"link",o),s.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=Ko.bind(t),i.addEventListener("load",s),i.addEventListener("error",s))}}var Zf=0;function Rw(t,i){return t.stylesheets&&t.count===0&&Zo(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var o=setTimeout(function(){if(t.stylesheets&&Zo(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+i);0<t.imgBytes&&Zf===0&&(Zf=62500*hw());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Zo(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>Zf?50:800)+i);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Ko(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zo(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Qo=null;function Zo(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Qo=new Map,i.forEach(Mw,t),Qo=null,Ko.call(t))}function Mw(t,i){if(!(i.state.loading&4)){var s=Qo.get(t);if(s)var o=s.get(null);else{s=new Map,Qo.set(t,s);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var x=h[p];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(s.set(x.dataset.precedence,x),o=x)}o&&s.set(null,o)}h=i.instance,x=h.getAttribute("data-precedence"),p=s.get(x)||o,p===o&&s.set(null,h),s.set(x,h),this.count++,o=Ko.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),i.state.loading|=4}}var sl={$$typeof:V,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function Dw(t,i,s,o,h,p,x,S,H){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ii(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ii(0),this.hiddenUpdates=ii(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Oy(t,i,s,o,h,p,x,S,H,ee,oe,pe){return t=new Dw(t,i,s,x,H,ee,oe,pe,S),i=1,p===!0&&(i|=24),p=Dn(3,null,null,i),t.current=p,p.stateNode=t,i=Nc(),i.refCount++,t.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:s,cache:i},Dc(p),t}function Ry(t){return t?(t=Ea,t):Ea}function My(t,i,s,o,h,p){h=Ry(h),o.context===null?o.context=h:o.pendingContext=h,o=mi(i),o.payload={element:s},p=p===void 0?null:p,p!==null&&(o.callback=p),s=pi(t,o,i),s!==null&&(Tn(s,t,i),Bs(s,t,i))}function Dy(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<i?s:i}}function Wf(t,i){Dy(t,i),(t=t.alternate)&&Dy(t,i)}function zy(t){if(t.tag===13||t.tag===31){var i=Xi(t,67108864);i!==null&&Tn(i,t,67108864),Wf(t,67108864)}}function Ly(t){if(t.tag===13||t.tag===31){var i=Pn();i=Mr(i);var s=Xi(t,i);s!==null&&Tn(s,t,i),Wf(t,i)}}var Wo=!0;function zw(t,i,s,o){var h=Y.T;Y.T=null;var p=ae.p;try{ae.p=2,eh(t,i,s,o)}finally{ae.p=p,Y.T=h}}function Lw(t,i,s,o){var h=Y.T;Y.T=null;var p=ae.p;try{ae.p=8,eh(t,i,s,o)}finally{ae.p=p,Y.T=h}}function eh(t,i,s,o){if(Wo){var h=th(o);if(h===null)Hf(t,i,o,eu,s),By(t,o);else if(Bw(h,t,i,s,o))o.stopPropagation();else if(By(t,o),i&4&&-1<Uw.indexOf(t)){for(;h!==null;){var p=N(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var x=ur(p.pendingLanes);if(x!==0){var S=p;for(S.pendingLanes|=2,S.entangledLanes|=2;x;){var H=1<<31-xe(x);S.entanglements[1]|=H,x&=~H}_r(p),(dt&6)===0&&(Lo=He()+500,el(0))}}break;case 31:case 13:S=Xi(p,2),S!==null&&Tn(S,p,2),Bo(),Wf(p,2)}if(p=th(o),p===null&&Hf(t,i,o,eu,s),p===h)break;h=p}h!==null&&o.stopPropagation()}else Hf(t,i,o,null,s)}}function th(t){return t=nc(t),nh(t)}var eu=null;function nh(t){if(eu=null,t=_(t),t!==null){var i=u(t);if(i===null)t=null;else{var s=i.tag;if(s===13){if(t=c(i),t!==null)return t;t=null}else if(s===31){if(t=f(i),t!==null)return t;t=null}else if(s===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;t=null}else i!==t&&(t=null)}}return eu=t,null}function Uy(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ln()){case ie:return 2;case ve:return 8;case Ue:case Ve:return 32;case st:return 268435456;default:return 32}default:return 32}}var rh=!1,Ci=null,Ai=null,Ti=null,ll=new Map,ol=new Map,ji=[],Uw="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function By(t,i){switch(t){case"focusin":case"focusout":Ci=null;break;case"dragenter":case"dragleave":Ai=null;break;case"mouseover":case"mouseout":Ti=null;break;case"pointerover":case"pointerout":ll.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":ol.delete(i.pointerId)}}function ul(t,i,s,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:i,domEventName:s,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=N(i),i!==null&&zy(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function Bw(t,i,s,o,h){switch(i){case"focusin":return Ci=ul(Ci,t,i,s,o,h),!0;case"dragenter":return Ai=ul(Ai,t,i,s,o,h),!0;case"mouseover":return Ti=ul(Ti,t,i,s,o,h),!0;case"pointerover":var p=h.pointerId;return ll.set(p,ul(ll.get(p)||null,t,i,s,o,h)),!0;case"gotpointercapture":return p=h.pointerId,ol.set(p,ul(ol.get(p)||null,t,i,s,o,h)),!0}return!1}function Py(t){var i=_(t.target);if(i!==null){var s=u(i);if(s!==null){if(i=s.tag,i===13){if(i=c(s),i!==null){t.blockedOn=i,Yl(t.priority,function(){Ly(s)});return}}else if(i===31){if(i=f(s),i!==null){t.blockedOn=i,Yl(t.priority,function(){Ly(s)});return}}else if(i===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function tu(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var s=th(t.nativeEvent);if(s===null){s=t.nativeEvent;var o=new s.constructor(s.type,s);tc=o,s.target.dispatchEvent(o),tc=null}else return i=N(s),i!==null&&zy(i),t.blockedOn=s,!1;i.shift()}return!0}function Hy(t,i,s){tu(t)&&s.delete(i)}function Pw(){rh=!1,Ci!==null&&tu(Ci)&&(Ci=null),Ai!==null&&tu(Ai)&&(Ai=null),Ti!==null&&tu(Ti)&&(Ti=null),ll.forEach(Hy),ol.forEach(Hy)}function nu(t,i){t.blockedOn===i&&(t.blockedOn=null,rh||(rh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Pw)))}var ru=null;function qy(t){ru!==t&&(ru=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ru===t&&(ru=null);for(var i=0;i<t.length;i+=3){var s=t[i],o=t[i+1],h=t[i+2];if(typeof o!="function"){if(nh(o||s)===null)continue;break}var p=N(s);p!==null&&(t.splice(i,3),i-=3,ef(p,{pending:!0,data:h,method:s.method,action:o},o,h))}}))}function Xa(t){function i(H){return nu(H,t)}Ci!==null&&nu(Ci,t),Ai!==null&&nu(Ai,t),Ti!==null&&nu(Ti,t),ll.forEach(i),ol.forEach(i);for(var s=0;s<ji.length;s++){var o=ji[s];o.blockedOn===t&&(o.blockedOn=null)}for(;0<ji.length&&(s=ji[0],s.blockedOn===null);)Py(s),s.blockedOn===null&&ji.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(o=0;o<s.length;o+=3){var h=s[o],p=s[o+1],x=h[Pt]||null;if(typeof p=="function")x||qy(s);else if(x){var S=null;if(p&&p.hasAttribute("formAction")){if(h=p,x=p[Pt]||null)S=x.formAction;else if(nh(h)!==null)continue}else S=x.action;typeof S=="function"?s[o+1]=S:(s.splice(o,3),o-=3),qy(s)}}}function Iy(){function t(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(x){return h=x})},focusReset:"manual",scroll:"manual"})}function i(){h!==null&&(h(),h=null),o||setTimeout(s,20)}function s(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(s,100),function(){o=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function ih(t){this._internalRoot=t}iu.prototype.render=ih.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(a(409));var s=i.current,o=Pn();My(s,o,t,i,null,null)},iu.prototype.unmount=ih.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;My(t.current,2,null,t,null,null),Bo(),i[Rn]=null}};function iu(t){this._internalRoot=t}iu.prototype.unstable_scheduleHydration=function(t){if(t){var i=ws();t={blockedOn:null,target:t,priority:i};for(var s=0;s<ji.length&&i!==0&&i<ji[s].priority;s++);ji.splice(s,0,t),s===0&&Py(t)}};var Fy=n.version;if(Fy!=="19.2.4")throw Error(a(527,Fy,"19.2.4"));ae.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=d(i),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var Hw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var au=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!au.isDisabled&&au.supportsFiber)try{Vt=au.inject(Hw),mt=au}catch{}}return fl.createRoot=function(t,i){if(!l(t))throw Error(a(299));var s=!1,o="",h=Kp,p=Qp,x=Zp;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(o=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(p=i.onCaughtError),i.onRecoverableError!==void 0&&(x=i.onRecoverableError)),i=Oy(t,1,!1,null,null,s,o,null,h,p,x,Iy),t[Rn]=i.current,Pf(t),new ih(i)},fl.hydrateRoot=function(t,i,s){if(!l(t))throw Error(a(299));var o=!1,h="",p=Kp,x=Qp,S=Zp,H=null;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(S=s.onRecoverableError),s.formState!==void 0&&(H=s.formState)),i=Oy(t,1,!0,i,s??null,o,h,H,p,x,S,Iy),i.context=Ry(null),s=i.current,o=Pn(),o=Mr(o),h=mi(o),h.callback=null,pi(s,h,o),s=o,i.current.lanes=s,cr(i,s),_r(i),t[Rn]=i.current,Pf(t),new iu(i)},fl.version="19.2.4",fl}var Wy;function Qw(){if(Wy)return lh.exports;Wy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),lh.exports=Kw(),lh.exports}var Zw=Qw();/**
50
- * react-router v7.13.1
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */var e0="popstate";function t0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Ww(e={}){function n(a,l){var d;let u=(d=l.state)==null?void 0:d.masked,{pathname:c,search:f,hash:m}=u||a.location;return Xh("",{pathname:c,search:f,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",u?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,l){return typeof l=="string"?l:Nl(l)}return tS(n,r,null,e)}function Ut(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Tr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function eS(){return Math.random().toString(36).substring(2,10)}function n0(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Xh(e,n,r=null,a,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?ps(n):n,state:r,key:n&&n.key||a||eS(),unstable_mask:l}}function Nl({pathname:e="/",search:n="",hash:r=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function ps(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(n.search=e.substring(a),e=e.substring(0,a)),e&&(n.pathname=e)}return n}function tS(e,n,r,a={}){let{window:l=document.defaultView,v5Compat:u=!1}=a,c=l.history,f="POP",m=null,d=y();d==null&&(d=0,c.replaceState({...c.state,idx:d},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let U=y(),T=U==null?null:U-d;d=U,m&&m({action:f,location:R.location,delta:T})}function b(U,T){f="PUSH";let F=t0(U)?U:Xh(R.location,U,T);d=y()+1;let V=n0(F,d),le=R.createHref(F.unstable_mask||F);try{c.pushState(V,"",le)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;l.location.assign(le)}u&&m&&m({action:f,location:R.location,delta:1})}function w(U,T){f="REPLACE";let F=t0(U)?U:Xh(R.location,U,T);d=y();let V=n0(F,d),le=R.createHref(F.unstable_mask||F);c.replaceState(V,"",le),u&&m&&m({action:f,location:R.location,delta:0})}function k(U){return nS(U)}let R={get action(){return f},get location(){return e(l,c)},listen(U){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(e0,g),m=U,()=>{l.removeEventListener(e0,g),m=null}},createHref(U){return n(l,U)},createURL:k,encodeLocation(U){let T=k(U);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:b,replace:w,go(U){return c.go(U)}};return R}function nS(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Ut(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:Nl(e);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function Ub(e,n,r="/"){return rS(e,n,r,!1)}function rS(e,n,r,a){let l=typeof n=="string"?ps(n):n,u=ei(l.pathname||"/",r);if(u==null)return null;let c=Bb(e);iS(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=pS(u);f=dS(c[m],d,a)}return f}function Bb(e,n=[],r=[],a="",l=!1){let u=(c,f,m=l,d)=>{let y={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(a)&&m)return;Ut(y.relativePath.startsWith(a),`Absolute route path "${y.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(a.length)}let g=Ar([a,y.relativePath]),b=r.concat(y);c.children&&c.children.length>0&&(Ut(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Bb(c.children,n,b,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:fS(g,c.index),routesMeta:b})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,f);else for(let d of Pb(c.path))u(c,f,!0,d)}),n}function Pb(e){let n=e.split("/");if(n.length===0)return[];let[r,...a]=n,l=r.endsWith("?"),u=r.replace(/\?$/,"");if(a.length===0)return l?[u,""]:[u];let c=Pb(a.join("/")),f=[];return f.push(...c.map(m=>m===""?u:[u,m].join("/"))),l&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function iS(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:hS(n.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var aS=/^:[\w-]+$/,sS=3,lS=2,oS=1,uS=10,cS=-2,r0=e=>e==="*";function fS(e,n){let r=e.split("/"),a=r.length;return r.some(r0)&&(a+=cS),n&&(a+=lS),r.filter(l=>!r0(l)).reduce((l,u)=>l+(aS.test(u)?sS:u===""?oS:uS),a)}function hS(e,n){return e.length===n.length&&e.slice(0,-1).every((a,l)=>a===n[l])?e[e.length-1]-n[n.length-1]:0}function dS(e,n,r=!1){let{routesMeta:a}=e,l={},u="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],d=f===a.length-1,y=u==="/"?n:n.slice(u.length)||"/",g=wu({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),b=m.route;if(!g&&d&&r&&!a[a.length-1].route.index&&(g=wu({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:Ar([u,g.pathname]),pathnameBase:xS(Ar([u,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(u=Ar([u,g.pathnameBase]))}return c}function wu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=mS(e.path,e.caseSensitive,e.end),l=n.match(r);if(!l)return null;let u=l[0],c=u.replace(/(.)\/+$/,"$1"),f=l.slice(1);return{params:a.reduce((d,{paramName:y,isOptional:g},b)=>{if(y==="*"){let k=f[b]||"";c=u.slice(0,u.length-k.length).replace(/(.)\/+$/,"$1")}const w=f[b];return g&&!w?d[y]=void 0:d[y]=(w||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function mS(e,n=!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 a=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,d,y)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let g=y.charAt(d+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),a]}function pS(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){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 (${n}).`),e}}function ei(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}var gS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function yS(e,n="/"){let{pathname:r,search:a="",hash:l=""}=typeof e=="string"?ps(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=i0(r.substring(1),"/"):u=i0(r,n)):u=n,{pathname:u,search:vS(a),hash:wS(l)}}function i0(e,n){let r=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function fh(e,n,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function bS(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Hb(e){let n=bS(e);return n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase)}function Ed(e,n,r,a=!1){let l;typeof e=="string"?l=ps(e):(l={...e},Ut(!l.pathname||!l.pathname.includes("?"),fh("?","pathname","search",l)),Ut(!l.pathname||!l.pathname.includes("#"),fh("#","pathname","hash",l)),Ut(!l.search||!l.search.includes("#"),fh("#","search","hash",l)));let u=e===""||l.pathname==="",c=u?"/":l.pathname,f;if(c==null)f=r;else{let g=n.length-1;if(!a&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),g-=1;l.pathname=b.join("/")}f=g>=0?n[g]:"/"}let m=yS(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var Ar=e=>e.join("/").replace(/\/\/+/g,"/"),xS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),vS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,SS=class{constructor(e,n,r,a=!1){this.status=e,this.statusText=n||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function _S(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function kS(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var qb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ib(e,n){let r=e;if(typeof r!="string"||!gS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,l=!1;if(qb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=ei(c.pathname,n);c.origin===u.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:a,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Fb=["POST","PUT","PATCH","DELETE"];new Set(Fb);var ES=["GET",...Fb];new Set(ES);var gs=z.createContext(null);gs.displayName="DataRouter";var Bu=z.createContext(null);Bu.displayName="DataRouterState";var CS=z.createContext(!1),$b=z.createContext({isTransitioning:!1});$b.displayName="ViewTransition";var AS=z.createContext(new Map);AS.displayName="Fetchers";var TS=z.createContext(null);TS.displayName="Await";var lr=z.createContext(null);lr.displayName="Navigation";var Ul=z.createContext(null);Ul.displayName="Location";var jr=z.createContext({outlet:null,matches:[],isDataRoute:!1});jr.displayName="Route";var Cd=z.createContext(null);Cd.displayName="RouteError";var Gb="REACT_ROUTER_ERROR",jS="REDIRECT",NS="ROUTE_ERROR_RESPONSE";function OS(e){if(e.startsWith(`${Gb}:${jS}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function RS(e){if(e.startsWith(`${Gb}:${NS}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new SS(n.status,n.statusText,n.data)}catch{}}function MS(e,{relative:n}={}){Ut(Bl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=z.useContext(lr),{hash:l,pathname:u,search:c}=Pl(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:Ar([r,u])),a.createHref({pathname:f,search:c,hash:l})}function Bl(){return z.useContext(Ul)!=null}function Nr(){return Ut(Bl(),"useLocation() may be used only in the context of a <Router> component."),z.useContext(Ul).location}var Yb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Vb(e){z.useContext(lr).static||z.useLayoutEffect(e)}function da(){let{isDataRoute:e}=z.useContext(jr);return e?VS():DS()}function DS(){Ut(Bl(),"useNavigate() may be used only in the context of a <Router> component.");let e=z.useContext(gs),{basename:n,navigator:r}=z.useContext(lr),{matches:a}=z.useContext(jr),{pathname:l}=Nr(),u=JSON.stringify(Hb(a)),c=z.useRef(!1);return Vb(()=>{c.current=!0}),z.useCallback((m,d={})=>{if(Tr(c.current,Yb),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=Ed(m,JSON.parse(u),l,d.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:Ar([n,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[n,r,u,l,e])}z.createContext(null);function zS(){let{matches:e}=z.useContext(jr),n=e[e.length-1];return n?n.params:{}}function Pl(e,{relative:n}={}){let{matches:r}=z.useContext(jr),{pathname:a}=Nr(),l=JSON.stringify(Hb(r));return z.useMemo(()=>Ed(e,JSON.parse(l),a,n==="path"),[e,l,a,n])}function LS(e,n){return Jb(e,n)}function Jb(e,n,r){var U;Ut(Bl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=z.useContext(lr),{matches:l}=z.useContext(jr),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let T=d&&d.path||"";Kb(f,!d||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${T}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
-
60
- Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let y=Nr(),g;if(n){let T=typeof n=="string"?ps(n):n;Ut(m==="/"||((U=T.pathname)==null?void 0:U.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${T.pathname}" was given in the \`location\` prop.`),g=T}else g=y;let b=g.pathname||"/",w=b;if(m!=="/"){let T=m.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(T.length).join("/")}let k=Ub(e,{pathname:w});Tr(d||k!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Tr(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let R=qS(k&&k.map(T=>Object.assign({},T,{params:Object.assign({},c,T.params),pathname:Ar([m,a.encodeLocation?a.encodeLocation(T.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?m:Ar([m,a.encodeLocation?a.encodeLocation(T.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),l,r);return n&&R?z.createElement(Ul.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},R):R}function US(){let e=YS(),n=_S(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:a},u={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=z.createElement(z.Fragment,null,z.createElement("p",null,"💿 Hey developer 👋"),z.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",z.createElement("code",{style:u},"ErrorBoundary")," or"," ",z.createElement("code",{style:u},"errorElement")," prop on your route.")),z.createElement(z.Fragment,null,z.createElement("h2",null,"Unexpected Application Error!"),z.createElement("h3",{style:{fontStyle:"italic"}},n),r?z.createElement("pre",{style:l},r):null,c)}var BS=z.createElement(US,null),Xb=class extends z.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=RS(e.digest);r&&(e=r)}let n=e!==void 0?z.createElement(jr.Provider,{value:this.props.routeContext},z.createElement(Cd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?z.createElement(PS,{error:e},n):n}};Xb.contextType=CS;var hh=new WeakMap;function PS({children:e,error:n}){let{basename:r}=z.useContext(lr);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let a=OS(n.digest);if(a){let l=hh.get(n);if(l)throw l;let u=Ib(a.location,r);if(qb&&!hh.get(n))if(u.isExternal||a.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:a.replace}));throw hh.set(n,c),c}return z.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function HS({routeContext:e,match:n,children:r}){let a=z.useContext(gs);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),z.createElement(jr.Provider,{value:e},r)}function qS(e,n=[],r){let a=r==null?void 0:r.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(n.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let l=e,u=a==null?void 0:a.errors;if(u!=null){let y=l.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);Ut(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,y+1))}let c=!1,f=-1;if(r&&a){c=a.renderFallback;for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=y),g.route.id){let{loaderData:b,errors:w}=a,k=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||k){r.isStatic&&(c=!0),f>=0?l=l.slice(0,f+1):l=[l[0]];break}}}}let m=r==null?void 0:r.onError,d=a&&m?(y,g)=>{var b,w;m(y,{location:a.location,params:((w=(b=a.matches)==null?void 0:b[0])==null?void 0:w.params)??{},unstable_pattern:kS(a.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,b)=>{let w,k=!1,R=null,U=null;a&&(w=u&&g.route.id?u[g.route.id]:void 0,R=g.route.errorElement||BS,c&&(f<0&&b===0?(Kb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,U=null):f===b&&(k=!0,U=g.route.hydrateFallbackElement||null)));let T=n.concat(l.slice(0,b+1)),F=()=>{let V;return w?V=R:k?V=U:g.route.Component?V=z.createElement(g.route.Component,null):g.route.element?V=g.route.element:V=y,z.createElement(HS,{match:g,routeContext:{outlet:y,matches:T,isDataRoute:a!=null},children:V})};return a&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?z.createElement(Xb,{location:a.location,revalidation:a.revalidation,component:R,error:w,children:F(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:d}):F()},null)}function Ad(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function IS(e){let n=z.useContext(gs);return Ut(n,Ad(e)),n}function FS(e){let n=z.useContext(Bu);return Ut(n,Ad(e)),n}function $S(e){let n=z.useContext(jr);return Ut(n,Ad(e)),n}function Td(e){let n=$S(e),r=n.matches[n.matches.length-1];return Ut(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function GS(){return Td("useRouteId")}function YS(){var a;let e=z.useContext(Cd),n=FS("useRouteError"),r=Td("useRouteError");return e!==void 0?e:(a=n.errors)==null?void 0:a[r]}function VS(){let{router:e}=IS("useNavigate"),n=Td("useNavigate"),r=z.useRef(!1);return Vb(()=>{r.current=!0}),z.useCallback(async(l,u={})=>{Tr(r.current,Yb),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...u}))},[e,n])}var a0={};function Kb(e,n,r){!n&&!a0[e]&&(a0[e]=!0,Tr(!1,r))}z.memo(JS);function JS({routes:e,future:n,state:r,isStatic:a,onError:l}){return Jb(e,void 0,{state:r,isStatic:a,onError:l})}function ua(e){Ut(!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 XS({basename:e="/",children:n=null,location:r,navigationType:a="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Ut(!Bl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=z.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=ps(r));let{pathname:d="/",search:y="",hash:g="",state:b=null,key:w="default",unstable_mask:k}=r,R=z.useMemo(()=>{let U=ei(d,f);return U==null?null:{location:{pathname:U,search:y,hash:g,state:b,key:w,unstable_mask:k},navigationType:a}},[f,d,y,g,b,w,a,k]);return Tr(R!=null,`<Router basename="${f}"> is not able to match the URL "${d}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),R==null?null:z.createElement(lr.Provider,{value:m},z.createElement(Ul.Provider,{children:n,value:R}))}function KS({children:e,location:n}){return LS(Kh(e),n)}function Kh(e,n=[]){let r=[];return z.Children.forEach(e,(a,l)=>{if(!z.isValidElement(a))return;let u=[...n,l];if(a.type===z.Fragment){r.push.apply(r,Kh(a.props.children,u));return}Ut(a.type===ua,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ut(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||u.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=Kh(a.props.children,u)),r.push(c)}),r}var gu="get",yu="application/x-www-form-urlencoded";function Pu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function QS(e){return Pu(e)&&e.tagName.toLowerCase()==="button"}function ZS(e){return Pu(e)&&e.tagName.toLowerCase()==="form"}function WS(e){return Pu(e)&&e.tagName.toLowerCase()==="input"}function e_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function t_(e,n){return e.button===0&&(!n||n==="_self")&&!e_(e)}var su=null;function n_(){if(su===null)try{new FormData(document.createElement("form"),0),su=!1}catch{su=!0}return su}var r_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function dh(e){return e!=null&&!r_.has(e)?(Tr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yu}"`),null):e}function i_(e,n){let r,a,l,u,c;if(ZS(e)){let f=e.getAttribute("action");a=f?ei(f,n):null,r=e.getAttribute("method")||gu,l=dh(e.getAttribute("enctype"))||yu,u=new FormData(e)}else if(QS(e)||WS(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(a=m?ei(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||gu,l=dh(e.getAttribute("formenctype"))||dh(f.getAttribute("enctype"))||yu,u=new FormData(f,e),!n_()){let{name:d,type:y,value:g}=e;if(y==="image"){let b=d?`${d}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else d&&u.append(d,g)}}else{if(Pu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=gu,a=null,l=yu,c=e}return u&&l==="text/plain"&&(c=u,u=void 0),{action:a,method:r.toLowerCase(),encType:l,formData:u,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function jd(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function a_(e,n,r,a){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${a}`:l.pathname=`${l.pathname}.${a}`:l.pathname==="/"?l.pathname=`_root.${a}`:n&&ei(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${a}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${a}`,l}async function s_(e,n){if(e.id in n)return n[e.id];try{let r=await import(e.module);return n[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function l_(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 o_(e,n,r){let a=await Promise.all(e.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await s_(u,r);return c.links?c.links():[]}return[]}));return h_(a.flat(1).filter(l_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function s0(e,n,r,a,l,u){let c=(m,d)=>r[d]?m.route.id!==r[d].route.id:!0,f=(m,d)=>{var y;return r[d].pathname!==m.pathname||((y=r[d].route.path)==null?void 0:y.endsWith("*"))&&r[d].params["*"]!==m.params["*"]};return u==="assets"?n.filter((m,d)=>c(m,d)||f(m,d)):u==="data"?n.filter((m,d)=>{var g;let y=a.routes[m.route.id];if(!y||!y.hasLoader)return!1;if(c(m,d)||f(m,d))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function u_(e,n,{includeHydrateFallback:r}={}){return c_(e.map(a=>{let l=n.routes[a.route.id];if(!l)return[];let u=[l.module];return l.clientActionModule&&(u=u.concat(l.clientActionModule)),l.clientLoaderModule&&(u=u.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(u=u.concat(l.hydrateFallbackModule)),l.imports&&(u=u.concat(l.imports)),u}).flat(1))}function c_(e){return[...new Set(e)]}function f_(e){let n={},r=Object.keys(e).sort();for(let a of r)n[a]=e[a];return n}function h_(e,n){let r=new Set;return new Set(n),e.reduce((a,l)=>{let u=JSON.stringify(f_(l));return r.has(u)||(r.add(u),a.push({key:u,link:l})),a},[])}function Qb(){let e=z.useContext(gs);return jd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function d_(){let e=z.useContext(Bu);return jd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Nd=z.createContext(void 0);Nd.displayName="FrameworkContext";function Zb(){let e=z.useContext(Nd);return jd(e,"You must render this element inside a <HydratedRouter> element"),e}function m_(e,n){let r=z.useContext(Nd),[a,l]=z.useState(!1),[u,c]=z.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,b=z.useRef(null);z.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let R=T=>{T.forEach(F=>{c(F.isIntersecting)})},U=new IntersectionObserver(R,{threshold:.5});return b.current&&U.observe(b.current),()=>{U.disconnect()}}},[e]),z.useEffect(()=>{if(a){let R=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(R)}}},[a]);let w=()=>{l(!0)},k=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,b,{}]:[u,b,{onFocus:hl(f,w),onBlur:hl(m,k),onMouseEnter:hl(d,w),onMouseLeave:hl(y,k),onTouchStart:hl(g,w)}]:[!1,b,{}]}function hl(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function p_({page:e,...n}){let{router:r}=Qb(),a=z.useMemo(()=>Ub(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?z.createElement(y_,{page:e,matches:a,...n}):null}function g_(e){let{manifest:n,routeModules:r}=Zb(),[a,l]=z.useState([]);return z.useEffect(()=>{let u=!1;return o_(e,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,n,r]),a}function y_({page:e,matches:n,...r}){let a=Nr(),{future:l,manifest:u,routeModules:c}=Zb(),{basename:f}=Qb(),{loaderData:m,matches:d}=d_(),y=z.useMemo(()=>s0(e,n,d,u,a,"data"),[e,n,d,u,a]),g=z.useMemo(()=>s0(e,n,d,u,a,"assets"),[e,n,d,u,a]),b=z.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let R=new Set,U=!1;if(n.forEach(F=>{var le;let V=u.routes[F.route.id];!V||!V.hasLoader||(!y.some(L=>L.route.id===F.route.id)&&F.route.id in m&&((le=c[F.route.id])!=null&&le.shouldRevalidate)||V.hasClientLoader?U=!0:R.add(F.route.id))}),R.size===0)return[];let T=a_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return U&&R.size>0&&T.searchParams.set("_routes",n.filter(F=>R.has(F.route.id)).map(F=>F.route.id).join(",")),[T.pathname+T.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,a,u,y,n,e,c]),w=z.useMemo(()=>u_(g,u),[g,u]),k=g_(g);return z.createElement(z.Fragment,null,b.map(R=>z.createElement("link",{key:R,rel:"prefetch",as:"fetch",href:R,...r})),w.map(R=>z.createElement("link",{key:R,rel:"modulepreload",href:R,...r})),k.map(({key:R,link:U})=>z.createElement("link",{key:R,nonce:r.nonce,...U,crossOrigin:U.crossOrigin??r.crossOrigin})))}function b_(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var x_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{x_&&(window.__reactRouterVersion="7.13.1")}catch{}function v_({basename:e,children:n,unstable_useTransitions:r,window:a}){let l=z.useRef();l.current==null&&(l.current=Ww({window:a,v5Compat:!0}));let u=l.current,[c,f]=z.useState({action:u.action,location:u.location}),m=z.useCallback(d=>{r===!1?f(d):z.startTransition(()=>f(d))},[r]);return z.useLayoutEffect(()=>u.listen(m),[u,m]),z.createElement(XS,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var Wb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ex=z.forwardRef(function({onClick:n,discover:r="render",prefetch:a="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:d,to:y,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:w,...k},R){let{basename:U,navigator:T,unstable_useTransitions:F}=z.useContext(lr),V=typeof y=="string"&&Wb.test(y),le=Ib(y,U);y=le.to;let L=MS(y,{relative:l}),D=Nr(),J=null;if(f){let I=Ed(f,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);U!=="/"&&(I.pathname=I.pathname==="/"?U:Ar([U,I.pathname])),J=T.createHref(I)}let[B,q,A]=m_(a,k),K=k_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:b,unstable_defaultShouldRevalidate:w,unstable_useTransitions:F});function Z(I){n&&n(I),I.defaultPrevented||K(I)}let ue=!(le.isExternal||u),he=z.createElement("a",{...k,...A,href:(ue?J:void 0)||le.absoluteURL||L,onClick:ue?Z:n,ref:b_(R,q),target:d,"data-discover":!V&&r==="render"?"true":void 0});return B&&!V?z.createElement(z.Fragment,null,he,z.createElement(p_,{page:L})):he});ex.displayName="Link";var w_=z.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:a="",end:l=!1,style:u,to:c,viewTransition:f,children:m,...d},y){let g=Pl(c,{relative:d.relative}),b=Nr(),w=z.useContext(Bu),{navigator:k,basename:R}=z.useContext(lr),U=w!=null&&j_(g)&&f===!0,T=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,F=b.pathname,V=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(F=F.toLowerCase(),V=V?V.toLowerCase():null,T=T.toLowerCase()),V&&R&&(V=ei(V,R)||V);const le=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let L=F===T||!l&&F.startsWith(T)&&F.charAt(le)==="/",D=V!=null&&(V===T||!l&&V.startsWith(T)&&V.charAt(T.length)==="/"),J={isActive:L,isPending:D,isTransitioning:U},B=L?n:void 0,q;typeof a=="function"?q=a(J):q=[a,L?"active":null,D?"pending":null,U?"transitioning":null].filter(Boolean).join(" ");let A=typeof u=="function"?u(J):u;return z.createElement(ex,{...d,"aria-current":B,className:q,ref:y,style:A,to:c,viewTransition:f},typeof m=="function"?m(J):m)});w_.displayName="NavLink";var S_=z.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:a,replace:l,state:u,method:c=gu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b,...w},k)=>{let{unstable_useTransitions:R}=z.useContext(lr),U=A_(),T=T_(f,{relative:d}),F=c.toLowerCase()==="get"?"get":"post",V=typeof f=="string"&&Wb.test(f),le=L=>{if(m&&m(L),L.defaultPrevented)return;L.preventDefault();let D=L.nativeEvent.submitter,J=(D==null?void 0:D.getAttribute("formmethod"))||c,B=()=>U(D||L.currentTarget,{fetcherKey:n,method:J,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b});R&&r!==!1?z.startTransition(()=>B()):B()};return z.createElement("form",{ref:k,method:F,action:T,onSubmit:a?m:le,...w,"data-discover":!V&&e==="render"?"true":void 0})});S_.displayName="Form";function __(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function tx(e){let n=z.useContext(gs);return Ut(n,__(e)),n}function k_(e,{target:n,replace:r,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=da(),g=Nr(),b=Pl(e,{relative:c});return z.useCallback(w=>{if(t_(w,n)){w.preventDefault();let k=r!==void 0?r:Nl(g)===Nl(b),R=()=>y(e,{replace:k,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?z.startTransition(()=>R()):R()}},[g,y,b,r,a,l,n,e,u,c,f,m,d])}var E_=0,C_=()=>`__${String(++E_)}__`;function A_(){let{router:e}=tx("useSubmit"),{basename:n}=z.useContext(lr),r=GS(),a=e.fetch,l=e.navigate;return z.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=i_(u,n);if(c.navigate===!1){let b=c.fetcherKey||C_();await a(b,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,l,n,r])}function T_(e,{relative:n}={}){let{basename:r}=z.useContext(lr),a=z.useContext(jr);Ut(a,"useFormAction must be used inside a RouteContext");let[l]=a.matches.slice(-1),u={...Pl(e||".",{relative:n})},c=Nr();if(e==null){u.search=c.search;let f=new URLSearchParams(u.search),m=f.getAll("index");if(m.some(y=>y==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let y=f.toString();u.search=y?`?${y}`:""}}return(!e||e===".")&&l.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:Ar([r,u.pathname])),Nl(u)}function j_(e,{relative:n}={}){let r=z.useContext($b);Ut(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=tx("useViewTransitionState"),l=Pl(e,{relative:n});if(!r.isTransitioning)return!1;let u=ei(r.currentLocation.pathname,a)||r.currentLocation.pathname,c=ei(r.nextLocation.pathname,a)||r.nextLocation.pathname;return wu(l.pathname,c)!=null||wu(l.pathname,u)!=null}var Su=Lb();const nx=z.createContext(null),rx="palmier_paired_hosts",Qh="palmier_active_host";function mh(){try{const e=localStorage.getItem(rx);if(e)return JSON.parse(e)}catch{}return[]}function N_(e){localStorage.setItem(rx,JSON.stringify(e))}function O_(){return localStorage.getItem(Qh)}function R_(e){e?localStorage.setItem(Qh,e):localStorage.removeItem(Qh)}const M_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function D_({children:e}){const[n,r]=z.useState(mh),[a,l]=z.useState(()=>{const y=O_(),g=mh();return y&&g.some(b=>b.hostId===y)?y:g.length>0?g[0].hostId:null});z.useEffect(()=>{if(!M_)return;const y="local";if(!mh().find(b=>b.hostId===y)){const b={hostId:y,clientToken:"",directUrl:window.location.origin};r(w=>[...w.filter(k=>k.hostId!==y),b]),l(y)}},[]),z.useEffect(()=>{N_(n)},[n]),z.useEffect(()=>{R_(a)},[a]);const u=z.useCallback(y=>{r(g=>[...g.filter(w=>w.hostId!==y.hostId),y]),l(y.hostId)},[]),c=z.useCallback(y=>{r(g=>{const b=g.filter(w=>w.hostId!==y);return b.length>0?l(b[0].hostId):l(null),b})},[]),f=z.useCallback((y,g)=>{r(b=>b.map(w=>w.hostId===y?{...w,name:g}:w))},[]),m=z.useCallback(y=>{l(y)},[]),d=z.useCallback(()=>n.find(y=>y.hostId===a)??null,[n,a]);return v.jsx(nx.Provider,{value:{pairedHosts:n,activeHostId:a,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setActiveHostId:m,getActiveHost:d},children:e})}function Hl(){const e=z.useContext(nx);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const Yn=new Uint8Array(0),Pi=new TextEncoder,Fn=new TextDecoder;function z_(...e){let n=0;for(let l=0;l<e.length;l++)n+=e[l].length;const r=new Uint8Array(n);let a=0;for(let l=0;l<e.length;l++)r.set(e[l],a),a+=e[l].length;return r}function _l(...e){const n=[];for(let r=0;r<e.length;r++)n.push(Pi.encode(e[r]));return n.length===0?Yn:n.length===1?n[0]:z_(...n)}function l0(e){return!e||e.length===0?"":Fn.decode(e)}const o0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",u0=36,L_=0xcfd41b9100000,c0=33,U_=333,f0=22;function B_(e){for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*255)}function P_(e){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(e):B_(e)}class H_{constructor(){E(this,"buf");E(this,"seq");E(this,"inc");E(this,"inited");this.buf=new Uint8Array(f0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*L_),this.inc=Math.floor(Math.random()*(U_-c0)+c0)}setPre(){const n=new Uint8Array(12);P_(n);for(let r=0;r<12;r++){const a=n[r]%36;this.buf[r]=o0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let r=f0-1;r>=12;r--)this.buf[r]=o0.charCodeAt(n%u0),n=Math.floor(n/u0)}next(){return this.inited||this.init(),this.seq+=this.inc,this.seq>0xcfd41b9100000&&(this.setPre(),this.initSeqAndInc()),this.fillSeq(),String.fromCharCode.apply(String,this.buf)}reset(){this.init()}}const Ui=new H_;var Zr;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Zr||(Zr={}));var rs;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(rs||(rs={}));var Se;(function(e){e.ApiError="BAD API",e.BadAuthentication="BAD_AUTHENTICATION",e.BadCreds="BAD_CREDS",e.BadHeader="BAD_HEADER",e.BadJson="BAD_JSON",e.BadPayload="BAD_PAYLOAD",e.BadSubject="BAD_SUBJECT",e.Cancelled="CANCELLED",e.ConnectionClosed="CONNECTION_CLOSED",e.ConnectionDraining="CONNECTION_DRAINING",e.ConnectionRefused="CONNECTION_REFUSED",e.ConnectionTimeout="CONNECTION_TIMEOUT",e.Disconnect="DISCONNECT",e.InvalidOption="INVALID_OPTION",e.InvalidPayload="INVALID_PAYLOAD",e.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",e.NoResponders="503",e.NotFunction="NOT_FUNC",e.RequestError="REQUEST_ERROR",e.ServerOptionNotAvailable="SERVER_OPT_NA",e.SubClosed="SUB_CLOSED",e.SubDraining="SUB_DRAINING",e.Timeout="TIMEOUT",e.Tls="TLS",e.Unknown="UNKNOWN_ERROR",e.WssRequired="WSS_REQUIRED",e.JetStreamInvalidAck="JESTREAM_INVALID_ACK",e.JetStream404NoMessages="404",e.JetStream408RequestTimeout="408",e.JetStream409MaxAckPendingExceeded="409",e.JetStream409="409",e.JetStreamNotEnabled="503",e.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",e.AuthorizationViolation="AUTHORIZATION_VIOLATION",e.AuthenticationExpired="AUTHENTICATION_EXPIRED",e.ProtocolError="NATS_PROTOCOL_ERR",e.PermissionsViolation="PERMISSIONS_VIOLATION",e.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",e.AccountExpired="ACCOUNT_EXPIRED"})(Se||(Se={}));function q_(e){return typeof e.code=="string"}class ix{constructor(){E(this,"messages");this.messages=new Map,this.messages.set(Se.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(Se.BadJson,"Bad JSON"),this.messages.set(Se.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return I_.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const I_=new ix;class je extends Error{constructor(r,a,l){super(r);E(this,"name");E(this,"message");E(this,"code");E(this,"permissionContext");E(this,"chainedError");E(this,"api_error");this.name="NatsError",this.message=r,this.code=a,this.chainedError=l}static errorForCode(r,a){const l=ix.getMessage(r);return new je(l,r,a)}isAuthError(){return this.code===Se.AuthenticationExpired||this.code===Se.AuthorizationViolation||this.code===Se.AccountExpired}isAuthTimeout(){return this.code===Se.AuthenticationTimeout}isPermissionError(){return this.code===Se.PermissionsViolation}isProtocolError(){return this.code===Se.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var qn;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(qn||(qn={}));var gr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(gr||(gr={}));var kl;(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"})(kl||(kl={}));const _u="Nats-Service-Error",ku="Nats-Service-Error-Code";class Eu extends Error{constructor(r,a){super(a);E(this,"code");this.code=r}static isServiceError(r){return Eu.toServiceError(r)!==null}static toServiceError(r){var l,u;const a=((l=r==null?void 0:r.headers)==null?void 0:l.get(ku))||"";if(a!==""){const c=parseInt(a)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(_u))||"";return new Eu(c,f.length?f:a)}return null}}function Wr(e=""){if(e=e||"_INBOX",typeof e!="string")throw new Error("prefix must be a string");return e.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${e}'`)}),`${e}.${Ui.next()}`}const Zh="127.0.0.1";var Di;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Di||(Di={}));function Hu(e,...n){for(let r=0;r<n.length;r++){const a=n[r];Object.keys(a).forEach(function(l){e[l]=a[l]})}return e}function lu(e){return Fn.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function cs(e,n=!0){const r=n?je.errorForCode(Se.Timeout):null;let a,l;const u=new Promise((c,f)=>{a={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?je.errorForCode(Se.Timeout):r)},e)});return Object.assign(u,a)}function ys(e=0){let n;const r=new Promise(a=>{const l=setTimeout(()=>{a()},e);n={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,n)}function Lt(){let e={};const n=new Promise((r,a)=>{e={resolve:r,reject:a}});return Object.assign(n,e)}function ax(e){for(let n=e.length-1;n>0;n--){const r=Math.floor(Math.random()*(n+1));[e[n],e[r]]=[e[r],e[n]]}return e}function F_(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Od(e=[0,250,250,500,500,3e3,5e3]){Array.isArray(e)||(e=[0,250,250,500,500,3e3,5e3]);const n=e.length-1;return{backoff(r){return F_(r>n?e[n]:e[r])}}}function zt(e){return e*1e6}function Rd(e){return Math.floor(e/1e6)}function h0(e){let a=!0;const l=new Array(e.length);for(let u=0;u<e.length;u++){let c=e.charCodeAt(u);if(c===58||c<33||c>126)throw new je(`'${e[u]}' is not a valid character for a header key`,Se.BadHeader);a&&97<=c&&c<=122?c-=32:!a&&65<=c&&c<=90&&(c+=32),l[u]=c,a=c==45}return String.fromCharCode(...l)}function ti(e=0,n=""){if(e===0&&n!==""||e>0&&n==="")throw new Error("setting status requires both code and description");return new zi(e,n)}const ph="NATS/1.0";class zi{constructor(n=0,r=""){E(this,"_code");E(this,"headers");E(this,"_description");this._code=n,this._description=r,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(n){if(n&&this.headers.size===n.headers.size&&this._code===n._code){for(const[r,a]of this.headers){const l=n.values(r);if(a.length!==l.length)return!1;const u=[...a].sort(),c=[...l].sort();for(let f=0;f<u.length;f++)if(u[f]!==c[f])return!1}return!0}return!1}static decode(n){const r=new zi,l=Fn.decode(n).split(`\r
61
- `),u=l[0];if(u!==ph){let c=u.replace(ph,"").trim();if(c.length>0){r._code=parseInt(c,10),isNaN(r._code)&&(r._code=0);const f=r._code.toString();c=c.replace(f,""),r._description=c.trim()}}return l.length>=1&&l.slice(1).map(c=>{if(c){const f=c.indexOf(":");if(f>-1){const m=c.slice(0,f),d=c.slice(f+1).trim();r.append(m,d)}}}),r}toString(){if(this.headers.size===0&&this._code===0)return"";let n=ph;this._code>0&&this._description!==""&&(n+=` ${this._code} ${this._description}`);for(const[r,a]of this.headers)for(let l=0;l<a.length;l++)n=`${n}\r
62
- ${r}: ${a[l]}`;return`${n}\r
63
- \r
64
- `}encode(){return Pi.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new je("invalid header value - \\r and \\n are not allowed.",Se.BadHeader);return n.trim()}keys(){const n=[];for(const r of this.headers.keys())n.push(r);return n}findKeys(n,r=qn.Exact){const a=this.keys();switch(r){case qn.Exact:return a.filter(l=>l===n);case qn.CanonicalMIME:return n=h0(n),a.filter(l=>l===n);default:{const l=n.toLowerCase();return a.filter(u=>l===u.toLowerCase())}}}get(n,r=qn.Exact){const a=this.findKeys(n,r);if(a.length){const l=this.headers.get(a[0]);if(l)return Array.isArray(l)?l[0]:l}return""}last(n,r=qn.Exact){const a=this.findKeys(n,r);if(a.length){const l=this.headers.get(a[0]);if(l)return Array.isArray(l)?l[l.length-1]:l}return""}has(n,r=qn.Exact){return this.findKeys(n,r).length>0}set(n,r,a=qn.Exact){this.delete(n,a),this.append(n,r,a)}append(n,r,a=qn.Exact){const l=h0(n);a===qn.CanonicalMIME&&(n=l);const u=this.findKeys(n,a);n=u.length>0?u[0]:n;const c=zi.validHeaderValue(r);let f=this.headers.get(n);f||(f=[],this.headers.set(n,f)),f.push(c)}values(n,r=qn.Exact){const a=[];return this.findKeys(n,r).forEach(u=>{const c=this.headers.get(u);c&&a.push(...c)}),a}delete(n,r=qn.Exact){this.findKeys(n,r).forEach(l=>{this.headers.delete(l)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){const n={};return this.keys().forEach(r=>{n[r]=this.values(r)}),n}get code(){return this._code}get description(){return this._description}static fromRecord(n){const r=new zi;for(const a in n)r.headers.set(a,n[a]);return r}}function Cu(){return{encode(e){return Pi.encode(e)},decode(e){return Fn.decode(e)}}}function yr(e){return{encode(n){try{return n===void 0&&(n=null),Pi.encode(JSON.stringify(n))}catch(r){throw je.errorForCode(Se.BadJson,r)}},decode(n){try{return JSON.parse(Fn.decode(n),e)}catch(r){throw je.errorForCode(Se.BadJson,r)}}}}function sx(e){var n;return e&&e.data.length===0&&((n=e.headers)==null?void 0:n.code)===503?je.errorForCode(Se.NoResponders):null}class Md{constructor(n,r,a){E(this,"_headers");E(this,"_msg");E(this,"_rdata");E(this,"_reply");E(this,"_subject");E(this,"publisher");this._msg=n,this._rdata=r,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=Fn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Fn.decode(this._msg.reply),this._reply)}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){const n=this._rdata.subarray(0,this._msg.hdr);this._headers=zi.decode(n)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array(0)}respond(n=Yn,r){return this.reply?(this.publisher.publish(this.reply,n,r),!0):!1}size(){var l;const n=this._msg.subject.length,r=((l=this._msg.reply)==null?void 0:l.length)||0,a=this._msg.size===-1?0:this._msg.size;return n+r+a}json(n){return yr(n).decode(this.data)}string(){return Fn.decode(this.data)}requestInfo(){var r;const n=(r=this.headers)==null?void 0:r.get("Nats-Request-Info");return n?JSON.parse(n,function(a,l){return(a==="start"||a==="stop")&&l!==""?new Date(Date.parse(l)):l}):null}}E(Md,"jc");function is(e){return qu("durable",e)}function yn(e){return qu("stream",e)}function qu(e,n=""){if(n==="")throw Error(`${e} name required`);return[".","*",">","/","\\"," "," ",`
65
- `,"\r"].forEach(a=>{if(n.indexOf(a)!==-1){switch(a){case`
66
- `:a="\\n";break;case"\r":a="\\r";break;case" ":a="\\t";break}throw Error(`invalid ${e} name - ${e} name cannot contain '${a}'`)}}),""}function wl(e,n=""){if(n==="")throw Error(`${e} name required`);const r=$_(n);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function $_(e=""){if(e==="")throw Error("name required");const n=/^[-\w]+$/g;if(e.match(n)===null){for(const a of e.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Wh(e){if(e.data.length>0)return!1;const n=e.headers;return n?n.code>=100&&n.code<200:!1}function ed(e){var n;return Wh(e)&&((n=e.headers)==null?void 0:n.description)==="Idle Heartbeat"}function G_(e,n,r){const a=ti(e,n),l={hdr:1,sid:0,size:0},u=new Md(l,Yn,{});return u._headers=a,u._subject=r,u}function as(e){if(e.data.length!==0)return null;const n=e.headers;return n?lx(n.code,n.description):null}var ar;(function(e){e.MaxBatchExceeded="exceeded maxrequestbatch of",e.MaxExpiresExceeded="exceeded maxrequestexpires of",e.MaxBytesExceeded="exceeded maxrequestmaxbytes of",e.MaxMessageSizeExceeded="message size exceeds maxbytes",e.PushConsumer="consumer is push based",e.MaxWaitingExceeded="exceeded maxwaiting",e.IdleHeartbeatMissed="idle heartbeats missed",e.ConsumerDeleted="consumer deleted"})(ar||(ar={}));function Y_(e){return e.code!==Se.JetStream409?!1:[ar.MaxBatchExceeded,ar.MaxExpiresExceeded,ar.MaxBytesExceeded,ar.MaxMessageSizeExceeded,ar.PushConsumer,ar.IdleHeartbeatMissed,ar.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function lx(e,n=""){if(e<300)return null;switch(n=n.toLowerCase(),e){case 404:return new je(n,Se.JetStream404NoMessages);case 408:return new je(n,Se.JetStream408RequestTimeout);case 409:{const r=n.startsWith(ar.IdleHeartbeatMissed)?Se.JetStreamIdleHeartBeat:Se.JetStream409;return new je(n,r)}case 503:return je.errorForCode(Se.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=Se.Unknown),new je(n,`${e}`)}}class sn{constructor(){E(this,"inflight");E(this,"processed");E(this,"received");E(this,"noIterator");E(this,"iterClosed");E(this,"done");E(this,"signal");E(this,"yields");E(this,"filtered");E(this,"pendingFiltered");E(this,"ingestionFilterFn");E(this,"protocolFilterFn");E(this,"dispatchedFn");E(this,"ctx");E(this,"_data");E(this,"err");E(this,"time");E(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=Lt(),this.yields=[],this.iterClosed=Lt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:r,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};r&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new je("unsupported iterator",Se.ApiError);if(this.yielding)throw new je("already yielding",Se.ApiError);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;const n=this.yields;this.inflight=n.length,this.yields=[];for(let r=0;r<n.length;r++){if(typeof n[r]=="function"){const l=n[r];try{l()}catch(u){throw u}if(this.err)throw this.err;continue}if(this.protocolFilterFn?this.protocolFilterFn(n[r]):!0){this.processed++;const l=Date.now();yield n[r],this.time=Date.now()-l,this.dispatchedFn&&n[r]&&this.dispatchedFn(n[r])}else this.pendingFiltered--;this.inflight--}if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=Lt())}}finally{this.stop()}}stop(n){this.done||(this.err=n,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(n))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}class Dd{constructor(n,r,a={maxOut:2}){E(this,"interval");E(this,"maxOut");E(this,"cancelAfter");E(this,"timer");E(this,"autoCancelTimer");E(this,"last");E(this,"missed");E(this,"count");E(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,r=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var td;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(td||(td={}));var Ol;(function(e){e.Old="old",e.New="new"})(Ol||(Ol={}));var nd;(function(e){e.File="file",e.Memory="memory"})(nd||(nd={}));var Yt;(function(e){e.All="all",e.Last="last",e.New="new",e.StartSequence="by_start_sequence",e.StartTime="by_start_time",e.LastPerSubject="last_per_subject"})(Yt||(Yt={}));var an;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(an||(an={}));var fs;(function(e){e.Instant="instant",e.Original="original"})(fs||(fs={}));var Bi;(function(e){e.None="none",e.S2="s2"})(Bi||(Bi={}));var Au;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(Au||(Au={}));function V_(e,n={}){return Object.assign({name:e,deliver_policy:Yt.All,ack_policy:an.Explicit,ack_wait:zt(30*1e3),replay_policy:fs.Instant},n)}var d0;(function(e){e.API="api_audit",e.StreamAction="stream_action",e.ConsumerAction="consumer_action",e.SnapshotCreate="snapshot_create",e.SnapshotComplete="snapshot_complete",e.RestoreCreate="restore_create",e.RestoreComplete="restore_complete",e.MaxDeliver="max_deliver",e.Terminated="terminated",e.Ack="consumer_ack",e.StreamLeaderElected="stream_leader_elected",e.StreamQuorumLost="stream_quorum_lost",e.ConsumerLeaderElected="consumer_leader_elected",e.ConsumerQuorumLost="consumer_quorum_lost"})(d0||(d0={}));var wn;(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"})(wn||(wn={}));var pr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(pr||(pr={}));var ts;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(ts||(ts={}));var m0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(m0||(m0={}));const In="KV_";class J_{constructor(n){E(this,"config");E(this,"ordered");E(this,"mack");E(this,"stream");E(this,"callbackFn");E(this,"max");E(this,"qname");E(this,"isBind");E(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=V_("",n||{})}getOpts(){var r;const n={};if(n.config=Object.assign({},this.config),n.config.filter_subject&&(this.filterSubject(n.config.filter_subject),n.config.filter_subject=void 0),n.config.filter_subjects&&((r=n.config.filter_subjects)==null||r.forEach(a=>{this.filterSubject(a)}),n.config.filter_subjects=void 0),n.mack=this.mack,n.stream=this.stream,n.callbackFn=this.callbackFn,n.max=this.max,n.queue=this.qname,n.ordered=this.ordered,n.config.ack_policy=n.ordered?an.None:n.config.ack_policy,n.isBind=n.isBind||!1,this.filters)switch(this.filters.length){case 0:break;case 1:n.config.filter_subject=this.filters[0];break;default:n.config.filter_subjects=this.filters}return n}description(n){return this.config.description=n,this}deliverTo(n){return this.config.deliver_subject=n,this}durable(n){return is(n),this.config.durable_name=n,this}startSequence(n){if(n<=0)throw new Error("sequence must be greater than 0");return this.config.deliver_policy=Yt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=Yt.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=Yt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Yt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Yt.Last,this}deliverNew(){return this.config.deliver_policy=Yt.New,this}startAtTimeDelta(n){return this.startTime(new Date(Date.now()-n)),this}headersOnly(){return this.config.headers_only=!0,this}ackNone(){return this.config.ack_policy=an.None,this}ackAll(){return this.config.ack_policy=an.All,this}ackExplicit(){return this.config.ack_policy=an.Explicit,this}ackWait(n){return this.config.ack_wait=zt(n),this}maxDeliver(n){return this.config.max_deliver=n,this}filterSubject(n){return this.filters=this.filters||[],this.filters.push(n),this}replayInstantly(){return this.config.replay_policy=fs.Instant,this}replayOriginal(){return this.config.replay_policy=fs.Original,this}sample(n){if(n=Math.trunc(n),n<0||n>100)throw new Error("value must be between 0-100");return this.config.sample_freq=`${n}%`,this}limit(n){return this.config.rate_limit_bps=n,this}maxWaiting(n){return this.config.max_waiting=n,this}maxAckPending(n){return this.config.max_ack_pending=n,this}idleHeartbeat(n){return this.config.idle_heartbeat=zt(n),this}flowControl(){return this.config.flow_control=!0,this}deliverGroup(n){return this.queue(n),this}manualAck(){return this.mack=!0,this}maxMessages(n){return this.max=n,this}callback(n){return this.callbackFn=n,this}queue(n){return this.qname=n,this.config.deliver_group=n,this}orderedConsumer(){return this.ordered=!0,this}bind(n,r){return this.stream=n,this.config.durable_name=r,this.isBind=!0,this}bindStream(n){return this.stream=n,this}inactiveEphemeralThreshold(n){return this.config.inactive_threshold=zt(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=zt(n),this}memory(){return this.config.mem_storage=!0,this}numReplicas(n){return this.config.num_replicas=n,this}consumerName(n){return this.config.name=n,this}}function Li(e){return new J_(e)}function p0(e){return typeof e.getOpts=="function"}class X_{static encode(n){if(typeof n=="string")return btoa(n);const r=Array.from(n);return btoa(String.fromCharCode(...r))}static decode(n,r=!1){const a=atob(n);return r?Uint8Array.from(a,l=>l.charCodeAt(0)):a}}class ss{static encode(n){return ss.toB64URLEncoding(X_.encode(n))}static decode(n,r=!1){return ss.decode(ss.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class hs{constructor(){E(this,"buffers");E(this,"byteLength");this.buffers=[],this.byteLength=0}static concat(...n){let r=0;for(let u=0;u<n.length;u++)r+=n[u].length;const a=new Uint8Array(r);let l=0;for(let u=0;u<n.length;u++)a.set(n[u],l),l+=n[u].length;return a}static fromAscii(n){return n||(n=""),Pi.encode(n)}static toAscii(n){return Fn.decode(n)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){const n=new Uint8Array(this.byteLength);let r=0;for(let a=0;a<this.buffers.length;a++)n.set(this.buffers[a],r),r+=this.buffers[a].length;this.buffers.length=0,this.buffers.push(n)}}shift(){if(this.buffers.length){const n=this.buffers.shift();if(n)return this.byteLength-=n.length,n}return new Uint8Array(0)}drain(n){if(this.buffers.length){this.pack();const r=this.buffers.pop();if(r){const a=this.byteLength;(n===void 0||n>a)&&(n=a);const l=r.subarray(0,n);return a>n&&this.buffers.push(r.subarray(n)),this.byteLength=a-n,l}}return new Uint8Array(0)}fill(n,...r){n&&(this.buffers.push(n),this.byteLength+=n.length);for(let a=0;a<r.length;a++)r[a]&&r[a].length&&(this.buffers.push(r[a]),this.byteLength+=r[a].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array(0)}size(){return this.byteLength}length(){return this.buffers.length}}function K_(e,n){return n.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(a){if(a!=="default"&&!(a in e)){var l=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(e,a,l.get?l:{enumerable:!0,get:function(){return r[a]}})}})}),Object.freeze(e)}var Q_=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},dl=Q_.performance||{};dl.now||dl.mozNow||dl.msNow||dl.oNow||dl.webkitNow;var g0={versions:{}},Z_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function W_(e){if(e.__esModule)return e;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var gh,Iu={exports:{}},y0={},b0=W_(K_({__proto__:null,default:y0},[y0]));gh=Iu,(function(){var e="input is invalid type",n=typeof window=="object",r=n?window:{};r.JS_SHA256_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",l=!r.JS_SHA256_NO_NODE_JS&&g0.versions&&g0.versions.node;l?r=Z_:a&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&gh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),m=[-2147483648,8388608,32768,128],d=[24,16,8,0],y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=["hex","array","digest","arrayBuffer"],b=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(L){return Object.prototype.toString.call(L)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(L){return typeof L=="object"&&L.buffer&&L.buffer.constructor===ArrayBuffer});var w=function(L,D){return function(J){return new F(D,!0).update(J)[L]()}},k=function(L){var D=w("hex",L);l&&(D=R(D,L)),D.create=function(){return new F(L)},D.update=function(q){return D.create().update(q)};for(var J=0;J<g.length;++J){var B=g[J];D[B]=w(B,L)}return D},R=function(L,D){var J,B=b0,q=b0.Buffer,A=D?"sha224":"sha256";return J=q.from&&!r.JS_SHA256_NO_BUFFER_FROM?q.from:function(K){return new q(K)},function(K){if(typeof K=="string")return B.createHash(A).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===q?B.createHash(A).update(J(K)).digest("hex"):L(K)}},U=function(L,D){return function(J,B){return new V(J,D,!0).update(B)[L]()}},T=function(L){var D=U("hex",L);D.create=function(q){return new V(q,L)},D.update=function(q,A){return D.create(q).update(A)};for(var J=0;J<g.length;++J){var B=g[J];D[B]=U(B,L)}return D};function F(L,D){D?(b[0]=b[16]=b[1]=b[2]=b[3]=b[4]=b[5]=b[6]=b[7]=b[8]=b[9]=b[10]=b[11]=b[12]=b[13]=b[14]=b[15]=0,this.blocks=b):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],L?(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=L}function V(L,D,J){var B,q=typeof L;if(q==="string"){var A,K=[],Z=L.length,ue=0;for(B=0;B<Z;++B)(A=L.charCodeAt(B))<128?K[ue++]=A:A<2048?(K[ue++]=192|A>>>6,K[ue++]=128|63&A):A<55296||A>=57344?(K[ue++]=224|A>>>12,K[ue++]=128|A>>>6&63,K[ue++]=128|63&A):(A=65536+((1023&A)<<10|1023&L.charCodeAt(++B)),K[ue++]=240|A>>>18,K[ue++]=128|A>>>12&63,K[ue++]=128|A>>>6&63,K[ue++]=128|63&A);L=K}else{if(q!=="object")throw new Error(e);if(L===null)throw new Error(e);if(c&&L.constructor===ArrayBuffer)L=new Uint8Array(L);else if(!(Array.isArray(L)||c&&ArrayBuffer.isView(L)))throw new Error(e)}L.length>64&&(L=new F(D,!0).update(L).array());var he=[],I=[];for(B=0;B<64;++B){var Y=L[B]||0;he[B]=92^Y,I[B]=54^Y}F.call(this,D,J),this.update(I),this.oKeyPad=he,this.inner=!0,this.sharedMemory=J}F.prototype.update=function(L){if(!this.finalized){var D,J=typeof L;if(J!=="string"){if(J!=="object")throw new Error(e);if(L===null)throw new Error(e);if(c&&L.constructor===ArrayBuffer)L=new Uint8Array(L);else if(!(Array.isArray(L)||c&&ArrayBuffer.isView(L)))throw new Error(e);D=!0}for(var B,q,A=0,K=L.length,Z=this.blocks;A<K;){if(this.hashed&&(this.hashed=!1,Z[0]=this.block,this.block=Z[16]=Z[1]=Z[2]=Z[3]=Z[4]=Z[5]=Z[6]=Z[7]=Z[8]=Z[9]=Z[10]=Z[11]=Z[12]=Z[13]=Z[14]=Z[15]=0),D)for(q=this.start;A<K&&q<64;++A)Z[q>>>2]|=L[A]<<d[3&q++];else for(q=this.start;A<K&&q<64;++A)(B=L.charCodeAt(A))<128?Z[q>>>2]|=B<<d[3&q++]:B<2048?(Z[q>>>2]|=(192|B>>>6)<<d[3&q++],Z[q>>>2]|=(128|63&B)<<d[3&q++]):B<55296||B>=57344?(Z[q>>>2]|=(224|B>>>12)<<d[3&q++],Z[q>>>2]|=(128|B>>>6&63)<<d[3&q++],Z[q>>>2]|=(128|63&B)<<d[3&q++]):(B=65536+((1023&B)<<10|1023&L.charCodeAt(++A)),Z[q>>>2]|=(240|B>>>18)<<d[3&q++],Z[q>>>2]|=(128|B>>>12&63)<<d[3&q++],Z[q>>>2]|=(128|B>>>6&63)<<d[3&q++],Z[q>>>2]|=(128|63&B)<<d[3&q++]);this.lastByteIndex=q,this.bytes+=q-this.start,q>=64?(this.block=Z[16],this.start=q-64,this.hash(),this.hashed=!0):this.start=q}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},F.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var L=this.blocks,D=this.lastByteIndex;L[16]=this.block,L[D>>>2]|=m[3&D],this.block=L[16],D>=56&&(this.hashed||this.hash(),L[0]=this.block,L[16]=L[1]=L[2]=L[3]=L[4]=L[5]=L[6]=L[7]=L[8]=L[9]=L[10]=L[11]=L[12]=L[13]=L[14]=L[15]=0),L[14]=this.hBytes<<3|this.bytes>>>29,L[15]=this.bytes<<3,this.hash()}},F.prototype.hash=function(){var L,D,J,B,q,A,K,Z,ue,he=this.h0,I=this.h1,Y=this.h2,ae=this.h3,ce=this.h4,Ae=this.h5,O=this.h6,P=this.h7,re=this.blocks;for(L=16;L<64;++L)D=((q=re[L-15])>>>7|q<<25)^(q>>>18|q<<14)^q>>>3,J=((q=re[L-2])>>>17|q<<15)^(q>>>19|q<<13)^q>>>10,re[L]=re[L-16]+D+re[L-7]+J|0;for(ue=I&Y,L=0;L<64;L+=4)this.first?(this.is224?(A=300032,P=(q=re[0]-1413257819)-150054599|0,ae=q+24177077|0):(A=704751109,P=(q=re[0]-210244248)-1521486534|0,ae=q+143694565|0),this.first=!1):(D=(he>>>2|he<<30)^(he>>>13|he<<19)^(he>>>22|he<<10),B=(A=he&I)^he&Y^ue,P=ae+(q=P+(J=(ce>>>6|ce<<26)^(ce>>>11|ce<<21)^(ce>>>25|ce<<7))+(ce&Ae^~ce&O)+y[L]+re[L])|0,ae=q+(D+B)|0),D=(ae>>>2|ae<<30)^(ae>>>13|ae<<19)^(ae>>>22|ae<<10),B=(K=ae&he)^ae&I^A,O=Y+(q=O+(J=(P>>>6|P<<26)^(P>>>11|P<<21)^(P>>>25|P<<7))+(P&ce^~P&Ae)+y[L+1]+re[L+1])|0,D=((Y=q+(D+B)|0)>>>2|Y<<30)^(Y>>>13|Y<<19)^(Y>>>22|Y<<10),B=(Z=Y&ae)^Y&he^K,Ae=I+(q=Ae+(J=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7))+(O&P^~O&ce)+y[L+2]+re[L+2])|0,D=((I=q+(D+B)|0)>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10),B=(ue=I&Y)^I&ae^Z,ce=he+(q=ce+(J=(Ae>>>6|Ae<<26)^(Ae>>>11|Ae<<21)^(Ae>>>25|Ae<<7))+(Ae&O^~Ae&P)+y[L+3]+re[L+3])|0,he=q+(D+B)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+he|0,this.h1=this.h1+I|0,this.h2=this.h2+Y|0,this.h3=this.h3+ae|0,this.h4=this.h4+ce|0,this.h5=this.h5+Ae|0,this.h6=this.h6+O|0,this.h7=this.h7+P|0},F.prototype.hex=function(){this.finalize();var L=this.h0,D=this.h1,J=this.h2,B=this.h3,q=this.h4,A=this.h5,K=this.h6,Z=this.h7,ue=f[L>>>28&15]+f[L>>>24&15]+f[L>>>20&15]+f[L>>>16&15]+f[L>>>12&15]+f[L>>>8&15]+f[L>>>4&15]+f[15&L]+f[D>>>28&15]+f[D>>>24&15]+f[D>>>20&15]+f[D>>>16&15]+f[D>>>12&15]+f[D>>>8&15]+f[D>>>4&15]+f[15&D]+f[J>>>28&15]+f[J>>>24&15]+f[J>>>20&15]+f[J>>>16&15]+f[J>>>12&15]+f[J>>>8&15]+f[J>>>4&15]+f[15&J]+f[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[q>>>28&15]+f[q>>>24&15]+f[q>>>20&15]+f[q>>>16&15]+f[q>>>12&15]+f[q>>>8&15]+f[q>>>4&15]+f[15&q]+f[A>>>28&15]+f[A>>>24&15]+f[A>>>20&15]+f[A>>>16&15]+f[A>>>12&15]+f[A>>>8&15]+f[A>>>4&15]+f[15&A]+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||(ue+=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]),ue},F.prototype.toString=F.prototype.hex,F.prototype.digest=function(){this.finalize();var L=this.h0,D=this.h1,J=this.h2,B=this.h3,q=this.h4,A=this.h5,K=this.h6,Z=this.h7,ue=[L>>>24&255,L>>>16&255,L>>>8&255,255&L,D>>>24&255,D>>>16&255,D>>>8&255,255&D,J>>>24&255,J>>>16&255,J>>>8&255,255&J,B>>>24&255,B>>>16&255,B>>>8&255,255&B,q>>>24&255,q>>>16&255,q>>>8&255,255&q,A>>>24&255,A>>>16&255,A>>>8&255,255&A,K>>>24&255,K>>>16&255,K>>>8&255,255&K];return this.is224||ue.push(Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z),ue},F.prototype.array=F.prototype.digest,F.prototype.arrayBuffer=function(){this.finalize();var L=new ArrayBuffer(this.is224?28:32),D=new DataView(L);return D.setUint32(0,this.h0),D.setUint32(4,this.h1),D.setUint32(8,this.h2),D.setUint32(12,this.h3),D.setUint32(16,this.h4),D.setUint32(20,this.h5),D.setUint32(24,this.h6),this.is224||D.setUint32(28,this.h7),L},V.prototype=new F,V.prototype.finalize=function(){if(F.prototype.finalize.call(this),this.inner){this.inner=!1;var L=this.array();F.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(L),F.prototype.finalize.call(this)}};var le=k();le.sha256=le,le.sha224=k(!0),le.sha256.hmac=T(),le.sha224.hmac=T(!0),u?gh.exports=le:(r.sha256=le.sha256,r.sha224=le.sha224)})();Iu.exports;Iu.exports.sha224;var x0=Iu.exports.sha256;function rd(e){return a2(e)}function e2(e){if(!/^[0-9A-Fa-f]+$/.test(e))return!1;const r=/^[0-9A-F]+$/.test(e),a=/^[0-9a-f]+$/.test(e);return r||a?e.length%2===0:!1}function t2(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function n2(e){return e2(e)?"hex":t2(e)?"b64":""}function r2(e){if(e.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)n[r/2]=parseInt(e.substring(r,r+2),16);return n}function i2(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))}function a2(e){switch(n2(e)){case"hex":return r2(e);case"b64":return i2(e)}return null}function s2(e,n){const r=typeof e=="string"?rd(e):e,a=typeof n=="string"?rd(n):n;if(r===null||a===null||r.length!==a.length)return!1;for(let l=0;l<r.length;l++)if(r[l]!==a[l])return!1;return!0}class ox{constructor(n,r,a=!0){E(this,"token");E(this,"received");E(this,"ctx");E(this,"requestSubject");E(this,"mux");this.mux=n,this.requestSubject=r,this.received=0,this.token=Ui.next(),a&&(this.ctx=new Error)}}class l2 extends ox{constructor(r,a,l={maxWait:1e3}){super(r,a);E(this,"callback");E(this,"done");E(this,"timer");E(this,"max");E(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=Lt(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},l.maxWait)}cancel(r){r&&this.callback(r,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(r,a){r?(this.ctx&&(r.stack+=`
67
-
68
- ${this.ctx.stack}`),this.cancel(r)):(this.callback(null,a),this.opts.strategy===gr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===gr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===gr.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class ux extends ox{constructor(r,a,l={timeout:1e3},u=!0){super(r,a,u);E(this,"deferred");E(this,"timer");this.deferred=Lt(),this.timer=cs(l.timeout,u)}resolver(r,a){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
69
-
70
- ${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(a),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||je.errorForCode(Se.Cancelled))}}const o2="$JS.API";function u2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Hu({apiPrefix:o2,timeout:5e3},e)}class ql{constructor(n,r){E(this,"nc");E(this,"opts");E(this,"prefix");E(this,"timeout");E(this,"jc");this.nc=n,this.opts=u2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=yr()}getOptions(){return Object.assign({},this.opts)}_parseOpts(){let n=this.opts.apiPrefix;if(!n||n.length===0)throw new Error("invalid empty prefix");n[n.length-1]==="."&&(n=n.substr(0,n.length-1)),this.opts.apiPrefix=n}async _request(n,r=null,a){a=a||{},a.timeout=this.timeout;let l=Yn;r&&(l=this.jc.encode(r));let{retries:u}=a;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=Od();for(let f=0;f<u;f++)try{const m=await this.nc.request(n,l,a);return this.parseJsResponse(m)}catch(m){const d=m;if((d.code==="503"||d.code===Se.Timeout)&&f+1<u)await ys(c.backoff(f));else throw m}}async findStream(n){const r={subject:n},l=await this._request(`${this.prefix}.STREAM.NAMES`,r);if(!l.streams||l.streams.length!==1)throw new Error("no stream matches subject");return l.streams[0]}getConnection(){return this.nc}parseJsResponse(n){const r=this.jc.decode(n.data),a=r;if(a.error){const l=lx(a.error.code,a.error.description);if(l!==null)throw l.api_error=a.error,l}return r}}class Sl{constructor(n,r,a,l){E(this,"err");E(this,"offset");E(this,"pageInfo");E(this,"subject");E(this,"jsm");E(this,"filter");E(this,"payload");if(!n)throw new Error("subject is required");this.subject=n,this.jsm=a,this.offset=0,this.pageInfo={},this.filter=r,this.payload=l||{}}async next(){if(this.err)return[];if(this.pageInfo&&this.offset>=this.pageInfo.total)return[];const n={offset:this.offset};this.payload&&Object.assign(n,this.payload);try{const r=await this.jsm._request(this.subject,n,{timeout:this.jsm.timeout});this.pageInfo=r;const a=this.countResponse(r);return a===0?[]:(this.offset+=a,this.filter(r))}catch(r){throw this.err=r,r}}countResponse(n){var r,a,l;switch(n==null?void 0:n.type){case"io.nats.jetstream.api.v1.stream_names_response":case"io.nats.jetstream.api.v1.stream_list_response":return((r=n.streams)==null?void 0:r.length)||0;case"io.nats.jetstream.api.v1.consumer_list_response":return((a=n.consumers)==null?void 0:a.length)||0;default:return console.error(`jslister.ts: unknown API response for paged output: ${n==null?void 0:n.type}`),((l=n.streams)==null?void 0:l.length)||0}return 0}async*[Symbol.asyncIterator](){let n=await this.next();for(;n.length>0;){for(const r of n)yield r;n=await this.next()}}}function ca(e=""){const n=e.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${e}' is not a semver value`)}function id(e,n){return e.major<n.major?-1:e.major>n.major?1:e.minor<n.minor?-1:e.minor>n.minor?1:e.micro<n.micro?-1:e.micro>n.micro?1:0}var ot;(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"})(ot||(ot={}));class c2{constructor(n){E(this,"server");E(this,"features");E(this,"disabled");this.features=new Map,this.disabled=[],this.update(n)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(n){this.disabled.push(n),this.update(this.server)}isDisabled(n){return this.disabled.indexOf(n)!==-1}update(n){typeof n=="string"&&(n=ca(n)),this.server=n,this.set(ot.JS_KV,"2.6.2"),this.set(ot.JS_OBJECTSTORE,"2.6.3"),this.set(ot.JS_PULL_MAX_BYTES,"2.8.3"),this.set(ot.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(ot.JS_ALLOW_DIRECT,"2.9.0"),this.set(ot.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(ot.JS_SIMPLIFICATION,"2.9.4"),this.set(ot.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(ot.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(ot.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(ot.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(ot.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(ot.JS_STREAM_COMPRESSION,"2.10.0"),this.set(ot.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(ot.JS_BATCH_DIRECT_GET,"2.11.0"),this.disabled.forEach(r=>{this.features.delete(r)})}set(n,r){this.features.set(n,{min:r,ok:id(this.server,ca(r))>=0})}get(n){return this.features.get(n)||{min:"unknown",ok:!1}}supports(n){var r;return((r=this.get(n))==null?void 0:r.ok)||!1}require(n){return typeof n=="string"&&(n=ca(n)),id(this.server,n)>=0}}class Tu extends ql{constructor(n,r){super(n,r)}async add(n,r,a=Au.Create){if(yn(n),r.deliver_group&&r.flow_control)throw new Error("jetstream flow control is not supported with queue groups");if(r.deliver_group&&r.idle_heartbeat)throw new Error("jetstream idle heartbeat is not supported with queue groups");const l={};l.config=r,l.stream_name=n,l.action=a,l.config.durable_name&&is(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(ot.JS_NEW_CONSUMER_CREATE_API);const m=r.name===""?void 0:r.name;if(m&&!f)throw new Error(`consumer 'name' requires server ${c}`);if(m)try{qu("name",m)}catch(b){const w=b.message,k=w.indexOf("cannot contain");throw k!==-1?new Error(`consumer 'name' ${w.substring(k)}`):b}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:b,ok:w}=u.features.get(ot.JS_MULTIPLE_CONSUMER_FILTER);if(!w)throw new Error(`consumer 'filter_subjects' requires server ${b}`);f=!1}if(r.metadata){const{min:b,ok:w}=u.features.get(ot.JS_STREAM_CONSUMER_METADATA);if(!w)throw new Error(`consumer 'metadata' requires server ${b}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let b=r.filter_subject??void 0;b===">"&&(b=void 0),d=b!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${y}.${b}`:`${this.prefix}.CONSUMER.CREATE.${n}.${y}`}else d=r.durable_name?`${this.prefix}.CONSUMER.DURABLE.CREATE.${n}.${r.durable_name}`:`${this.prefix}.CONSUMER.CREATE.${n}`;return await this._request(d,l)}async update(n,r,a){const l=await this.info(n,r),u=a;return this.add(n,Object.assign(l.config,u),Au.Update)}async info(n,r){return yn(n),is(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return yn(n),is(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){yn(n);const r=l=>l.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new Sl(a,r,this)}pause(n,r,a){const l=`${this.prefix}.CONSUMER.PAUSE.${n}.${r}`,u={pause_until:a.toISOString()};return this._request(l,u)}resume(n,r){return this.pause(n,r,new Date(0))}}function Ka(e,n,r=!1){if(r===!0&&!e)throw je.errorForCode(Se.ApiError,new Error(`${n} is not a function`));if(e&&typeof e!="function")throw je.errorForCode(Se.ApiError,new Error(`${n} is not a function`))}class f2 extends sn{constructor(r,a,l){super();E(this,"sub");E(this,"adapter");E(this,"subIterDone");Ka(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&Ka(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(Ka(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(Ka(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(Ka(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&Ka(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,b)=>{const[w,k]=this.adapter(g,b);if(w){y(w,null);return}const{ingest:R}=this.ingestionFilterFn?this.ingestionFilterFn(k,this):{ingest:!0};R&&(!this.protocolFilterFn||this.protocolFilterFn(k))&&(y(w,k),this.dispatchedFn&&k&&this.dispatchedFn(k))}}const{max:c,queue:f,timeout:m}=l,d={queue:f,timeout:m,callback:u};c&&c>0&&(d.max=c),this.sub=r.subscribe(a,d),l.cleanupFn&&(this.sub.cleanupFn=l.cleanupFn),this.noIterator||this.iterClosed.then(()=>{this.unsubscribe()}),this.subIterDone=Lt(),Promise.all([this.sub.closed,this.iterClosed]).then(()=>{this.subIterDone.resolve()}).catch(()=>{this.subIterDone.resolve()}),(async y=>{await y.closed,this.stop()})(this.sub).then().catch()}unsubscribe(r){this.sub.unsubscribe(r)}drain(){return this.sub.drain()}isDraining(){return this.sub.isDraining()}isClosed(){return this.sub.isClosed()}callback(r,a){this.sub.cancelTimeout();const[l,u]=this.adapter(r,a);l&&this.stop(l),u&&this.push(u)}getSubject(){return this.sub.getSubject()}getReceived(){return this.sub.getReceived()}getProcessed(){return this.sub.getProcessed()}getPending(){return this.sub.getPending()}getID(){return this.sub.getID()}getMax(){return this.sub.getMax()}get closed(){return this.sub.closed}}let $n;function h2(e){$n=e}function cx(){return $n!==void 0&&$n.defaultPort!==void 0?$n.defaultPort:4222}function yh(){return $n!==void 0&&$n.urlParseFn?$n.urlParseFn:void 0}function d2(){if(!$n||typeof $n.factory!="function")throw new Error("transport fn is not set");return $n.factory()}function ad(){return $n!==void 0&&$n.dnsResolveFn?$n.dnsResolveFn:void 0}const bu=`\r
71
- `,ju=hs.fromAscii(bu),m2=new Uint8Array(ju)[0],p2=new Uint8Array(ju)[1];function g2(e){for(let n=0;n<e.length;n++){const r=n+1;if(e.byteLength>r&&e[n]===m2&&e[r]===p2)return r+1}return 0}function y2(e){const n=g2(e);if(n>0){const a=new Uint8Array(e).slice(0,n);return Fn.decode(a)}return""}const b2=4,fx=48,x2=65,v2=97;function w2(e,n,r,a){const l=new Uint8Array(16);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((c,f)=>{l[f]=c}),l[12]=e,l[13]=n,l[14]=r,l[15]=a,l}function sd(e){return S2(e)!==void 0}function S2(e){for(let n=0;n<e.length;n++)switch(e[n]){case".":return hx(e);case":":return _2(e)}}function hx(e){const n=new Uint8Array(4);for(let r=0;r<4;r++){if(e.length===0)return;if(r>0){if(e[0]!==".")return;e=e.substring(1)}const{n:a,c:l,ok:u}=k2(e);if(!u||a>255)return;e=e.substring(l),n[r]=a}return w2(n[0],n[1],n[2],n[3])}function _2(e){const n=new Uint8Array(16);let r=-1;if(e.length>=2&&e[0]===":"&&e[1]===":"&&(r=0,e=e.substring(2),e.length===0))return n;let a=0;for(;a<16;){const{n:l,c:u,ok:c}=E2(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&a!=12||a+4>16)return;const f=hx(e);if(f===void 0)return;n[a]=f[12],n[a+1]=f[13],n[a+2]=f[14],n[a+3]=f[15],e="",a+=b2;break}if(n[a]=l>>8,n[a+1]=l,a+=2,e=e.substring(u),e.length===0)break;if(e[0]!==":"||e.length==1)return;if(e=e.substring(1),e[0]===":"){if(r>=0)return;if(r=a,e=e.substring(1),e.length===0)break}}if(e.length===0){if(a<16){if(r<0)return;const l=16-a;for(let u=a-1;u>=r;u--)n[u+l]=n[u];for(let u=r+l-1;u>=r;u--)n[u]=0}else if(r>=0)return;return n}}function k2(e){let n=0,r=0;for(n=0;n<e.length&&48<=e.charCodeAt(n)&&e.charCodeAt(n)<=57;n++)if(r=r*10+(e.charCodeAt(n)-fx),r>=16777215)return{n:16777215,c:n,ok:!1};return n===0?{n:0,c:0,ok:!1}:{n:r,c:n,ok:!0}}function E2(e){let n=0,r=0;for(r=0;r<e.length;r++){if(48<=e.charCodeAt(r)&&e.charCodeAt(r)<=57)n*=16,n+=e.charCodeAt(r)-fx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)n*=16,n+=e.charCodeAt(r)-v2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)n*=16,n+=e.charCodeAt(r)-x2+10;else break;if(n>=16777215)return{n:0,c:r,ok:!1}}return r===0?{n:0,c:r,ok:!1}:{n,c:r,ok:!0}}function C2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function ld(e){return!C2(e)}function A2(e){const n="::FFFF:",r=e.toUpperCase().indexOf(n);if(r!==-1&&e.indexOf(".")!==-1){let a=e.substring(r+n.length);return a=a.replace("[",""),a.replace("]","")}return e}function T2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=A2(e),ld(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const n=ld(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),r=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=r===80?"https":"http",l=new URL(`${a}://${e}`);l.port=`${r}`;let u=l.hostname;return u.charAt(0)==="["&&(u=u.substring(1,u.length-1)),{listen:l.host,hostname:u,port:r}}class El{constructor(n,r=!1){E(this,"src");E(this,"listen");E(this,"hostname");E(this,"port");E(this,"didConnect");E(this,"reconnects");E(this,"lastConnect");E(this,"gossiped");E(this,"tlsName");E(this,"resolves");this.src=n,this.tlsName="";const a=T2(n);this.listen=a.listen,this.hostname=a.hostname,this.port=a.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=r}toString(){return this.listen}async resolve(n){if(!n.fn||n.resolve===!1)return[this];const r=[];if(sd(this.hostname))return[this];{const a=await n.fn(this.hostname);n.debug&&console.log(`resolve ${this.hostname} = ${a.join(",")}`);for(const l of a){const u=this.port===80?"https":"http",c=new URL(`${u}://${ld(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new El(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&ax(r),this.resolves=r,r}}class j2{constructor(n=[],r={}){E(this,"firstSelect");E(this,"servers");E(this,"currentServer");E(this,"tlsName");E(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const a=yh();n&&(n.forEach(l=>{l=a?a(l):l,this.servers.push(new El(l))}),this.randomize&&(this.servers=ax(this.servers))),this.servers.length===0&&this.addServer(`${Zh}:${cx()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();sd(n.hostname)||(this.tlsName=n.hostname,this.servers.forEach(r=>{r.gossiped&&(r.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(n,r=!1){const a=yh();n=a?a(n):n;const l=new El(n,r);sd(l.hostname)&&(l.tlsName=this.tlsName),this.servers.push(l)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;const n=this.servers.shift();return n&&(this.servers.push(n),this.currentServer=n),n}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(n){if(n){const r=this.servers.indexOf(n);this.servers.splice(r,1)}}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(n,r){const a=[];let l=[];const u=yh(),c=new Map;n.connect_urls&&n.connect_urls.length>0&&n.connect_urls.forEach(m=>{m=u?u(m,r):m;const d=new El(m,!0);c.set(m,d)});const f=[];return this.servers.forEach((m,d)=>{const y=m.listen;m.gossiped&&this.currentServer.listen!==y&&c.get(y)===void 0&&f.push(d),c.delete(y)}),f.reverse(),f.forEach(m=>{const d=this.servers.splice(m,1);l=l.concat(d[0].listen)}),c.forEach((m,d)=>{this.servers.push(m),a.push(d)}),{added:a,deleted:l}}}class N2{constructor(){E(this,"baseInbox");E(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${Wr(n)}.`,this.baseInbox}add(n){isNaN(n.received)||(n.received=0),this.reqs.set(n.token,n)}get(n){return this.reqs.get(n)}cancel(n){this.reqs.delete(n.token)}getToken(n){const r=n.subject||"";return r.indexOf(this.baseInbox)===0?r.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(n,r){if(r&&r.permissionContext){if(n)return this.all().forEach(l=>{l.resolver(r,{})}),!0;const a=r.permissionContext;if(a.operation==="publish"){const l=this.all().find(u=>u.requestSubject===a.subject);if(l)return l.resolver(r,{}),!0}}return!1}dispatcher(){return(n,r)=>{const a=this.getToken(r);if(a){const l=this.get(a);l&&(n===null&&r.headers&&(n=sx(r)),l.resolver(n,r))}}}close(){const n=je.errorForCode(Se.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class O2{constructor(n,r,a){E(this,"ph");E(this,"interval");E(this,"maxOut");E(this,"timer");E(this,"pendings");this.ph=n,this.interval=r,this.maxOut=a,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(n){this.timer&&(clearTimeout(this.timer),this.timer=void 0),this._reset(),n&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:rs.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=Lt();this.ph.flush(n).then(()=>{this._reset()}).catch(()=>{this.cancel()}),this.pendings.push(n),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(n=>(n.resolve(),!1))}}class R2 extends Error{constructor(n){super(n),this.name="AssertionError"}}function M2(e,n="Assertion failed."){if(!e)throw new R2(n)}const v0=32*1024,bh=2**32-2;function ou(e,n,r=0){const a=n.byteLength-r;return e.byteLength>a&&(e=e.subarray(0,a)),n.set(e,r),e.byteLength}class xh{constructor(n){E(this,"_buf");E(this,"_off");if(this._off=0,n==null){this._buf=new Uint8Array(0);return}this._buf=new Uint8Array(n)}bytes(n={copy:!0}){return n.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(n){if(n===0){this.reset();return}if(n<0||n>this.length)throw Error("bytes.Buffer: truncation out of range");this._reslice(this._off+n)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(n){const r=this._buf.byteLength;return n<=this.capacity-r?(this._reslice(r+n),r):-1}_reslice(n){M2(n<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,n)}readByte(){const n=new Uint8Array(1);return this.read(n)?n[0]:null}read(n){if(this.empty())return this.reset(),n.byteLength===0?0:null;const r=ou(this._buf.subarray(this._off),n);return this._off+=r,r}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(Pi.encode(n))}write(n){const r=this._grow(n.byteLength);return ou(n,this._buf,r)}_grow(n){const r=this.length;r===0&&this._off!==0&&this.reset();const a=this._tryGrowByReslice(n);if(a>=0)return a;const l=this.capacity;if(n<=Math.floor(l/2)-r)ou(this._buf.subarray(this._off),this._buf);else{if(l+n>bh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,bh));ou(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,bh)),r}grow(n){if(n<0)throw Error("Buffer._grow: negative count");const r=this._grow(n);this._reslice(r)}readFrom(n){let r=0;const a=new Uint8Array(v0);for(;;){const l=this.capacity-this.length<v0,u=l?a:new Uint8Array(this._buf.buffer,this.length),c=n.read(u);if(c===null)return r;l?this.write(u.subarray(0,c)):this._reslice(this.length+c),r+=c}}}var bn;(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"})(bn||(bn={}));function w0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const D2=48;class S0{constructor(n){E(this,"dispatcher");E(this,"state");E(this,"as");E(this,"drop");E(this,"hdr");E(this,"ma");E(this,"argBuf");E(this,"msgBuf");this.dispatcher=n,this.state=ke.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let r;for(r=0;r<n.length;r++){const a=n[r];switch(this.state){case ke.OP_START:switch(a){case Ee.M:case Ee.m:this.state=ke.OP_M,this.hdr=-1,this.ma=w0();break;case Ee.H:case Ee.h:this.state=ke.OP_H,this.hdr=0,this.ma=w0();break;case Ee.P:case Ee.p:this.state=ke.OP_P;break;case Ee.PLUS:this.state=ke.OP_PLUS;break;case Ee.MINUS:this.state=ke.OP_MINUS;break;case Ee.I:case Ee.i:this.state=ke.OP_I;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_H:switch(a){case Ee.M:case Ee.m:this.state=ke.OP_M;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_M:switch(a){case Ee.S:case Ee.s:this.state=ke.OP_MS;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MS:switch(a){case Ee.G:case Ee.g:this.state=ke.OP_MSG;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MSG:switch(a){case Ee.SPACE:case Ee.TAB:this.state=ke.OP_MSG_SPC;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MSG_SPC:switch(a){case Ee.SPACE:case Ee.TAB:continue;default:this.state=ke.MSG_ARG,this.as=r}break;case ke.MSG_ARG:switch(a){case Ee.CR:this.drop=1;break;case Ee.NL:{const l=this.argBuf?this.argBuf.bytes():n.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=ke.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case ke.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:bn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ke.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const u=n.length-r;u<l&&(l=u),l>0?(this.msgBuf.write(n.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(a)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:bn.MSG,msg:this.ma,data:n.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=ke.MSG_END);break;case ke.MSG_END:switch(a){case Ee.NL:this.drop=0,this.as=r+1,this.state=ke.OP_START;break;default:continue}break;case ke.OP_PLUS:switch(a){case Ee.O:case Ee.o:this.state=ke.OP_PLUS_O;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PLUS_O:switch(a){case Ee.K:case Ee.k:this.state=ke.OP_PLUS_OK;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PLUS_OK:switch(a){case Ee.NL:this.dispatcher.push({kind:bn.OK}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_MINUS:switch(a){case Ee.E:case Ee.e:this.state=ke.OP_MINUS_E;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MINUS_E:switch(a){case Ee.R:case Ee.r:this.state=ke.OP_MINUS_ER;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MINUS_ER:switch(a){case Ee.R:case Ee.r:this.state=ke.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MINUS_ERR:switch(a){case Ee.SPACE:case Ee.TAB:this.state=ke.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_MINUS_ERR_SPC:switch(a){case Ee.SPACE:case Ee.TAB:continue;default:this.state=ke.MINUS_ERR_ARG,this.as=r}break;case ke.MINUS_ERR_ARG:switch(a){case Ee.CR:this.drop=1;break;case Ee.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:bn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=ke.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case ke.OP_P:switch(a){case Ee.I:case Ee.i:this.state=ke.OP_PI;break;case Ee.O:case Ee.o:this.state=ke.OP_PO;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PO:switch(a){case Ee.N:case Ee.n:this.state=ke.OP_PON;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PON:switch(a){case Ee.G:case Ee.g:this.state=ke.OP_PONG;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PONG:switch(a){case Ee.NL:this.dispatcher.push({kind:bn.PONG}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_PI:switch(a){case Ee.N:case Ee.n:this.state=ke.OP_PIN;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PIN:switch(a){case Ee.G:case Ee.g:this.state=ke.OP_PING;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_PING:switch(a){case Ee.NL:this.dispatcher.push({kind:bn.PING}),this.drop=0,this.state=ke.OP_START;break}break;case ke.OP_I:switch(a){case Ee.N:case Ee.n:this.state=ke.OP_IN;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_IN:switch(a){case Ee.F:case Ee.f:this.state=ke.OP_INF;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_INF:switch(a){case Ee.O:case Ee.o:this.state=ke.OP_INFO;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_INFO:switch(a){case Ee.SPACE:case Ee.TAB:this.state=ke.OP_INFO_SPC;break;default:throw this.fail(n.subarray(r))}break;case ke.OP_INFO_SPC:switch(a){case Ee.SPACE:case Ee.TAB:continue;default:this.state=ke.INFO_ARG,this.as=r}break;case ke.INFO_ARG:switch(a){case Ee.CR:this.drop=1;break;case Ee.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:bn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=ke.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(r))}}(this.state===ke.MSG_ARG||this.state===ke.MINUS_ERR_ARG||this.state===ke.INFO_ARG)&&!this.argBuf&&(this.argBuf=new xh(n.subarray(this.as,r-this.drop))),this.state===ke.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new xh(n.subarray(this.as)))}cloneMsgArg(){const n=this.ma.subject.length,r=this.ma.reply?this.ma.reply.length:0,a=new Uint8Array(n+r);a.set(this.ma.subject),this.ma.reply&&a.set(this.ma.reply,n),this.argBuf=new xh(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ee.SPACE:case Ee.TAB:case Ee.CR:case Ee.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${Fn.decode(n)}`)}processHeaderMsgArgs(n){const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Ee.SPACE:case Ee.TAB:case Ee.CR:case Ee.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let r=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;r=r*10+(n[a]-D2)}return r}}var ke;(function(e){e[e.OP_START=0]="OP_START",e[e.OP_PLUS=1]="OP_PLUS",e[e.OP_PLUS_O=2]="OP_PLUS_O",e[e.OP_PLUS_OK=3]="OP_PLUS_OK",e[e.OP_MINUS=4]="OP_MINUS",e[e.OP_MINUS_E=5]="OP_MINUS_E",e[e.OP_MINUS_ER=6]="OP_MINUS_ER",e[e.OP_MINUS_ERR=7]="OP_MINUS_ERR",e[e.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",e[e.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",e[e.OP_M=10]="OP_M",e[e.OP_MS=11]="OP_MS",e[e.OP_MSG=12]="OP_MSG",e[e.OP_MSG_SPC=13]="OP_MSG_SPC",e[e.MSG_ARG=14]="MSG_ARG",e[e.MSG_PAYLOAD=15]="MSG_PAYLOAD",e[e.MSG_END=16]="MSG_END",e[e.OP_H=17]="OP_H",e[e.OP_P=18]="OP_P",e[e.OP_PI=19]="OP_PI",e[e.OP_PIN=20]="OP_PIN",e[e.OP_PING=21]="OP_PING",e[e.OP_PO=22]="OP_PO",e[e.OP_PON=23]="OP_PON",e[e.OP_PONG=24]="OP_PONG",e[e.OP_I=25]="OP_I",e[e.OP_IN=26]="OP_IN",e[e.OP_INF=27]="OP_INF",e[e.OP_INFO=28]="OP_INFO",e[e.OP_INFO_SPC=29]="OP_INFO_SPC",e[e.INFO_ARG=30]="INFO_ARG"})(ke||(ke={}));var Ee;(function(e){e[e.CR=13]="CR",e[e.E=69]="E",e[e.e=101]="e",e[e.F=70]="F",e[e.f=102]="f",e[e.G=71]="G",e[e.g=103]="g",e[e.H=72]="H",e[e.h=104]="h",e[e.I=73]="I",e[e.i=105]="i",e[e.K=75]="K",e[e.k=107]="k",e[e.M=77]="M",e[e.m=109]="m",e[e.MINUS=45]="MINUS",e[e.N=78]="N",e[e.n=110]="n",e[e.NL=10]="NL",e[e.O=79]="O",e[e.o=111]="o",e[e.P=80]="P",e[e.p=112]="p",e[e.PLUS=43]="PLUS",e[e.R=82]="R",e[e.r=114]="r",e[e.S=83]="S",e[e.s=115]="s",e[e.SPACE=32]="SPACE",e[e.TAB=9]="TAB"})(Ee||(Ee={}));(function(e){var n=function(_,N){this.hi=_|0,this.lo=N|0},r=function(_){var N,C=new Float64Array(16);if(_)for(N=0;N<_.length;N++)C[N]=_[N];return C},a=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[0]=9;var c=r(),f=r([1]),m=r([56129,1]),d=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),b=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),w=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function k(_,N){return _<<N|_>>>32-N}function R(_,N){var C=_[N+3]&255;return C=C<<8|_[N+2]&255,C=C<<8|_[N+1]&255,C<<8|_[N+0]&255}function U(_,N){var C=_[N]<<24|_[N+1]<<16|_[N+2]<<8|_[N+3],M=_[N+4]<<24|_[N+5]<<16|_[N+6]<<8|_[N+7];return new n(C,M)}function T(_,N,C){var M;for(M=0;M<4;M++)_[N+M]=C&255,C>>>=8}function F(_,N,C){_[N]=C.hi>>24&255,_[N+1]=C.hi>>16&255,_[N+2]=C.hi>>8&255,_[N+3]=C.hi&255,_[N+4]=C.lo>>24&255,_[N+5]=C.lo>>16&255,_[N+6]=C.lo>>8&255,_[N+7]=C.lo&255}function V(_,N,C,M,$){var Q,me=0;for(Q=0;Q<$;Q++)me|=_[N+Q]^C[M+Q];return(1&me-1>>>8)-1}function le(_,N,C,M){return V(_,N,C,M,16)}function L(_,N,C,M){return V(_,N,C,M,32)}function D(_,N,C,M,$){var Q=new Uint32Array(16),me=new Uint32Array(16),ye=new Uint32Array(16),ne=new Uint32Array(4),de,Ne,Qe;for(de=0;de<4;de++)me[5*de]=R(M,4*de),me[1+de]=R(C,4*de),me[6+de]=R(N,4*de),me[11+de]=R(C,16+4*de);for(de=0;de<16;de++)ye[de]=me[de];for(de=0;de<20;de++){for(Ne=0;Ne<4;Ne++){for(Qe=0;Qe<4;Qe++)ne[Qe]=me[(5*Ne+4*Qe)%16];for(ne[1]^=k(ne[0]+ne[3]|0,7),ne[2]^=k(ne[1]+ne[0]|0,9),ne[3]^=k(ne[2]+ne[1]|0,13),ne[0]^=k(ne[3]+ne[2]|0,18),Qe=0;Qe<4;Qe++)Q[4*Ne+(Ne+Qe)%4]=ne[Qe]}for(Qe=0;Qe<16;Qe++)me[Qe]=Q[Qe]}if($){for(de=0;de<16;de++)me[de]=me[de]+ye[de]|0;for(de=0;de<4;de++)me[5*de]=me[5*de]-R(M,4*de)|0,me[6+de]=me[6+de]-R(N,4*de)|0;for(de=0;de<4;de++)T(_,4*de,me[5*de]),T(_,16+4*de,me[6+de])}else for(de=0;de<16;de++)T(_,4*de,me[de]+ye[de]|0)}function J(_,N,C,M){return D(_,N,C,M,!1),0}function B(_,N,C,M){return D(_,N,C,M,!0),0}var q=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function A(_,N,C,M,$,Q,me){var ye=new Uint8Array(16),ne=new Uint8Array(64),de,Ne;if(!$)return 0;for(Ne=0;Ne<16;Ne++)ye[Ne]=0;for(Ne=0;Ne<8;Ne++)ye[Ne]=Q[Ne];for(;$>=64;){for(J(ne,ye,me,q),Ne=0;Ne<64;Ne++)_[N+Ne]=(C?C[M+Ne]:0)^ne[Ne];for(de=1,Ne=8;Ne<16;Ne++)de=de+(ye[Ne]&255)|0,ye[Ne]=de&255,de>>>=8;$-=64,N+=64,C&&(M+=64)}if($>0)for(J(ne,ye,me,q),Ne=0;Ne<$;Ne++)_[N+Ne]=(C?C[M+Ne]:0)^ne[Ne];return 0}function K(_,N,C,M,$){return A(_,N,null,0,C,M,$)}function Z(_,N,C,M,$){var Q=new Uint8Array(32);return B(Q,M,$,q),K(_,N,C,M.subarray(16),Q)}function ue(_,N,C,M,$,Q,me){var ye=new Uint8Array(32);return B(ye,Q,me,q),A(_,N,C,M,$,Q.subarray(16),ye)}function he(_,N){var C,M=0;for(C=0;C<17;C++)M=M+(_[C]+N[C]|0)|0,_[C]=M&255,M>>>=8}var I=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function Y(_,N,C,M,$,Q){var me,ye,ne,de,Ne=new Uint32Array(17),Qe=new Uint32Array(17),Nt=new Uint32Array(17),hn=new Uint32Array(17),fr=new Uint32Array(17);for(ne=0;ne<17;ne++)Qe[ne]=Nt[ne]=0;for(ne=0;ne<16;ne++)Qe[ne]=Q[ne];for(Qe[3]&=15,Qe[4]&=252,Qe[7]&=15,Qe[8]&=252,Qe[11]&=15,Qe[12]&=252,Qe[15]&=15;$>0;){for(ne=0;ne<17;ne++)hn[ne]=0;for(ne=0;ne<16&&ne<$;++ne)hn[ne]=C[M+ne];for(hn[ne]=1,M+=ne,$-=ne,he(Nt,hn),ye=0;ye<17;ye++)for(Ne[ye]=0,ne=0;ne<17;ne++)Ne[ye]=Ne[ye]+Nt[ne]*(ne<=ye?Qe[ye-ne]:320*Qe[ye+17-ne]|0)|0|0;for(ye=0;ye<17;ye++)Nt[ye]=Ne[ye];for(de=0,ne=0;ne<16;ne++)de=de+Nt[ne]|0,Nt[ne]=de&255,de>>>=8;for(de=de+Nt[16]|0,Nt[16]=de&3,de=5*(de>>>2)|0,ne=0;ne<16;ne++)de=de+Nt[ne]|0,Nt[ne]=de&255,de>>>=8;de=de+Nt[16]|0,Nt[16]=de}for(ne=0;ne<17;ne++)fr[ne]=Nt[ne];for(he(Nt,I),me=-(Nt[16]>>>7)|0,ne=0;ne<17;ne++)Nt[ne]^=me&(fr[ne]^Nt[ne]);for(ne=0;ne<16;ne++)hn[ne]=Q[ne+16];for(hn[16]=0,he(Nt,hn),ne=0;ne<16;ne++)_[N+ne]=Nt[ne];return 0}function ae(_,N,C,M,$,Q){var me=new Uint8Array(16);return Y(me,0,C,M,$,Q),le(_,N,me,0)}function ce(_,N,C,M,$){var Q;if(C<32)return-1;for(ue(_,0,N,0,C,M,$),Y(_,16,_,32,C-32,_),Q=0;Q<16;Q++)_[Q]=0;return 0}function Ae(_,N,C,M,$){var Q,me=new Uint8Array(32);if(C<32||(Z(me,0,32,M,$),ae(N,16,N,32,C-32,me)!==0))return-1;for(ue(_,0,N,0,C,M,$),Q=0;Q<32;Q++)_[Q]=0;return 0}function O(_,N){var C;for(C=0;C<16;C++)_[C]=N[C]|0}function P(_){var N,C;for(C=0;C<16;C++)_[C]+=65536,N=Math.floor(_[C]/65536),_[(C+1)*(C<15?1:0)]+=N-1+37*(N-1)*(C===15?1:0),_[C]-=N*65536}function re(_,N,C){for(var M,$=~(C-1),Q=0;Q<16;Q++)M=$&(_[Q]^N[Q]),_[Q]^=M,N[Q]^=M}function j(_,N){var C,M,$,Q=r(),me=r();for(C=0;C<16;C++)me[C]=N[C];for(P(me),P(me),P(me),M=0;M<2;M++){for(Q[0]=me[0]-65517,C=1;C<15;C++)Q[C]=me[C]-65535-(Q[C-1]>>16&1),Q[C-1]&=65535;Q[15]=me[15]-32767-(Q[14]>>16&1),$=Q[15]>>16&1,Q[14]&=65535,re(me,Q,1-$)}for(C=0;C<16;C++)_[2*C]=me[C]&255,_[2*C+1]=me[C]>>8}function be(_,N){var C=new Uint8Array(32),M=new Uint8Array(32);return j(C,_),j(M,N),L(C,0,M,0)}function Re(_){var N=new Uint8Array(32);return j(N,_),N[0]&1}function Te(_,N){var C;for(C=0;C<16;C++)_[C]=N[2*C]+(N[2*C+1]<<8);_[15]&=32767}function De(_,N,C){var M;for(M=0;M<16;M++)_[M]=N[M]+C[M]|0}function Fe(_,N,C){var M;for(M=0;M<16;M++)_[M]=N[M]-C[M]|0}function Ce(_,N,C){var M,$,Q=new Float64Array(31);for(M=0;M<31;M++)Q[M]=0;for(M=0;M<16;M++)for($=0;$<16;$++)Q[M+$]+=N[M]*C[$];for(M=0;M<15;M++)Q[M]+=38*Q[M+16];for(M=0;M<16;M++)_[M]=Q[M];P(_),P(_)}function tt(_,N){Ce(_,N,N)}function It(_,N){var C=r(),M;for(M=0;M<16;M++)C[M]=N[M];for(M=253;M>=0;M--)tt(C,C),M!==2&&M!==4&&Ce(C,C,N);for(M=0;M<16;M++)_[M]=C[M]}function _e(_,N){var C=r(),M;for(M=0;M<16;M++)C[M]=N[M];for(M=250;M>=0;M--)tt(C,C),M!==1&&Ce(C,C,N);for(M=0;M<16;M++)_[M]=C[M]}function qe(_,N,C){var M=new Uint8Array(32),$=new Float64Array(80),Q,me,ye=r(),ne=r(),de=r(),Ne=r(),Qe=r(),Nt=r();for(me=0;me<31;me++)M[me]=N[me];for(M[31]=N[31]&127|64,M[0]&=248,Te($,C),me=0;me<16;me++)ne[me]=$[me],Ne[me]=ye[me]=de[me]=0;for(ye[0]=Ne[0]=1,me=254;me>=0;--me)Q=M[me>>>3]>>>(me&7)&1,re(ye,ne,Q),re(de,Ne,Q),De(Qe,ye,de),Fe(ye,ye,de),De(de,ne,Ne),Fe(ne,ne,Ne),tt(Ne,Qe),tt(Nt,ye),Ce(ye,de,ye),Ce(de,ne,Qe),De(Qe,ye,de),Fe(ye,ye,de),tt(ne,ye),Fe(de,Ne,Nt),Ce(ye,de,m),De(ye,ye,Ne),Ce(de,de,ye),Ce(ye,Ne,Nt),Ce(Ne,ne,$),tt(ne,Qe),re(ye,ne,Q),re(de,Ne,Q);for(me=0;me<16;me++)$[me+16]=ye[me],$[me+32]=de[me],$[me+48]=ne[me],$[me+64]=Ne[me];var hn=$.subarray(32),fr=$.subarray(16);return It(hn,hn),Ce(fr,fr,hn),j(_,fr),0}function ge(_,N){return qe(_,N,u)}function Le(_,N){return a(N,32),ge(_,N)}function Ke(_,N,C){var M=new Uint8Array(32);return qe(M,C,N),B(_,l,M,q)}var kt=ce,bt=Ae;function Mt(_,N,C,M,$,Q){var me=new Uint8Array(32);return Ke(me,$,Q),kt(_,N,C,M,me)}function it(_,N,C,M,$,Q){var me=new Uint8Array(32);return Ke(me,$,Q),bt(_,N,C,M,me)}function Ie(){var _=0,N=0,C=0,M=0,$=65535,Q,me,ye;for(ye=0;ye<arguments.length;ye++)Q=arguments[ye].lo,me=arguments[ye].hi,_+=Q&$,N+=Q>>>16,C+=me&$,M+=me>>>16;return N+=_>>>16,C+=N>>>16,M+=C>>>16,new n(C&$|M<<16,_&$|N<<16)}function ht(_,N){return new n(_.hi>>>N,_.lo>>>N|_.hi<<32-N)}function Et(){var _=0,N=0,C;for(C=0;C<arguments.length;C++)_^=arguments[C].lo,N^=arguments[C].hi;return new n(N,_)}function He(_,N){var C,M,$=32-N;return N<32?(C=_.hi>>>N|_.lo<<$,M=_.lo>>>N|_.hi<<$):N<64&&(C=_.lo>>>N|_.hi<<$,M=_.hi>>>N|_.lo<<$),new n(C,M)}function ln(_,N,C){var M=_.hi&N.hi^~_.hi&C.hi,$=_.lo&N.lo^~_.lo&C.lo;return new n(M,$)}function ie(_,N,C){var M=_.hi&N.hi^_.hi&C.hi^N.hi&C.hi,$=_.lo&N.lo^_.lo&C.lo^N.lo&C.lo;return new n(M,$)}function ve(_){return Et(He(_,28),He(_,34),He(_,39))}function Ue(_){return Et(He(_,14),He(_,18),He(_,41))}function Ve(_){return Et(He(_,1),He(_,8),ht(_,7))}function st(_){return Et(He(_,19),He(_,61),ht(_,6))}var tn=[new n(1116352408,3609767458),new n(1899447441,602891725),new n(3049323471,3964484399),new n(3921009573,2173295548),new n(961987163,4081628472),new n(1508970993,3053834265),new n(2453635748,2937671579),new n(2870763221,3664609560),new n(3624381080,2734883394),new n(310598401,1164996542),new n(607225278,1323610764),new n(1426881987,3590304994),new n(1925078388,4068182383),new n(2162078206,991336113),new n(2614888103,633803317),new n(3248222580,3479774868),new n(3835390401,2666613458),new n(4022224774,944711139),new n(264347078,2341262773),new n(604807628,2007800933),new n(770255983,1495990901),new n(1249150122,1856431235),new n(1555081692,3175218132),new n(1996064986,2198950837),new n(2554220882,3999719339),new n(2821834349,766784016),new n(2952996808,2566594879),new n(3210313671,3203337956),new n(3336571891,1034457026),new n(3584528711,2466948901),new n(113926993,3758326383),new n(338241895,168717936),new n(666307205,1188179964),new n(773529912,1546045734),new n(1294757372,1522805485),new n(1396182291,2643833823),new n(1695183700,2343527390),new n(1986661051,1014477480),new n(2177026350,1206759142),new n(2456956037,344077627),new n(2730485921,1290863460),new n(2820302411,3158454273),new n(3259730800,3505952657),new n(3345764771,106217008),new n(3516065817,3606008344),new n(3600352804,1432725776),new n(4094571909,1467031594),new n(275423344,851169720),new n(430227734,3100823752),new n(506948616,1363258195),new n(659060556,3750685593),new n(883997877,3785050280),new n(958139571,3318307427),new n(1322822218,3812723403),new n(1537002063,2003034995),new n(1747873779,3602036899),new n(1955562222,1575990012),new n(2024104815,1125592928),new n(2227730452,2716904306),new n(2361852424,442776044),new n(2428436474,593698344),new n(2756734187,3733110249),new n(3204031479,2999351573),new n(3329325298,3815920427),new n(3391569614,3928383900),new n(3515267271,566280711),new n(3940187606,3454069534),new n(4118630271,4000239992),new n(116418474,1914138554),new n(174292421,2731055270),new n(289380356,3203993006),new n(460393269,320620315),new n(685471733,587496836),new n(852142971,1086792851),new n(1017036298,365543100),new n(1126000580,2618297676),new n(1288033470,3409855158),new n(1501505948,4234509866),new n(1607167915,987167468),new n(1816402316,1246189591)];function Sn(_,N,C){var M=[],$=[],Q=[],me=[],ye,ne,de;for(ne=0;ne<8;ne++)M[ne]=Q[ne]=U(_,8*ne);for(var Ne=0;C>=128;){for(ne=0;ne<16;ne++)me[ne]=U(N,8*ne+Ne);for(ne=0;ne<80;ne++){for(de=0;de<8;de++)$[de]=Q[de];for(ye=Ie(Q[7],Ue(Q[4]),ln(Q[4],Q[5],Q[6]),tn[ne],me[ne%16]),$[7]=Ie(ye,ve(Q[0]),ie(Q[0],Q[1],Q[2])),$[3]=Ie($[3],ye),de=0;de<8;de++)Q[(de+1)%8]=$[de];if(ne%16===15)for(de=0;de<16;de++)me[de]=Ie(me[de],me[(de+9)%16],Ve(me[(de+1)%16]),st(me[(de+14)%16]))}for(ne=0;ne<8;ne++)Q[ne]=Ie(Q[ne],M[ne]),M[ne]=Q[ne];Ne+=128,C-=128}for(ne=0;ne<8;ne++)F(_,8*ne,M[ne]);return C}var Vt=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(_,N,C){var M=new Uint8Array(64),$=new Uint8Array(256),Q,me=C;for(Q=0;Q<64;Q++)M[Q]=Vt[Q];for(Sn(M,N,C),C%=128,Q=0;Q<256;Q++)$[Q]=0;for(Q=0;Q<C;Q++)$[Q]=N[me-C+Q];for($[C]=128,C=256-128*(C<112?1:0),$[C-9]=0,F($,C-8,new n(me/536870912|0,me<<3)),Sn(M,$,C),Q=0;Q<64;Q++)_[Q]=M[Q];return 0}function Bt(_,N){var C=r(),M=r(),$=r(),Q=r(),me=r(),ye=r(),ne=r(),de=r(),Ne=r();Fe(C,_[1],_[0]),Fe(Ne,N[1],N[0]),Ce(C,C,Ne),De(M,_[0],_[1]),De(Ne,N[0],N[1]),Ce(M,M,Ne),Ce($,_[3],N[3]),Ce($,$,y),Ce(Q,_[2],N[2]),De(Q,Q,Q),Fe(me,M,C),Fe(ye,Q,$),De(ne,Q,$),De(de,M,C),Ce(_[0],me,ye),Ce(_[1],de,ne),Ce(_[2],ne,ye),Ce(_[3],me,de)}function xe(_,N,C){var M;for(M=0;M<4;M++)re(_[M],N[M],C)}function Ge(_,N){var C=r(),M=r(),$=r();It($,N[2]),Ce(C,N[0],$),Ce(M,N[1],$),j(_,M),_[31]^=Re(C)<<7}function ut(_,N,C){var M,$;for(O(_[0],c),O(_[1],f),O(_[2],f),O(_[3],c),$=255;$>=0;--$)M=C[$/8|0]>>($&7)&1,xe(_,N,M),Bt(N,_),Bt(_,_),xe(_,N,M)}function Vn(_,N){var C=[r(),r(),r(),r()];O(C[0],g),O(C[1],b),O(C[2],f),Ce(C[3],g,b),ut(_,C,N)}function Ft(_,N,C){var M=new Uint8Array(64),$=[r(),r(),r(),r()],Q;for(C||a(N,32),mt(M,N,32),M[0]&=248,M[31]&=127,M[31]|=64,Vn($,M),Ge(_,$),Q=0;Q<32;Q++)N[Q+32]=_[Q];return 0}var Rr=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 ri(_,N){var C,M,$,Q;for(M=63;M>=32;--M){for(C=0,$=M-32,Q=M-12;$<Q;++$)N[$]+=C-16*N[M]*Rr[$-(M-32)],C=Math.floor((N[$]+128)/256),N[$]-=C*256;N[$]+=C,N[M]=0}for(C=0,$=0;$<32;$++)N[$]+=C-(N[31]>>4)*Rr[$],C=N[$]>>8,N[$]&=255;for($=0;$<32;$++)N[$]-=C*Rr[$];for(M=0;M<32;M++)N[M+1]+=N[M]>>8,_[M]=N[M]&255}function ur(_){var N=new Float64Array(64),C;for(C=0;C<64;C++)N[C]=_[C];for(C=0;C<64;C++)_[C]=0;ri(_,N)}function qi(_,N,C,M){var $=new Uint8Array(64),Q=new Uint8Array(64),me=new Uint8Array(64),ye,ne,de=new Float64Array(64),Ne=[r(),r(),r(),r()];mt($,M,32),$[0]&=248,$[31]&=127,$[31]|=64;var Qe=C+64;for(ye=0;ye<C;ye++)_[64+ye]=N[ye];for(ye=0;ye<32;ye++)_[32+ye]=$[32+ye];for(mt(me,_.subarray(32),C+32),ur(me),Vn(Ne,me),Ge(_,Ne),ye=32;ye<64;ye++)_[ye]=M[ye];for(mt(Q,_,C+64),ur(Q),ye=0;ye<64;ye++)de[ye]=0;for(ye=0;ye<32;ye++)de[ye]=me[ye];for(ye=0;ye<32;ye++)for(ne=0;ne<32;ne++)de[ye+ne]+=Q[ye]*$[ne];return ri(_.subarray(32),de),Qe}function Ii(_,N){var C=r(),M=r(),$=r(),Q=r(),me=r(),ye=r(),ne=r();return O(_[2],f),Te(_[1],N),tt($,_[1]),Ce(Q,$,d),Fe($,$,_[2]),De(Q,_[2],Q),tt(me,Q),tt(ye,me),Ce(ne,ye,me),Ce(C,ne,$),Ce(C,C,Q),_e(C,C),Ce(C,C,$),Ce(C,C,Q),Ce(C,C,Q),Ce(_[0],C,Q),tt(M,_[0]),Ce(M,M,Q),be(M,$)&&Ce(_[0],_[0],w),tt(M,_[0]),Ce(M,M,Q),be(M,$)?-1:(Re(_[0])===N[31]>>7&&Fe(_[0],c,_[0]),Ce(_[3],_[0],_[1]),0)}function vs(_,N,C,M){var $,Q=new Uint8Array(32),me=new Uint8Array(64),ye=[r(),r(),r(),r()],ne=[r(),r(),r(),r()];if(C<64||Ii(ne,M))return-1;for($=0;$<C;$++)_[$]=N[$];for($=0;$<32;$++)_[$+32]=M[$];if(mt(me,_,C),ur(me),ut(ye,ne,me),Vn(ne,N.subarray(32)),Bt(ye,ne),Ge(Q,ye),C-=64,L(N,0,Q,0)){for($=0;$<C;$++)_[$]=0;return-1}for($=0;$<C;$++)_[$]=N[$+64];return C}var pa=32,ii=24,cr=32,ai=16,si=32,Fi=32,li=32,Mr=32,$i=32,ws=ii,Yl=cr,xr=ai,Ct=64,Pt=32,Rn=64,Gi=32,Ss=64;e.lowlevel={crypto_core_hsalsa20:B,crypto_stream_xor:ue,crypto_stream:Z,crypto_stream_salsa20_xor:A,crypto_stream_salsa20:K,crypto_onetimeauth:Y,crypto_onetimeauth_verify:ae,crypto_verify_16:le,crypto_verify_32:L,crypto_secretbox:ce,crypto_secretbox_open:Ae,crypto_scalarmult:qe,crypto_scalarmult_base:ge,crypto_box_beforenm:Ke,crypto_box_afternm:kt,crypto_box:Mt,crypto_box_open:it,crypto_box_keypair:Le,crypto_hash:mt,crypto_sign:qi,crypto_sign_keypair:Ft,crypto_sign_open:vs,crypto_secretbox_KEYBYTES:pa,crypto_secretbox_NONCEBYTES:ii,crypto_secretbox_ZEROBYTES:cr,crypto_secretbox_BOXZEROBYTES:ai,crypto_scalarmult_BYTES:si,crypto_scalarmult_SCALARBYTES:Fi,crypto_box_PUBLICKEYBYTES:li,crypto_box_SECRETKEYBYTES:Mr,crypto_box_BEFORENMBYTES:$i,crypto_box_NONCEBYTES:ws,crypto_box_ZEROBYTES:Yl,crypto_box_BOXZEROBYTES:xr,crypto_sign_BYTES:Ct,crypto_sign_PUBLICKEYBYTES:Pt,crypto_sign_SECRETKEYBYTES:Rn,crypto_sign_SEEDBYTES:Gi,crypto_hash_BYTES:Ss,gf:r,D:d,L:Rr,pack25519:j,unpack25519:Te,M:Ce,A:De,S:tt,Z:Fe,pow2523:_e,add:Bt,set25519:O,modL:ri,scalarmult:ut,scalarbase:Vn};function Vl(_,N){if(_.length!==pa)throw new Error("bad key size");if(N.length!==ii)throw new Error("bad nonce size")}function Jl(_,N){if(_.length!==li)throw new Error("bad public key size");if(N.length!==Mr)throw new Error("bad secret key size")}function Wt(){for(var _=0;_<arguments.length;_++)if(!(arguments[_]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ga(_){for(var N=0;N<_.length;N++)_[N]=0}e.randomBytes=function(_){var N=new Uint8Array(_);return a(N,_),N},e.secretbox=function(_,N,C){Wt(_,N,C),Vl(C,N);for(var M=new Uint8Array(cr+_.length),$=new Uint8Array(M.length),Q=0;Q<_.length;Q++)M[Q+cr]=_[Q];return ce($,M,M.length,N,C),$.subarray(ai)},e.secretbox.open=function(_,N,C){Wt(_,N,C),Vl(C,N);for(var M=new Uint8Array(ai+_.length),$=new Uint8Array(M.length),Q=0;Q<_.length;Q++)M[Q+ai]=_[Q];return M.length<32||Ae($,M,M.length,N,C)!==0?null:$.subarray(cr)},e.secretbox.keyLength=pa,e.secretbox.nonceLength=ii,e.secretbox.overheadLength=ai,e.scalarMult=function(_,N){if(Wt(_,N),_.length!==Fi)throw new Error("bad n size");if(N.length!==si)throw new Error("bad p size");var C=new Uint8Array(si);return qe(C,_,N),C},e.scalarMult.base=function(_){if(Wt(_),_.length!==Fi)throw new Error("bad n size");var N=new Uint8Array(si);return ge(N,_),N},e.scalarMult.scalarLength=Fi,e.scalarMult.groupElementLength=si,e.box=function(_,N,C,M){var $=e.box.before(C,M);return e.secretbox(_,N,$)},e.box.before=function(_,N){Wt(_,N),Jl(_,N);var C=new Uint8Array($i);return Ke(C,_,N),C},e.box.after=e.secretbox,e.box.open=function(_,N,C,M){var $=e.box.before(C,M);return e.secretbox.open(_,N,$)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var _=new Uint8Array(li),N=new Uint8Array(Mr);return Le(_,N),{publicKey:_,secretKey:N}},e.box.keyPair.fromSecretKey=function(_){if(Wt(_),_.length!==Mr)throw new Error("bad secret key size");var N=new Uint8Array(li);return ge(N,_),{publicKey:N,secretKey:new Uint8Array(_)}},e.box.publicKeyLength=li,e.box.secretKeyLength=Mr,e.box.sharedKeyLength=$i,e.box.nonceLength=ws,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(_,N){if(Wt(_,N),N.length!==Rn)throw new Error("bad secret key size");var C=new Uint8Array(Ct+_.length);return qi(C,_,_.length,N),C},e.sign.open=function(_,N){if(Wt(_,N),N.length!==Pt)throw new Error("bad public key size");var C=new Uint8Array(_.length),M=vs(C,_,_.length,N);if(M<0)return null;for(var $=new Uint8Array(M),Q=0;Q<$.length;Q++)$[Q]=C[Q];return $},e.sign.detached=function(_,N){for(var C=e.sign(_,N),M=new Uint8Array(Ct),$=0;$<M.length;$++)M[$]=C[$];return M},e.sign.detached.verify=function(_,N,C){if(Wt(_,N,C),N.length!==Ct)throw new Error("bad signature size");if(C.length!==Pt)throw new Error("bad public key size");var M=new Uint8Array(Ct+_.length),$=new Uint8Array(Ct+_.length),Q;for(Q=0;Q<Ct;Q++)M[Q]=N[Q];for(Q=0;Q<_.length;Q++)M[Q+Ct]=_[Q];return vs($,M,M.length,C)>=0},e.sign.keyPair=function(){var _=new Uint8Array(Pt),N=new Uint8Array(Rn);return Ft(_,N),{publicKey:_,secretKey:N}},e.sign.keyPair.fromSecretKey=function(_){if(Wt(_),_.length!==Rn)throw new Error("bad secret key size");for(var N=new Uint8Array(Pt),C=0;C<N.length;C++)N[C]=_[32+C];return{publicKey:N,secretKey:new Uint8Array(_)}},e.sign.keyPair.fromSeed=function(_){if(Wt(_),_.length!==Gi)throw new Error("bad seed size");for(var N=new Uint8Array(Pt),C=new Uint8Array(Rn),M=0;M<32;M++)C[M]=_[M];return Ft(N,C,!0),{publicKey:N,secretKey:C}},e.sign.publicKeyLength=Pt,e.sign.secretKeyLength=Rn,e.sign.seedLength=Gi,e.sign.signatureLength=Ct,e.hash=function(_){Wt(_);var N=new Uint8Array(Ss);return mt(N,_,_.length),N},e.hash.hashLength=Ss,e.verify=function(_,N){return Wt(_,N),_.length===0||N.length===0||_.length!==N.length?!1:V(_,0,N,0,_.length)===0},e.setPRNG=function(_){a=_},(function(){var _=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(_&&_.getRandomValues){var N=65536;e.setPRNG(function(C,M){var $,Q=new Uint8Array(M);for($=0;$<M;$+=N)_.getRandomValues(Q.subarray($,$+Math.min(M-$,N)));for($=0;$<M;$++)C[$]=Q[$];ga(Q)})}else typeof require<"u"&&(_=require("crypto"),_&&_.randomBytes&&e.setPRNG(function(C,M){var $,Q=_.randomBytes(M);for($=0;$<M;$++)C[$]=Q[$];ga(Q)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const uu=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,z2={fromSeed:uu.sign.keyPair.fromSeed,sign:uu.sign.detached,verify:uu.sign.detached.verify,randomBytes:uu.randomBytes};let dx;function L2(e){dx=e}function Ri(){return dx}const U2=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 Nu{static checksum(n){let r=0;for(let a=0;a<n.byteLength;a++){let l=n[a];r=r<<8&65535^U2[(r>>8^l)&255]}return r}static validate(n,r){return Nu.checksum(n)==r}}const vh="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class _0{static encode(n){let r=0,a=0,l=new Uint8Array(n),u=new Uint8Array(n.byteLength*2),c=0;for(let f=0;f<l.byteLength;f++)for(a=a<<8|l[f],r+=8;r>=5;){let m=a>>>r-5&31;u[c++]=vh.charAt(m).charCodeAt(0),r-=5}if(r>0){let f=a<<5-r&31;u[c++]=vh.charAt(f).charCodeAt(0)}return u.slice(0,c)}static decode(n){let r=0,a=0,l=0,u=new Uint8Array(n),c=new Uint8Array(u.byteLength*5/8|0);for(let f=0;f<u.byteLength;f++){let m=String.fromCharCode(u[f]),d=vh.indexOf(m);if(d===-1)throw new Error("Illegal Base32 character: "+u[f]);a=a<<5|d,r+=5,r>=8&&(c[l++]=a>>>r-8&255,r-=8)}return c.slice(0,l)}}class _t extends Error{constructor(r,a){super(r);E(this,"name");E(this,"code");E(this,"chainedError");this.name="NKeysError",this.code=r,this.chainedError=a}}function B2(){return Fu(St.Operator)}function P2(){return Fu(St.Account)}function H2(){return Fu(St.User)}var pt;(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"})(pt||(pt={}));var St;(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"})(St||(St={}));class ns{static isValidPublicPrefix(n){return n==St.Server||n==St.Operator||n==St.Cluster||n==St.Account||n==St.User}static startsWithValidPrefix(n){let r=n[0];return r=="S"||r=="P"||r=="O"||r=="N"||r=="C"||r=="A"||r=="U"}static isValidPrefix(n){return this.parsePrefix(n)!=-1}static parsePrefix(n){switch(n){case St.Seed:return St.Seed;case St.Private:return St.Private;case St.Operator:return St.Operator;case St.Server:return St.Server;case St.Cluster:return St.Cluster;case St.Account:return St.Account;case St.User:return St.User;default:return-1}}}class xn{static encode(n,r){if(!r||!(r instanceof Uint8Array))throw new _t(pt.SerializationError);if(!ns.isValidPrefix(n))throw new _t(pt.InvalidPrefixByte);return xn._encode(!1,n,r)}static encodeSeed(n,r){if(!r)throw new _t(pt.ApiError);if(!ns.isValidPublicPrefix(n))throw new _t(pt.InvalidPrefixByte);if(r.byteLength!==32)throw new _t(pt.InvalidSeedLen);return xn._encode(!0,n,r)}static decode(n,r){if(!ns.isValidPrefix(n))throw new _t(pt.InvalidPrefixByte);const a=xn._decode(r);if(a[0]!==n)throw new _t(pt.InvalidPrefixByte);return a.slice(1)}static decodeSeed(n){const r=xn._decode(n),a=xn._decodePrefix(r);if(a[0]!=St.Seed)throw new _t(pt.InvalidSeed);if(!ns.isValidPublicPrefix(a[1]))throw new _t(pt.InvalidPrefixByte);return{buf:r.slice(2),prefix:a[1]}}static _encode(n,r,a){const l=n?2:1,u=a.byteLength,c=l+u+2,f=l+u,m=new Uint8Array(c);if(n){const g=xn._encodePrefix(St.Seed,r);m.set(g)}else m[0]=r;m.set(a,l);const d=Nu.checksum(m.slice(0,f));return new DataView(m.buffer).setUint16(f,d,!0),_0.encode(m)}static _decode(n){if(n.byteLength<4)throw new _t(pt.InvalidEncoding);let r;try{r=_0.decode(n)}catch(f){throw new _t(pt.InvalidEncoding,f)}const a=r.byteLength-2,u=new DataView(r.buffer).getUint16(a,!0),c=r.slice(0,a);if(!Nu.validate(c,u))throw new _t(pt.InvalidChecksum);return c}static _encodePrefix(n,r){const a=n|r>>5,l=(r&31)<<3;return new Uint8Array([a,l])}static _decodePrefix(n){const r=n[0]&248,a=(n[0]&7)<<5|(n[1]&248)>>3;return new Uint8Array([r,a])}}class mx{constructor(n){E(this,"seed");this.seed=n}getRawSeed(){if(!this.seed)throw new _t(pt.ClearedPair);return xn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new _t(pt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new _t(pt.ClearedPair);const n=xn.decodeSeed(this.seed),r=Ri().fromSeed(this.getRawSeed()),a=xn.encode(n.prefix,r.publicKey);return new TextDecoder().decode(a)}getPrivateKey(){if(!this.seed)throw new _t(pt.ClearedPair);const n=Ri().fromSeed(this.getRawSeed());return xn.encode(St.Private,n.secretKey)}sign(n){if(!this.seed)throw new _t(pt.ClearedPair);const r=Ri().fromSeed(this.getRawSeed());return Ri().sign(n,r.secretKey)}verify(n,r){if(!this.seed)throw new _t(pt.ClearedPair);const a=Ri().fromSeed(this.getRawSeed());return Ri().verify(n,r,a.publicKey)}clear(){this.seed&&(this.seed.fill(0),this.seed=void 0)}}function Fu(e){const n=Ri().randomBytes(32);let r=xn.encodeSeed(e,new Uint8Array(n));return new mx(r)}class q2{constructor(n){E(this,"publicKey");this.publicKey=n}getPublicKey(){if(!this.publicKey)throw new _t(pt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new _t(pt.PublicKeyOnly):new _t(pt.ClearedPair)}getSeed(){throw this.publicKey?new _t(pt.PublicKeyOnly):new _t(pt.ClearedPair)}sign(n){throw this.publicKey?new _t(pt.CannotSign):new _t(pt.ClearedPair)}verify(n,r){if(!this.publicKey)throw new _t(pt.ClearedPair);let a=xn._decode(this.publicKey);return Ri().verify(n,r,a.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function I2(e){const n=new TextEncoder().encode(e),r=xn._decode(n),a=ns.parsePrefix(r[0]);if(ns.isValidPublicPrefix(a))return new q2(n);throw new _t(pt.InvalidPublicKey)}function F2(e){return xn.decodeSeed(e),new mx(e)}function $2(e){return btoa(String.fromCharCode(...e))}function G2(e){const n=atob(e),r=new Uint8Array(n.length);for(let a=0;a<n.length;a++)r[a]=n.charCodeAt(a);return r}L2(z2);const k0={createAccount:P2,createOperator:B2,createPair:Fu,createUser:H2,fromPublic:I2,fromSeed:F2,NKeysError:_t,NKeysErrorCode:pt,Prefix:St,decode:G2,encode:$2};function Y2(e){return n=>{let r={};return e.forEach(a=>{const l=a(n)||{};r=Object.assign(r,l)}),r}}function V2(){return()=>{}}function J2(e,n){return()=>{const r=typeof e=="function"?e():e,a=typeof n=="function"?n():n;return{user:r,pass:a}}}function X2(e){return()=>({auth_token:typeof e=="function"?e():e})}function K2(e){return n=>{const r=typeof e=="function"?e():e,a=r?k0.fromSeed(r):void 0,l=a?a.getPublicKey():"",u=Pi.encode(n||""),c=a!==void 0&&n?a.sign(u):void 0,f=c?k0.encode(c):"";return{nkey:l,sig:f}}}function px(e,n){return r=>{const a=typeof e=="function"?e():e,l=K2(n),{nkey:u,sig:c}=l(r);return{jwt:a,nkey:u,sig:c}}}const gx=120*1e3,Q2=2,yx=2*1e3;function Z2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:gx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:yx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function W2(e){const n=[];return typeof e.authenticator=="function"&&n.push(e.authenticator),Array.isArray(e.authenticator)&&n.push(...e.authenticator),e.token&&n.push(X2(e.token)),e.user&&n.push(J2(e.user,e.pass)),n.length===0?V2():Y2(n)}function ek(e){const n=`${Zh}:${cx()}`;if(e=e||{servers:[n]},e.servers=e.servers||[],typeof e.servers=="string"&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw new je("port and servers options are mutually exclusive",Se.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Zh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[n]);const r=Hu(Z2(),e);if(r.authenticator=W2(r),["reconnectDelayHandler","authenticator"].forEach(a=>{if(r[a]&&typeof r[a]!="function")throw new je(`${a} option should be a function`,Se.NotFunction)}),r.reconnectDelayHandler||(r.reconnectDelayHandler=()=>{let a=r.tls?r.reconnectJitterTLS:r.reconnectJitter;return a&&(a++,a=Math.floor(Math.random()*a)),r.reconnectTimeWait+a}),r.inboxPrefix)try{Wr(r.inboxPrefix)}catch(a){throw new je(a.message,Se.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof ad()=="function"),r.resolve&&typeof ad()!="function")throw new je("'resolve' is not supported on this client",Se.InvalidOption);return r}function tk(e,n){const{proto:r,tls_required:a,tls_available:l}=e;if((r===void 0||r<1)&&n.noEcho)throw new je("noEcho",Se.ServerOptionNotAvailable);const u=a||l||!1;if(n.tls&&!u)throw new je("tls",Se.ServerOptionNotAvailable)}const nk=1024*32,rk=/^INFO\s+([^\r\n]+)\r\n/i,ik=_l(`PONG\r
72
- `),E0=_l(`PING\r
73
- `);class ak{constructor(n,r,a){E(this,"echo");E(this,"no_responders");E(this,"protocol");E(this,"verbose");E(this,"pedantic");E(this,"jwt");E(this,"nkey");E(this,"sig");E(this,"user");E(this,"pass");E(this,"auth_token");E(this,"tls_required");E(this,"name");E(this,"lang");E(this,"version");E(this,"headers");this.protocol=1,this.version=n.version,this.lang=n.lang,this.echo=r.noEcho?!1:void 0,this.verbose=r.verbose,this.pedantic=r.pedantic,this.tls_required=r.tls?!0:void 0,this.name=r.name;const l=(r&&typeof r.authenticator=="function"?r.authenticator(a):{})||{};Hu(this,l)}}class bx extends sn{constructor(r,a,l={}){var c;super();E(this,"sid");E(this,"queue");E(this,"draining");E(this,"max");E(this,"subject");E(this,"drained");E(this,"protocol");E(this,"timer");E(this,"info");E(this,"cleanupFn");E(this,"closed");E(this,"requestSubject");Hu(this,l),this.protocol=r,this.subject=a,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Lt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=cs(l.timeout,u),this.timer.then(()=>{this.timer=void 0}).catch(f=>{this.stop(f),this.noIterator&&this.callback(f,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const a=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),u=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,m)=>{const{ingest:d}=l(m);d&&u(m)&&(a(f,m),c(m))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,a){this.cancelTimeout(),r?this.stop(r):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(je.errorForCode(Se.ConnectionClosed)):this.isClosed()?Promise.reject(je.errorForCode(Se.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Lt()).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(){E(this,"mux");E(this,"subs");E(this,"sidCounter");this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(n){return this.sidCounter++,n.sid=this.sidCounter,this.subs.set(n.sid,n),n}setMux(n){return this.mux=n,n}getMux(){return this.mux}get(n){return this.subs.get(n)}resub(n){return this.sidCounter++,this.subs.delete(n.sid),n.sid=this.sidCounter,this.subs.set(n.sid,n),n}all(){return Array.from(this.subs.values())}cancel(n){n&&(n.close(),this.subs.delete(n.sid))}handleError(n){if(n&&n.permissionContext){const r=n.permissionContext,a=this.all();let l;if(r.operation==="subscription"&&(l=a.find(u=>u.subject===r.subject&&u.queue===r.queue)),r.operation==="publish"&&(l=a.find(u=>u.requestSubject===r.subject)),l)return l.callback(n,{}),l.close(),this.subs.delete(l.sid),l!==this.mux}return!1}close(){this.subs.forEach(n=>{n.close()})}}class Ou{constructor(n,r){E(this,"connected");E(this,"connectedOnce");E(this,"infoReceived");E(this,"info");E(this,"muxSubscriptions");E(this,"options");E(this,"outbound");E(this,"pongs");E(this,"subscriptions");E(this,"transport");E(this,"noMorePublishing");E(this,"connectError");E(this,"publisher");E(this,"_closed");E(this,"closed");E(this,"listeners");E(this,"heartbeats");E(this,"parser");E(this,"outMsgs");E(this,"inMsgs");E(this,"outBytes");E(this,"inBytes");E(this,"pendingLimit");E(this,"lastError");E(this,"abortReconnect");E(this,"whyClosed");E(this,"servers");E(this,"server");E(this,"features");E(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=nk,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new sk,this.muxSubscriptions=new N2,this.outbound=new hs,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new c2({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new j2(a,{randomize:!n.noRandomize}),this.closed=Lt(),this.parser=new S0(this),this.heartbeats=new O2(this,this.options.pingInterval||gx,this.options.maxPingOut||Q2)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=je.errorForCode(Se.Disconnect);r.stack="",n.forEach(a=>{a.reject(r)}),this.parser=new S0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new sn;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=Lt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=d2(),this.transport.closed().then(async r=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),n}disconnect(){this.dispatchStatus({type:rs.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:rs.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Zr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Zr.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===Se.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(n)}async dial(n){const r=this.prepare();let a;try{a=cs(this.options.timeout||2e4);const l=this.transport.connect(n,this.options);await Promise.race([l,a]),(async()=>{try{for await(const u of this.transport)this.parser.parse(u)}catch(u){console.log("reader closed",u)}})().then()}catch(l){r.reject(l)}try{await Promise.race([a,r]),a&&a.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(l){throw a&&a.cancel(),await this.transport.close(l),l}}async _doDial(n){const{resolve:r}=this.options,a=await n.resolve({fn:ad(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of a)try{l=null,this.dispatchStatus({type:rs.Reconnecting,data:u.toString()}),await this.dial(u);return}catch(c){l=c}throw l}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let n;for(;;){this._closed&&this.servers.clear();const r=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler():yx;let a=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:je.errorForCode(Se.ConnectionRefused));const u=Date.now();if(l.lastConnect===0||l.lastConnect+r<=u){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(c){if(n=c,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}l.reconnects++;const f=this.options.maxReconnectAttempts||0;f!==-1&&l.reconnects>=f&&this.servers.removeCurrentServer()}}else a=Math.min(a,l.lastConnect+r-u),await ys(a)}}static async connect(n,r){const a=new Ou(n,r);return await a.dialLoop(),a}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const a=new je(n,Se.PermissionsViolation),l=n.match(/(Publish|Subscription) to "(\S+)"/);if(l){a.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=n.match(/using queue "(\S+)"/);u&&(a.permissionContext.queue=u[1])}return a}else return r.indexOf("authorization violation")!==-1?new je(n,Se.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new je(n,Se.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new je(n,Se.AccountExpired):r.indexOf("authentication timeout")!==-1?new je(n,Se.AuthenticationTimeout):new je(n,Se.ProtocolError)}processMsg(n,r){if(this.inMsgs++,this.inBytes+=r.length,!this.subscriptions.sidCounter)return;const a=this.subscriptions.get(n.sid);a&&(a.received+=1,a.callback&&a.callback(null,new Md(n,r,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const r=l0(n),a=Ou.toError(r),l={type:Zr.Error,data:a.code};if(a.isPermissionError()){let u=!1;if(a.permissionContext){l.permissionContext=a.permissionContext;const c=this.subscriptions.getMux();u=(c==null?void 0:c.subject)===a.permissionContext.subject}this.subscriptions.handleError(a),this.muxSubscriptions.handleError(u,a),u&&this.subscriptions.setMux(null)}this.dispatchStatus(l),this.handleError(a)}handleError(n){n.isAuthError()?this.handleAuthError(n):n.isProtocolError()?this.lastError=n:n.isAuthTimeout()&&(this.lastError=n),n.isPermissionError()||(this.lastError=n)}handleAuthError(n){this.lastError&&n.code===this.lastError.code&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(n):this.disconnect()}processPing(){this.transport.send(ik)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse(l0(n));this.info=r;const a=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(r,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(ca(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new ak({version:u,lang:c},this.options,r.nonce);r.headers&&(f.headers=!0,f.no_responders=!0);const m=JSON.stringify(f);this.transport.send(_l(`CONNECT ${m}${bu}`)),this.transport.send(E0)}catch(f){this._close(f)}}a&&this.dispatchStatus({type:Zr.Update,data:a}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Zr.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case bn.MSG:{const{msg:r,data:a}=n;this.processMsg(r,a);break}case bn.OK:break;case bn.ERR:this.processError(n.data);break;case bn.PING:this.processPing();break;case bn.PONG:this.processPong();break;case bn.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const a=this.outbound.length();let l;typeof n=="string"?l=_l(n):l=n,this.outbound.fill(l,...r),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=Yn,a){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Pi.encode(r);else throw je.errorForCode(Se.BadPayload);let u=l.length;a=a||{},a.reply=a.reply||"";let c=Yn,f=0;if(a.headers){if(this.info&&!this.info.headers)throw new je("headers",Se.ServerOptionNotAvailable);c=a.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw je.errorForCode(Se.MaxPayloadExceeded);this.outBytes+=u,this.outMsgs++;let m;a.headers?(a.reply?m=`HPUB ${n} ${a.reply} ${f} ${u}\r
74
- `:m=`HPUB ${n} ${f} ${u}\r
75
- `,this.sendCommand(m,c,l,ju)):(a.reply?m=`PUB ${n} ${a.reply} ${u}\r
76
- `:m=`PUB ${n} ${u}\r
77
- `,this.sendCommand(m,l,ju))}request(n){return this.initMux(),this.muxSubscriptions.add(n),n}subscribe(n){return this.subscriptions.add(n),this._subunsub(n),n}_sub(n){n.queue?this.sendCommand(`SUB ${n.subject} ${n.queue} ${n.sid}\r
78
- `):this.sendCommand(`SUB ${n.subject} ${n.sid}\r
79
- `)}_subunsub(n){return this._sub(n),n.max&&this.unsubscribe(n,n.max),n}unsubscribe(n,r){this.unsub(n,r),(n.max===void 0||n.received>=n.max)&&this.subscriptions.cancel(n)}unsub(n,r){!n||this.isClosed()||(r?this.sendCommand(`UNSUB ${n.sid} ${r}\r
80
- `):this.sendCommand(`UNSUB ${n.sid}\r
81
- `),n.max=r)}resub(n,r){!n||this.isClosed()||(this.unsub(n),n.subject=r,this.subscriptions.resub(n),this._sub(n))}flush(n){return n||(n=Lt()),this.pongs.push(n),this.outbound.fill(E0),this.flushPending(),n}sendSubscriptions(){const n=[];this.subscriptions.all().forEach(r=>{const a=r;a.queue?n.push(`SUB ${a.subject} ${a.queue} ${a.sid}${bu}`):n.push(`SUB ${a.subject} ${a.sid}${bu}`)}),n.length&&this.transport.send(_l(n.join("")))}async _close(n){this._closed||(this.whyClosed=new Error("close trace").stack||"",this.heartbeats.cancel(),this.connectError&&(this.connectError(n),this.connectError=void 0),this.muxSubscriptions.close(),this.subscriptions.close(),this.listeners.forEach(r=>{r.stop()}),this._closed=!0,await this.transport.close(n),await this.closed.resolve(n))}close(){return this._close()}isClosed(){return this._closed}drain(){const n=this.subscriptions.all(),r=[];return n.forEach(a=>{r.push(a.drain())}),Promise.all(r).then(async()=>(this.noMorePublishing=!0,await this.flush(),this.close())).catch(()=>{})}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){const n=this.outbound.drain();this.transport.send(n)}}initMux(){if(!this.subscriptions.getMux()){const r=this.muxSubscriptions.init(this.options.inboxPrefix),a=new bx(this,`${r}*`);a.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(a),this.subscribe(a)}}selectServer(){const n=this.servers.selectServer();if(n!==void 0)return this.server=n,this.server}getServer(){return this.server}}const lk="$SRV";class C0{constructor(n){E(this,"msg");this.msg=n}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||""}get headers(){return this.msg.headers}respond(n,r){return this.msg.respond(n,r)}respondError(n,r,a,l){var u,c;return l=l||{},l.headers=l.headers||ti(),(u=l.headers)==null||u.set(ku,`${n}`),(c=l.headers)==null||c.set(_u,r),this.msg.respond(a,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class Rl{constructor(n,r="",a=""){E(this,"subject");E(this,"queue");E(this,"srv");r!==""&&uk("service group",r);let l="";if(n instanceof Il)this.srv=n,l="";else if(n instanceof Rl){const u=n;this.srv=u.srv,a===""&&u.queue!==""&&(a=u.queue),l=u.subject}else throw new Error("unknown ServiceGroup type");this.subject=this.calcSubject(l,r),this.queue=a}calcSubject(n,r=""){return r===""?n:n!==""?`${n}.${r}`:r}addEndpoint(n="",r){r=r||{subject:n};const a=typeof r=="function"?{handler:r,subject:n}:r;wl("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=a;l=l||n,f=f||this.queue,ok("endpoint subject",l),l=this.calcSubject(this.subject,l);const m={name:n,subject:l,queue:f,handler:u,metadata:c};return this.srv._addEndpoint(m)}addGroup(n="",r=""){return new Rl(this,n,r)}}function ok(e,n){if(n==="")throw new Error(`${e} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);const r=n.split(".");r.forEach((a,l)=>{if(a===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${n}'`)})}function uk(e,n){if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${e} name cannot contain internal '>': '${n}'`)})}class Il{constructor(n,r={name:"",version:""}){E(this,"nc");E(this,"_id");E(this,"config");E(this,"handlers");E(this,"internal");E(this,"_stopped");E(this,"_done");E(this,"started");this.nc=n,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),wl("name",this.config.name),wl("queue",this.config.queue),ca(this.config.version),this._id=Ui.next(),this.internal=[],this._done=Lt(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.nc.closed().then(()=>{this.close().catch()}).catch(a=>{this.close(a).catch()})}static controlSubject(n,r="",a="",l){const u=l??lk;return r===""&&a===""?`${u}.${n}`:(wl("control subject name",r),a!==""?(wl("control subject id",a),`${u}.${n}.${r}.${a}`):`${u}.${n}.${r}`)}get subjects(){return this.handlers.filter(n=>n.internal===!1).map(n=>n.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??""}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(n){const r=ti();if(n instanceof Eu){const a=n;r.set(_u,a.message),r.set(ku,`${a.code}`)}else r.set(_u,n.message),r.set(ku,"500");return r}setupHandler(n,r=!1){const a=r?"":n.queue?n.queue:this.config.queue,{name:l,subject:u,handler:c}=n,f=n;f.internal=r,r&&this.internal.push(f),f.stats=new ck(l,u,a),f.queue=a;const m=c?(d,y)=>{if(d){this.close(d);return}const g=Date.now();try{c(d,new C0(y))}catch(b){f.stats.countError(b),y==null||y.respond(Yn,{headers:this.errorToHeader(b)})}finally{f.stats.countLatency(g)}}:void 0;return f.sub=this.nc.subscribe(u,{callback:m,queue:a}),f.sub.closed.then(()=>{this._stopped||this.close(new Error(`required subscription ${n.subject} stopped`)).catch()}).catch(d=>{if(!this._stopped){const y=new Error(`required subscription ${n.subject} errored: ${d.message}`);y.stack=d.stack,this.close(y).catch()}}),f}info(){return{type:kl.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(n=>{const{subject:r,metadata:a,name:l,queue:u}=n;return{subject:r,metadata:a,name:l,queue_group:u}})}async stats(){const n=[];for(const r of this.handlers){if(typeof this.config.statsHandler=="function")try{r.stats.data=await this.config.statsHandler(r)}catch(a){r.stats.countError(a)}n.push(r.stats.stats(r.qi))}return{type:kl.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:n}}addInternalHandler(n,r){const a=`${n}`.toUpperCase();this._doAddInternalHandler(`${a}-all`,n,r),this._doAddInternalHandler(`${a}-kind`,n,r,this.name),this._doAddInternalHandler(`${a}`,n,r,this.name,this.id)}_doAddInternalHandler(n,r,a,l="",u=""){const c={};c.name=n,c.subject=Il.controlSubject(r,l,u),c.handler=a,this.setupHandler(c,!0)}start(){const n=yr(),r=(c,f)=>c?(this.close(c),Promise.reject(c)):this.stats().then(m=>(f==null||f.respond(n.encode(m)),Promise.resolve())),a=(c,f)=>c?(this.close(c),Promise.reject(c)):(f==null||f.respond(n.encode(this.info())),Promise.resolve()),l=n.encode(this.ping()),u=(c,f)=>c?(this.close(c).then().catch(),Promise.reject(c)):(f.respond(l),Promise.resolve());return this.addInternalHandler(Di.PING,u),this.addInternalHandler(Di.STATS,r),this.addInternalHandler(Di.INFO,a),this.handlers.forEach(c=>{const{subject:f}=c;typeof f=="string"&&c.handler!==null&&this.setupHandler(c)}),Promise.resolve(this)}close(n){if(this._stopped)return this._done;this._stopped=!0;let r=[];return this.nc.isClosed()||(r=this.handlers.concat(this.internal).map(a=>a.sub.drain())),Promise.allSettled(r).then(()=>{this._done.resolve(n||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(n){return this.close(n)}ping(){return{type:kl.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(const n of this.handlers)n.stats.reset(n.qi)}addGroup(n,r){return new Rl(this,n,r)}addEndpoint(n,r){return new Rl(this).addEndpoint(n,r)}_addEndpoint(n){const r=new sn;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new C0(u))},r.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=r,this.handlers.push(a),r}}class ck{constructor(n,r,a=""){E(this,"name");E(this,"subject");E(this,"average_processing_time");E(this,"num_requests");E(this,"processing_time");E(this,"num_errors");E(this,"last_error");E(this,"data");E(this,"metadata");E(this,"queue");this.name=n,this.subject=r,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=a}reset(n){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;const r=n;r&&(r.time=0,r.processed=0)}countLatency(n){this.num_requests++,this.processing_time+=zt(Date.now()-n),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(n){this.num_errors++,this.last_error=n.message}_stats(){const{name:n,subject:r,average_processing_time:a,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue:d}=this;return{name:n,subject:r,average_processing_time:a,num_errors:l,num_requests:u,processing_time:c,last_error:f,data:m,queue_group:d}}stats(n){const r=n;return(r==null?void 0:r.noIterator)===!1&&(this.processing_time=zt(r.time),this.num_requests=r.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}class fk{constructor(n,r={strategy:gr.JitterTimer,maxWait:2e3},a){E(this,"nc");E(this,"prefix");E(this,"opts");this.nc=n,this.prefix=a,this.opts=r}ping(n="",r=""){return this.q(Di.PING,n,r)}stats(n="",r=""){return this.q(Di.STATS,n,r)}info(n="",r=""){return this.q(Di.INFO,n,r)}async q(n,r="",a=""){const l=new sn,u=yr(),c=Il.controlSubject(n,r,a,this.prefix),f=await this.nc.requestMany(c,Yn,this.opts);return(async()=>{for await(const m of f)try{const d=u.decode(m.data);l.push(d)}catch(d){l.push(()=>{l.stop(d)})}l.push(()=>{l.stop()})})().catch(m=>{l.stop(m)}),l}}function xx(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function hk(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:xx(),storage:nd.File}}const Ru="KV-Operation",A0="$KV",dk=/^[-/=.\w]+$/,mk=/^[-/=.>*\w]+$/,pk=/^[-\w]+$/;function gk(e){if(e.startsWith(".")||e.endsWith(".")||!dk.test(e))throw new Error(`invalid key: ${e}`)}function yk(e){if(e.startsWith(".")||e.endsWith(".")||!mk.test(e))throw new Error(`invalid key: ${e}`)}function bk(e){if(e.startsWith(".")||e.endsWith("."))throw new Error(`invalid key: ${e}`);const n=e.split(".");let r=!1;for(let a=0;a<n.length;a++)switch(n[a]){case"*":r=!0;break;case">":if(a!==n.length-1)throw new Error(`invalid key: ${e}`);r=!0;break}return r}function xu(e){if(!pk.test(e))throw new Error(`invalid bucket name: ${e}`)}var Er;(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"})(Er||(Er={}));class Ml{constructor(n,r,a){E(this,"js");E(this,"jsm");E(this,"stream");E(this,"bucket");E(this,"direct");E(this,"codec");E(this,"prefix");E(this,"editPrefix");E(this,"useJsPrefix");E(this,"_prefixLen");E(this,"validateKey",gk);E(this,"validateSearchKey",yk);E(this,"hasWildcards",bk);xu(n),this.js=r,this.jsm=a,this.bucket=n,this.prefix=A0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,a={}){xu(r);const l=await n.jetstreamManager(),u=new Ml(r,n,l);return await u.init(a),u}static async bind(n,r,a={}){const l=await n.jetstreamManager(),u={config:{allow_direct:a.allow_direct}};xu(r);const c=new Ml(r,n,l);return u.config.name=a.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=a.codec||xx(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(hk(),n);this.codec=r.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=td.Limits,a.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(a.max_bytes=r.max_bytes),a.max_msg_size=r.maxValueSize,a.storage=r.storage;const l=n.placementCluster??"";if(l&&(n.placement={},n.placement.cluster=l,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const g=Object.assign({},n.mirror);g.name.startsWith(In)||(g.name=`${In}${g.name}`),a.mirror=g,a.mirror_direct=!0}else if(n.sources){const g=n.sources.map(b=>{const w=Object.assign({},b),k=w.name.startsWith(In)?w.name.substring(In.length):w.name;return w.name.startsWith(In)||(w.name=`${In}${w.name}`),!b.external&&k!==this.bucket&&(w.subject_transforms=[{src:`$KV.${k}.>`,dest:`$KV.${this.bucket}.>`}]),w});a.sources=g,a.subjects=[this.subjectForBucket()]}else a.subjects=[this.subjectForBucket()];n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Bi.S2:Bi.None);const u=this.js.nc,c=u.getServerVersion(),f=c?id(c,ca("2.7.2"))>=0:!1;a.discard=f?Ol.New:Ol.Old;const{ok:m,min:d}=u.features.get(ot.JS_ALLOW_DIRECT);if(!m&&n.allow_direct===!0){const g=c?`${c.major}.${c.minor}.${c.micro}`:"unknown";return Promise.reject(new Error(`allow_direct is not available on server version ${g} - requires ${d}`))}n.allow_direct=typeof n.allow_direct=="boolean"?n.allow_direct:m,a.allow_direct=n.allow_direct,this.direct=a.allow_direct,a.num_replicas=r.replicas,r.ttl&&(a.max_age=zt(r.ttl)),a.allow_rollup_hdrs=!0;let y;try{y=await this.jsm.streams.info(a.name),!y.config.allow_direct&&this.direct===!0&&(this.direct=!1)}catch(g){if(g.message==="stream not found")y=await this.jsm.streams.add(a);else throw g}this.initializePrefixes(y)}initializePrefixes(n){this._prefixLen=0,this.prefix=`$KV.${this.bucket}`,this.useJsPrefix=this.js.apiPrefix!=="$JS.API";const{mirror:r}=n.config;if(r){let a=r.name;if(a.startsWith(In)&&(a=a.substring(In.length)),r.external&&r.external.api!==""){const l=r.name.substring(In.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${In}${this.bucket}`}subjectForBucket(){return`${this.prefix}.${this.bucket}.>`}subjectForKey(n,r=!1){const a=[];return r?(this.useJsPrefix&&a.push(this.js.apiPrefix),this.editPrefix!==""?a.push(this.editPrefix):a.push(this.prefix)):this.prefix&&a.push(this.prefix),a.push(n),a.join(".")}fullKeyName(n){return this.prefix!==""?`${this.prefix}.${n}`:`${A0}.${this.bucket}.${n}`}get prefixLen(){return this._prefixLen===0&&(this._prefixLen=this.prefix.length+1),this._prefixLen}encodeKey(n){const r=[];for(const a of n.split("."))switch(a){case">":case"*":r.push(a);break;default:r.push(this.codec.key.encode(a));break}return r.join(".")}decodeKey(n){const r=[];for(const a of n.split("."))switch(a){case">":case"*":r.push(a);break;default:r.push(this.codec.key.decode(a));break}return r.join(".")}close(){return Promise.resolve()}dataLen(n,r){const a=r&&r.get(wn.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new Mk(this.bucket,this.prefixLen,n)}jmToEntry(n){const r=this.decodeKey(n.subject.substring(this.prefixLen));return new Dk(this.bucket,r,n)}async create(n,r){var u;let a;try{const c=await this.put(n,r,{previousSeq:0});return Promise.resolve(c)}catch(c){if(a=c,((u=c==null?void 0:c.api_error)==null?void 0:u.err_code)!==10071)return Promise.reject(c)}let l=0;try{const c=await this.get(n);return(c==null?void 0:c.operation)==="DEL"||(c==null?void 0:c.operation)==="PURGE"?(l=c!==null?c.revision:0,this.update(n,r,l)):Promise.reject(a)}catch(c){return Promise.reject(c)}}update(n,r,a){if(a<=0)throw new Error("version must be greater than 0");return this.put(n,r,{previousSeq:a})}async put(n,r,a={}){var c,f;const l=this.encodeKey(n);this.validateKey(l);const u={};if(a.previousSeq!==void 0){const m=ti();u.headers=m,m.set(Er.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`)}try{return(await this.js.publish(this.subjectForKey(l,!0),r,u)).seq}catch(m){const d=m;return d.isJetStreamError()?(d.message=(c=d.api_error)==null?void 0:c.description,d.code=`${(f=d.api_error)==null?void 0:f.code}`,Promise.reject(d)):Promise.reject(m)}}async get(n,r){const a=this.encodeKey(n);this.validateKey(a);let l={last_by_subj:this.subjectForKey(a)};r&&r.revision>0&&(l={seq:r.revision});let u;try{this.direct?u=await this.jsm.direct.getMessage(this.bucketName(),l):u=await this.jsm.streams.getMessage(this.bucketName(),l);const c=this.smToEntry(u);return c.key!==a?null:c}catch(c){if(c.code===Se.JetStream404NoMessages)return null;throw c}}purge(n,r){return this._deleteOrPurge(n,"PURGE",r)}delete(n,r){return this._deleteOrPurge(n,"DEL",r)}async purgeDeletes(n=1800*1e3){const r=Lt(),a=[],l=await this.watch({key:">",initializedFn:()=>{r.resolve()}});(async()=>{for await(const m of l)(m.operation==="DEL"||m.operation==="PURGE")&&a.push(m)})().then(),await r,l.stop();const u=Date.now()-n,c=a.map(m=>{const d=this.subjectForKey(m.key);return m.created.getTime()>=u?this.jsm.streams.purge(this.stream,{filter:d,keep:1}):this.jsm.streams.purge(this.stream,{filter:d,keep:0})}),f=await Promise.all(c);return f.unshift({success:!0,purged:0}),f.reduce((m,d)=>(m.purged+=d.purged,m))}async _deleteOrPurge(n,r,a){if(!this.hasWildcards(n))return this._doDeleteOrPurge(n,r,a);const l=await this.keys(n),u=[];for await(const c of l)u.push(this._doDeleteOrPurge(c,r)),u.length===100&&(await Promise.all(u),u.length=0);u.length>0&&await Promise.all(u)}async _doDeleteOrPurge(n,r,a){const l=this.encodeKey(n);this.validateKey(l);const u=ti();u.set(Ru,r),r==="PURGE"&&u.set(wn.RollupHdr,wn.RollupValueSubject),a!=null&&a.previousSeq&&u.set(Er.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Yn,{headers:u})}_buildCC(n,r,a={}){let u=(Array.isArray(n)?n:[n]).map(m=>{const d=this.encodeKey(m);return this.validateSearchKey(m),this.fullKeyName(d)}),c=Yt.LastPerSubject;r===pr.AllHistory&&(c=Yt.All),r===pr.UpdatesOnly&&(c=Yt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:an.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:zt(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",a=new sn,l={};l.headers_only=n.headers_only||!1;let u;u=()=>{a.stop()};let c=0;const f=this._buildCC(r,pr.AllHistory,l),m=f.filter_subject,d=Li(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,b)=>{if(g){a.stop(g);return}if(b){const w=this.jmToEntry(b);a.push(w),a.received++,(u&&c>0&&a.received>=c||b.info.pending===0)&&(a.push(u),u=void 0)}});const y=await this.js.subscribe(m,d);if(u){const{info:{last:g}}=y,b=g.num_pending+g.delivered.consumer_seq;if(b===0||a.received>=b)try{u()}catch(w){a.stop(w)}finally{u=void 0}else c=b}return a._data=y,a.iterClosed.then(()=>{y.unsubscribe()}),y.closed.then(()=>{a.stop()}).catch(g=>{a.stop(g)}),a}canSetWatcherName(){const r=this.js.nc,{ok:a}=r.features.get(ot.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const r=n.key??">",a=new sn,l={};l.headers_only=n.headers_only||!1;let u=pr.LastValue;n.include===pr.AllHistory?u=pr.AllHistory:n.include===pr.UpdatesOnly&&(u=pr.UpdatesOnly);const c=n.ignoreDeletes===!0;let f=n.initializedFn,m=0;const d=this._buildCC(r,u,l),y=d.filter_subject,g=Li(d);this.canSetWatcherName()&&g.consumerName(Ui.next()),g.bindStream(this.stream),n.resumeFromRevision&&n.resumeFromRevision>0&&g.startSequence(n.resumeFromRevision),g.orderedConsumer(),g.callback((w,k)=>{if(w){a.stop(w);return}if(k){const R=this.jmToEntry(k);if(c&&R.operation==="DEL")return;a.push(R),a.received++,f&&(m>0&&a.received>=m||k.info.pending===0)&&(a.push(f),f=void 0)}});const b=await this.js.subscribe(y,g);if(f){const{info:{last:w}}=b,k=w.num_pending+w.delivered.consumer_seq;if(k===0||a.received>=k)try{f()}catch(R){a.stop(R)}finally{f=void 0}else m=k}return a._data=b,a.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{a.stop()}).catch(w=>{a.stop(w)}),a}async keys(n=">"){const r=new sn,a=this._buildCC(n,pr.LastValue,{headers_only:!0}),l=Array.isArray(n)?">":a.filter_subject,u=Li(a);u.bindStream(this.stream),u.orderedConsumer();const c=await this.js.subscribe(l,u);return(async()=>{var m;for await(const d of c){const y=(m=d.headers)==null?void 0:m.get(Ru);if(y!=="DEL"&&y!=="PURGE"){const g=this.decodeKey(d.subject.substring(this.prefixLen));r.push(g)}d.info.pending===0&&c.unsubscribe()}})().then(()=>{r.stop()}).catch(m=>{r.stop(m)}),c.info.last.num_pending===0&&c.unsubscribe(),r}purgeBucket(n){return this.jsm.streams.purge(this.bucketName(),n)}destroy(){return this.jsm.streams.delete(this.bucketName())}async status(){var u;const r=((u=this.js.nc.info)==null?void 0:u.cluster)??"",a=this.bucketName(),l=await this.jsm.streams.info(a);return new vx(l,r)}}class vx{constructor(n,r=""){E(this,"si");E(this,"cluster");this.si=n,this.cluster=r}get bucket(){return this.si.config.name.startsWith(In)?this.si.config.name.substring(In.length):this.si.config.name}get values(){return this.si.state.messages}get history(){return this.si.config.max_msgs_per_subject}get ttl(){return Rd(this.si.config.max_age)}get bucket_location(){return this.cluster}get backingStore(){return this.si.config.storage}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get description(){return this.si.config.description??""}get maxBucketSize(){return this.si.config.max_bytes}get maxValueSize(){return this.si.config.max_msg_size}get max_bytes(){return this.si.config.max_bytes}get placement(){return this.si.config.placement||{cluster:"",tags:[]}}get placementCluster(){var n;return((n=this.si.config.placement)==null?void 0:n.cluster)??""}get republish(){return this.si.config.republish??{src:"",dest:""}}get streamInfo(){return this.si}get size(){return this.si.state.bytes}get metadata(){return this.si.config.metadata??{}}get compression(){return this.si.config.compression?this.si.config.compression!==Bi.None:!1}}const zd="OBJ_",T0="SHA-256=";function xk(e){return xu(e),`${zd}${e}`}function vk(e){return e.startsWith(zd)?e.substring(4):e}class od{constructor(n){E(this,"si");E(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return vk(this.si.config.name)}get description(){return this.si.config.description??""}get ttl(){return this.si.config.max_age}get storage(){return this.si.config.storage}get replicas(){return this.si.config.num_replicas}get sealed(){return this.si.config.sealed}get size(){return this.si.state.bytes}get streamInfo(){return this.si}get metadata(){return this.si.config.metadata}get compression(){return this.si.config.compression?this.si.config.compression!==Bi.None:!1}}function cu(e){if(e===void 0)return;const{domain:n}=e;if(n===void 0)return e;const r=Object.assign({},e);if(delete r.domain,n==="")return r;if(r.external)throw new Error("domain and external are both set");return r.external={api:`$JS.${n}.API`},r}var ir;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(ir||(ir={}));var Cr;(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"})(Cr||(Cr={}));var ls;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(ls||(ls={}));const j0=Uint8Array.of(43,65,67,75),wk=Uint8Array.of(45,78,65,75),ml=Uint8Array.of(43,87,80,73),Sk=Uint8Array.of(43,78,88,84),_k=Uint8Array.of(43,84,69,82,77),kk=Uint8Array.of(32);function Dl(e,n=5e3){return new qk(e,n)}class wh extends sn{constructor(r,a,l=!1){super();E(this,"consumer");E(this,"opts");E(this,"sub");E(this,"monitor");E(this,"pending");E(this,"inbox");E(this,"refilling");E(this,"pong");E(this,"callback");E(this,"timeout");E(this,"cleanupHandler");E(this,"listeners");E(this,"statusIterator");E(this,"forOrderedConsumer");E(this,"resetHandler");E(this,"abortOnMissingResource");E(this,"bind");E(this,"inBackOff");this.consumer=r;const u=a;this.opts=this.parseOptions(a,l),this.callback=u.callback||null,this.noIterator=typeof this.callback=="function",this.monitor=null,this.pong=null,this.pending={msgs:0,bytes:0,requests:0},this.refilling=l,this.timeout=null,this.inbox=Wr(r.api.nc.options.inboxPrefix),this.listeners=[],this.forOrderedConsumer=!1,this.abortOnMissingResource=u.abort_on_missing_resource===!0,this.bind=u.bind===!0,this.inBackOff=!1,this.start()}start(){const{max_messages:r,max_bytes:a,idle_heartbeat:l,threshold_bytes:u,threshold_messages:c}=this.opts;this.closed().then(m=>{if(this.cleanupHandler)try{this.cleanupHandler(m)}catch{}});const{sub:f}=this;f&&f.unsubscribe(),this.sub=this.consumer.api.nc.subscribe(this.inbox,{callback:(m,d)=>{var g,b,w,k;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(ed(d))return;const R=(b=d.headers)==null?void 0:b.code,U=((k=(w=d.headers)==null?void 0:w.description)==null?void 0:k.toLowerCase())||"unknown",{msgsLeft:T,bytesLeft:F}=this.parseDiscard(d.headers);if(T>0||F>0)this.pending.msgs-=T,this.pending.bytes-=F,this.pending.requests--,this.notify(ls.Discard,{msgsLeft:T,bytesLeft:F});else if(R===400){this.stop(new je(U,`${R}`));return}else if(R===409&&U==="consumer deleted"){if(this.notify(Cr.ConsumerDeleted,`${R} ${U}`),!this.refilling||this.abortOnMissingResource){const V=new je(U,`${R}`);this.stop(V);return}}else if(R===503){if(this.notify(Cr.NoResponders,`${R} No Responders`),!this.refilling||this.abortOnMissingResource){const V=new je("no responders",`${R}`);this.stop(V);return}}else this.notify(ls.DebugEvent,`${R} ${U}`)}else this._push(Dl(d,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=d.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=c||a&&this.pending.bytes<=u){const R=this.pullOptions();this.pull(R)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Dd(l,m=>(this.notify(Cr.HeartbeatsMissed,m),this.resetPending().then(()=>{}).catch(()=>{}),!1),{maxOut:2})),(async()=>{var d;const m=this.consumer.api.nc.status();this.statusIterator=m;for await(const y of m)switch(y.type){case Zr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Zr.Reconnect:this.resetPending().then(g=>{var b;g&&((b=this.monitor)==null||b.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const a=typeof r=="function"?r:null;try{a?a():this.callback(r)}catch(l){this.stop(l)}}}notify(r,a){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:a})})}resetPending(){return this.bind?this.resetPendingNoInfo():this.resetPendingWithInfo()}resetPendingNoInfo(){return this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),Promise.resolve(!0)}async resetPendingWithInfo(){if(this.inBackOff)return!1;let r=0,a=0;const l=Od([this.opts.expires]);let u=0;for(;;){if(this.done)return!1;if(this.consumer.api.nc.isClosed())return console.error("aborting resetPending - connection is closed"),!1;try{return await this.consumer.info(),this.inBackOff=!1,r=0,this.pending.msgs=0,this.pending.bytes=0,this.pending.requests=0,this.pull(this.pullOptions()),!0}catch(c){if(c.message==="stream not found"){if(a++,this.notify(Cr.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(Cr.ConsumerNotFound,r),this.resetHandler)try{this.resetHandler()}catch{}if(!this.refilling||this.abortOnMissingResource)return this.stop(c),!1;if(this.forOrderedConsumer)return!1}else r=0,a=0;this.inBackOff=!0;const f=l.backoff(u),m=ys(f);await Promise.race([m,this.consumer.api.nc.closed()]),m.cancel(),u++}}}pull(r){this.pending.bytes+=r.max_bytes??0,this.pending.msgs+=r.batch??0,this.pending.requests++;const a=this.consumer.api.nc;this._push(()=>{a.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`,this.consumer.api.jc.encode(r),{reply:this.inbox}),this.notify(ls.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,l=zt(this.opts.idle_heartbeat),u=zt(this.opts.expires);return{batch:r,max_bytes:a,idle_heartbeat:l,expires:u}}parseDiscard(r){const a={msgsLeft:0,bytesLeft:0},l=r==null?void 0:r.get(wn.PendingMessagesHdr);l&&(a.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(wn.PendingBytesHdr);return u&&(a.bytesLeft=parseInt(u)),a}trackTimeout(r){this.timeout=r}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}clearTimers(){var r,a;(r=this.monitor)==null||r.cancel(),this.monitor=null,(a=this.timeout)==null||a.cancel(),this.timeout=null}setCleanupHandler(r){this.cleanupHandler=r}stop(r){var a,l;this.done||((a=this.sub)==null||a.unsubscribe(),this.clearTimers(),(l=this.statusIterator)==null||l.stop(),this._push(()=>{super.stop(r),this.listeners.forEach(u=>{u.stop()})}))}parseOptions(r,a=!1){const l=r||{};if(l.max_messages=l.max_messages||0,l.max_bytes=l.max_bytes||0,l.max_messages!==0&&l.max_bytes!==0)throw new Error("only specify one of max_messages or max_bytes");if(l.max_messages===0&&(l.max_messages=100),l.expires=l.expires||3e4,l.expires<1e3)throw new Error("expires should be at least 1000ms");if(l.idle_heartbeat=l.idle_heartbeat||l.expires/2,l.idle_heartbeat=l.idle_heartbeat>3e4?3e4:l.idle_heartbeat,a){const u=Math.round(l.max_messages*.75)||1;l.threshold_messages=l.threshold_messages||u;const c=Math.round(l.max_bytes*.75)||1;l.threshold_bytes=l.threshold_bytes||c}return l}status(){const r=new sn;return this.listeners.push(r),Promise.resolve(r)}}class Ek extends sn{constructor(){super();E(this,"src");E(this,"listeners");this.listeners=[]}setSource(r){this.src&&(this.src.resetHandler=void 0,this.src.setCleanupHandler(),this.src.stop()),this.src=r,this.src.setCleanupHandler(a=>{this.stop(a||void 0)}),(async()=>{const a=await this.src.status();for await(const l of a)this.notify(l.type,l.data)})().catch(()=>{})}notify(r,a){this.listeners.length>0&&this.listeners.forEach(l=>{l.done||l.push({type:r,data:a})})}stop(r){var a;this.done||((a=this.src)==null||a.stop(r),super.stop(r),this.listeners.forEach(l=>{l.stop()}))}close(){return this.stop(),this.iterClosed}closed(){return this.iterClosed}status(){const r=new sn;return this.listeners.push(r),Promise.resolve(r)}}class ud{constructor(n,r){E(this,"api");E(this,"_info");E(this,"stream");E(this,"name");this.api=n,this._info=r,this.stream=r.stream_name,this.name=r.name}consume(n={max_messages:100,expires:3e4}){return Promise.resolve(new wh(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new wh(this,n,!1),a=Math.round(r.opts.expires*1.05),l=cs(a);return r.closed().catch(()=>{}).finally(()=>{l.cancel()}),l.catch(()=>{r.close().catch()}),r.trackTimeout(l),Promise.resolve(r)}next(n={expires:3e4}){const r=Lt(),a=n;a.max_messages=1;const l=new wh(this,a,!1),u=Math.round(l.opts.expires*1.05);u>=6e4&&(async()=>{for await(const f of await l.status())if(f.type===Cr.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=cs(u);return l.closed().then(f=>{f?r.reject(f):r.resolve(null)}).catch(f=>{r.reject(f)}).finally(()=>{c.cancel()}),c.catch(f=>{r.resolve(null),l.close().catch()}),l.trackTimeout(c),r}delete(){const{stream_name:n,name:r}=this._info;return this.api.delete(n,r)}info(n=!1){if(n)return Promise.resolve(this._info);const{stream_name:r,name:a}=this._info;return this.api.info(r,a).then(l=>(this._info=l,this._info))}}class Ck{constructor(n,r,a={}){E(this,"api");E(this,"consumerOpts");E(this,"consumer");E(this,"opts");E(this,"cursor");E(this,"stream");E(this,"namePrefix");E(this,"serial");E(this,"currentConsumer");E(this,"userCallback");E(this,"iter");E(this,"type");E(this,"startSeq");E(this,"maxInitialReset");this.api=n,this.stream=r,this.cursor={stream_seq:1,deliver_seq:0},this.namePrefix=Ui.next(),typeof a.name_prefix=="string"&&(qu("name_prefix",a.name_prefix),this.namePrefix=a.name_prefix+this.namePrefix),this.serial=0,this.currentConsumer=null,this.userCallback=null,this.iter=null,this.type=ir.Unset,this.consumerOpts=a,this.maxInitialReset=30,this.startSeq=this.consumerOpts.opt_start_seq||0,this.cursor.stream_seq=this.startSeq>0?this.startSeq-1:0}getConsumerOpts(n){this.serial++;const r=`${this.namePrefix}_${this.serial}`;n=n===0?1:n;const a={name:r,deliver_policy:Yt.StartSequence,opt_start_seq:n,ack_policy:an.None,inactive_threshold:zt(300*1e3),num_replicas:1};return this.consumerOpts.headers_only===!0&&(a.headers_only=!0),Array.isArray(this.consumerOpts.filterSubjects)&&(a.filter_subjects=this.consumerOpts.filterSubjects),typeof this.consumerOpts.filterSubjects=="string"&&(a.filter_subject=this.consumerOpts.filterSubjects),this.consumerOpts.replay_policy&&(a.replay_policy=this.consumerOpts.replay_policy),n===this.startSeq+1&&(a.deliver_policy=this.consumerOpts.deliver_policy||Yt.StartSequence,(this.consumerOpts.deliver_policy===Yt.LastPerSubject||this.consumerOpts.deliver_policy===Yt.New||this.consumerOpts.deliver_policy===Yt.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===Yt.LastPerSubject&&typeof a.filter_subjects>"u"&&typeof a.filter_subject>"u"&&(a.filter_subject=">"),this.consumerOpts.opt_start_time&&(delete a.opt_start_seq,a.deliver_policy=Yt.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=zt(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var c,f,m,d,y;Ui.next();const r=this.serial===0;(c=this.consumer)==null||c.delete().catch(()=>{}),n=n===0?1:n,this.cursor.deliver_seq=0;const a=this.getConsumerOpts(n);a.max_deliver=1,a.mem_storage=!0;const l=Od([((f=this.opts)==null?void 0:f.expires)||3e4]);let u;for(let g=0;;g++)try{u=await this.api.add(this.stream,a),(m=this.iter)==null||m.notify(Cr.OrderedConsumerRecreated,u.name);break}catch(b){if(b.message==="stream not found"&&((d=this.iter)==null||d.notify(Cr.StreamNotFound,g),this.type===ir.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(b),Promise.reject(b);if(r&&g>=this.maxInitialReset)throw b;await ys(l.backoff(g+1))}return u}internalHandler(n){return r=>{var l;if(this.serial!==n)return;const a=r.info.deliverySequence;if(a!==this.cursor.deliver_seq+1){this.notifyOrderedResetAndReset();return}this.cursor.deliver_seq=a,this.cursor.stream_seq=r.info.streamSequence,this.userCallback?this.userCallback(r):(l=this.iter)==null||l.push(r)}}async reset(n={max_messages:100,expires:3e4},r){var m,d;r=r||{};const a=r.fromFetch||!1,l=r.orderedReset||!1;if(this.type===ir.Fetch&&l){(m=this.iter)==null||m.src.stop(),await((d=this.iter)==null?void 0:d.closed()),this.currentConsumer=null;return}(this.currentConsumer===null||l)&&(this.currentConsumer=await this.resetConsumer(this.cursor.stream_seq+1)),(this.iter===null||a)&&(this.iter=new Ek),this.consumer=new ud(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===ir.Fetch&&a?c=await this.consumer.fetch(n):this.type===ir.Consume&&(c=await this.consumer.consume(n));const f=c;f.forOrderedConsumer=!0,f.resetHandler=()=>{this.notifyOrderedResetAndReset()},this.iter.setSource(f)}notifyOrderedResetAndReset(){var n;(n=this.iter)==null||n.notify(ls.Reset,""),this.reset(this.opts,{orderedReset:!0})}async consume(n={max_messages:100,expires:3e4}){if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===ir.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===ir.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=ir.Consume,this.opts=n,await this.reset(n),this.iter}async fetch(n={max_messages:100,expires:3e4}){var l;if(n.bind)return Promise.reject(new Error("bind is not supported"));if(this.type===ir.Consume)return Promise.reject(new Error("ordered consumer already initialized as consume"));if(((l=this.iter)==null?void 0:l.done)===!1)return Promise.reject(new Error("ordered consumer doesn't support concurrent fetch"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=ir.Fetch,this.opts=n,await this.reset(n,{fromFetch:!0}),this.iter}async next(n={expires:3e4}){const r=n;if(r.bind)return Promise.reject(new Error("bind is not supported"));r.max_messages=1;const a=Lt();return r.callback=u=>{this.userCallback=null,a.resolve(u)},(await this.fetch(r)).iterClosed.then(u=>{u&&a.reject(u),a.resolve(null)}).catch(u=>{a.reject(u)}),a}delete(){return this.currentConsumer?this.api.delete(this.stream,this.currentConsumer.name).then(n=>Promise.resolve(n)).catch(n=>Promise.reject(n)).finally(()=>{this.currentConsumer=null}):Promise.resolve(!1)}async info(n){return this.currentConsumer==null?(this.currentConsumer=await this.resetConsumer(this.startSeq),Promise.resolve(this.currentConsumer)):n&&this.currentConsumer?Promise.resolve(this.currentConsumer):this.api.info(this.stream,this.currentConsumer.name)}}class cd{constructor(n){E(this,"api");E(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(ot.JS_SIMPLIFICATION);return n.ok?Promise.resolve():Promise.reject(new Error(`consumers framework is only supported on servers ${n.min} or better`))}getPullConsumerFor(n){if(n.config.deliver_subject!==void 0)throw new Error("push consumer not supported");return new ud(this.api,n)}async get(n,r={}){return typeof r=="object"?this.ordered(n,r):(await this.checkVersion(),this.api.info(n,r).then(a=>a.config.deliver_subject!==void 0?Promise.reject(new Error("push consumer not supported")):new ud(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,r){await this.checkVersion();const a=this.api;return new Ld(a.nc,a.opts).info(n).then(u=>Promise.resolve(new Ck(this.api,n,r))).catch(u=>Promise.reject(u))}}class $u{constructor(n,r){E(this,"api");E(this,"_info");this.api=n,this._info=r}get name(){return this._info.config.name}alternates(){return this.info().then(n=>n.alternates?n.alternates:[])}async best(){if(await this.info(),this._info.alternates){const n=await this.api.info(this._info.alternates[0].name);return new $u(this.api,n)}else return this}info(n=!1,r){return n?Promise.resolve(this._info):this.api.info(this.name,r).then(a=>(this._info=a,this._info))}getConsumerFromInfo(n){return new cd(new Tu(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new cd(new Tu(this.api.nc,this.api.opts)).get(this.name,n)}getMessage(n){return this.api.getMessage(this.name,n)}deleteMessage(n,r){return this.api.deleteMessage(this.name,n,r)}}class Ld extends ql{constructor(n,r){super(n,r)}checkStreamConfigVersions(n){const r=this.nc;if(n.metadata){const{min:l,ok:u}=r.features.get(ot.JS_STREAM_CONSUMER_METADATA);if(!u)throw new Error(`stream 'metadata' requires server ${l}`)}if(n.first_seq){const{min:l,ok:u}=r.features.get(ot.JS_STREAM_FIRST_SEQ);if(!u)throw new Error(`stream 'first_seq' requires server ${l}`)}if(n.subject_transform){const{min:l,ok:u}=r.features.get(ot.JS_STREAM_SUBJECT_TRANSFORM);if(!u)throw new Error(`stream 'subject_transform' requires server ${l}`)}if(n.compression){const{min:l,ok:u}=r.features.get(ot.JS_STREAM_COMPRESSION);if(!u)throw new Error(`stream 'compression' requires server ${l}`)}if(n.consumer_limits){const{min:l,ok:u}=r.features.get(ot.JS_DEFAULT_CONSUMER_LIMITS);if(!u)throw new Error(`stream 'consumer_limits' requires server ${l}`)}function a(l,u){var f;if((((f=u==null?void 0:u.subject_transforms)==null?void 0:f.length)||0)>0){const{min:m,ok:d}=r.features.get(ot.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);if(!d)throw new Error(`${l} 'subject_transforms' requires server ${m}`)}}n.sources&&n.sources.forEach(l=>{a("stream sources",l)}),n.mirror&&a("stream mirror",n.mirror)}async add(n={}){var l;this.checkStreamConfigVersions(n),yn(n.name),n.mirror=cu(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(cu);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return yn(n),(await this._request(`${this.prefix}.STREAM.DELETE.${n}`)).success}async update(n,r={}){var f;if(typeof n=="object"){const m=n;n=m.name,r=m,console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m")}this.checkStreamConfigVersions(r),yn(n);const a=await this.info(n),l=Object.assign(a.config,r);l.mirror=cu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(cu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,l);return this._fixInfo(c),c}async info(n,r){yn(n);const a=`${this.prefix}.STREAM.INFO.${n}`;let u=await this._request(a,r),{total:c,limit:f}=u,m=u.state.subjects?Object.getOwnPropertyNames(u.state.subjects).length:1;if(c&&c>m){const d=[u],y=r||{};let g=0;for(;c>m;){g++,y.offset=f*g;const w=await this._request(a,y);c=w.total,d.push(w);const k=Object.getOwnPropertyNames(w.state.subjects).length;if(m+=k,k<f)break}let b={};for(let w=0;w<d.length;w++)u=d[w],u.state.subjects&&(b=Object.assign(b,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=b}return this._fixInfo(u),u}list(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>{const c=u;return c.streams.forEach(f=>{this._fixInfo(f)}),c.streams},l=`${this.prefix}.STREAM.LIST`;return new Sl(l,a,this,r)}_fixInfo(n){n.config.sealed=n.config.sealed||!1,n.config.deny_delete=n.config.deny_delete||!1,n.config.deny_purge=n.config.deny_purge||!1,n.config.allow_rollup_hdrs=n.config.allow_rollup_hdrs||!1}async purge(n,r){if(r){const{keep:l,seq:u}=r;if(typeof l=="number"&&typeof u=="number")throw new Error("can specify one of keep or seq")}return yn(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,a=!0){yn(n);const l={seq:r};return a||(l.no_erase=!0),(await this._request(`${this.prefix}.STREAM.MSG.DELETE.${n}`,l)).success}async getMessage(n,r){yn(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new wx(l)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var m;const u=a.streams.filter(d=>d.config.name.startsWith(In));u.forEach(d=>{this._fixInfo(d)});let c="";return u.length&&(c=((m=this.nc.info)==null?void 0:m.cluster)??""),u.map(d=>new vx(d,c))},r=`${this.prefix}.STREAM.LIST`;return new Sl(r,n,this)}listObjectStores(){const n=a=>{const u=a.streams.filter(f=>f.config.name.startsWith(zd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new od(f))},r=`${this.prefix}.STREAM.LIST`;return new Sl(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new Sl(l,a,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new $u(this,r))}}class Ak extends ql{constructor(n,r){super(n,r)}async getMessage(n,r){yn(n);let a=r;const{last_by_subj:l}=a;l&&(a=null);const u=a?this.jc.encode(a):Yn,c=this.opts.apiPrefix||"$JS.API",f=l?`${c}.DIRECT.GET.${n}.${l}`:`${c}.DIRECT.GET.${n}`,m=await this.nc.request(f,u,{timeout:this.timeout}),d=as(m);if(d)return Promise.reject(d);const y=new fd(m);return Promise.resolve(y)}async getBatch(n,r){yn(n);const l=`${this.opts.apiPrefix||"$JS.API"}.DIRECT.GET.${n}`;if(!Array.isArray(r.multi_last)||r.multi_last.length===0)return Promise.reject("multi_last is required");const u=JSON.stringify(r,(m,d)=>m==="up_to_time"&&d instanceof Date?d.toISOString():d),c=new sn,f=await this.nc.requestMany(l,u,{strategy:gr.SentinelMsg});return(async()=>{var g,b,w;let m=!1,d=!1,y;for await(const k of f){if(!m){m=!0;const R=((g=k.headers)==null?void 0:g.code)||0;if(R!==0&&R<200||R>299){y=(b=k.headers)==null?void 0:b.description.toLowerCase();break}if(((w=k.headers)==null?void 0:w.get("Nats-Num-Pending"))===""){d=!0;break}}if(k.data.length===0)break;c.push(new fd(k))}c.push(()=>{if(d)throw new Error("batch direct get not supported by the server");if(y)throw new Error(`bad request: ${y}`);c.stop()})})(),Promise.resolve(c)}}class fd{constructor(n){E(this,"data");E(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(ts.Subject)}get seq(){const n=this.header.last(ts.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(ts.TimeStamp)}get stream(){return this.header.last(ts.Stream)}json(n){return yr(n).decode(this.data)}string(){return Fn.decode(this.data)}}E(fd,"jc");class Tk extends ql{constructor(r,a){super(r,a);E(this,"streams");E(this,"consumers");E(this,"direct");this.streams=new Ld(r,a),this.consumers=new Tu(r,a),this.direct=new Ak(r,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new sn;return this.nc.subscribe("$JS.EVENT.ADVISORY.>",{callback:(a,l)=>{if(a)throw a;try{const u=this.parseJsResponse(l),c=u.type.split("."),f=c[c.length-1];r.push({kind:f,data:u})}catch(u){r.stop(u)}}}),r}}class wx{constructor(n){E(this,"_header");E(this,"smr");this.smr=n}get subject(){return this.smr.message.subject}get seq(){return this.smr.message.seq}get timestamp(){return this.smr.message.time}get time(){return new Date(Date.parse(this.timestamp))}get data(){return this.smr.message.data?this._parse(this.smr.message.data):Yn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=zi.decode(n)}else this._header=ti();return this._header}_parse(n){const r=atob(n),a=r.length,l=new Uint8Array(a);for(let u=0;u<a;u++)l[u]=r.charCodeAt(u);return l}json(n){return yr(n).decode(this.data)}string(){return Fn.decode(this.data)}}E(wx,"jc");class jk{constructor(n){E(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new $u(this.api,r))}}class Sh{constructor(n){E(this,"info");E(this,"hdrs");this.info=n}get name(){return this.info.name}get description(){return this.info.description??""}get headers(){return this.hdrs||(this.hdrs=zi.fromRecord(this.info.headers||{})),this.hdrs}get options(){return this.info.options}get bucket(){return this.info.bucket}get chunks(){return this.info.chunks}get deleted(){return this.info.deleted??!1}get digest(){return this.info.digest}get mtime(){return this.info.mtime}get nuid(){return this.info.nuid}get size(){return this.info.size}get revision(){return this.info.revision}get metadata(){return this.info.metadata||{}}isLink(){var n,r;return((n=this.info.options)==null?void 0:n.link)!==void 0&&((r=this.info.options)==null?void 0:r.link)!==null}}function N0(e){const n={name:e.name,description:e.description??"",options:e.options,metadata:e.metadata};if(e.headers){const r=e.headers;n.headers=r.toRecord()}return n}function Nk(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class Cl{constructor(n,r,a){E(this,"jsm");E(this,"js");E(this,"stream");E(this,"name");this.name=n,this.jsm=r,this.js=a}_checkNotEmpty(n){return!n||n.length===0?{name:n,error:new Error("name cannot be empty")}:{name:n}}async info(n){const r=await this.rawInfo(n);return r?new Sh(r):null}async list(){const n=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of r){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:r,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const l=this._metaSubject(r);try{const u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=yr().decode(u.data);return f.revision=u.seq,f}catch(u){return u.code==="404"?null:Promise.reject(u)}}async _si(n){try{return await this.jsm.streams.info(this.stream,n)}catch(r){return r.code==="404"?null:Promise.reject(r)}}async seal(){let n=await this._si();return n===null?Promise.reject(new Error("object store not found")):(n.config.sealed=!0,n=await this.jsm.streams.update(this.stream,n.config),Promise.resolve(new od(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new od(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,r,a){var le;const l=this.js.getOptions();a=a||{timeout:l.timeout},a.timeout=a.timeout||l.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:u,previousRevision:c}=a,f=this.js.nc.info,m=(f==null?void 0:f.max_payload)||1024;n=n||{},n.options=n.options||{};let d=((le=n.options)==null?void 0:le.max_chunk_size)||128*1024;d=d>m?m:d,n.options.max_chunk_size=d;const y=await this.info(n.name),{name:g,error:b}=this._checkNotEmpty(n.name);if(b)return Promise.reject(b);const w=Ui.next(),k=this._chunkSubject(w),R=this._metaSubject(g),U=Object.assign({bucket:this.name,nuid:w,size:0,chunks:0},N0(n)),T=Lt(),F=[],V=new hs;try{const L=r?r.getReader():null,D=x0.create();for(;;){const{done:J,value:B}=L?await L.read():{done:!0,value:void 0};if(J){if(V.size()>0){const Z=V.drain();D.update(Z),U.chunks++,U.size+=Z.length,F.push(this.js.publish(k,Z,{timeout:u}))}await Promise.all(F),F.length=0,U.mtime=new Date().toISOString();const q=ss.encode(D.digest());U.digest=`${T0}${q}`,U.deleted=!1;const A=ti();typeof c=="number"&&A.set(Er.ExpectedLastSubjectSequenceHdr,`${c}`),A.set(wn.RollupHdr,wn.RollupValueSubject);const K=await this.js.publish(R,yr().encode(U),{headers:A,timeout:u});if(U.revision=K.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}T.resolve(new Sh(U));break}if(B)for(V.fill(B);V.size()>d;){U.chunks++,U.size+=d;const q=V.drain(n.options.max_chunk_size);D.update(q),F.push(this.js.publish(k,q,{timeout:u}))}}}catch(L){await this.jsm.streams.purge(this.stream,{filter:k}),T.reject(L)}return T}putBlob(n,r,a){function l(u){return new ReadableStream({pull(c){c.enqueue(u),c.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(n,l(r),a)}put(n,r,a){var l;return(l=n==null?void 0:n.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,r,a)}async getBlob(n){async function r(u){const c=new hs,f=u.getReader();for(;;){const{done:m,value:d}=await f.read();if(m)return c.drain();d&&d.length&&c.fill(d)}}const a=await this.get(n);if(a===null)return Promise.resolve(null);const l=await Promise.all([a.error,r(a.data)]);return l[0]?Promise.reject(l[0]):Promise.resolve(l[1])}async get(n){const r=await this.rawInfo(n);if(r===null||r.deleted)return Promise.resolve(null);if(r.options&&r.options.link){const g=r.options.link.name||"";if(g==="")throw new Error("link is a bucket");return(r.options.link.bucket!==this.name?await Cl.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(T0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const a=rd(r.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Lt(),u={info:new Sh(r),error:l};if(r.size===0)return u.data=Nk(),l.resolve(null),Promise.resolve(u);let c;const f=Li();f.orderedConsumer();const m=x0.create(),d=`$O.${this.name}.C.${r.nuid}`,y=await this.js.subscribe(d,f);return(async()=>{for await(const g of y)g.data.length>0&&(m.update(g.data),c.enqueue(g.data)),g.info.pending===0&&(s2(a,m.digest())?c.close():c.error(new Error(`received a corrupt object, digests do not match received: ${r.digest} calculated ${a}`)),y.unsubscribe())})().then(()=>{l.resolve()}).catch(g=>{c.error(g),l.reject(g)}),u.data=new ReadableStream({start(g){c=g},cancel(){y.unsubscribe()}}),u}linkStore(n,r){if(!(r instanceof Cl))return Promise.reject("bucket required");const a=r,{name:l,error:u}=this._checkNotEmpty(n);if(u)return Promise.reject(u);const c={name:l,options:{link:{bucket:a.name}}};return this._put(c,null)}async link(n,r){const{name:a,error:l}=this._checkNotEmpty(n);if(l)return Promise.reject(l);if(r.deleted)return Promise.reject(new Error("src object is deleted"));if(r.isLink())return Promise.reject(new Error("src object is a link"));const u=await this.rawInfo(n);if(u!==null&&!u.deleted)return Promise.reject(new Error("an object already exists with that name"));const c={bucket:r.bucket,name:r.name},f={name:a,bucket:r.bucket,options:{link:c}};await this.js.publish(this._metaSubject(n),JSON.stringify(f));const m=await this.info(n);return Promise.resolve(m)}async delete(n){const r=await this.rawInfo(n);if(r===null)return Promise.resolve({purged:0,success:!1});r.deleted=!0,r.size=0,r.chunks=0,r.digest="";const a=yr(),l=ti();return l.set(wn.RollupHdr,wn.RollupValueSubject),await this.js.publish(this._metaSubject(r.name),a.encode(r),{headers:l}),this.jsm.streams.purge(this.stream,{filter:this._chunkSubject(r.nuid)})}async update(n,r={}){const a=await this.rawInfo(n);if(a===null)return Promise.reject(new Error("object not found"));if(a.deleted)return Promise.reject(new Error("cannot update meta for a deleted object"));r.name=r.name??a.name;const{name:l,error:u}=this._checkNotEmpty(r.name);if(u)return Promise.reject(u);if(n!==r.name){const m=await this.info(r.name);if(m&&!m.deleted)return Promise.reject(new Error("an object already exists with that name"))}r.name=l;const c=Object.assign({},a,N0(r)),f=await this.js.publish(this._metaSubject(c.name),JSON.stringify(c));return n!==r.name&&await this.jsm.streams.purge(this.stream,{filter:this._metaSubject(n)}),Promise.resolve(f)}async watch(n={}){n.includeHistory=n.includeHistory??!1,n.ignoreDeletes=n.ignoreDeletes??!1;let r=!1;const a=new sn,l=this._metaSubjectAll();try{await this.jsm.streams.getMessage(this.stream,{last_by_subj:l})}catch(m){m.code==="404"?(a.push(null),r=!0):a.stop(m)}const u=yr(),c=Li();c.orderedConsumer(),n.includeHistory?c.deliverLastPerSubject():(r=!0,c.deliverNew()),c.callback((m,d)=>{var y;if(m){a.stop(m);return}if(d!==null){const g=u.decode(d.data);g.deleted&&n.ignoreDeletes===!0||a.push(g),((y=d.info)==null?void 0:y.pending)===0&&!r&&(r=!0,a.push(null))}});const f=await this.js.subscribe(l,c);return a._data=f,a.iterClosed.then(()=>{f.unsubscribe()}),f.closed.then(()=>{a.stop()}).catch(m=>{a.stop(m)}),a}_chunkSubject(n){return`$O.${this.name}.C.${n}`}_metaSubject(n){return`$O.${this.name}.M.${ss.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=xk(this.name)}catch(l){return Promise.reject(l)}const r=(n==null?void 0:n.ttl)||0;delete n.ttl;const a=Object.assign({max_age:r},n);a.name=this.stream,a.num_replicas=n.replicas??1,a.allow_direct=!0,a.allow_rollup_hdrs=!0,a.discard=Ol.New,a.subjects=[`$O.${this.name}.C.>`,`$O.${this.name}.M.>`],n.placement&&(a.placement=n.placement),n.metadata&&(a.metadata=n.metadata),typeof n.compression=="boolean"&&(a.compression=n.compression?Bi.S2:Bi.None);try{await this.jsm.streams.info(a.name)}catch(l){l.message==="stream not found"&&await this.jsm.streams.add(a)}}static async create(n,r,a={}){const l=await n.jetstreamManager(),u=new Cl(r,l,n);return await u.init(a),Promise.resolve(u)}}class Ok{constructor(n){E(this,"js");this.js=n}kv(n,r={}){const a=this.js,{ok:l,min:u}=a.nc.features.get(ot.JS_KV);return l?r.bindOnly?Ml.bind(this.js,n,r):Ml.create(this.js,n,r):Promise.reject(new Error(`kv is only supported on servers ${u} or better`))}os(n,r={}){var c;if(typeof((c=crypto==null?void 0:crypto.subtle)==null?void 0:c.digest)!="function")return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));const a=this.js,{ok:l,min:u}=a.nc.features.get(ot.JS_OBJECTSTORE);return l?Cl.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Ud extends ql{constructor(r,a){super(r,a);E(this,"consumers");E(this,"streams");E(this,"consumerAPI");E(this,"streamAPI");this.consumerAPI=new Tu(r,a),this.streamAPI=new Ld(r,a),this.consumers=new cd(this.consumerAPI),this.streams=new jk(this.streamAPI)}jetstreamManager(r){r===void 0&&(r=this.opts.checkAPI);const a=Object.assign({},this.opts,{checkAPI:r});return this.nc.jetstreamManager(a)}get apiPrefix(){return this.prefix}get views(){return new Ok(this)}async publish(r,a=Yn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||ti();l&&(l.msgID&&u.set(Er.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(Er.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(Er.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(Er.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(Er.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=u);let{retries:m,retry_delay:d}=l;m=m||1,d=d||250;let y;for(let b=0;b<m;b++)try{y=await this.nc.request(r,a,f);break}catch(w){if(w.code==="503"&&b+1<m)await ys(d);else throw w}const g=this.parseJsResponse(y);if(g.stream==="")throw je.errorForCode(Se.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,a,l=0){yn(r),is(a);let u=this.timeout;l>u&&(u=l),l=l<0?0:zt(l);const c={batch:1,no_wait:l===0,expires:l},f=await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(c),{noMux:!0,timeout:u}),m=as(f);if(m)throw m;return Dl(f,this.timeout)}fetch(r,a,l={}){yn(r),is(a);let u=null;const c=(l.max_bytes??0)>0;let f=0;const m=c?l.max_bytes:0;let d=null;const y={};if(y.batch=l.batch||1,m){const F=this.nc.features.get(ot.JS_PULL_MAX_BYTES);if(!F.ok)throw new Error(`max_bytes is only supported on servers ${F.min} or better`);y.max_bytes=m}y.no_wait=l.no_wait||!1,y.no_wait&&y.expires&&(y.expires=0);const g=l.expires||0;if(g&&(y.expires=zt(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const b=l.idle_heartbeat||0;b&&(y.idle_heartbeat=zt(b),l.delay_heartbeat===!0&&(y.idle_heartbeat=zt(b*4)));const w=new sn,k=y.batch;let R=0;w.protocolFilterFn=(F,V=!1)=>ed(F.msg)?(d==null||d.work(),!1):!0,w.dispatchedFn=F=>{if(F){if(c&&(f+=F.data.length),R++,u&&F.info.pending===0)return;(w.getPending()===1&&F.info.pending===0||k===R||m>0&&f>=m)&&w.stop()}};const U=Wr(this.nc.options.inboxPrefix),T=this.nc.subscribe(U,{max:l.batch,callback:(F,V)=>{F===null&&(F=as(V)),F!==null?(u&&(u.cancel(),u=null),q_(F)?w.stop(_x(F)===null?void 0:F):w.stop(F)):(d==null||d.work(),w.received++,w.push(Dl(V,this.timeout)))}});return g&&(u=cs(g),u.catch(()=>{T.isClosed()||(T.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{b&&(d=new Dd(b,F=>(w.push(()=>{w.err=new je(`${ar.IdleHeartbeatMissed}: ${F}`,Se.JetStreamIdleHeartBeat)}),!0)))}catch{}await T.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),w.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(y),{reply:U}),w}async pullSubscribe(r,a=Li()){const l=await this._processOptions(r,a);if(l.ordered)throw new Error("pull subscribers cannot be be ordered");if(l.config.deliver_subject)throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set");const u=l.config.ack_policy;if(u===an.None||u===an.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new zk(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,a=Li()){const l=await this._processOptions(r,a);if(!l.isBind&&!l.config.deliver_subject)throw new Error("push consumer requires deliver_subject");const u=this._buildTypedSubscriptionOpts(l),c=new Sx(this,l.deliver,u);c.info=l;try{await this._maybeCreateConsumer(l)}catch(f){throw c.unsubscribe(),f}return c._maybeSetupHbMonitoring(),c}async _processOptions(r,a=Li()){const l=p0(a)?a.getOpts():a;if(l.isBind=p0(a)?a.isBind:!1,l.flow_control={heartbeat_count:0,fc_count:0,consumer_restarts:0},l.ordered){if(l.ordered_consumer_sequence={stream_seq:0,delivery_seq:0},l.config.ack_policy!==an.NotSet&&l.config.ack_policy!==an.None)throw new je("ordered consumer: ack_policy can only be set to 'none'",Se.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new je("ordered consumer: durable_name cannot be set",Se.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new je("ordered consumer: deliver_subject cannot be set",Se.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new je("ordered consumer: max_deliver cannot be set",Se.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new je("ordered consumer: deliver_group cannot be set",Se.ApiError);l.config.deliver_subject=Wr(this.nc.options.inboxPrefix),l.config.ack_policy=an.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||zt(5e3),l.config.ack_wait=zt(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===an.NotSet&&(l.config.ack_policy=an.All),l.api=this,l.config=l.config||{},l.stream=l.stream?l.stream:await this.findStream(r),l.attached=!1,l.config.durable_name)try{const u=await this.consumerAPI.info(l.stream,l.config.durable_name);if(u){if(u.config.filter_subject&&u.config.filter_subject!==r)throw new Error("subject does not match consumer");const c=l.config.deliver_group??"";if(c===""&&u.push_bound===!0)throw new Error("duplicate subscription");const f=u.config.deliver_group??"";if(c!==f)throw f===""?new Error("durable requires no queue group"):new Error(`durable requires queue group '${f}'`);l.last=u,l.config=u.config,l.attached=!0,l.config.durable_name||(l.name=u.name)}}catch(u){if(u.code!=="404")throw u}return!l.attached&&l.config.filter_subject===void 0&&l.config.filter_subjects===void 0&&(l.config.filter_subject=r),l.deliver=l.config.deliver_subject||Wr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const a={};return a.adapter=Lk(r.callbackFn===void 0,this.timeout),a.ingestionFilterFn=Ud.ingestionFn(r.ordered),a.protocolFilterFn=(l,u=!1)=>{const c=l;return Wh(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==an.None&&(a.dispatchedFn=Pk),r.callbackFn&&(a.callback=r.callbackFn),a.max=r.max||0,a.queue=r.queue,a}async _maybeCreateConsumer(r){if(r.attached)return;if(r.isBind)throw new Error(`unable to bind - durable consumer ${r.config.durable_name} doesn't exist in ${r.stream}`);r.config=Object.assign({deliver_policy:Yt.All,ack_policy:an.Explicit,ack_wait:zt(30*1e3),replay_policy:fs.Instant},r.config);const a=await this.consumerAPI.add(r.stream,r.config);if(Array.isArray(r.config.filter_subjects&&!Array.isArray(a.config.filter_subjects)))throw new Error("jetstream server doesn't support consumers with multiple filter subjects");r.name=a.name,r.config=a.config,r.last=a}static ingestionFn(r){return(a,l)=>{var m;const u=l;if(!a)return{ingest:!1,protocol:!1};const c=a;if(as(c.msg)||(m=u.monitor)==null||m.work(),ed(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Wh(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(a):!0,protocol:!1}}}}class Bd{constructor(n){E(this,"options");E(this,"protocol");E(this,"draining");E(this,"listeners");E(this,"_services");this.draining=!1,this.options=ek(n),this.listeners=[]}static connect(n={}){return new Promise((r,a)=>{const l=new Bd(n);Ou.connect(l.options,l).then(u=>{l.protocol=u,(async function(){for await(const c of u.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(u=>{a(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,r,a){if(this.isClosed())throw je.errorForCode(Se.ConnectionClosed);if(r&&this.isDraining()||a&&this.protocol.noMorePublishing)throw je.errorForCode(Se.ConnectionDraining);if(n=n||"",n.length===0)throw je.errorForCode(Se.BadSubject)}publish(n,r,a){this._check(n,!1,!0),this.protocol.publish(n,r,a)}publishMessage(n){return this.publish(n.subject,n.data,{reply:n.reply,headers:n.headers})}respondMessage(n){return n.reply?(this.publish(n.reply,n.data,{reply:n.reply,headers:n.headers}),!0):!1}subscribe(n,r={}){this._check(n,!0,!1);const a=new bx(this.protocol,n,r);return this.protocol.subscribe(a),a}_resub(n,r,a){this._check(r,!0,!1);const l=n;l.max=a,a&&(l.max=a+l.received),this.protocol.resub(l,r)}requestMany(n,r=Yn,a={maxWait:1e3,maxMessages:-1}){const l=!this.protocol.options.noAsyncTraces;try{this._check(n,!0,!0)}catch(m){return Promise.reject(m)}if(a.strategy=a.strategy||gr.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new je("timeout",Se.InvalidOption));const u=new sn;function c(m){u.push(()=>{u.stop(m)})}function f(m,d){m||d===null?c(m===null?void 0:m):u.push(d)}if(a.noMux){const m=l?new Error().stack:null;let d=typeof a.maxMessages=="number"&&a.maxMessages>0?a.maxMessages:-1;const y=this.subscribe(Wr(this.options.inboxPrefix),{callback:(k,R)=>{var U,T;if(((U=R==null?void 0:R.data)==null?void 0:U.length)===0&&((T=R==null?void 0:R.headers)==null?void 0:T.status)===Se.NoResponders&&(k=je.errorForCode(Se.NoResponders)),k){m&&(k.stack+=`
82
-
83
- ${m}`),g(k);return}f(null,R),a.strategy===gr.Count&&(d--,d===0&&g()),a.strategy===gr.JitterTimer&&(w(),b=setTimeout(()=>{g()},300)),a.strategy===gr.SentinelMsg&&R&&R.data.length===0&&g()}});y.requestSubject=n,y.closed.then(()=>{c()}).catch(k=>{u.stop(k)});const g=k=>{k&&u.push(()=>{throw k}),w(),y.drain().then(()=>{c()}).catch(R=>{c()})};u.iterClosed.then(()=>{w(),y==null||y.unsubscribe()}).catch(k=>{w(),y==null||y.unsubscribe()});try{this.publish(n,r,{reply:y.getSubject()})}catch(k){g(k)}let b=setTimeout(()=>{g()},a.maxWait);const w=()=>{b&&clearTimeout(b)}}else{const m=a;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new l2(this.protocol.muxSubscriptions,n,m);this.protocol.request(d);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${d.token}`,headers:a.headers})}catch(y){d.cancel(y)}}return Promise.resolve(u)}request(n,r,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(u){return Promise.reject(u)}const l=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new je("timeout",Se.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new je("reply can only be used with noMux",Se.InvalidOption));if(a.noMux){const u=a.reply?a.reply:Wr(this.options.inboxPrefix),c=Lt(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:a.timeout,callback:(d,y)=>{d?(f&&d.code!==Se.Timeout&&(d.stack+=`
84
-
85
- ${f.stack}`),m.unsubscribe(),c.reject(d)):(d=sx(y),d?(f&&(d.stack+=`
86
-
87
- ${f.stack}`),c.reject(d)):c.resolve(y))}});return m.requestSubject=n,this.protocol.publish(n,r,{reply:u,headers:a.headers}),c}else{const u=new ux(this.protocol.muxSubscriptions,n,a,l);this.protocol.request(u);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:a.headers})}catch(f){u.cancel(f)}const c=Promise.race([u.timer,u.deferred]);return c.catch(()=>{u.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(je.errorForCode(Se.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(je.errorForCode(Se.ConnectionClosed)):this.isDraining()?Promise.reject(je.errorForCode(Se.ConnectionDraining)):(this.draining=!0,this.protocol.drain())}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){const n=this.protocol.getServer();return n?n.listen:""}status(){const n=new sn;return n.iterClosed.then(()=>{const r=this.listeners.indexOf(n);this.listeners.splice(r,1)}),this.listeners.push(n),n}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request("$SYS.REQ.USER.INFO")).json((r,a)=>r==="time"?new Date(Date.parse(a)):a)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}async jetstreamManager(n={}){const r=new Tk(this,n);if(n.checkAPI!==!1)try{await r.getAccountInfo()}catch(a){const l=a;throw l.code===Se.NoResponders&&(l.code=Se.JetStreamNotEnabled),l}return r}jetstream(n={}){return new Ud(this,n)}getServerVersion(){const n=this.info;return n?ca(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw je.errorForCode(Se.Disconnect);const n=Date.now();return await this.flush(),Date.now()-n}get features(){return this.protocol.features}get services(){return this._services||(this._services=new Rk(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(je.errorForCode(Se.ConnectionClosed)):this.isDraining()?Promise.reject(je.errorForCode(Se.ConnectionDraining)):this.protocol.reconnect()}}class Rk{constructor(n){E(this,"nc");this.nc=n}add(n){try{return new Il(this.nc,n).start()}catch(r){return Promise.reject(r)}}client(n,r){return new fk(this.nc,n,r)}}class Mk{constructor(n,r,a){E(this,"bucket");E(this,"sm");E(this,"prefixLen");this.bucket=n,this.prefixLen=r,this.sm=a}get key(){return this.sm.subject.substring(this.prefixLen)}get value(){return this.sm.data}get delta(){return 0}get created(){return this.sm.time}get revision(){return this.sm.seq}get operation(){return this.sm.header.get(Ru)||"PUT"}get length(){const n=this.sm.header.get(wn.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Dk{constructor(n,r,a){E(this,"bucket");E(this,"key");E(this,"sm");this.bucket=n,this.key=r,this.sm=a}get value(){return this.sm.data}get created(){return new Date(Rd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Ru))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(wn.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class Sx extends f2{constructor(r,a,l){super(r.nc,a,l);E(this,"js");E(this,"monitor");this.js=r,this.monitor=null,this.sub.closed.then(()=>{this.monitor&&this.monitor.cancel()})}set info(r){this.sub.info=r}get info(){return this.sub.info}_resetOrderedConsumer(r){if(this.info===null||this.sub.isClosed())return;const a=Wr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const u=this.info;u.config.name=Ui.next(),u.ordered_consumer_sequence.delivery_seq=0,u.flow_control.heartbeat_count=0,u.flow_control.fc_count=0,u.flow_control.consumer_restarts++,u.deliver=a,u.config.deliver_subject=a,u.config.deliver_policy=Yt.StartSequence,u.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=u.config;const f=`${u.api.prefix}.CONSUMER.CREATE.${u.stream}`;this.js._request(f,c,{retries:-1}).then(m=>{const d=m,y=this.sub.info;y.last=d,this.info.config=d.config,this.info.name=d.name}).catch(m=>{const d=new je(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,Se.RequestError,m);this.sub.callback(d,{})})}_maybeSetupHbMonitoring(){var a,l;const r=((l=(a=this.info)==null?void 0:a.config)==null?void 0:l.idle_heartbeat)||0;r&&this._setupHbMonitoring(Rd(r))}_setupHbMonitoring(r,a=0){const l={cancelAfter:0,maxOut:2};a&&(l.cancelAfter=a);const u=this.sub,c=f=>{var y,g,b,w;const m=G_(409,`${ar.IdleHeartbeatMissed}: ${f}`,this.sub.subject);if(!((y=this.info)==null?void 0:y.ordered))this.sub.callback(null,m);else{if(!this.js.nc.protocol.connected)return!1;const k=((b=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:b.stream_seq)||0;return this._resetOrderedConsumer(k+1),(w=this.monitor)==null||w.restart(),!1}return!u.noIterator};this.monitor=new Dd(r,c,l)}_checkHbOrderConsumer(r){const a=r.headers.get(wn.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const l=parseInt(r.headers.get(wn.LastConsumerSeqHdr),10),u=this.info.ordered_consumer_sequence;return this.info.flow_control.heartbeat_count++,l!==u.delivery_seq&&this._resetOrderedConsumer(u.stream_seq+1),!1}_checkOrderedConsumer(r){const a=this.info.ordered_consumer_sequence,l=r.info.streamSequence,u=r.info.deliverySequence;return u!=a.delivery_seq+1?(this._resetOrderedConsumer(a.stream_seq+1),!1):(a.delivery_seq=u,a.stream_seq=l,!0)}async destroy(){this.isClosed()||await this.drain();const r=this.sub.info,a=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.DELETE.${r.stream}.${a}`;await r.api._request(l)}async consumerInfo(){const r=this.sub.info,a=r.config.durable_name||r.name,l=`${r.api.prefix}.CONSUMER.INFO.${r.stream}.${a}`,u=await r.api._request(l);return r.last=u,u}}class zk extends Sx{constructor(n,r,a){super(n,r,a)}pull(n={batch:1}){const{stream:r,config:a,name:l}=this.sub.info,u=a.durable_name??l,c={};if(c.batch=n.batch||1,c.no_wait=n.no_wait||!1,(n.max_bytes??0)>0){const d=this.js.nc.features.get(ot.JS_PULL_MAX_BYTES);if(!d.ok)throw new Error(`max_bytes is only supported on servers ${d.min} or better`);c.max_bytes=n.max_bytes}let f=0;n.expires&&n.expires>0&&(f=n.expires,c.expires=zt(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=zt(m)),m&&f===0)throw new Error("idle_heartbeat requires expires");if(m>f)throw new Error("expires must be greater than idle_heartbeat");if(this.info){this.monitor&&this.monitor.cancel(),f&&m&&(this.monitor?this.monitor._change(m,f):this._setupHbMonitoring(m,f));const d=this.info.api,y=`${d.prefix}.CONSUMER.MSG.NEXT.${r}.${u}`,g=this.sub.subject;d.nc.publish(y,d.jc.encode(c),{reply:g})}}}function Lk(e,n){return e?Bk(n):Uk(n)}function Uk(e){return(n,r)=>n?[n,null]:(n=as(r),n?[n,null]:[null,Dl(r,e)])}function Bk(e){return(n,r)=>{if(n)return[n,null];const a=as(r);return a!==null?[_x(a),null]:[null,Dl(r,e)]}}function _x(e){if(e!==null)switch(e.code){case Se.JetStream404NoMessages:case Se.JetStream408RequestTimeout:return null;case Se.JetStream409:return Y_(e)?e:null;default:return e}return null}function Pk(e){e&&e.ack()}function Hk(e){const n=e.split(".");if(n.length===9&&n.splice(2,0,"_",""),n.length<11||n[0]!=="$JS"||n[1]!=="ACK")throw new Error("not js message");const r={};return r.domain=n[2]==="_"?"":n[2],r.account_hash=n[3],r.stream=n[4],r.consumer=n[5],r.deliveryCount=parseInt(n[6],10),r.redeliveryCount=r.deliveryCount,r.redelivered=r.deliveryCount>1,r.streamSequence=parseInt(n[7],10),r.deliverySequence=parseInt(n[8],10),r.timestampNanos=parseInt(n[9],10),r.pending=parseInt(n[10],10),r}class qk{constructor(n,r){E(this,"msg");E(this,"di");E(this,"didAck");E(this,"timeout");this.msg=n,this.didAck=!1,this.timeout=r}get subject(){return this.msg.subject}get sid(){return this.msg.sid}get data(){return this.msg.data}get headers(){return this.msg.headers}get info(){return this.di||(this.di=Hk(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===ml[0]&&n[1]===ml[1]&&n[2]===ml[2]&&n[3]===ml[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const r=Lt();if(this.didAck)r.resolve(!1);else if(this.didAck=!0,this.msg.reply){const u=this.msg.publisher,c=!((a=u.options)!=null&&a.noAsyncTraces),f=new ux(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,j0,{reply:`${u.muxSubscriptions.baseInbox}${f.token}`})}catch(m){f.cancel(m)}try{await Promise.race([f.timer,f.deferred]),r.resolve(!0)}catch(m){f.cancel(m),r.reject(m)}}else r.resolve(!1);return r}ack(){this.doAck(j0)}nak(n){let r=wk;n&&(r=Cu().encode(`-NAK ${JSON.stringify({delay:zt(n)})}`)),this.doAck(r)}working(){this.doAck(ml)}next(n,r={batch:1}){const a={};a.batch=r.batch||1,a.no_wait=r.no_wait||!1,r.expires&&r.expires>0&&(a.expires=zt(r.expires));const l=yr().encode(a),u=hs.concat(Sk,kk,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=_k;(n==null?void 0:n.length)>0&&(r=Cu().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const Ik="1.30.3",Fk="nats.ws";class $k{constructor(){E(this,"version");E(this,"lang");E(this,"closeError");E(this,"connected");E(this,"done");E(this,"socket");E(this,"options");E(this,"socketClosed");E(this,"encrypted");E(this,"peeked");E(this,"yields");E(this,"signal");E(this,"closedNotification");this.version=Ik,this.lang=Fk,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Lt(),this.closedNotification=Lt()}async connect(n,r){const a=Lt();if(r.tls)return a.reject(new je("tls",Se.InvalidOption)),a;this.options=r;const l=n.src;if(r.wsFactory){const{socket:u,encrypted:c}=await r.wsFactory(n.src,r);this.socket=u,this.encrypted=c}else this.encrypted=l.indexOf("wss://")===0,this.socket=new WebSocket(l);return this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{this.isDiscarded()},this.socket.onmessage=u=>{if(this.isDiscarded())return;if(this.yields.push(new Uint8Array(u.data)),this.peeked){this.signal.resolve();return}const c=hs.concat(...this.yields),f=y2(c);if(f!==""){const m=rk.exec(f);if(!m){r.debug&&console.error("!!!",lu(c)),a.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);tk(d,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(d){a.reject(d);return}}},this.socket.onclose=u=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(u.wasClean||(c=new Error(u.reason)),this._closed(c))},this.socket.onerror=u=>{if(this.isDiscarded())return;const c=u,f=new je(c.message,Se.Unknown,new Error(c.error));a.reject(f)},a}disconnect(){this._closed(void 0,!0)}async _closed(n,r=!0){if(!this.isDiscarded()&&this.connected&&!this.done){if(this.closeError=n,!n)for(;!this.socketClosed&&this.socket.bufferedAmount>0;)await ys(100);this.done=!0;try{this.socket.close(n?1002:1e3,n?n.message:void 0)}catch{}r&&this.closedNotification.resolve(n)}}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.isDiscarded())return;this.yields.length===0&&await this.signal;const n=this.yields;this.yields=[];for(let r=0;r<n.length;r++)this.options.debug&&console.info(`> ${lu(n[r])}`),yield n[r];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=Lt())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${lu(n)}`);return}catch(r){this.options.debug&&console.error(`!!! ${lu(n)}: ${r}`)}}close(n){return this._closed(n,!1)}closed(){return this.closedNotification}isDiscarded(){return this.done?(this.discard(),!0):!1}discard(){var n;this.done=!0;try{(n=this.socket)==null||n.close()}catch{}}}function Gk(e,n){/^(.*:\/\/)(.*)/.test(e)||(typeof n=="boolean"?e=`${n===!0?"https":"http"}://${e}`:e=`https://${e}`);let a=new URL(e);const l=a.protocol.toLowerCase();l==="ws:"&&(n=!1),l==="wss:"&&(n=!0),l!=="https:"&&l!=="http"&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${e}`));let u,c;const f=a.hostname,m=a.pathname,d=a.search||"";switch(l){case"http:":case"ws:":case"nats:":c=a.port||"80",u="ws:";break;case"https:":case"wss:":case"tls:":c=a.port||"443",u="wss:";break;default:c=a.port||n===!0?"443":"80",u=n===!0?"wss:":"ws:";break}return`${u}//${f}:${c}${m}${d}`}function kx(e={}){return h2({defaultPort:443,urlParseFn:Gk,factory:()=>new $k}),Bd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var ds;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(ds||(ds={}));class _h extends Error{constructor(n,r,a){super(n),this.message=n,this.code=r,this.data=a}}const Yk=e=>{var n,r;return e!=null&&e.androidBridge?"android":!((r=(n=e==null?void 0:e.webkit)===null||n===void 0?void 0:n.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},Vk=e=>{const n=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},a=r.Plugins=r.Plugins||{},l=()=>n!==null?n.name:Yk(e),u=()=>l()!=="web",c=g=>{const b=d.get(g);return!!(b!=null&&b.platforms.has(l())||f(g))},f=g=>{var b;return(b=r.PluginHeaders)===null||b===void 0?void 0:b.find(w=>w.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,b={})=>{const w=d.get(g);if(w)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),w.proxy;const k=l(),R=f(g);let U;const T=async()=>(!U&&k in b?U=typeof b[k]=="function"?U=await b[k]():U=b[k]:n!==null&&!U&&"web"in b&&(U=typeof b.web=="function"?U=await b.web():U=b.web),U),F=(B,q)=>{var A,K;if(R){const Z=R==null?void 0:R.methods.find(ue=>q===ue.name);if(Z)return Z.rtype==="promise"?ue=>r.nativePromise(g,q.toString(),ue):(ue,he)=>r.nativeCallback(g,q.toString(),ue,he);if(B)return(A=B[q])===null||A===void 0?void 0:A.bind(B)}else{if(B)return(K=B[q])===null||K===void 0?void 0:K.bind(B);throw new _h(`"${g}" plugin is not implemented on ${k}`,ds.Unimplemented)}},V=B=>{let q;const A=(...K)=>{const Z=T().then(ue=>{const he=F(ue,B);if(he){const I=he(...K);return q=I==null?void 0:I.remove,I}else throw new _h(`"${g}.${B}()" is not implemented on ${k}`,ds.Unimplemented)});return B==="addListener"&&(Z.remove=async()=>q()),Z};return A.toString=()=>`${B.toString()}() { [capacitor code] }`,Object.defineProperty(A,"name",{value:B,writable:!1,configurable:!1}),A},le=V("addListener"),L=V("removeListener"),D=(B,q)=>{const A=le({eventName:B},q),K=async()=>{const ue=await A;L({eventName:B,callbackId:ue},q)},Z=new Promise(ue=>A.then(()=>ue({remove:K})));return Z.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await K()},Z},J=new Proxy({},{get(B,q){switch(q){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return R?D:le;case"removeListener":return L;default:return V(q)}}});return a[g]=J,d.set(g,{name:g,proxy:J,platforms:new Set([...Object.keys(b),...R?[k]:[]])}),J};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=m,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=_h,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},Jk=e=>e.Capacitor=Vk(e),Nn=Jk(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),or=Nn.registerPlugin;class Pd{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(n,r){let a=!1;this.listeners[n]||(this.listeners[n]=[],a=!0),this.listeners[n].push(r);const u=this.windowListeners[n];u&&!u.registered&&this.addWindowListener(u),a&&this.sendRetainedArgumentsForEvent(n);const c=async()=>this.removeListener(n,r);return Promise.resolve({remove:c})}async removeAllListeners(){this.listeners={};for(const n in this.windowListeners)this.removeWindowListener(this.windowListeners[n]);this.windowListeners={}}notifyListeners(n,r,a){const l=this.listeners[n];if(!l){if(a){let u=this.retainedEventArguments[n];u||(u=[]),u.push(r),this.retainedEventArguments[n]=u}return}l.forEach(u=>u(r))}hasListeners(n){var r;return!!(!((r=this.listeners[n])===null||r===void 0)&&r.length)}registerWindowListener(n,r){this.windowListeners[r]={registered:!1,windowEventName:n,pluginEventName:r,handler:a=>{this.notifyListeners(r,a)}}}unimplemented(n="not implemented"){return new Nn.Exception(n,ds.Unimplemented)}unavailable(n="not available"){return new Nn.Exception(n,ds.Unavailable)}async removeListener(n,r){const a=this.listeners[n];if(!a)return;const l=a.indexOf(r);this.listeners[n].splice(l,1),this.listeners[n].length||this.removeWindowListener(this.windowListeners[n])}addWindowListener(n){window.addEventListener(n.windowEventName,n.handler),n.registered=!0}removeWindowListener(n){n&&(window.removeEventListener(n.windowEventName,n.handler),n.registered=!1)}sendRetainedArgumentsForEvent(n){const r=this.retainedEventArguments[n];r&&(delete this.retainedEventArguments[n],r.forEach(a=>{this.notifyListeners(n,a)}))}}const O0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),R0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class Xk extends Pd{async getCookies(){const n=document.cookie,r={};return n.split(";").forEach(a=>{if(a.length<=0)return;let[l,u]=a.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");l=R0(l).trim(),u=R0(u).trim(),r[l]=u}),r}async setCookie(n){try{const r=O0(n.key),a=O0(n.value),l=n.expires?`; expires=${n.expires.replace("expires=","")}`:"",u=(n.path||"/").replace("path=",""),c=n.url!=null&&n.url.length>0?`domain=${n.url}`:"";document.cookie=`${r}=${a||""}${l}; path=${u}; ${c};`}catch(r){return Promise.reject(r)}}async deleteCookie(n){try{document.cookie=`${n.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const n=document.cookie.split(";")||[];for(const r of n)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(n){return Promise.reject(n)}}async clearAllCookies(){try{await this.clearCookies()}catch(n){return Promise.reject(n)}}}or("CapacitorCookies",{web:()=>new Xk});const Kk=async e=>new Promise((n,r)=>{const a=new FileReader;a.onload=()=>{const l=a.result;n(l.indexOf(",")>=0?l.split(",")[1]:l)},a.onerror=l=>r(l),a.readAsDataURL(e)}),Qk=(e={})=>{const n=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[n[c]],l),{})},Zk=(e,n=!0)=>e?Object.entries(e).reduce((a,l)=>{const[u,c]=l;let f,m;return Array.isArray(c)?(m="",c.forEach(d=>{f=n?encodeURIComponent(d):d,m+=`${u}=${f}&`}),m.slice(0,-1)):(f=n?encodeURIComponent(c):c,m=`${u}=${f}`),`${a}&${m}`},"").substr(1):null,Wk=(e,n={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},n),l=Qk(e.headers)["content-type"]||"";if(typeof e.data=="string")r.body=e.data;else if(l.includes("application/x-www-form-urlencoded")){const u=new URLSearchParams;for(const[c,f]of Object.entries(e.data||{}))u.set(c,f);r.body=u.toString()}else if(l.includes("multipart/form-data")||e.data instanceof FormData){const u=new FormData;if(e.data instanceof FormData)e.data.forEach((f,m)=>{u.append(m,f)});else for(const f of Object.keys(e.data))u.append(f,e.data[f]);r.body=u;const c=new Headers(r.headers);c.delete("content-type"),r.headers=c}else(l.includes("application/json")||typeof e.data=="object")&&(r.body=JSON.stringify(e.data));return r};class eE extends Pd{async request(n){const r=Wk(n,n.webFetchExtra),a=Zk(n.params,n.shouldEncodeUrlParams),l=a?`${n.url}?${a}`:n.url,u=await fetch(l,r),c=u.headers.get("content-type")||"";let{responseType:f="text"}=u.ok?n:{};c.includes("application/json")&&(f="json");let m,d;switch(f){case"arraybuffer":case"blob":d=await u.blob(),m=await Kk(d);break;case"json":m=await u.json();break;case"document":case"text":default:m=await u.text()}const y={};return u.headers.forEach((g,b)=>{y[b]=g}),{data:m,headers:y,status:u.status,url:u.url}}async get(n){return this.request(Object.assign(Object.assign({},n),{method:"GET"}))}async post(n){return this.request(Object.assign(Object.assign({},n),{method:"POST"}))}async put(n){return this.request(Object.assign(Object.assign({},n),{method:"PUT"}))}async patch(n){return this.request(Object.assign(Object.assign({},n),{method:"PATCH"}))}async delete(n){return this.request(Object.assign(Object.assign({},n),{method:"DELETE"}))}}or("CapacitorHttp",{web:()=>new eE});var M0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(M0||(M0={}));var D0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(D0||(D0={}));class tE extends Pd{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}or("SystemBars",{web:()=>new tE});const Hd=Nn.isNativePlatform()?"https://app.palmier.me":"";async function Ex(e,n,r,a){const l=`${Hd}${n}`;console.log(`[API] ${e} ${l}`);const c=await fetch(l,{method:e,headers:{"Content-Type":"application/json"},body:r!=null?JSON.stringify(r):void 0});if(!c.ok){const f=await c.text();let m;try{const d=JSON.parse(f);m=d.error??d.message??f}catch{m=f}throw console.error(`[API] ${e} ${n} failed:`,c.status,m),new Error(m||`Request failed with status ${c.status}`)}return console.log(`[API] ${e} ${n} ->`,c.status),c.json()}function nE(e,n,r){return Ex("POST",e,n)}function rE(e,n){return Ex("GET",e,void 0)}const Cx=z.createContext({connected:!1,mode:"disconnected",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),iE=2e3,kh=6e3;function aE({children:e}){const{getActiveHost:n}=Hl(),r=n(),[a,l]=z.useState(null),[u,c]=z.useState(!1),f=z.useRef(null),[m,d]=z.useState(!1),[y,g]=z.useState(!1),b=z.useRef(Cu()),w=z.useRef(new Set),k=z.useRef(0),R=r!=null&&!!r.directUrl,U=r?R?m?"direct":"disconnected":u?"nats":"disconnected":"disconnected",T=U!=="disconnected";z.useEffect(()=>{g(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),z.useEffect(()=>{if(R){f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1));return}if(!r)return;let le=!1;async function L(){try{const D=await fetch(`${Hd}/api/nats-credentials/${r.hostId}`);if(!D.ok){console.error("[NATS] Failed to fetch credentials");return}const J=await D.json();if(!J.natsWsUrl){console.warn("[NATS] No WebSocket URL configured");return}if(le)return;console.log("[NATS] Connecting to",J.natsWsUrl);const B=await kx({servers:J.natsWsUrl,authenticator:px(J.natsJwt,new TextEncoder().encode(J.natsNkeySeed))});if(le){B.close().catch(()=>{});return}console.log("[NATS] Connected"),f.current=B,l(B),c(!0),B.closed().then(()=>{console.log("[NATS] Connection closed"),le||(l(null),c(!1),f.current=null)})}catch(D){console.error("[NATS] Connection failed:",D),le||c(!1)}}return L(),()=>{le=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[R,r]),z.useEffect(()=>{if(!r||!R){d(!1);return}const le=new AbortController;async function L(){var q;const J=new AbortController,B=setTimeout(()=>J.abort(),iE);le.signal.addEventListener("abort",()=>J.abort());try{const A=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:J.signal});return clearTimeout(B),A.ok?((q=A.body)==null?void 0:q.getReader())??null:null}catch{return clearTimeout(B),null}}async function D(J){d(!0),console.log("[HOST] SSE connected to",r.directUrl),k.current=Date.now();function B(){setTimeout(()=>{le.signal.aborted||Date.now()-k.current<kh||(console.log("[HOST] Heartbeat timeout — no data for",kh/1e3,"s"),le.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},kh)}B();const q=new TextDecoder;let A="";try{for(;;){const{done:K,value:Z}=await J.read();if(K)break;A+=q.decode(Z,{stream:!0}),k.current=Date.now(),B();const ue=A.split(`
88
- `);A=ue.pop()??"";for(const he of ue)if(he.startsWith("data: ")){const I=he.slice(6);try{const Y=JSON.parse(I);if(Y.task_id&&Y.event_type){const ae=`host-event.${r.hostId}.${Y.task_id}`;for(const ce of w.current)ce({subject:ae,data:b.current.encode(I)})}}catch{}}}}catch{}}return(async()=>{const J=await L();J&&await D(J)})(),()=>{le.abort(),d(!1)}},[r,R]);const F=z.useCallback(async(le,L,D)=>{if(!r)throw new Error("No active host");function J(ue){ue&&typeof ue=="object"&&ue.error==="Unauthorized"&&g(!0)}if(R){console.log(`[HOST/HTTP] → ${le}`,L??"");const ue=await fetch(`${r.directUrl}/rpc/${le}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.clientToken}`},body:L!=null?JSON.stringify(L):void 0,signal:D!=null&&D.timeout?AbortSignal.timeout(D.timeout):void 0});if(ue.status===401)throw g(!0),new Error("Unauthorized");const he=await ue.json();return J(he),console.log(`[HOST/HTTP] ← ${le}`,he),he}if(!f.current)throw new Error("Not connected");const B=`host.${r.hostId}.rpc.${le}`,q={...L??{},clientToken:r.clientToken},A=b.current.encode(JSON.stringify(q));console.log(`[HOST/NATS] → ${le}`,L??"");const K=await f.current.request(B,A,{timeout:(D==null?void 0:D.timeout)??1e4}),Z=JSON.parse(b.current.decode(K.data));return J(Z),console.log(`[HOST/NATS] ← ${le}`,Z),Z},[r,R]),V=z.useCallback((le,L)=>{if(R)return w.current.add(L),()=>{w.current.delete(L)};if(f.current){const D=f.current.subscribe(`host-event.${le}.>`);let J=!1;return(async()=>{try{for await(const B of D){if(J)break;L({subject:B.subject,data:B.data})}}catch{}})(),()=>{J=!0,D.unsubscribe()}}return()=>{}},[r,R]);return v.jsx(Cx.Provider,{value:{connected:T,mode:U,nc:a,request:F,subscribeEvents:V,activeHost:r,unauthorized:y},children:e})}function Gu(){return z.useContext(Cx)}function Mu(e){const n=new Date(e),r=new Date,a=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===r.toDateString()?a:`${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})} ${a}`}const Ax={};function sE(e){for(const n of e)Ax[n.key]=n.label}function hd(e){return Ax[e]??e}const lE=()=>window.matchMedia("(max-width: 600px)").matches;function oE({task:e,lastEvent:n,onEdit:r,onDelete:a,onViewRun:l}){const{request:u}=Gu(),[c,f]=z.useState(!1),[m,d]=z.useState(!1),[y,g]=z.useState(!1),b=z.useRef(null),w=(n==null?void 0:n.running_state)==="started",k=!e.triggers_enabled||e.triggers.length===0?"var(--color-text-secondary)":w?"var(--color-success)":(n==null?void 0:n.running_state)==="failed"?"var(--color-error)":"var(--color-success)";z.useEffect(()=>{if(!m)return;function A(K){b.current&&!b.current.contains(K.target)&&d(!1)}return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[m]);function R(){lE()?g(!0):d(A=>!A)}function U(){d(!1),g(!1)}async function T(){if(U(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(A){console.error("Abort failed:",A)}finally{f(!1)}}}async function F(){U();try{const A=await u("task.run",{id:e.id});l(e.id,A.run_id)}catch(A){console.error("Run failed:",A)}}async function V(){if(U(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),a(e.id)}catch(A){console.error("Delete failed:",A)}}const le={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function L(A){if(A.length===0)return"";if(A.length===1)return J(A[0]);const K=A.map(D);if(new Set(K.map(ue=>ue.kind)).size===1){const ue=K[0].kind;if(ue==="hourly")return"Every hour";const he=K.map(I=>I.detail);return`${ue.charAt(0).toUpperCase()+ue.slice(1)}: ${he.join(", ")}`}return A.map(J).join(", ")}function D(A){if(A.type==="once"){const Ae=new Date(A.value);return{kind:"once",detail:isNaN(Ae.getTime())?A.value:`${Ae.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${Ae.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const K=A.value.split(" ");if(K.length!==5)return{kind:"unknown",detail:A.value};const[Z,ue,he,,I]=K,Y=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ue==="*")return{kind:"hourly",detail:""};const ae=new Date;ae.setHours(Number(ue),Number(Z),0,0);const ce=ae.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return I!=="*"?{kind:"weekly",detail:`${Y[Number(I)]??I} at ${ce}`}:he!=="*"?{kind:"monthly",detail:`day ${he} at ${ce}`}:{kind:"daily",detail:ce}}function J(A){const K=D(A);return K.kind==="hourly"?"Every hour":K.kind==="once"?`Once on ${K.detail}`:`${K.kind.charAt(0).toUpperCase()+K.kind.slice(1)}: ${K.detail}`}const B=L(e.triggers),q=v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:()=>{U(),r(e)},children:[v.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),v.jsxs("button",{onClick:()=>{U(),l(e.id)},children:[v.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),w?v.jsxs("button",{className:"menu-item-danger",onClick:T,disabled:c,children:[v.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:F,children:[v.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),v.jsxs("button",{className:"menu-item-danger",onClick:V,children:[v.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"task-card",onClick:()=>w?l(e.id,"latest"):l(e.id),children:[v.jsxs("div",{className:"task-card-header",children:[v.jsxs("div",{className:"task-card-title-row",children:[w?v.jsx("span",{className:"status-spinner",children:v.jsx("span",{})}):v.jsx("span",{className:"status-dot",style:{backgroundColor:k}}),v.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),v.jsx("div",{className:"task-card-actions",onClick:A=>A.stopPropagation(),children:v.jsxs("div",{className:"task-card-menu",ref:b,children:[v.jsx("button",{className:"task-card-menu-btn",onClick:R,"aria-label":"Task actions",children:"⋮"}),m&&v.jsx("div",{className:"task-card-menu-dropdown",children:q})]})})]}),v.jsxs("div",{className:"task-card-meta",children:[e.agent&&v.jsx("span",{className:"task-card-agent",children:hd(e.agent)}),n&&le[n.running_state]&&v.jsxs("span",{className:"task-card-last-event",children:[le[n.running_state]," ",Mu(n.time_stamp)]}),e.triggers.length>0&&v.jsx("span",{className:"task-card-triggers",children:e.triggers_enabled?B:"Triggers disabled"})]})]}),y&&Su.createPortal(v.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:v.jsxs("div",{className:"bottom-sheet",onClick:A=>A.stopPropagation(),children:[v.jsx("div",{className:"bottom-sheet-handle"}),v.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),v.jsx("div",{className:"bottom-sheet-actions",children:q})]})}),document.body)]})}function uE({permissions:e}){return v.jsxs("div",{className:"plan-dialog",children:[v.jsx("h2",{children:"Granted Permissions"}),v.jsx("div",{className:"plan-dialog-scroll",children:e&&e.length>0?v.jsx("div",{className:"permissions-section",children:v.jsx("ul",{className:"permissions-list",children:e.map((n,r)=>v.jsxs("li",{className:"permission-item",children:[v.jsx("span",{className:"permission-tool",children:n.name}),v.jsx("span",{className:"permission-desc",children:n.description})]},r))})}):v.jsx("p",{className:"plan-empty",children:"No permissions have been granted for this task."})}),v.jsx("div",{className:"plan-dialog-actions",children:v.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const Wa=[];function cE(){const e=Wa.pop();e&&(e.pushed.current=!1,e.close())}let z0=!1;function fE(){z0||(z0=!0,window.addEventListener("popstate",cE))}function hE(e,n){const r=z.useRef(!1),a=z.useRef(n);a.current=n;const l=z.useCallback(()=>a.current(),[]),u=z.useRef({close:l,pushed:r});u.current.close=l,z.useEffect(()=>{if(e&&!r.current)fE(),history.pushState({modal:!0},""),Wa.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=Wa.indexOf(u.current);c!==-1&&Wa.splice(c,1),history.back()}},[e,l]),z.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=Wa.indexOf(c);f!==-1&&Wa.splice(f,1),history.back()}}},[])}const dE=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Mi(e="daily"){return{schedule:e,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function mE(e){const n=e.split(" ");if(n.length!==5)return Mi();const[r,a,l,,u]=n;if(a==="*")return Mi("hourly");const c=`${a.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...Mi("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...Mi("monthly"),time:c,dayOfMonth:l}:{...Mi("daily"),time:c}}function L0(e){if(e.type==="once"){const[n,r]=e.value.split("T");return{...Mi("once"),onceDate:n??"",onceTime:(r??"09:00").slice(0,5)}}return mE(e.value)}function pE(e){const[n,r]=e.time.split(":").map(Number);switch(e.schedule){case"hourly":return"0 * * * *";case"daily":return`${r} ${n} * * *`;case"weekly":return`${r} ${n} * * ${e.dayOfWeek}`;case"monthly":return`${r} ${n} ${e.dayOfMonth} * *`;default:return"0 * * * *"}}function gE(e){return e.schedule==="once"?e.onceDate?{type:"once",value:`${e.onceDate}T${e.onceTime}`}:null:{type:"cron",value:pE(e)}}function yE({initial:e,agents:n,hostPlatform:r,onSaved:a,onCancel:l}){var It;const{request:u}=Gu(),c=()=>{var ge;const _e=localStorage.getItem("palmier:lastAgent"),qe=n.map(Le=>Le.key);return _e&&qe.includes(_e)?_e:((ge=n[0])==null?void 0:ge.key)??""},[f,m]=z.useState((e==null?void 0:e.user_prompt)??""),[d,y]=z.useState((e==null?void 0:e.agent)??c()),g=!!((It=e==null?void 0:e.permissions)!=null&&It.length),[b,w]=z.useState(!1),k=z.useCallback(()=>w(!1),[]);hE(b,k);const[R,U]=z.useState(null),[T,F]=z.useState(()=>((e==null?void 0:e.triggers)??[]).map(L0)),[V,le]=z.useState(()=>{var _e;return((_e=((e==null?void 0:e.triggers)??[]).map(L0)[0])==null?void 0:_e.schedule)??"daily"}),[L,D]=z.useState((e==null?void 0:e.triggers_enabled)??!1),[J,B]=z.useState((e==null?void 0:e.requires_confirmation)??!1),[q,A]=z.useState((e==null?void 0:e.yolo_mode)??!1),[K,Z]=z.useState((e==null?void 0:e.foreground_mode)??!1),[ue,he]=z.useState(!1),[I,Y]=z.useState(!!(e!=null&&e.command)),[ae,ce]=z.useState((e==null?void 0:e.command)??""),Ae=z.useRef(null),O=!!e,P=!O||f!==((e==null?void 0:e.user_prompt)??"")||d!==((e==null?void 0:e.agent)??"")||L!==((e==null?void 0:e.triggers_enabled)??!0)||J!==((e==null?void 0:e.requires_confirmation)??!1)||q!==((e==null?void 0:e.yolo_mode)??!1)||K!==((e==null?void 0:e.foreground_mode)??!1)||I!==!!(e!=null&&e.command)||I&&ae!==((e==null?void 0:e.command)??"")||JSON.stringify(Fe())!==JSON.stringify((e==null?void 0:e.triggers)??[]),re=L&&T.some(_e=>_e.schedule==="once"&&(!_e.onceDate||new Date(`${_e.onceDate}T${_e.onceTime}`)<=new Date)),j=P&&!!f.trim()&&!re&&(!I||!!ae.trim());function be(_e,qe){F(ge=>ge.map((Le,Ke)=>Ke===_e?{...Le,...qe}:Le))}function Re(_e){F(qe=>{const ge=qe.filter((Le,Ke)=>Ke!==_e);return ge.length===0&&(D(!1),B(!1)),ge})}function Te(){F(_e=>[..._e,Mi(V)])}function De(_e){le(_e),F([Mi(_e)])}function Fe(){return T.flatMap(_e=>{const qe=gE(_e);return qe?[qe]:[]})}function Ce(){return q?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 tt(){he(!0),U(null);try{const _e=O?"task.update":"task.create",qe={user_prompt:f,agent:d,triggers:Fe(),triggers_enabled:L,requires_confirmation:J,yolo_mode:q,foreground_mode:K,command:I?ae:""};O&&(qe.id=e.id);const ge=await u(_e,qe,{timeout:45e3});return ge.error?(U(ge.error),null):(O||localStorage.setItem("palmier:lastAgent",d),a(ge),ge)}catch(_e){return U(_e instanceof Error?_e.message:String(_e)),null}finally{he(!1)}}return v.jsx("div",{className:"task-form-overlay",children:v.jsx("div",{className:"task-form",children:b?v.jsx(uE,{permissions:e==null?void 0:e.permissions}):v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"task-form-header",children:v.jsx("h2",{children:e?"Edit Task":"New Task"})}),R&&v.jsx("div",{className:"form-error",children:R}),v.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:f,onChange:_e=>m(_e.target.value),placeholder:I?"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:ue}),v.jsxs("div",{className:"plan-actions",children:[g&&v.jsx("button",{className:"btn btn-link",onClick:()=>w(!0),children:"Granted Permissions"}),v.jsxs("div",{className:"agent-picker-section-inline",style:{marginLeft:"auto"},children:[v.jsx("span",{className:"agent-picker-label",children:"Run with"}),v.jsx("select",{className:"form-select form-select-sm",value:d,onChange:_e=>y(_e.target.value),children:n.map(_e=>v.jsx("option",{value:_e.key,children:_e.label},_e.key))})]})]}),v.jsxs("div",{className:"toggles-group",children:[v.jsxs("div",{className:`command-section${I?" command-section-active":""}`,children:[v.jsxs("label",{className:"toggle-label",children:[v.jsx("input",{type:"checkbox",checked:I,onChange:_e=>{Y(_e.target.checked),_e.target.checked?setTimeout(()=>{var qe;return(qe=Ae.current)==null?void 0:qe.focus()},0):ce("")},disabled:ue}),"Reactive"]}),I&&v.jsxs(v.Fragment,{children:[v.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."}),v.jsx("input",{ref:Ae,className:"form-input form-input-mono",type:"text",value:ae,onChange:_e=>ce(_e.target.value),placeholder:"gws gmail +watch --project my-project",disabled:ue})]})]}),r==="win32"&&v.jsxs("label",{className:"toggle-label",children:[v.jsx("input",{type:"checkbox",checked:K,onChange:_e=>Z(_e.target.checked),disabled:ue}),"Run in the foreground (host must login to Windows)"]}),v.jsxs("label",{className:"toggle-label",children:[v.jsx("input",{type:"checkbox",checked:q,onChange:_e=>A(_e.target.checked),disabled:ue}),"Yolo mode"]}),q&&v.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."}),v.jsxs("div",{className:"triggers-section",children:[v.jsxs("label",{className:"toggle-label",children:[v.jsx("input",{type:"checkbox",checked:L,onChange:_e=>{_e.target.checked?(D(!0),T.length===0&&Te()):(D(!1),B(!1),F(qe=>{const ge=qe.filter(Le=>Le.schedule==="once"?Le.onceDate&&new Date(`${Le.onceDate}T${Le.onceTime}`)>new Date:!0);return ge.length===1&&ge[0].schedule==="daily"&&ge[0].time==="00:00"?[]:ge}))},disabled:ue}),"Enable schedule"]}),v.jsxs("div",{className:`triggers-section-body${L?"":" disabled"}`,children:[T.length>0&&v.jsxs("select",{className:"form-select",value:V,disabled:!L,onChange:_e=>De(_e.target.value),children:[v.jsx("option",{value:"once",children:"Specific Time"}),v.jsx("option",{value:"hourly",children:"Hourly"}),v.jsx("option",{value:"daily",children:"Daily"}),v.jsx("option",{value:"weekly",children:"Weekly"}),v.jsx("option",{value:"monthly",children:"Monthly"})]}),V!=="hourly"&&T.map((_e,qe)=>v.jsxs("div",{className:"trigger-row-card",children:[v.jsxs("div",{className:"trigger-row-content",children:[V==="daily"&&v.jsx("input",{className:"form-input",type:"time",value:_e.time,disabled:!L,onChange:ge=>be(qe,{time:ge.target.value})}),V==="weekly"&&v.jsxs("div",{className:"trigger-row-top",children:[v.jsx("select",{className:"form-select",value:_e.dayOfWeek,disabled:!L,onChange:ge=>be(qe,{dayOfWeek:ge.target.value}),children:dE.map((ge,Le)=>v.jsx("option",{value:String(Le),children:ge},Le))}),v.jsx("input",{className:"form-input",type:"time",value:_e.time,disabled:!L,onChange:ge=>be(qe,{time:ge.target.value})})]}),V==="monthly"&&v.jsxs("div",{className:"trigger-row-top",children:[v.jsx("select",{className:"form-select",value:_e.dayOfMonth,disabled:!L,onChange:ge=>be(qe,{dayOfMonth:ge.target.value}),children:Array.from({length:28},(ge,Le)=>Le+1).map(ge=>v.jsxs("option",{value:String(ge),children:["Day ",ge]},ge))}),v.jsx("input",{className:"form-input",type:"time",value:_e.time,disabled:!L,onChange:ge=>be(qe,{time:ge.target.value})})]}),V==="once"&&v.jsxs("div",{className:"trigger-row-top",children:[v.jsx("input",{className:"form-input",type:"date",value:_e.onceDate,min:new Date().toISOString().split("T")[0],disabled:!L,onChange:ge=>be(qe,{onceDate:ge.target.value})}),v.jsx("input",{className:"form-input",type:"time",value:_e.onceTime,min:_e.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,disabled:!L,onChange:ge=>be(qe,{onceTime:ge.target.value})})]})]}),T.length>1&&v.jsx("button",{className:"trigger-remove-btn",onClick:()=>Re(qe),disabled:!L,title:"Remove trigger",children:"×"})]},qe)),T.length>0&&V!=="hourly"&&v.jsx("button",{className:"trigger-add-btn",onClick:Te,disabled:!L,children:"+ Add"})]})]}),L&&T.length>0&&v.jsxs("label",{className:"toggle-label",children:[v.jsx("input",{type:"checkbox",checked:J,onChange:_e=>B(_e.target.checked),disabled:ue}),"Confirm before each run"]})]}),!q&&(()=>{const _e=n.find(qe=>qe.key===d);return(_e==null?void 0:_e.supportsPermissions)===!1&&v.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",_e.label,". The task may fail if required permissions are not pre-configured."]})})(),v.jsxs("div",{className:"form-actions",children:[(()=>{const qe=T.length>0?"Schedule":"Save";return O?P?v.jsxs("button",{className:"btn btn-primary",onClick:()=>Ce()&&tt(),disabled:!j||ue,children:[ue&&v.jsx("span",{className:"btn-spinner"}),"Save"]}):v.jsx("button",{className:"btn btn-primary",disabled:!0,children:"Save"}):v.jsxs("button",{className:"btn btn-primary",onClick:()=>Ce()&&tt(),disabled:!j||ue,children:[ue&&v.jsx("span",{className:"btn-spinner"}),qe]})})(),v.jsx("button",{className:"btn btn-secondary",onClick:()=>{P&&f.trim()&&!confirm("You have unsaved changes. Discard?")||l()},style:{marginLeft:"auto"},children:"Cancel"})]})]})})})}function bE({connected:e,hostId:n,request:r,subscribeEvents:a,agents:l,hostPlatform:u,onViewRun:c}){const[f,m]=z.useState([]),[d,y]=z.useState(!1),[g,b]=z.useState(null),[w,k]=z.useState(new Map),[R,U]=z.useState(!1),[T,F]=z.useState(void 0),V=z.useCallback(()=>{U(!1),F(void 0)},[]),le=z.useCallback(async()=>{if(e){y(!0),b(null);try{const B=(await r("task.list")).tasks??[],q=new Map;for(const A of B)A.status&&q.set(A.id,A.status);k(q),m(B)}catch(J){const B=J instanceof Error?J.message:String(J);B==="Not connected"||B.includes("503")||B.toLowerCase().includes("no responders")?b(null):b(B),m([])}finally{y(!1)}}},[e,n,r]);z.useEffect(()=>{e?le():(m([]),y(!1))},[e,n,le]),z.useEffect(()=>!e||!n?void 0:a(n,async B=>{const q=B.subject.split(".");if(q.length<3)return;const A=q.slice(2).join(".");let K={};try{K=JSON.parse(new TextDecoder().decode(B.data))}catch{return}const Z=K.event_type;if(!(Z!=="running-state"&&Z!=="permission-resolved"))try{const ue=await r("task.status",{id:A},{timeout:5e3});if(ue.error)return;k(he=>{const I=new Map(he);return I.set(A,ue),I})}catch{}}),[e,n,a,r]);function L(J){m(B=>{const q=B.findIndex(A=>A.id===J.id);if(q>=0){const A=[...B];return A[q]=J,A}return[J,...B]}),U(!1),F(void 0)}function D(J){m(B=>B.filter(q=>q.id!==J)),k(B=>{const q=new Map(B);return q.delete(J),q})}return v.jsxs(v.Fragment,{children:[g&&v.jsxs("div",{className:"form-error",children:[g,g.toLowerCase().includes("failed to fetch")&&v.jsxs(v.Fragment,{children:[" ",v.jsx("a",{href:"#",onClick:J=>{J.preventDefault(),window.location.reload()},children:"Reload"})]})]}),v.jsx("div",{className:"new-task-input-card",onClick:()=>{F(void 0),U(!0)},role:"button",tabIndex:0,onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&(F(void 0),U(!0))},children:v.jsx("span",{className:"new-task-placeholder",children:"Describe your new task..."})}),d&&!f.length?v.jsx("div",{className:"task-list",children:[0,1,2].map(J=>v.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[v.jsx("div",{className:"task-card-header",children:v.jsxs("div",{className:"task-card-title-row",children:[v.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),v.jsx("div",{className:"skeleton-line",style:{width:`${60+J*12}%`}})]})}),v.jsxs("div",{className:"task-card-meta",children:[v.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),v.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},J))}):v.jsx("div",{className:"task-list",children:f.map(J=>v.jsx(oE,{task:J,lastEvent:w.get(J.id),onEdit:async B=>{try{const q=await r("task.get",{id:B.id});F(q.error?B:q)}catch{F(B)}U(!0)},onDelete:D,onViewRun:c},J.id))}),R&&v.jsx(yE,{initial:T,agents:l,hostPlatform:u,onSaved:L,onCancel:V})]})}let os=null;function U0(e){os&&(e.preventDefault(),e.returnValue="")}function Eh(e){const n=!!os;os=e;const r=!!os;r&&!n?window.addEventListener("beforeunload",U0):!r&&n&&window.removeEventListener("beforeunload",U0)}function fa(){return os?window.confirm(os):!0}function xE(){const e=da(),r=Nr().pathname.startsWith("/tasks"),a=!r;function l(u){fa()&&e(u)}return v.jsxs(v.Fragment,{children:[v.jsxs("button",{className:`tab-btn ${a?"tab-btn-active":""}`,onClick:()=>l("/"),children:[v.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:v.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Sessions"]}),v.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>l("/tasks"),children:[v.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:[v.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),v.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]})]})}const vE="modulepreload",wE=function(e){return"/"+e},B0={},Tx=function(n,r,a){let l=Promise.resolve();if(r&&r.length>0){let c=function(d){return Promise.all(d.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=c(r.map(d=>{if(d=wE(d),d in B0)return;B0[d]=!0;const y=d.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":vE,y||(b.as="script"),b.crossOrigin="",b.href=d,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((w,k)=>{b.addEventListener("load",w),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${d}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return l.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return n().catch(u)})},SE=or("App",{web:()=>Tx(()=>import("./web-BNr628AV.js"),[]).then(e=>new e.AppWeb)}),rn=or("Preferences",{web:()=>Tx(()=>import("./web-DyQPewAi.js"),[]).then(e=>new e.PreferencesWeb)});function jx(e){const[n,r]=z.useState(()=>window.matchMedia(e).matches);return z.useEffect(()=>{const a=window.matchMedia(e),l=u=>r(u.matches);return a.addEventListener("change",l),r(a.matches),()=>a.removeEventListener("change",l)},[e]),n}const fu=Nn.isNativePlatform()?or("LocationPermission"):null,Ch=Nn.isNativePlatform()?or("NotificationListener"):null,Ah=Nn.isNativePlatform()?or("SmsPermission"):null,Th=Nn.isNativePlatform()?or("ContactsPermission"):null,jh=Nn.isNativePlatform()?or("CalendarPermission"):null,Nh=Nn.isNativePlatform()?or("DndAccess"):null,Oh=Nn.isNativePlatform()?or("FullScreenIntent"):null,P0=!!window.__PALMIER_SERVE__,H0=Nn.isNativePlatform();function q0({daemonVersion:e,capabilityTokens:n,activeClientToken:r,request:a,onCapabilityTokensChange:l}){var Bt;const{pairedHosts:u,activeHostId:c,setActiveHostId:f,removePairedHost:m,renamePairedHost:d}=Hl(),y=da(),g=jx("(min-width: 768px)"),[b,w]=z.useState(!1),[k,R]=z.useState(!1),[U,T]=z.useState(null),[F,V]=z.useState(""),[le,L]=z.useState(null),[D,J]=z.useState(!1),[B,q]=z.useState(!1),[A,K]=z.useState(!1),[Z,ue]=z.useState(!1),[he,I]=z.useState(!1),[Y,ae]=z.useState(!1),[ce,Ae]=z.useState(!1),[O,P]=z.useState(!1),[re,j]=z.useState(!1);function be(xe){return!!(r&&(n==null?void 0:n[xe])===r)}const Re=be("location"),Te=be("notifications"),De=be("sms"),Fe=be("contacts"),Ce=be("calendar"),tt=be("dnd"),It=be("alert"),_e=be("battery"),qe=be("email");function ge(xe,Ge){const ut={};for(const[Vn,Ft]of Object.entries(n??{}))ut[Vn]=Ft??null;ut[xe]=Ge?r??null:null,l==null||l(ut)}z.useEffect(()=>{if(!H0||!fu||!a)return;function xe(){Re&&fu.check().then(({fine:ut})=>{ut||a("device.location.disable").then(()=>{ge("location",!1)}).catch(()=>{})})}xe();const Ge=SE.addListener("resume",()=>{xe()});return()=>{Ge.then(ut=>ut.remove())}},[Re,r]);async function Le(){if(!(!Ch||!a)){q(!0);try{if(Te)await rn.set({key:"notificationListenerEnabled",value:"false"}),await a("device.capability.disable",{capability:"notifications"}),ge("notifications",!1);else{const{enabled:xe}=await Ch.check();if(!xe&&!(await Ch.request()).enabled)return;const{value:Ge}=await rn.get({key:"fcmToken"});if(!Ge){console.warn("No FCM token available");return}await rn.set({key:"notificationListenerEnabled",value:"true"}),await a("device.capability.enable",{capability:"notifications",fcmToken:Ge}),ge("notifications",!0)}}catch(xe){console.error("Failed to toggle notification listener:",xe)}finally{q(!1)}}}async function Ke(){if(!(!Ah||!a)){K(!0);try{if(De)await rn.set({key:"smsListenerEnabled",value:"false"}),await a("device.capability.disable",{capability:"sms"}),ge("sms",!1);else{const{granted:xe}=await Ah.check();if(!xe&&!(await Ah.request()).granted)return;const{value:Ge}=await rn.get({key:"fcmToken"});if(!Ge){console.warn("No FCM token available");return}await rn.set({key:"smsListenerEnabled",value:"true"}),await a("device.capability.enable",{capability:"sms",fcmToken:Ge}),ge("sms",!0)}}catch(xe){console.error("Failed to toggle SMS access:",xe)}finally{K(!1)}}}async function kt(){if(!(!Th||!a)){ue(!0);try{if(Fe)await rn.set({key:"contactsAccessEnabled",value:"false"}),await a("device.capability.disable",{capability:"contacts"}),ge("contacts",!1);else{const{granted:xe}=await Th.check();if(!xe&&!(await Th.request()).granted)return;const{value:Ge}=await rn.get({key:"fcmToken"});if(!Ge){console.warn("No FCM token available");return}await rn.set({key:"contactsAccessEnabled",value:"true"}),await a("device.capability.enable",{capability:"contacts",fcmToken:Ge}),ge("contacts",!0)}}catch(xe){console.error("Failed to toggle contacts access:",xe)}finally{ue(!1)}}}async function bt(){if(!(!jh||!a)){I(!0);try{if(Ce)await rn.set({key:"calendarAccessEnabled",value:"false"}),await a("device.capability.disable",{capability:"calendar"}),ge("calendar",!1);else{const{granted:xe}=await jh.check();if(!xe&&!(await jh.request()).granted)return;const{value:Ge}=await rn.get({key:"fcmToken"});if(!Ge){console.warn("No FCM token available");return}await rn.set({key:"calendarAccessEnabled",value:"true"}),await a("device.capability.enable",{capability:"calendar",fcmToken:Ge}),ge("calendar",!0)}}catch(xe){console.error("Failed to toggle calendar access:",xe)}finally{I(!1)}}}async function Mt(){if(!(!Nh||!a)){ae(!0);try{if(tt)await a("device.capability.disable",{capability:"dnd"}),ge("dnd",!1);else{const{enabled:xe}=await Nh.check();if(!xe&&!(await Nh.request()).enabled)return;const{value:Ge}=await rn.get({key:"fcmToken"});if(!Ge){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"dnd",fcmToken:Ge}),ge("dnd",!0)}}catch(xe){console.error("Failed to toggle DND access:",xe)}finally{ae(!1)}}}async function it(){if(!Oh)return!0;const{granted:xe}=await Oh.check();return xe?!0:(await Oh.request()).granted}async function Ie(){if(a){Ae(!0);try{if(It)await a("device.capability.disable",{capability:"alert"}),ge("alert",!1);else{if(!await it())return;const{value:xe}=await rn.get({key:"fcmToken"});if(!xe){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"alert",fcmToken:xe}),ge("alert",!0)}}catch(xe){console.error("Failed to toggle alert access:",xe)}finally{Ae(!1)}}}async function ht(){if(a){j(!0);try{if(qe)await a("device.capability.disable",{capability:"email"}),ge("email",!1);else{if(!await it())return;const{value:xe}=await rn.get({key:"fcmToken"});if(!xe){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"email",fcmToken:xe}),ge("email",!0)}}catch(xe){console.error("Failed to toggle email access:",xe)}finally{j(!1)}}}async function Et(){if(a){P(!0);try{if(_e)await a("device.capability.disable",{capability:"battery"}),ge("battery",!1);else{const{value:xe}=await rn.get({key:"fcmToken"});if(!xe){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"battery",fcmToken:xe}),ge("battery",!0)}}catch(xe){console.error("Failed to toggle battery access:",xe)}finally{P(!1)}}}async function He(){if(a){J(!0);try{if(Re)await a("device.location.disable"),ge("location",!1);else{if(fu&&!(await fu.request()).fine)return;const{value:xe}=await rn.get({key:"fcmToken"});if(!xe){console.warn("No FCM token available");return}await a("device.location.enable",{fcmToken:xe}),ge("location",!0)}}catch(xe){console.error("Failed to toggle location:",xe)}finally{J(!1)}}}const ln=z.useRef(null),ie=z.useRef(null),ve=z.useCallback(()=>{R(!0)},[]);function Ue(){k&&(w(!1),R(!1))}function Ve(){R(!1),w(!0)}function st(xe,Ge){T(xe),V(Ge)}function tn(){U&&F.trim()&&d(U,F.trim()),T(null),V("")}function Sn(){T(null),V("")}z.useEffect(()=>{U&&ie.current&&(ie.current.focus(),ie.current.select())},[U]),z.useEffect(()=>{if(!b||k)return;function xe(Ge){Ge.key==="Escape"&&ve()}return document.addEventListener("keydown",xe),()=>{document.removeEventListener("keydown",xe)}},[b,k,ve]);const Vt=v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"drawer-header",children:[v.jsx("span",{className:"drawer-title",children:"Palmier"}),!g&&v.jsx("button",{className:"drawer-close-btn",onClick:ve,"aria-label":"Close menu",children:v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:v.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),!P0&&u.length>0&&v.jsxs("div",{className:"drawer-section",children:[v.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),v.jsx("div",{className:"host-picker-inline",children:v.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(xe=>{const Ge=xe.hostId===c,ut=U===xe.hostId,Vn=xe.name||xe.hostId.slice(0,8);return v.jsx("div",{className:"host-picker-item-wrapper",children:v.jsxs("div",{className:`host-picker-item ${Ge?"host-picker-item-active":""}`,onClick:()=>{if(!ut&&!Ge){if(!fa())return;f(xe.hostId),g||ve()}},role:"option","aria-selected":Ge,children:[ut?v.jsx("input",{ref:ie,className:"form-input host-picker-rename-input",type:"text",value:F,onChange:Ft=>V(Ft.target.value),onKeyDown:Ft=>{Ft.key==="Enter"&&tn(),Ft.key==="Escape"&&Sn()},onBlur:tn,onClick:Ft=>Ft.stopPropagation()}):v.jsx("span",{className:"host-picker-item-name",children:Vn}),v.jsxs("div",{className:"host-picker-item-actions",children:[Ge&&!ut&&v.jsx("button",{className:"host-picker-edit-btn",onClick:Ft=>{Ft.stopPropagation(),st(xe.hostId,Vn)},"aria-label":"Rename host",children:v.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:v.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"})})}),!Ge&&v.jsx("button",{className:"host-picker-delete-btn",onClick:Ft=>{Ft.stopPropagation(),L(xe.hostId)},"aria-label":`Unpair ${Vn}`,children:v.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:v.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"})})})]})]})},xe.hostId)})})})]}),!P0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"drawer-divider"}),v.jsx("div",{className:"drawer-section",children:v.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{fa()&&(y("/pair"),g||ve())},children:"Pair New Host"})})]}),H0&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"drawer-divider"}),v.jsxs("div",{className:"drawer-section",children:[v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Location Access"}),v.jsx("button",{className:`toggle-switch ${Re?"toggle-switch-on":""}`,onClick:He,disabled:D,role:"switch","aria-checked":Re,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Notification Access"}),v.jsx("button",{className:`toggle-switch ${Te?"toggle-switch-on":""}`,onClick:Le,disabled:B,role:"switch","aria-checked":Te,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"SMS Access"}),v.jsx("button",{className:`toggle-switch ${De?"toggle-switch-on":""}`,onClick:Ke,disabled:A,role:"switch","aria-checked":De,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Contacts Access"}),v.jsx("button",{className:`toggle-switch ${Fe?"toggle-switch-on":""}`,onClick:kt,disabled:Z,role:"switch","aria-checked":Fe,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Calendar Access"}),v.jsx("button",{className:`toggle-switch ${Ce?"toggle-switch-on":""}`,onClick:bt,disabled:he,role:"switch","aria-checked":Ce,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Do Not Disturb Control"}),v.jsx("button",{className:`toggle-switch ${tt?"toggle-switch-on":""}`,onClick:Mt,disabled:Y,role:"switch","aria-checked":tt,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Alert Access"}),v.jsx("button",{className:`toggle-switch ${It?"toggle-switch-on":""}`,onClick:Ie,disabled:ce,role:"switch","aria-checked":It,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Battery Access"}),v.jsx("button",{className:`toggle-switch ${_e?"toggle-switch-on":""}`,onClick:Et,disabled:O,role:"switch","aria-checked":_e,children:v.jsx("span",{className:"toggle-switch-thumb"})})]}),v.jsxs("label",{className:"drawer-toggle",children:[v.jsx("span",{className:"drawer-toggle-label",children:"Email Access"}),v.jsx("button",{className:`toggle-switch ${qe?"toggle-switch-on":""}`,onClick:ht,disabled:re,role:"switch","aria-checked":qe,children:v.jsx("span",{className:"toggle-switch-thumb"})})]})]})]}),v.jsxs("div",{className:"drawer-footer",children:[e&&v.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),v.jsxs("div",{className:"drawer-legal",children:[v.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),v.jsx("span",{className:"drawer-legal-sep",children:"·"}),v.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),mt=le&&Su.createPortal(v.jsx("div",{className:"confirm-modal-overlay",onClick:()=>L(null),children:v.jsxs("div",{className:"confirm-modal",onClick:xe=>xe.stopPropagation(),children:[v.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),v.jsxs("p",{className:"confirm-modal-message",children:['"',((Bt=u.find(xe=>xe.hostId===le))==null?void 0:Bt.name)||le.slice(0,8),'" will be unpaired from this device.']}),v.jsxs("div",{className:"confirm-modal-actions",children:[v.jsx("button",{className:"btn btn-secondary",onClick:()=>L(null),children:"Cancel"}),v.jsx("button",{className:"btn btn-danger",onClick:()=>{m(le),L(null)},children:"Delete"})]})]})}),document.body);return g?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:ln,children:Vt}),mt]}):v.jsxs(v.Fragment,{children:[v.jsx("button",{className:"hamburger-btn",onClick:Ve,"aria-label":"Open menu",children:v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:v.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),b&&Su.createPortal(v.jsx("div",{className:`drawer-overlay ${k?"drawer-overlay-closing":""}`,onClick:ve,onAnimationEnd:Ue,children:v.jsx("div",{className:`drawer-panel ${k?"drawer-panel-closing":""}`,ref:ln,onClick:xe=>xe.stopPropagation(),children:Vt})}),document.body),mt]})}function I0(e){var a;const n=localStorage.getItem("palmier:lastAgent"),r=e.map(l=>l.key);return n&&r.includes(n)?n:((a=e[0])==null?void 0:a.key)??""}function _E({agents:e,onStarted:n}){const{request:r}=Gu(),[a,l]=z.useState(""),[u,c]=z.useState(()=>I0(e)),[f,m]=z.useState(!1),[d,y]=z.useState(!1),[g,b]=z.useState(null);z.useEffect(()=>{e.length&&(e.find(T=>T.key===u)||c(I0(e)))},[e,u]),z.useEffect(()=>{const T=a.trim().length>0;return Eh(T?"Your session draft will be lost. Continue?":null),()=>Eh(null)},[a]);const w=!!a.trim()&&!!u&&!d;function k(){return f?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
91
-
92
- Are you sure you want to continue?`):!0}async function R(){if(!(!w||!k())){y(!0),b(null);try{const T=await r("task.run_oneoff",{user_prompt:a,agent:u,yolo_mode:f});if(T.error){b(T.error);return}localStorage.setItem("palmier:lastAgent",u),l(""),Eh(null),T.task_id&&n(T.task_id,T.run_id)}catch(T){b(T instanceof Error?T.message:String(T))}finally{y(!1)}}}function U(T){T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),R())}return v.jsxs("div",{className:"session-composer",children:[g&&v.jsx("div",{className:"form-error",children:g}),v.jsx("textarea",{className:"session-composer-textarea",value:a,onChange:T=>l(T.target.value),onKeyDown:U,placeholder:"What can I do for you?",rows:3,disabled:d}),v.jsxs("div",{className:"session-composer-controls",children:[v.jsxs("div",{className:"agent-picker-section-inline",children:[v.jsx("span",{className:"agent-picker-label",children:"Run with"}),v.jsx("select",{className:"form-select form-select-sm",value:u,onChange:T=>c(T.target.value),disabled:d||!e.length,children:e.map(T=>v.jsx("option",{value:T.key,children:T.label},T.key))})]}),v.jsxs("label",{className:"session-composer-yolo",children:[v.jsx("input",{type:"checkbox",checked:f,onChange:T=>m(T.target.checked),disabled:d}),"Yolo"]}),v.jsx("button",{className:"btn btn-primary chat-send-btn",onClick:R,disabled:!w,"aria-label":"Run session",title:"Run session",children:d?v.jsx("span",{className:"btn-spinner"}):v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),v.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),f&&v.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."})]})}const kE=10;function EE({connected:e,hostId:n,request:r,subscribeEvents:a,agents:l,filterTaskId:u,onClearFilter:c}){const[f,m]=z.useState([]),[d,y]=z.useState(0),[g,b]=z.useState(!1),[w,k]=z.useState(!1),R=da(),U=z.useRef(null),T=z.useCallback(B=>{const q={offset:B,limit:kE};return u&&(q.task_id=u),q},[u]),F=z.useCallback(async(B,q)=>{if(e){q?k(!0):b(!0);try{const A=await r("taskrun.list",T(B)),K=A.entries??[];y(A.total??0),m(q?Z=>{const ue=new Set(Z.map(I=>`${I.task_id}:${I.run_id}`)),he=K.filter(I=>!ue.has(`${I.task_id}:${I.run_id}`));return[...Z,...he]}:K)}catch(A){A instanceof Error&&A.message==="Not connected"||console.error("Failed to load runs:",A)}finally{b(!1),k(!1)}}},[e,r,T]);z.useEffect(()=>{e?(m([]),y(0),F(0,!1)):(m([]),y(0))},[e,n,F,u]),z.useEffect(()=>!e||!n?void 0:a(n,async q=>{try{const A=JSON.parse(new TextDecoder().decode(q.data));if(A.event_type==="running-state"&&A.running_state&&["monitoring","started","finished","failed","aborted"].includes(A.running_state)){const K=await r("taskrun.list",T(0)),Z=K.entries??[];y(K.total??0),m(ue=>{const he=new Map(Z.map(ce=>[`${ce.task_id}:${ce.run_id}`,ce])),I=ue.map(ce=>{const Ae=`${ce.task_id}:${ce.run_id}`;return he.get(Ae)??ce}),Y=new Set(I.map(ce=>`${ce.task_id}:${ce.run_id}`));return[...Z.filter(ce=>!Y.has(`${ce.task_id}:${ce.run_id}`)),...I]})}}catch{}}),[e,n,a,r]),z.useEffect(()=>{const B=U.current;if(!B)return;const q=new IntersectionObserver(A=>{A[0].isIntersecting&&!w&&f.length<d&&F(f.length,!0)},{threshold:.1});return q.observe(B),()=>q.disconnect()},[f.length,d,w,F]);function V(B,q){if(!B||!q)return"";const A=Math.round((q-B)/1e3);if(A<60)return`${A}s`;const K=Math.floor(A/60),Z=A%60;return`${K}m ${Z}s`}const le={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function L(B,q){fa()&&R(`/runs/${B}/${encodeURIComponent(q)}`)}const D=!u&&v.jsx(_E,{agents:l,onStarted:(B,q)=>{R(q?`/runs/${encodeURIComponent(B)}/${encodeURIComponent(q)}`:`/runs/${encodeURIComponent(B)}`)}});function J(B){if(B==="failed")return"var(--color-error)";if(B==="aborted")return"var(--color-warning, #d97706)"}return g&&f.length===0&&e?v.jsxs(v.Fragment,{children:[D,v.jsx("div",{className:"task-list",children:[0,1,2].map(B=>v.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[v.jsx("div",{className:"task-card-header",children:v.jsx("div",{className:"task-card-title-row",children:v.jsx("div",{className:"skeleton-line",style:{width:`${70+B*10}%`}})})}),v.jsx("div",{className:"task-card-meta",children:v.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},B))})]}):!e||g&&f.length===0?v.jsxs(v.Fragment,{children:[D,v.jsx("div",{className:"runs-view",children:v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{className:"empty-state-text",children:"Sessions"}),v.jsx("p",{className:"empty-state-hint",children:"Your sessions will appear here"})]})})]}):f.length===0?v.jsxs(v.Fragment,{children:[D,u&&c&&v.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:v.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",v.jsx("button",{onClick:c,"aria-label":"Clear filter",children:"×"})]})}),v.jsx("div",{className:"runs-view",children:v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{className:"empty-state-text",children:"No sessions yet"}),v.jsx("p",{className:"empty-state-hint",children:u?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Your sessions will appear here."})]})})]}):v.jsxs(v.Fragment,{children:[D,u&&c&&v.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:v.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",v.jsx("button",{onClick:c,"aria-label":"Clear filter",children:"×"})]})}),v.jsxs("div",{className:"task-list",children:[f.map((B,q)=>v.jsxs("div",{className:"runs-card",onClick:()=>!B.error&&L(B.task_id,B.run_id),children:[v.jsxs("div",{className:"runs-card-body",children:[v.jsx("h3",{className:"runs-card-name",children:B.task_name||B.task_id}),v.jsxs("div",{className:"runs-card-meta",children:[v.jsx("span",{style:{color:J(B.running_state)},children:le[B.running_state??""]??B.running_state}),B.end_time&&v.jsx("span",{children:Mu(B.end_time)}),B.start_time&&B.end_time&&v.jsx("span",{style:{color:"var(--color-muted)"},children:V(B.start_time,B.end_time)}),B.error&&v.jsx("span",{style:{color:"var(--color-muted)"},children:B.error})]})]}),v.jsx("span",{className:"runs-card-chevron",children:"›"})]},`${B.task_id}-${B.run_id}-${q}`)),v.jsx("div",{ref:U,style:{height:1}}),w&&v.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:v.jsx("div",{className:"spinner"})})]})]})}function CE(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const AE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jE={};function F0(e,n){return(jE.jsx?TE:AE).test(e)}const NE=/[ \t\n\f\r]/g;function OE(e){return typeof e=="object"?e.type==="text"?$0(e.value):!1:$0(e)}function $0(e){return e.replace(NE,"")===""}class Fl{constructor(n,r,a){this.normal=r,this.property=n,a&&(this.space=a)}}Fl.prototype.normal={};Fl.prototype.property={};Fl.prototype.space=void 0;function Nx(e,n){const r={},a={};for(const l of e)Object.assign(r,l.property),Object.assign(a,l.normal);return new Fl(r,a,n)}function dd(e){return e.toLowerCase()}class On{constructor(n,r){this.attribute=r,this.property=n}}On.prototype.attribute="";On.prototype.booleanish=!1;On.prototype.boolean=!1;On.prototype.commaOrSpaceSeparated=!1;On.prototype.commaSeparated=!1;On.prototype.defined=!1;On.prototype.mustUseProperty=!1;On.prototype.number=!1;On.prototype.overloadedBoolean=!1;On.prototype.property="";On.prototype.spaceSeparated=!1;On.prototype.space=void 0;let RE=0;const Xe=ma(),Zt=ma(),md=ma(),we=ma(),jt=ma(),us=ma(),Hn=ma();function ma(){return 2**++RE}const pd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:Zt,commaOrSpaceSeparated:Hn,commaSeparated:us,number:we,overloadedBoolean:md,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),Rh=Object.keys(pd);class qd extends On{constructor(n,r,a,l){let u=-1;if(super(n,r),G0(this,"space",l),typeof a=="number")for(;++u<Rh.length;){const c=Rh[u];G0(this,Rh[u],(a&pd[c])===pd[c])}}}qd.prototype.defined=!0;function G0(e,n,r){r&&(e[n]=r)}function bs(e){const n={},r={};for(const[a,l]of Object.entries(e.properties)){const u=new qd(a,e.transform(e.attributes||{},a),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(u.mustUseProperty=!0),n[a]=u,r[dd(a)]=a,r[dd(u.attribute)]=a}return new Fl(n,r,e.space)}const Ox=bs({properties:{ariaActiveDescendant:null,ariaAtomic:Zt,ariaAutoComplete:null,ariaBusy:Zt,ariaChecked:Zt,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:jt,ariaCurrent:null,ariaDescribedBy:jt,ariaDetails:null,ariaDisabled:Zt,ariaDropEffect:jt,ariaErrorMessage:null,ariaExpanded:Zt,ariaFlowTo:jt,ariaGrabbed:Zt,ariaHasPopup:null,ariaHidden:Zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jt,ariaLevel:we,ariaLive:null,ariaModal:Zt,ariaMultiLine:Zt,ariaMultiSelectable:Zt,ariaOrientation:null,ariaOwns:jt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:Zt,ariaReadOnly:Zt,ariaRelevant:null,ariaRequired:Zt,ariaRoleDescription:jt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:Zt,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Rx(e,n){return n in e?e[n]:n}function Mx(e,n){return Rx(e,n.toLowerCase())}const ME=bs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:us,acceptCharset:jt,accessKey:jt,action:null,allow:null,allowFullScreen:Xe,allowPaymentRequest:Xe,allowUserMedia:Xe,alt:null,as:null,async:Xe,autoCapitalize:null,autoComplete:jt,autoFocus:Xe,autoPlay:Xe,blocking:jt,capture:null,charSet:null,checked:Xe,cite:null,className:jt,cols:we,colSpan:null,content:null,contentEditable:Zt,controls:Xe,controlsList:jt,coords:we|us,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:md,draggable:Zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:jt,height:we,hidden:md,high:we,href:null,hrefLang:null,htmlFor:jt,httpEquiv:jt,id:null,imageSizes:null,imageSrcSet:null,inert:Xe,inputMode:null,integrity:null,is:null,isMap:Xe,itemId:null,itemProp:jt,itemRef:jt,itemScope:Xe,itemType:jt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xe,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Xe,muted:Xe,name:null,nonce:null,noModule:Xe,noValidate:Xe,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:Xe,optimum:we,pattern:null,ping:jt,placeholder:null,playsInline:Xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xe,referrerPolicy:null,rel:jt,required:Xe,reversed:Xe,rows:we,rowSpan:we,sandbox:jt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:Zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:Zt,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:Zt,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xe,disableRemotePlayback:Xe,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Mx}),DE=bs({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:Hn,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:jt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:us,g2:us,glyphName:us,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:Hn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:we,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:jt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Hn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Hn,rev:Hn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Hn,requiredFeatures:Hn,requiredFonts:Hn,requiredFormats:Hn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:Hn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Hn,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Hn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Rx}),Dx=bs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),zx=bs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Mx}),Lx=bs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),zE={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"},LE=/[A-Z]/g,Y0=/-[a-z]/g,UE=/^data[-\w.:]+$/i;function BE(e,n){const r=dd(n);let a=n,l=On;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&UE.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(Y0,HE);a="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!Y0.test(u)){let c=u.replace(LE,PE);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=qd}return new l(a,n)}function PE(e){return"-"+e.toLowerCase()}function HE(e){return e.charAt(1).toUpperCase()}const qE=Nx([Ox,ME,Dx,zx,Lx],"html"),Id=Nx([Ox,DE,Dx,zx,Lx],"svg");function IE(e){return e.join(" ").trim()}var Qa={},Mh,V0;function FE(){if(V0)return Mh;V0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
93
- `,d="/",y="*",g="",b="comment",w="declaration";function k(U,T){if(typeof U!="string")throw new TypeError("First argument must be a string");if(!U)return[];T=T||{};var F=1,V=1;function le(he){var I=he.match(n);I&&(F+=I.length);var Y=he.lastIndexOf(m);V=~Y?he.length-Y:V+he.length}function L(){var he={line:F,column:V};return function(I){return I.position=new D(he),q(),I}}function D(he){this.start=he,this.end={line:F,column:V},this.source=T.source}D.prototype.content=U;function J(he){var I=new Error(T.source+":"+F+":"+V+": "+he);if(I.reason=he,I.filename=T.source,I.line=F,I.column=V,I.source=U,!T.silent)throw I}function B(he){var I=he.exec(U);if(I){var Y=I[0];return le(Y),U=U.slice(Y.length),I}}function q(){B(r)}function A(he){var I;for(he=he||[];I=K();)I!==!1&&he.push(I);return he}function K(){var he=L();if(!(d!=U.charAt(0)||y!=U.charAt(1))){for(var I=2;g!=U.charAt(I)&&(y!=U.charAt(I)||d!=U.charAt(I+1));)++I;if(I+=2,g===U.charAt(I-1))return J("End of comment missing");var Y=U.slice(2,I-2);return V+=2,le(Y),U=U.slice(I),V+=2,he({type:b,comment:Y})}}function Z(){var he=L(),I=B(a);if(I){if(K(),!B(l))return J("property missing ':'");var Y=B(u),ae=he({type:w,property:R(I[0].replace(e,g)),value:Y?R(Y[0].replace(e,g)):g});return B(c),ae}}function ue(){var he=[];A(he);for(var I;I=Z();)I!==!1&&(he.push(I),A(he));return he}return q(),ue()}function R(U){return U?U.replace(f,g):g}return Mh=k,Mh}var J0;function $E(){if(J0)return Qa;J0=1;var e=Qa&&Qa.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.default=r;const n=e(FE());function r(a,l){let u=null;if(!a||typeof a!="string")return u;const c=(0,n.default)(a),f=typeof l=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:d,value:y}=m;f?l(d,y,m):y&&(u=u||{},u[d]=y)}),u}return Qa}var pl={},X0;function GE(){if(X0)return pl;X0=1,Object.defineProperty(pl,"__esModule",{value:!0}),pl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(d){return!d||r.test(d)||e.test(d)},c=function(d,y){return y.toUpperCase()},f=function(d,y){return"".concat(y,"-")},m=function(d,y){return y===void 0&&(y={}),u(d)?d:(d=d.toLowerCase(),y.reactCompat?d=d.replace(l,f):d=d.replace(a,f),d.replace(n,c))};return pl.camelCase=m,pl}var gl,K0;function YE(){if(K0)return gl;K0=1;var e=gl&&gl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=e($E()),r=GE();function a(l,u){var c={};return!l||typeof l!="string"||(0,n.default)(l,function(f,m){f&&m&&(c[(0,r.camelCase)(f,u)]=m)}),c}return a.default=a,gl=a,gl}var VE=YE();const JE=zb(VE),Ux=Bx("end"),Fd=Bx("start");function Bx(e){return n;function n(r){const a=r&&r.position&&r.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function XE(e){const n=Fd(e),r=Ux(e);if(n&&r)return{start:n,end:r}}function Al(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Q0(e.position):"start"in e||"end"in e?Q0(e):"line"in e||"column"in e?gd(e):""}function gd(e){return Z0(e&&e.line)+":"+Z0(e&&e.column)}function Q0(e){return gd(e&&e.start)+"-"+gd(e&&e.end)}function Z0(e){return e&&typeof e=="number"?e:1}class pn extends Error{constructor(n,r,a){super(),typeof r=="string"&&(a=r,r=void 0);let l="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof n=="string"?l=n:!u.cause&&n&&(c=!0,l=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?u.ruleId=a:(u.source=a.slice(0,m),u.ruleId=a.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=f?f.line:void 0,this.name=Al(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}pn.prototype.file="";pn.prototype.name="";pn.prototype.reason="";pn.prototype.message="";pn.prototype.stack="";pn.prototype.column=void 0;pn.prototype.line=void 0;pn.prototype.ancestors=void 0;pn.prototype.cause=void 0;pn.prototype.fatal=void 0;pn.prototype.place=void 0;pn.prototype.ruleId=void 0;pn.prototype.source=void 0;const $d={}.hasOwnProperty,KE=new Map,QE=/[A-Z]/g,ZE=new Set(["table","tbody","thead","tfoot","tr"]),WE=new Set(["td","th"]),Px="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function eC(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let a;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=oC(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=lC(r,n.jsx,n.jsxs)}const l={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:a,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Id:qE,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=Hx(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function Hx(e,n,r){if(n.type==="element")return tC(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return nC(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return iC(e,n,r);if(n.type==="mdxjsEsm")return rC(e,n);if(n.type==="root")return aC(e,n,r);if(n.type==="text")return sC(e,n)}function tC(e,n,r){const a=e.schema;let l=a;n.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=Id,e.schema=l),e.ancestors.push(n);const u=Ix(e,n.tagName,!1),c=uC(e,n);let f=Yd(e,n);return ZE.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!OE(m):!0})),qx(e,c,u,n),Gd(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function nC(e,n){if(n.data&&n.data.estree&&e.evaluater){const a=n.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}zl(e,n.position)}function rC(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);zl(e,n.position)}function iC(e,n,r){const a=e.schema;let l=a;n.name==="svg"&&a.space==="html"&&(l=Id,e.schema=l),e.ancestors.push(n);const u=n.name===null?e.Fragment:Ix(e,n.name,!0),c=cC(e,n),f=Yd(e,n);return qx(e,c,u,n),Gd(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function aC(e,n,r){const a={};return Gd(a,Yd(e,n)),e.create(n,e.Fragment,a,r)}function sC(e,n){return n.value}function qx(e,n,r,a){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=a)}function Gd(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function lC(e,n,r){return a;function a(l,u,c,f){const d=Array.isArray(c.children)?r:n;return f?d(u,c,f):d(u,c)}}function oC(e,n){return r;function r(a,l,u,c){const f=Array.isArray(u.children),m=Fd(a);return n(l,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function uC(e,n){const r={};let a,l;for(l in n.properties)if(l!=="children"&&$d.call(n.properties,l)){const u=fC(e,l,n.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&WE.has(n.tagName)?a=f:r[c]=f}}if(a){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return r}function cC(e,n){const r={};for(const a of n.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const u=a.data.estree.body[0];u.type;const c=u.expression;c.type;const f=c.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else zl(e,n.position);else{const l=a.name;let u;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else zl(e,n.position);else u=a.value===null?!0:a.value;r[l]=u}return r}function Yd(e,n){const r=[];let a=-1;const l=e.passKeys?new Map:KE;for(;++a<n.children.length;){const u=n.children[a];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const d=l.get(m)||0;c=m+"-"+d,l.set(m,d+1)}}const f=Hx(e,u,c);f!==void 0&&r.push(f)}return r}function fC(e,n,r){const a=BE(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?CE(r):IE(r)),a.property==="style"){let l=typeof r=="object"?r:hC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=dC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&a.space?zE[a.property]||a.property:a.attribute,r]}}function hC(e,n){try{return JE(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,l=new pn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Px+"#cannot-parse-style-attribute",l}}function Ix(e,n,r){let a;if(!r)a={type:"Literal",value:n};else if(n.includes(".")){const l=n.split(".");let u=-1,c;for(;++u<l.length;){const f=F0(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}a=c}else a=F0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(a.type==="Literal"){const l=a.value;return $d.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(a);zl(e)}function zl(e,n){const r=new pn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Px+"#cannot-handle-mdx-estrees-without-createevaluater",r}function dC(e){const n={};let r;for(r in e)$d.call(e,r)&&(n[mC(r)]=e[r]);return n}function mC(e){let n=e.replace(QE,pC);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function pC(e){return"-"+e.toLowerCase()}const Dh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},gC={};function Vd(e,n){const r=gC,a=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Fx(e,a,l)}function Fx(e,n,r){if(yC(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return W0(e.children,n,r)}return Array.isArray(e)?W0(e,n,r):""}function W0(e,n,r){const a=[];let l=-1;for(;++l<e.length;)a[l]=Fx(e[l],n,r);return a.join("")}function yC(e){return!!(e&&typeof e=="object")}const eb=document.createElement("i");function Jd(e){const n="&"+e+";";eb.innerHTML=n;const r=eb.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function Gn(e,n,r,a){const l=e.length;let u=0,c;if(n<0?n=-n>l?0:l+n:n=n>l?l:n,r=r>0?r:0,a.length<1e4)c=Array.from(a),c.unshift(n,r),e.splice(...c);else for(r&&e.splice(n,r);u<a.length;)c=a.slice(u,u+1e4),c.unshift(n,0),e.splice(...c),u+=1e4,n+=1e4}function sr(e,n){return e.length>0?(Gn(e,e.length,0,n),e):n}const tb={}.hasOwnProperty;function $x(e){const n={};let r=-1;for(;++r<e.length;)bC(n,e[r]);return n}function bC(e,n){let r;for(r in n){const l=(tb.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let c;if(u)for(c in u){tb.call(l,c)||(l[c]=[]);const f=u[c];xC(l[c],Array.isArray(f)?f:f?[f]:[])}}}function xC(e,n){let r=-1;const a=[];for(;++r<n.length;)(n[r].add==="after"?e:a).push(n[r]);Gn(e,0,0,a)}function Gx(e,n){const r=Number.parseInt(e,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function br(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const vn=Hi(/[A-Za-z]/),mn=Hi(/[\dA-Za-z]/),vC=Hi(/[#-'*+\--9=?A-Z^-~]/);function Du(e){return e!==null&&(e<32||e===127)}const yd=Hi(/\d/),wC=Hi(/[\dA-Fa-f]/),SC=Hi(/[!-/:-@[-`{-~]/);function Be(e){return e!==null&&e<-2}function Tt(e){return e!==null&&(e<0||e===32)}function et(e){return e===-2||e===-1||e===32}const Yu=Hi(new RegExp("\\p{P}|\\p{S}","u")),ha=Hi(/\s/);function Hi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function xs(e){const n=[];let r=-1,a=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&mn(e.charCodeAt(r+1))&&mn(e.charCodeAt(r+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(r+1);u<56320&&f>56319&&f<57344?(c=String.fromCharCode(u,f),l=1):c="�"}else c=String.fromCharCode(u);c&&(n.push(e.slice(a,r),encodeURIComponent(c)),a=r+l+1,c=""),l&&(r+=l,l=0)}return n.join("")+e.slice(a)}function lt(e,n,r,a){const l=a?a-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return et(m)?(e.enter(r),f(m)):n(m)}function f(m){return et(m)&&u++<l?(e.consume(m),f):(e.exit(r),n(m))}}const _C={tokenize:kC};function kC(e){const n=e.attempt(this.parser.constructs.contentInitial,a,l);let r;return n;function a(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),lt(e,n,"linePrefix")}function l(f){return e.enter("paragraph"),u(f)}function u(f){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Be(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const EC={tokenize:CC},nb={tokenize:AC};function CC(e){const n=this,r=[];let a=0,l,u,c;return f;function f(V){if(a<r.length){const le=r[a];return n.containerState=le[1],e.attempt(le[0].continuation,m,d)(V)}return d(V)}function m(V){if(a++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&F();const le=n.events.length;let L=le,D;for(;L--;)if(n.events[L][0]==="exit"&&n.events[L][1].type==="chunkFlow"){D=n.events[L][1].end;break}T(a);let J=le;for(;J<n.events.length;)n.events[J][1].end={...D},J++;return Gn(n.events,L+1,0,n.events.slice(le)),n.events.length=J,d(V)}return f(V)}function d(V){if(a===r.length){if(!l)return b(V);if(l.currentConstruct&&l.currentConstruct.concrete)return k(V);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(nb,y,g)(V)}function y(V){return l&&F(),T(a),b(V)}function g(V){return n.parser.lazy[n.now().line]=a!==r.length,c=n.now().offset,k(V)}function b(V){return n.containerState={},e.attempt(nb,w,k)(V)}function w(V){return a++,r.push([n.currentConstruct,n.containerState]),b(V)}function k(V){if(V===null){l&&F(),T(0),e.consume(V);return}return l=l||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),R(V)}function R(V){if(V===null){U(e.exit("chunkFlow"),!0),T(0),e.consume(V);return}return Be(V)?(e.consume(V),U(e.exit("chunkFlow")),a=0,n.interrupt=void 0,f):(e.consume(V),R)}function U(V,le){const L=n.sliceStream(V);if(le&&L.push(null),V.previous=u,u&&(u.next=V),u=V,l.defineSkip(V.start),l.write(L),n.parser.lazy[V.start.line]){let D=l.events.length;for(;D--;)if(l.events[D][1].start.offset<c&&(!l.events[D][1].end||l.events[D][1].end.offset>c))return;const J=n.events.length;let B=J,q,A;for(;B--;)if(n.events[B][0]==="exit"&&n.events[B][1].type==="chunkFlow"){if(q){A=n.events[B][1].end;break}q=!0}for(T(a),D=J;D<n.events.length;)n.events[D][1].end={...A},D++;Gn(n.events,B+1,0,n.events.slice(J)),n.events.length=D}}function T(V){let le=r.length;for(;le-- >V;){const L=r[le];n.containerState=L[1],L[0].exit.call(n,e)}r.length=V}function F(){l.write([null]),u=void 0,l=void 0,n.containerState._closeFlow=void 0}}function AC(e,n,r){return lt(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ms(e){if(e===null||Tt(e)||ha(e))return 1;if(Yu(e))return 2}function Vu(e,n,r){const a=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!a.includes(u)&&(n=u(n,r),a.push(u))}return n}const bd={name:"attention",resolveAll:TC,tokenize:jC};function TC(e,n){let r=-1,a,l,u,c,f,m,d,y;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(a=r;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&n.sliceSerialize(e[a][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[a][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[a][1].end},b={...e[r][1].start};rb(g,-m),rb(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:b},u={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[r][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[r][1].start={...f.end},d=[],e[a][1].end.offset-e[a][1].start.offset&&(d=sr(d,[["enter",e[a][1],n],["exit",e[a][1],n]])),d=sr(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=sr(d,Vu(n.parser.constructs.insideSpan.null,e.slice(a+1,r),n)),d=sr(d,[["exit",u,n],["enter",f,n],["exit",f,n],["exit",l,n]]),e[r][1].end.offset-e[r][1].start.offset?(y=2,d=sr(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):y=0,Gn(e,a-1,r-a+3,d),r=a+d.length-y-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function jC(e,n){const r=this.parser.constructs.attentionMarkers.null,a=this.previous,l=ms(a);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const d=e.exit("attentionSequence"),y=ms(m),g=!y||y===2&&l||r.includes(m),b=!l||l===2&&y||r.includes(a);return d._open=!!(u===42?g:g&&(l||!b)),d._close=!!(u===42?b:b&&(y||!g)),n(m)}}function rb(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const NC={name:"autolink",tokenize:OC};function OC(e,n,r){let a=0;return l;function l(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(w){return vn(w)?(e.consume(w),c):w===64?r(w):d(w)}function c(w){return w===43||w===45||w===46||mn(w)?(a=1,f(w)):d(w)}function f(w){return w===58?(e.consume(w),a=0,m):(w===43||w===45||w===46||mn(w))&&a++<32?(e.consume(w),f):(a=0,d(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):w===null||w===32||w===60||Du(w)?r(w):(e.consume(w),m)}function d(w){return w===64?(e.consume(w),y):vC(w)?(e.consume(w),d):r(w)}function y(w){return mn(w)?g(w):r(w)}function g(w){return w===46?(e.consume(w),a=0,y):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):b(w)}function b(w){if((w===45||mn(w))&&a++<63){const k=w===45?b:g;return e.consume(w),k}return r(w)}}const $l={partial:!0,tokenize:RC};function RC(e,n,r){return a;function a(u){return et(u)?lt(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Be(u)?n(u):r(u)}}const Yx={continuation:{tokenize:DC},exit:zC,name:"blockQuote",tokenize:MC};function MC(e,n,r){const a=this;return l;function l(c){if(c===62){const f=a.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return r(c)}function u(c){return et(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(c))}}function DC(e,n,r){const a=this;return l;function l(c){return et(c)?lt(e,u,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(Yx,n,r)(c)}}function zC(e){e.exit("blockQuote")}const Vx={name:"characterEscape",tokenize:LC};function LC(e,n,r){return a;function a(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return SC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const Jx={name:"characterReference",tokenize:UC};function UC(e,n,r){const a=this;let l=0,u,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),u=31,c=mn,y(g))}function d(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=wC,y):(e.enter("characterReferenceValue"),u=7,c=yd,y(g))}function y(g){if(g===59&&l){const b=e.exit("characterReferenceValue");return c===mn&&!Jd(a.sliceSerialize(b))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return c(g)&&l++<u?(e.consume(g),y):r(g)}}const ib={partial:!0,tokenize:PC},ab={concrete:!0,name:"codeFenced",tokenize:BC};function BC(e,n,r){const a=this,l={partial:!0,tokenize:L};let u=0,c=0,f;return m;function m(D){return d(D)}function d(D){const J=a.events[a.events.length-1];return u=J&&J[1].type==="linePrefix"?J[2].sliceSerialize(J[1],!0).length:0,f=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(D)}function y(D){return D===f?(c++,e.consume(D),y):c<3?r(D):(e.exit("codeFencedFenceSequence"),et(D)?lt(e,g,"whitespace")(D):g(D))}function g(D){return D===null||Be(D)?(e.exit("codeFencedFence"),a.interrupt?n(D):e.check(ib,R,le)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(D))}function b(D){return D===null||Be(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(D)):et(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),lt(e,w,"whitespace")(D)):D===96&&D===f?r(D):(e.consume(D),b)}function w(D){return D===null||Be(D)?g(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(D))}function k(D){return D===null||Be(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(D)):D===96&&D===f?r(D):(e.consume(D),k)}function R(D){return e.attempt(l,le,U)(D)}function U(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),T}function T(D){return u>0&&et(D)?lt(e,F,"linePrefix",u+1)(D):F(D)}function F(D){return D===null||Be(D)?e.check(ib,R,le)(D):(e.enter("codeFlowValue"),V(D))}function V(D){return D===null||Be(D)?(e.exit("codeFlowValue"),F(D)):(e.consume(D),V)}function le(D){return e.exit("codeFenced"),n(D)}function L(D,J,B){let q=0;return A;function A(I){return D.enter("lineEnding"),D.consume(I),D.exit("lineEnding"),K}function K(I){return D.enter("codeFencedFence"),et(I)?lt(D,Z,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):Z(I)}function Z(I){return I===f?(D.enter("codeFencedFenceSequence"),ue(I)):B(I)}function ue(I){return I===f?(q++,D.consume(I),ue):q>=c?(D.exit("codeFencedFenceSequence"),et(I)?lt(D,he,"whitespace")(I):he(I)):B(I)}function he(I){return I===null||Be(I)?(D.exit("codeFencedFence"),J(I)):B(I)}}}function PC(e,n,r){const a=this;return l;function l(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}const zh={name:"codeIndented",tokenize:qC},HC={partial:!0,tokenize:IC};function qC(e,n,r){const a=this;return l;function l(d){return e.enter("codeIndented"),lt(e,u,"linePrefix",5)(d)}function u(d){const y=a.events[a.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?c(d):r(d)}function c(d){return d===null?m(d):Be(d)?e.attempt(HC,c,m)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||Be(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function m(d){return e.exit("codeIndented"),n(d)}}function IC(e,n,r){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?r(c):Be(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):lt(e,u,"linePrefix",5)(c)}function u(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):Be(c)?l(c):r(c)}}const FC={name:"codeText",previous:GC,resolve:$C,tokenize:YC};function $C(e){let n=e.length-4,r=3,a,l;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(a=r;++a<n;)if(e[a][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(a=r-1,n++;++a<=n;)l===void 0?a!==n&&e[a][1].type!=="lineEnding"&&(l=a):(a===n||e[a][1].type==="lineEnding")&&(e[l][1].type="codeTextData",a!==l+2&&(e[l][1].end=e[a-1][1].end,e.splice(l+2,a-l-2),n-=a-l-2,a=l+2),l=void 0);return e}function GC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function YC(e,n,r){let a=0,l,u;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),a++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(u=e.enter("codeTextSequence"),l=0,y(g)):Be(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),d(g))}function d(g){return g===null||g===32||g===96||Be(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),d)}function y(g){return g===96?(e.consume(g),l++,y):l===a?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(u.type="codeTextData",d(g))}}class VC{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const a=r??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(n,a):n>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(n,r,a){const l=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return a&&yl(this.left,a),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),yl(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),yl(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const r=this.left.splice(n,Number.POSITIVE_INFINITY);yl(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);yl(this.left,r.reverse())}}}function yl(e,n){let r=0;if(n.length<1e4)e.push(...n);else for(;r<n.length;)e.push(...n.slice(r,r+1e4)),r+=1e4}function Xx(e){const n={};let r=-1,a,l,u,c,f,m,d;const y=new VC(e);for(;++r<y.length;){for(;r in n;)r=n[r];if(a=y.get(r),r&&a[1].type==="chunkFlow"&&y.get(r-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(a[0]==="enter")a[1].contentType&&(Object.assign(n,JC(y,r)),r=n[r],d=!0);else if(a[1]._container){for(u=r,l=void 0;u--;)if(c=y.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(y.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(a[1].end={...y.get(l)[1].start},f=y.slice(l,r),f.unshift(a),y.splice(l,r-l+1,f))}}return Gn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function JC(e,n){const r=e.get(n)[1],a=e.get(n)[2];let l=n-1;const u=[];let c=r._tokenizer;c||(c=a.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],d={};let y,g,b=-1,w=r,k=0,R=0;const U=[R];for(;w;){for(;e.get(++l)[1]!==w;);u.push(l),w._tokenizer||(y=a.sliceStream(w),w.next||y.push(null),g&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=r;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(R=b+1,U.push(R),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):U.pop(),b=U.length;b--;){const T=f.slice(U[b],U[b+1]),F=u.pop();m.push([F,F+T.length-1]),e.splice(F,2,T)}for(m.reverse(),b=-1;++b<m.length;)d[k+m[b][0]]=k+m[b][1],k+=m[b][1]-m[b][0]-1;return d}const XC={resolve:QC,tokenize:ZC},KC={partial:!0,tokenize:WC};function QC(e){return Xx(e),e}function ZC(e,n){let r;return a;function a(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?u(f):Be(f)?e.check(KC,c,u)(f):(e.consume(f),l)}function u(f){return e.exit("chunkContent"),e.exit("content"),n(f)}function c(f){return e.consume(f),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,l}}function WC(e,n,r){const a=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),lt(e,u,"linePrefix")}function u(c){if(c===null||Be(c))return r(c);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(c):e.interrupt(a.parser.constructs.flow,r,n)(c)}}function Kx(e,n,r,a,l,u,c,f,m){const d=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(T){return T===60?(e.enter(a),e.enter(l),e.enter(u),e.consume(T),e.exit(u),b):T===null||T===32||T===41||Du(T)?r(T):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),R(T))}function b(T){return T===62?(e.enter(u),e.consume(T),e.exit(u),e.exit(l),e.exit(a),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(T))}function w(T){return T===62?(e.exit("chunkString"),e.exit(f),b(T)):T===null||T===60||Be(T)?r(T):(e.consume(T),T===92?k:w)}function k(T){return T===60||T===62||T===92?(e.consume(T),w):w(T)}function R(T){return!y&&(T===null||T===41||Tt(T))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),n(T)):y<d&&T===40?(e.consume(T),y++,R):T===41?(e.consume(T),y--,R):T===null||T===32||T===40||Du(T)?r(T):(e.consume(T),T===92?U:R)}function U(T){return T===40||T===41||T===92?(e.consume(T),R):R(T)}}function Qx(e,n,r,a,l,u){const c=this;let f=0,m;return d;function d(w){return e.enter(a),e.enter(l),e.consume(w),e.exit(l),e.enter(u),y}function y(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(w):w===93?(e.exit(u),e.enter(l),e.consume(w),e.exit(l),e.exit(a),n):Be(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||w===91||w===93||Be(w)||f++>999?(e.exit("chunkString"),y(w)):(e.consume(w),m||(m=!et(w)),w===92?b:g)}function b(w){return w===91||w===92||w===93?(e.consume(w),f++,g):g(w)}}function Zx(e,n,r,a,l,u){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(a),e.enter(l),e.consume(b),e.exit(l),c=b===40?41:b,m):r(b)}function m(b){return b===c?(e.enter(l),e.consume(b),e.exit(l),e.exit(a),n):(e.enter(u),d(b))}function d(b){return b===c?(e.exit(u),m(c)):b===null?r(b):Be(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),lt(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===c||b===null||Be(b)?(e.exit("chunkString"),d(b)):(e.consume(b),b===92?g:y)}function g(b){return b===c||b===92?(e.consume(b),y):y(b)}}function Tl(e,n){let r;return a;function a(l){return Be(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,a):et(l)?lt(e,a,r?"linePrefix":"lineSuffix")(l):n(l)}}const eA={name:"definition",tokenize:nA},tA={partial:!0,tokenize:rA};function nA(e,n,r){const a=this;let l;return u;function u(w){return e.enter("definition"),c(w)}function c(w){return Qx.call(a,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return l=br(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):r(w)}function m(w){return Tt(w)?Tl(e,d)(w):d(w)}function d(w){return Kx(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function y(w){return e.attempt(tA,g,g)(w)}function g(w){return et(w)?lt(e,b,"whitespace")(w):b(w)}function b(w){return w===null||Be(w)?(e.exit("definition"),a.parser.defined.push(l),n(w)):r(w)}}function rA(e,n,r){return a;function a(f){return Tt(f)?Tl(e,l)(f):r(f)}function l(f){return Zx(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return et(f)?lt(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Be(f)?n(f):r(f)}}const iA={name:"hardBreakEscape",tokenize:aA};function aA(e,n,r){return a;function a(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Be(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const sA={name:"headingAtx",resolve:lA,tokenize:oA};function lA(e,n){let r=e.length-2,a=3,l,u;return e[a][1].type==="whitespace"&&(a+=2),r-2>a&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(a===r-1||r-4>a&&e[r-2][1].type==="whitespace")&&(r-=a+1===r?2:4),r>a&&(l={type:"atxHeadingText",start:e[a][1].start,end:e[r][1].end},u={type:"chunkText",start:e[a][1].start,end:e[r][1].end,contentType:"text"},Gn(e,a,r-a+1,[["enter",l,n],["enter",u,n],["exit",u,n],["exit",l,n]])),e}function oA(e,n,r){let a=0;return l;function l(y){return e.enter("atxHeading"),u(y)}function u(y){return e.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&a++<6?(e.consume(y),c):y===null||Tt(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||Be(y)?(e.exit("atxHeading"),n(y)):et(y)?lt(e,f,"whitespace")(y):(e.enter("atxHeadingText"),d(y))}function m(y){return y===35?(e.consume(y),m):(e.exit("atxHeadingSequence"),f(y))}function d(y){return y===null||y===35||Tt(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const uA=["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"],sb=["pre","script","style","textarea"],cA={concrete:!0,name:"htmlFlow",resolveTo:dA,tokenize:mA},fA={partial:!0,tokenize:gA},hA={partial:!0,tokenize:pA};function dA(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function mA(e,n,r){const a=this;let l,u,c,f,m;return d;function d(j){return y(j)}function y(j){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(j),g}function g(j){return j===33?(e.consume(j),b):j===47?(e.consume(j),u=!0,R):j===63?(e.consume(j),l=3,a.interrupt?n:O):vn(j)?(e.consume(j),c=String.fromCharCode(j),U):r(j)}function b(j){return j===45?(e.consume(j),l=2,w):j===91?(e.consume(j),l=5,f=0,k):vn(j)?(e.consume(j),l=4,a.interrupt?n:O):r(j)}function w(j){return j===45?(e.consume(j),a.interrupt?n:O):r(j)}function k(j){const be="CDATA[";return j===be.charCodeAt(f++)?(e.consume(j),f===be.length?a.interrupt?n:Z:k):r(j)}function R(j){return vn(j)?(e.consume(j),c=String.fromCharCode(j),U):r(j)}function U(j){if(j===null||j===47||j===62||Tt(j)){const be=j===47,Re=c.toLowerCase();return!be&&!u&&sb.includes(Re)?(l=1,a.interrupt?n(j):Z(j)):uA.includes(c.toLowerCase())?(l=6,be?(e.consume(j),T):a.interrupt?n(j):Z(j)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?r(j):u?F(j):V(j))}return j===45||mn(j)?(e.consume(j),c+=String.fromCharCode(j),U):r(j)}function T(j){return j===62?(e.consume(j),a.interrupt?n:Z):r(j)}function F(j){return et(j)?(e.consume(j),F):A(j)}function V(j){return j===47?(e.consume(j),A):j===58||j===95||vn(j)?(e.consume(j),le):et(j)?(e.consume(j),V):A(j)}function le(j){return j===45||j===46||j===58||j===95||mn(j)?(e.consume(j),le):L(j)}function L(j){return j===61?(e.consume(j),D):et(j)?(e.consume(j),L):V(j)}function D(j){return j===null||j===60||j===61||j===62||j===96?r(j):j===34||j===39?(e.consume(j),m=j,J):et(j)?(e.consume(j),D):B(j)}function J(j){return j===m?(e.consume(j),m=null,q):j===null||Be(j)?r(j):(e.consume(j),J)}function B(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||Tt(j)?L(j):(e.consume(j),B)}function q(j){return j===47||j===62||et(j)?V(j):r(j)}function A(j){return j===62?(e.consume(j),K):r(j)}function K(j){return j===null||Be(j)?Z(j):et(j)?(e.consume(j),K):r(j)}function Z(j){return j===45&&l===2?(e.consume(j),Y):j===60&&l===1?(e.consume(j),ae):j===62&&l===4?(e.consume(j),P):j===63&&l===3?(e.consume(j),O):j===93&&l===5?(e.consume(j),Ae):Be(j)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(fA,re,ue)(j)):j===null||Be(j)?(e.exit("htmlFlowData"),ue(j)):(e.consume(j),Z)}function ue(j){return e.check(hA,he,re)(j)}function he(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),I}function I(j){return j===null||Be(j)?ue(j):(e.enter("htmlFlowData"),Z(j))}function Y(j){return j===45?(e.consume(j),O):Z(j)}function ae(j){return j===47?(e.consume(j),c="",ce):Z(j)}function ce(j){if(j===62){const be=c.toLowerCase();return sb.includes(be)?(e.consume(j),P):Z(j)}return vn(j)&&c.length<8?(e.consume(j),c+=String.fromCharCode(j),ce):Z(j)}function Ae(j){return j===93?(e.consume(j),O):Z(j)}function O(j){return j===62?(e.consume(j),P):j===45&&l===2?(e.consume(j),O):Z(j)}function P(j){return j===null||Be(j)?(e.exit("htmlFlowData"),re(j)):(e.consume(j),P)}function re(j){return e.exit("htmlFlow"),n(j)}}function pA(e,n,r){const a=this;return l;function l(c){return Be(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}function gA(e,n,r){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt($l,n,r)}}const yA={name:"htmlText",tokenize:bA};function bA(e,n,r){const a=this;let l,u,c;return f;function f(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),m}function m(O){return O===33?(e.consume(O),d):O===47?(e.consume(O),L):O===63?(e.consume(O),V):vn(O)?(e.consume(O),B):r(O)}function d(O){return O===45?(e.consume(O),y):O===91?(e.consume(O),u=0,k):vn(O)?(e.consume(O),F):r(O)}function y(O){return O===45?(e.consume(O),w):r(O)}function g(O){return O===null?r(O):O===45?(e.consume(O),b):Be(O)?(c=g,ae(O)):(e.consume(O),g)}function b(O){return O===45?(e.consume(O),w):g(O)}function w(O){return O===62?Y(O):O===45?b(O):g(O)}function k(O){const P="CDATA[";return O===P.charCodeAt(u++)?(e.consume(O),u===P.length?R:k):r(O)}function R(O){return O===null?r(O):O===93?(e.consume(O),U):Be(O)?(c=R,ae(O)):(e.consume(O),R)}function U(O){return O===93?(e.consume(O),T):R(O)}function T(O){return O===62?Y(O):O===93?(e.consume(O),T):R(O)}function F(O){return O===null||O===62?Y(O):Be(O)?(c=F,ae(O)):(e.consume(O),F)}function V(O){return O===null?r(O):O===63?(e.consume(O),le):Be(O)?(c=V,ae(O)):(e.consume(O),V)}function le(O){return O===62?Y(O):V(O)}function L(O){return vn(O)?(e.consume(O),D):r(O)}function D(O){return O===45||mn(O)?(e.consume(O),D):J(O)}function J(O){return Be(O)?(c=J,ae(O)):et(O)?(e.consume(O),J):Y(O)}function B(O){return O===45||mn(O)?(e.consume(O),B):O===47||O===62||Tt(O)?q(O):r(O)}function q(O){return O===47?(e.consume(O),Y):O===58||O===95||vn(O)?(e.consume(O),A):Be(O)?(c=q,ae(O)):et(O)?(e.consume(O),q):Y(O)}function A(O){return O===45||O===46||O===58||O===95||mn(O)?(e.consume(O),A):K(O)}function K(O){return O===61?(e.consume(O),Z):Be(O)?(c=K,ae(O)):et(O)?(e.consume(O),K):q(O)}function Z(O){return O===null||O===60||O===61||O===62||O===96?r(O):O===34||O===39?(e.consume(O),l=O,ue):Be(O)?(c=Z,ae(O)):et(O)?(e.consume(O),Z):(e.consume(O),he)}function ue(O){return O===l?(e.consume(O),l=void 0,I):O===null?r(O):Be(O)?(c=ue,ae(O)):(e.consume(O),ue)}function he(O){return O===null||O===34||O===39||O===60||O===61||O===96?r(O):O===47||O===62||Tt(O)?q(O):(e.consume(O),he)}function I(O){return O===47||O===62||Tt(O)?q(O):r(O)}function Y(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),n):r(O)}function ae(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),ce}function ce(O){return et(O)?lt(e,Ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):Ae(O)}function Ae(O){return e.enter("htmlTextData"),c(O)}}const Xd={name:"labelEnd",resolveAll:SA,resolveTo:_A,tokenize:kA},xA={tokenize:EA},vA={tokenize:CA},wA={tokenize:AA};function SA(e){let n=-1;const r=[];for(;++n<e.length;){const a=e[n][1];if(r.push(e[n]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const l=a.type==="labelImage"?4:2;a.type="data",n+=l}}return e.length!==r.length&&Gn(e,0,e.length,r),e}function _A(e,n){let r=e.length,a=0,l,u,c,f;for(;r--;)if(l=e[r][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(u=r,l.type!=="labelLink")){a=2;break}}else l.type==="labelEnd"&&(c=r);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},y={type:"labelText",start:{...e[u+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,n],["enter",d,n]],f=sr(f,e.slice(u+1,u+a+3)),f=sr(f,[["enter",y,n]]),f=sr(f,Vu(n.parser.constructs.insideSpan.null,e.slice(u+a+4,c-3),n)),f=sr(f,[["exit",y,n],e[c-2],e[c-1],["exit",d,n]]),f=sr(f,e.slice(c+1)),f=sr(f,[["exit",m,n]]),Gn(e,u,e.length,f),e}function kA(e,n,r){const a=this;let l=a.events.length,u,c;for(;l--;)if((a.events[l][1].type==="labelImage"||a.events[l][1].type==="labelLink")&&!a.events[l][1]._balanced){u=a.events[l][1];break}return f;function f(b){return u?u._inactive?g(b):(c=a.parser.defined.includes(br(a.sliceSerialize({start:u.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),m):r(b)}function m(b){return b===40?e.attempt(xA,y,c?y:g)(b):b===91?e.attempt(vA,y,c?d:g)(b):c?y(b):g(b)}function d(b){return e.attempt(wA,y,g)(b)}function y(b){return n(b)}function g(b){return u._balanced=!0,r(b)}}function EA(e,n,r){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return Tt(g)?Tl(e,u)(g):u(g)}function u(g){return g===41?y(g):Kx(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Tt(g)?Tl(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?Zx(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return Tt(g)?Tl(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),n):r(g)}}function CA(e,n,r){const a=this;return l;function l(f){return Qx.call(a,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return a.parser.defined.includes(br(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function c(f){return r(f)}}function AA(e,n,r){return a;function a(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),n):r(u)}}const TA={name:"labelStartImage",resolveAll:Xd.resolveAll,tokenize:jA};function jA(e,n,r){const a=this;return l;function l(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):r(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(f):n(f)}}const NA={name:"labelStartLink",resolveAll:Xd.resolveAll,tokenize:OA};function OA(e,n,r){const a=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(c):n(c)}}const Lh={name:"lineEnding",tokenize:RA};function RA(e,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),lt(e,n,"linePrefix")}}const vu={name:"thematicBreak",tokenize:MA};function MA(e,n,r){let a=0,l;return u;function u(d){return e.enter("thematicBreak"),c(d)}function c(d){return l=d,f(d)}function f(d){return d===l?(e.enter("thematicBreakSequence"),m(d)):a>=3&&(d===null||Be(d))?(e.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(e.consume(d),a++,m):(e.exit("thematicBreakSequence"),et(d)?lt(e,f,"whitespace")(d):f(d))}}const jn={continuation:{tokenize:UA},exit:PA,name:"list",tokenize:LA},DA={partial:!0,tokenize:HA},zA={partial:!0,tokenize:BA};function LA(e,n,r){const a=this,l=a.events[a.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return f;function f(w){const k=a.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||w===a.containerState.marker:yd(w)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(vu,r,d)(w):d(w);if(!a.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return yd(w)&&++c<10?(e.consume(w),m):(!a.interrupt||c<2)&&(a.containerState.marker?w===a.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),d(w)):r(w)}function d(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||w,e.check($l,a.interrupt?r:y,e.attempt(DA,b,g))}function y(w){return a.containerState.initialBlankLine=!0,u++,b(w)}function g(w){return et(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),b):r(w)}function b(w){return a.containerState.size=u+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(w)}}function UA(e,n,r){const a=this;return a.containerState._closeFlow=void 0,e.check($l,l,u);function l(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,lt(e,n,"listItemIndent",a.containerState.size+1)(f)}function u(f){return a.containerState.furtherBlankLines||!et(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(zA,n,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,lt(e,e.attempt(jn,n,r),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function BA(e,n,r){const a=this;return lt(e,l,"listItemIndent",a.containerState.size+1);function l(u){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?n(u):r(u)}}function PA(e){e.exit(this.containerState.type)}function HA(e,n,r){const a=this;return lt(e,l,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=a.events[a.events.length-1];return!et(u)&&c&&c[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const lb={name:"setextUnderline",resolveTo:qA,tokenize:IA};function qA(e,n){let r=e.length,a,l,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=r;break}e[r][1].type==="paragraph"&&(l=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",u?(e.splice(l,0,["enter",c,n]),e.splice(u+1,0,["exit",e[a][1],n]),e[a][1].end={...e[u][1].end}):e[a][1]=c,e.push(["exit",c,n]),e}function IA(e,n,r){const a=this;let l;return u;function u(d){let y=a.events.length,g;for(;y--;)if(a.events[y][1].type!=="lineEnding"&&a.events[y][1].type!=="linePrefix"&&a.events[y][1].type!=="content"){g=a.events[y][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||g)?(e.enter("setextHeadingLine"),l=d,c(d)):r(d)}function c(d){return e.enter("setextHeadingLineSequence"),f(d)}function f(d){return d===l?(e.consume(d),f):(e.exit("setextHeadingLineSequence"),et(d)?lt(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Be(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const FA={tokenize:$A};function $A(e){const n=this,r=e.attempt($l,a,e.attempt(this.parser.constructs.flowInitial,l,lt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(XC,l)),"linePrefix")));return r;function a(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const GA={resolveAll:e1()},YA=Wx("string"),VA=Wx("text");function Wx(e){return{resolveAll:e1(e==="text"?JA:void 0),tokenize:n};function n(r){const a=this,l=this.parser.constructs[e],u=r.attempt(l,c,f);return c;function c(y){return d(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return d(y)?(r.exit("data"),u(y)):(r.consume(y),m)}function d(y){if(y===null)return!0;const g=l[y];let b=-1;if(g)for(;++b<g.length;){const w=g[b];if(!w.previous||w.previous.call(a,a.previous))return!0}return!1}}}function e1(e){return n;function n(r,a){let l=-1,u;for(;++l<=r.length;)u===void 0?r[l]&&r[l][1].type==="data"&&(u=l,l++):(!r[l]||r[l][1].type!=="data")&&(l!==u+2&&(r[u][1].end=r[l-1][1].end,r.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(r,a):r}}function JA(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const a=e[r-1][1],l=n.sliceStream(a);let u=l.length,c=-1,f=0,m;for(;u--;){const d=l[u];if(typeof d=="string"){for(c=d.length;d.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(d===-2)m=!0,f++;else if(d!==-1){u++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const d={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:a.start._bufferIndex+c,_index:a.start._index+u,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...d.start},a.start.offset===a.end.offset?Object.assign(a,d):(e.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return e}const XA={42:jn,43:jn,45:jn,48:jn,49:jn,50:jn,51:jn,52:jn,53:jn,54:jn,55:jn,56:jn,57:jn,62:Yx},KA={91:eA},QA={[-2]:zh,[-1]:zh,32:zh},ZA={35:sA,42:vu,45:[lb,vu],60:cA,61:lb,95:vu,96:ab,126:ab},WA={38:Jx,92:Vx},eT={[-5]:Lh,[-4]:Lh,[-3]:Lh,33:TA,38:Jx,42:bd,60:[NC,yA],91:NA,92:[iA,Vx],93:Xd,95:bd,96:FC},tT={null:[bd,GA]},nT={null:[42,95]},rT={null:[]},iT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:nT,contentInitial:KA,disable:rT,document:XA,flow:ZA,flowInitial:QA,insideSpan:tT,string:WA,text:eT},Symbol.toStringTag,{value:"Module"}));function aT(e,n,r){let a={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},u=[];let c=[],f=[];const m={attempt:J(L),check:J(D),consume:F,enter:V,exit:le,interrupt:J(D,{interrupt:!0})},d={code:null,containerState:{},defineSkip:R,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:w,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(K){return c=sr(c,K),U(),c[c.length-1]!==null?[]:(B(n,0),d.events=Vu(u,d.events,d),d.events)}function b(K,Z){return lT(w(K),Z)}function w(K){return sT(c,K)}function k(){const{_bufferIndex:K,_index:Z,line:ue,column:he,offset:I}=a;return{_bufferIndex:K,_index:Z,line:ue,column:he,offset:I}}function R(K){l[K.line]=K.column,A()}function U(){let K;for(;a._index<c.length;){const Z=c[a._index];if(typeof Z=="string")for(K=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===K&&a._bufferIndex<Z.length;)T(Z.charCodeAt(a._bufferIndex));else T(Z)}}function T(K){y=y(K)}function F(K){Be(K)?(a.line++,a.column=1,a.offset+=K===-3?2:1,A()):K!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===c[a._index].length&&(a._bufferIndex=-1,a._index++)),d.previous=K}function V(K,Z){const ue=Z||{};return ue.type=K,ue.start=k(),d.events.push(["enter",ue,d]),f.push(ue),ue}function le(K){const Z=f.pop();return Z.end=k(),d.events.push(["exit",Z,d]),Z}function L(K,Z){B(K,Z.from)}function D(K,Z){Z.restore()}function J(K,Z){return ue;function ue(he,I,Y){let ae,ce,Ae,O;return Array.isArray(he)?re(he):"tokenize"in he?re([he]):P(he);function P(Te){return De;function De(Fe){const Ce=Fe!==null&&Te[Fe],tt=Fe!==null&&Te.null,It=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(tt)?tt:tt?[tt]:[]];return re(It)(Fe)}}function re(Te){return ae=Te,ce=0,Te.length===0?Y:j(Te[ce])}function j(Te){return De;function De(Fe){return O=q(),Ae=Te,Te.partial||(d.currentConstruct=Te),Te.name&&d.parser.constructs.disable.null.includes(Te.name)?Re():Te.tokenize.call(Z?Object.assign(Object.create(d),Z):d,m,be,Re)(Fe)}}function be(Te){return K(Ae,O),I}function Re(Te){return O.restore(),++ce<ae.length?j(ae[ce]):Y}}}function B(K,Z){K.resolveAll&&!u.includes(K)&&u.push(K),K.resolve&&Gn(d.events,Z,d.events.length-Z,K.resolve(d.events.slice(Z),d)),K.resolveTo&&(d.events=K.resolveTo(d.events,d))}function q(){const K=k(),Z=d.previous,ue=d.currentConstruct,he=d.events.length,I=Array.from(f);return{from:he,restore:Y};function Y(){a=K,d.previous=Z,d.currentConstruct=ue,d.events.length=he,f=I,A()}}function A(){a.line in l&&a.column<2&&(a.column=l[a.line],a.offset+=l[a.line]-1)}}function sT(e,n){const r=n.start._index,a=n.start._bufferIndex,l=n.end._index,u=n.end._bufferIndex;let c;if(r===l)c=[e[r].slice(a,u)];else{if(c=e.slice(r,l),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}u>0&&c.push(e[l].slice(0,u))}return c}function lT(e,n){let r=-1;const a=[];let l;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
94
- `;break}case-3:{c=`\r
95
- `;break}case-2:{c=n?" ":" ";break}case-1:{if(!n&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,a.push(c)}return a.join("")}function oT(e){const a={constructs:$x([iT,...(e||{}).extensions||[]]),content:l(_C),defined:[],document:l(EC),flow:l(FA),lazy:{},string:l(YA),text:l(VA)};return a;function l(u){return c;function c(f){return aT(a,u,f)}}}function uT(e){for(;!Xx(e););return e}const ob=/[\0\t\n\r]/g;function cT(){let e=1,n="",r=!0,a;return l;function l(u,c,f){const m=[];let d,y,g,b,w;for(u=n+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),g=0,n="",r&&(u.charCodeAt(0)===65279&&g++,r=void 0);g<u.length;){if(ob.lastIndex=g,d=ob.exec(u),b=d&&d.index!==void 0?d.index:u.length,w=u.charCodeAt(b),!d){n=u.slice(g);break}if(w===10&&g===b&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<b&&(m.push(u.slice(g,b)),e+=b-g),w){case 0:{m.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,m.push(-2);e++<y;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=b+1}return f&&(a&&m.push(-5),n&&m.push(n),m.push(null)),m}}const fT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function hT(e){return e.replace(fT,dT)}function dT(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return Gx(r.slice(u?2:1),u?16:10)}return Jd(r)||e}const t1={}.hasOwnProperty;function mT(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),pT(r)(uT(oT(r).document().write(cT()(e,n,!0))))}function pT(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(Mt),autolinkProtocol:q,autolinkEmail:q,atxHeading:u(Le),blockQuote:u(tt),characterEscape:q,characterReference:q,codeFenced:u(It),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(It,c),codeText:u(_e,c),codeTextData:q,data:q,codeFlowValue:q,definition:u(qe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(ge),hardBreakEscape:u(Ke),hardBreakTrailing:u(Ke),htmlFlow:u(kt,c),htmlFlowData:q,htmlText:u(kt,c),htmlTextData:q,image:u(bt),label:c,link:u(Mt),listItem:u(Ie),listItemValue:b,listOrdered:u(it,g),listUnordered:u(it),paragraph:u(ht),reference:j,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(Le),strong:u(Et),thematicBreak:u(ln)},exit:{atxHeading:m(),atxHeadingSequence:L,autolink:m(),autolinkEmail:Ce,autolinkProtocol:Fe,blockQuote:m(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:Re,characterReferenceMarkerNumeric:Re,characterReferenceValue:Te,characterReference:De,codeFenced:m(U),codeFencedFence:R,codeFencedFenceInfo:w,codeFencedFenceMeta:k,codeFlowValue:A,codeIndented:m(T),codeText:m(I),codeTextData:A,data:A,definition:m(),definitionDestinationString:le,definitionLabelString:F,definitionTitleString:V,emphasis:m(),hardBreakEscape:m(Z),hardBreakTrailing:m(Z),htmlFlow:m(ue),htmlFlowData:A,htmlText:m(he),htmlTextData:A,image:m(ae),label:Ae,labelText:ce,lineEnding:K,link:m(Y),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:be,resourceDestinationString:O,resourceTitleString:P,resource:re,setextHeading:m(B),setextHeadingLineSequence:J,setextHeadingText:D,strong:m(),thematicBreak:m()}};n1(n,(e||{}).mdastExtensions||[]);const r={};return a;function a(ie){let ve={type:"root",children:[]};const Ue={stack:[ve],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},Ve=[];let st=-1;for(;++st<ie.length;)if(ie[st][1].type==="listOrdered"||ie[st][1].type==="listUnordered")if(ie[st][0]==="enter")Ve.push(st);else{const tn=Ve.pop();st=l(ie,tn,st)}for(st=-1;++st<ie.length;){const tn=n[ie[st][0]];t1.call(tn,ie[st][1].type)&&tn[ie[st][1].type].call(Object.assign({sliceSerialize:ie[st][2].sliceSerialize},Ue),ie[st][1])}if(Ue.tokenStack.length>0){const tn=Ue.tokenStack[Ue.tokenStack.length-1];(tn[1]||ub).call(Ue,void 0,tn[0])}for(ve.position={start:Oi(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:Oi(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},st=-1;++st<n.transforms.length;)ve=n.transforms[st](ve)||ve;return ve}function l(ie,ve,Ue){let Ve=ve-1,st=-1,tn=!1,Sn,Vt,mt,Bt;for(;++Ve<=Ue;){const xe=ie[Ve];switch(xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xe[0]==="enter"?st++:st--,Bt=void 0;break}case"lineEndingBlank":{xe[0]==="enter"&&(Sn&&!Bt&&!st&&!mt&&(mt=Ve),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!st&&xe[0]==="enter"&&xe[1].type==="listItemPrefix"||st===-1&&xe[0]==="exit"&&(xe[1].type==="listUnordered"||xe[1].type==="listOrdered")){if(Sn){let Ge=Ve;for(Vt=void 0;Ge--;){const ut=ie[Ge];if(ut[1].type==="lineEnding"||ut[1].type==="lineEndingBlank"){if(ut[0]==="exit")continue;Vt&&(ie[Vt][1].type="lineEndingBlank",tn=!0),ut[1].type="lineEnding",Vt=Ge}else if(!(ut[1].type==="linePrefix"||ut[1].type==="blockQuotePrefix"||ut[1].type==="blockQuotePrefixWhitespace"||ut[1].type==="blockQuoteMarker"||ut[1].type==="listItemIndent"))break}mt&&(!Vt||mt<Vt)&&(Sn._spread=!0),Sn.end=Object.assign({},Vt?ie[Vt][1].start:xe[1].end),ie.splice(Vt||Ve,0,["exit",Sn,xe[2]]),Ve++,Ue++}if(xe[1].type==="listItemPrefix"){const Ge={type:"listItem",_spread:!1,start:Object.assign({},xe[1].start),end:void 0};Sn=Ge,ie.splice(Ve,0,["enter",Ge,xe[2]]),Ve++,Ue++,mt=void 0,Bt=!0}}}return ie[ve][1]._spread=tn,Ue}function u(ie,ve){return Ue;function Ue(Ve){f.call(this,ie(Ve),Ve),ve&&ve.call(this,Ve)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ie,ve,Ue){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([ve,Ue||void 0]),ie.position={start:Oi(ve.start),end:void 0}}function m(ie){return ve;function ve(Ue){ie&&ie.call(this,Ue),d.call(this,Ue)}}function d(ie,ve){const Ue=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==ie.type&&(ve?ve.call(this,ie,Ve[0]):(Ve[1]||ub).call(this,ie,Ve[0]));else throw new Error("Cannot close `"+ie.type+"` ("+Al({start:ie.start,end:ie.end})+"): it’s not open");Ue.position.end=Oi(ie.end)}function y(){return Vd(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(ie){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function w(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=ie}function k(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=ie}function R(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function U(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ie.replace(/(\r?\n|\r)$/g,"")}function F(ie){const ve=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=ve,Ue.identifier=br(this.sliceSerialize(ie)).toLowerCase()}function V(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ie}function le(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ie}function L(ie){const ve=this.stack[this.stack.length-1];if(!ve.depth){const Ue=this.sliceSerialize(ie).length;ve.depth=Ue}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function J(ie){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function q(ie){const Ue=this.stack[this.stack.length-1].children;let Ve=Ue[Ue.length-1];(!Ve||Ve.type!=="text")&&(Ve=He(),Ve.position={start:Oi(ie.start),end:void 0},Ue.push(Ve)),this.stack.push(Ve)}function A(ie){const ve=this.stack.pop();ve.value+=this.sliceSerialize(ie),ve.position.end=Oi(ie.end)}function K(ie){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ue=ve.children[ve.children.length-1];Ue.position.end=Oi(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(ve.type)&&(q.call(this,ie),A.call(this,ie))}function Z(){this.data.atHardBreak=!0}function ue(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ie}function he(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ie}function I(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ie}function Y(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=ve,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function ae(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=ve,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function ce(ie){const ve=this.sliceSerialize(ie),Ue=this.stack[this.stack.length-2];Ue.label=hT(ve),Ue.identifier=br(ve).toLowerCase()}function Ae(){const ie=this.stack[this.stack.length-1],ve=this.resume(),Ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ue.type==="link"){const Ve=ie.children;Ue.children=Ve}else Ue.alt=ve}function O(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ie}function P(){const ie=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ie}function re(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function be(ie){const ve=this.resume(),Ue=this.stack[this.stack.length-1];Ue.label=ve,Ue.identifier=br(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function Re(ie){this.data.characterReferenceType=ie.type}function Te(ie){const ve=this.sliceSerialize(ie),Ue=this.data.characterReferenceType;let Ve;Ue?(Ve=Gx(ve,Ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=Jd(ve);const st=this.stack[this.stack.length-1];st.value+=Ve}function De(ie){const ve=this.stack.pop();ve.position.end=Oi(ie.end)}function Fe(ie){A.call(this,ie);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(ie)}function Ce(ie){A.call(this,ie);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(ie)}function tt(){return{type:"blockquote",children:[]}}function It(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ge(){return{type:"emphasis",children:[]}}function Le(){return{type:"heading",depth:0,children:[]}}function Ke(){return{type:"break"}}function kt(){return{type:"html",value:""}}function bt(){return{type:"image",title:null,url:"",alt:null}}function Mt(){return{type:"link",title:null,url:"",children:[]}}function it(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[]}}function Ie(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[]}}function ht(){return{type:"paragraph",children:[]}}function Et(){return{type:"strong",children:[]}}function He(){return{type:"text",value:""}}function ln(){return{type:"thematicBreak"}}}function Oi(e){return{line:e.line,column:e.column,offset:e.offset}}function n1(e,n){let r=-1;for(;++r<n.length;){const a=n[r];Array.isArray(a)?n1(e,a):gT(e,a)}}function gT(e,n){let r;for(r in n)if(t1.call(n,r))switch(r){case"canContainEols":{const a=n[r];a&&e[r].push(...a);break}case"transforms":{const a=n[r];a&&e[r].push(...a);break}case"enter":case"exit":{const a=n[r];a&&Object.assign(e[r],a);break}}}function ub(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Al({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Al({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Al({start:n.start,end:n.end})+") is still open")}function yT(e){const n=this;n.parser=r;function r(a){return mT(a,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function bT(e,n){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,r),e.applyData(n,r)}function xT(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
96
- `}]}function vT(e,n){const r=n.value?n.value+`
97
- `:"",a={},l=n.lang?n.lang.split(/\s+/):[];l.length>0&&(a.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:a,children:[{type:"text",value:r}]};return n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function wT(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ST(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function _T(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(n.identifier).toUpperCase(),l=xs(a.toLowerCase()),u=e.footnoteOrder.indexOf(a);let c,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=u+1,f+=1,e.footnoteCounts.set(a,f);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+l,id:r+"fnref-"+l+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(n,m);const d={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,d),e.applyData(n,d)}function kT(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ET(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function r1(e,n){const r=n.referenceType;let a="]";if(r==="collapsed"?a+="[]":r==="full"&&(a+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+a}];const l=e.all(n),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=a:l.push({type:"text",value:a}),l}function CT(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return r1(e,n);const l={src:xs(a.url||""),alt:n.alt};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(n,u),e.applyData(n,u)}function AT(e,n){const r={src:xs(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,a),e.applyData(n,a)}function TT(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const a={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,a),e.applyData(n,a)}function jT(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return r1(e,n);const l={href:xs(a.url||"")};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"a",properties:l,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function NT(e,n){const r={href:xs(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const a={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function OT(e,n,r){const a=e.all(n),l=r?RT(r):i1(n),u={},c=[];if(typeof n.checked=="boolean"){const y=a[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const y=a[f];(l||f!==0||y.type!=="element"||y.tagName!=="p")&&c.push({type:"text",value:`
98
- `}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const m=a[a.length-1];m&&(l||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
99
- `});const d={type:"element",tagName:"li",properties:u,children:c};return e.patch(n,d),e.applyData(n,d)}function RT(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let a=-1;for(;!n&&++a<r.length;)n=i1(r[a])}return n}function i1(e){const n=e.spread;return n??e.children.length>1}function MT(e,n){const r={},a=e.all(n);let l=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++l<a.length;){const c=a[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(a,!0)};return e.patch(n,u),e.applyData(n,u)}function DT(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function zT(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function LT(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function UT(e,n){const r=e.all(n),a=r.shift(),l=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(n.children[0],c),l.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Fd(n.children[1]),m=Ux(n.children[n.children.length-1]);f&&m&&(c.position={start:f,end:m}),l.push(c)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(n,u),e.applyData(n,u)}function BT(e,n,r){const a=r?r.children:void 0,u=(a?a.indexOf(n):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,f=c?c.length:n.children.length;let m=-1;const d=[];for(;++m<f;){const g=n.children[m],b={},w=c?c[m]:void 0;w&&(b.align=w);let k={type:"element",tagName:u,properties:b,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),d.push(k)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,y),e.applyData(n,y)}function PT(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const cb=9,fb=32;function HT(e){const n=String(e),r=/\r?\n|\r/g;let a=r.exec(n),l=0;const u=[];for(;a;)u.push(hb(n.slice(l,a.index),l>0,!0),a[0]),l=a.index+a[0].length,a=r.exec(n);return u.push(hb(n.slice(l),l>0,!1)),u.join("")}function hb(e,n,r){let a=0,l=e.length;if(n){let u=e.codePointAt(a);for(;u===cb||u===fb;)a++,u=e.codePointAt(a)}if(r){let u=e.codePointAt(l-1);for(;u===cb||u===fb;)l--,u=e.codePointAt(l-1)}return l>a?e.slice(a,l):""}function qT(e,n){const r={type:"text",value:HT(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function IT(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const FT={blockquote:bT,break:xT,code:vT,delete:wT,emphasis:ST,footnoteReference:_T,heading:kT,html:ET,imageReference:CT,image:AT,inlineCode:TT,linkReference:jT,link:NT,listItem:OT,list:MT,paragraph:DT,root:zT,strong:LT,table:UT,tableCell:PT,tableRow:BT,text:qT,thematicBreak:IT,toml:hu,yaml:hu,definition:hu,footnoteDefinition:hu};function hu(){}const a1=-1,Ju=0,jl=1,zu=2,Kd=3,Qd=4,Zd=5,Wd=6,s1=7,l1=8,db=typeof self=="object"?self:globalThis,$T=(e,n)=>{const r=(l,u)=>(e.set(u,l),l),a=l=>{if(e.has(l))return e.get(l);const[u,c]=n[l];switch(u){case Ju:case a1:return r(c,l);case jl:{const f=r([],l);for(const m of c)f.push(a(m));return f}case zu:{const f=r({},l);for(const[m,d]of c)f[a(m)]=a(d);return f}case Kd:return r(new Date(c),l);case Qd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case Zd:{const f=r(new Map,l);for(const[m,d]of c)f.set(a(m),a(d));return f}case Wd:{const f=r(new Set,l);for(const m of c)f.add(a(m));return f}case s1:{const{name:f,message:m}=c;return r(new db[f](m),l)}case l1: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 db[u](c),l)};return a},mb=e=>$T(new Map,e)(0),Za="",{toString:GT}={},{keys:YT}=Object,bl=e=>{const n=typeof e;if(n!=="object"||!e)return[Ju,n];const r=GT.call(e).slice(8,-1);switch(r){case"Array":return[jl,Za];case"Object":return[zu,Za];case"Date":return[Kd,Za];case"RegExp":return[Qd,Za];case"Map":return[Zd,Za];case"Set":return[Wd,Za];case"DataView":return[jl,r]}return r.includes("Array")?[jl,r]:r.includes("Error")?[s1,r]:[zu,r]},du=([e,n])=>e===Ju&&(n==="function"||n==="symbol"),VT=(e,n,r,a)=>{const l=(c,f)=>{const m=a.push(c)-1;return r.set(f,m),m},u=c=>{if(r.has(c))return r.get(c);let[f,m]=bl(c);switch(f){case Ju:{let y=c;switch(m){case"bigint":f=l1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([a1],c)}return l([f,y],c)}case jl:{if(m){let b=c;return m==="DataView"?b=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(c)),l([m,[...b]],c)}const y=[],g=l([f,y],c);for(const b of c)y.push(u(b));return g}case zu:{if(m)switch(m){case"BigInt":return l([m,c.toString()],c);case"Boolean":case"Number":case"String":return l([m,c.valueOf()],c)}if(n&&"toJSON"in c)return u(c.toJSON());const y=[],g=l([f,y],c);for(const b of YT(c))(e||!du(bl(c[b])))&&y.push([u(b),u(c[b])]);return g}case Kd:return l([f,c.toISOString()],c);case Qd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Zd:{const y=[],g=l([f,y],c);for(const[b,w]of c)(e||!(du(bl(b))||du(bl(w))))&&y.push([u(b),u(w)]);return g}case Wd:{const y=[],g=l([f,y],c);for(const b of c)(e||!du(bl(b)))&&y.push(u(b));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},pb=(e,{json:n,lossy:r}={})=>{const a=[];return VT(!(n||r),!!n,new Map,a)(e),a},Lu=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?mb(pb(e,n)):structuredClone(e):(e,n)=>mb(pb(e,n));function JT(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function XT(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function KT(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||JT,a=e.options.footnoteBackLabel||XT,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[m]);if(!d)continue;const y=e.all(d),g=String(d.identifier).toUpperCase(),b=xs(g.toLowerCase());let w=0;const k=[],R=e.footnoteCounts.get(g);for(;R!==void 0&&++w<=R;){k.length>0&&k.push({type:"text",value:" "});let F=typeof r=="string"?r:r(m,w);typeof F=="string"&&(F={type:"text",value:F}),k.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+b+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,w),className:["data-footnote-backref"]},children:Array.isArray(F)?F:[F]})}const U=y[y.length-1];if(U&&U.type==="element"&&U.tagName==="p"){const F=U.children[U.children.length-1];F&&F.type==="text"?F.value+=" ":U.children.push({type:"text",value:" "}),U.children.push(...k)}else y.push(...k);const T={type:"element",tagName:"li",properties:{id:n+"fn-"+b},children:e.wrap(y,!0)};e.patch(d,T),f.push(T)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Lu(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
100
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
101
- `}]}}const Xu=(function(e){if(e==null)return ej;if(typeof e=="function")return Ku(e);if(typeof e=="object")return Array.isArray(e)?QT(e):ZT(e);if(typeof e=="string")return WT(e);throw new Error("Expected function, string, or object as test")});function QT(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Xu(e[r]);return Ku(a);function a(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function ZT(e){const n=e;return Ku(r);function r(a){const l=a;let u;for(u in e)if(l[u]!==n[u])return!1;return!0}}function WT(e){return Ku(n);function n(r){return r&&r.type===e}}function Ku(e){return n;function n(r,a,l){return!!(tj(r)&&e.call(this,r,typeof a=="number"?a:void 0,l||void 0))}}function ej(){return!0}function tj(e){return e!==null&&typeof e=="object"&&"type"in e}const o1=[],nj=!0,xd=!1,rj="skip";function u1(e,n,r,a){let l;typeof n=="function"&&typeof r!="function"?(a=r,r=n):l=n;const u=Xu(l),c=a?-1:1;f(e,void 0,[])();function f(m,d,y){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return b;function b(){let w=o1,k,R,U;if((!n||u(m,d,y[y.length-1]||void 0))&&(w=ij(r(m,y)),w[0]===xd))return w;if("children"in m&&m.children){const T=m;if(T.children&&w[0]!==rj)for(R=(a?T.children.length:-1)+c,U=y.concat(T);R>-1&&R<T.children.length;){const F=T.children[R];if(k=f(F,R,U)(),k[0]===xd)return k;R=typeof k[1]=="number"?k[1]:R+c}}return w}}}function ij(e){return Array.isArray(e)?e:typeof e=="number"?[nj,e]:e==null?o1:[e]}function em(e,n,r,a){let l,u,c;typeof n=="function"&&typeof r!="function"?(u=void 0,c=n,l=r):(u=n,c=r,l=a),u1(e,u,f,l);function f(m,d){const y=d[d.length-1],g=y?y.children.indexOf(m):void 0;return c(m,g,y)}}const vd={}.hasOwnProperty,aj={};function sj(e,n){const r=n||aj,a=new Map,l=new Map,u=new Map,c={...FT,...r.handlers},f={all:d,applyData:oj,definitionById:a,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:lj,wrap:cj};return em(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?a:l,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),f;function m(y,g){const b=y.type,w=f.handlers[b];if(vd.call(f.handlers,b)&&w)return w(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in y){const{children:R,...U}=y,T=Lu(U);return T.children=f.all(y),T}return Lu(y)}return(f.options.unknownHandler||uj)(f,y,g)}function d(y){const g=[];if("children"in y){const b=y.children;let w=-1;for(;++w<b.length;){const k=f.one(b[w],y);if(k){if(w&&b[w-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=gb(k.value)),!Array.isArray(k)&&k.type==="element")){const R=k.children[0];R&&R.type==="text"&&(R.value=gb(R.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function lj(e,n){e.position&&(n.position=XE(e))}function oj(e,n){let r=n;if(e&&e.data){const a=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof a=="string")if(r.type==="element")r.tagName=a;else{const c="children"in r?r.children:[r];r={type:"element",tagName:a,properties:{},children:c}}r.type==="element"&&u&&Object.assign(r.properties,Lu(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function uj(e,n){const r=n.data||{},a="value"in n&&!(vd.call(r,"hProperties")||vd.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function cj(e,n){const r=[];let a=-1;for(n&&r.push({type:"text",value:`
102
- `});++a<e.length;)a&&r.push({type:"text",value:`
103
- `}),r.push(e[a]);return n&&e.length>0&&r.push({type:"text",value:`
104
- `}),r}function gb(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function yb(e,n){const r=sj(e,n),a=r.one(e,void 0),l=KT(r),u=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
105
- `},l),u}function fj(e,n){return e&&"run"in e?async function(r,a){const l=yb(r,{file:a,...n});await e.run(l,a)}:function(r,a){return yb(r,{file:a,...e||n})}}function bb(e){if(e)throw e}var Uh,xb;function hj(){if(xb)return Uh;xb=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):n.call(d)==="[object Array]"},u=function(d){if(!d||n.call(d)!=="[object Object]")return!1;var y=e.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!y&&!g)return!1;var b;for(b in d);return typeof b>"u"||e.call(d,b)},c=function(d,y){r&&y.name==="__proto__"?r(d,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):d[y.name]=y.newValue},f=function(d,y){if(y==="__proto__")if(e.call(d,y)){if(a)return a(d,y).value}else return;return d[y]};return Uh=function m(){var d,y,g,b,w,k,R=arguments[0],U=1,T=arguments.length,F=!1;for(typeof R=="boolean"&&(F=R,R=arguments[1]||{},U=2),(R==null||typeof R!="object"&&typeof R!="function")&&(R={});U<T;++U)if(d=arguments[U],d!=null)for(y in d)g=f(R,y),b=f(d,y),R!==b&&(F&&b&&(u(b)||(w=l(b)))?(w?(w=!1,k=g&&l(g)?g:[]):k=g&&u(g)?g:{},c(R,{name:y,newValue:m(F,k,b)})):typeof b<"u"&&c(R,{name:y,newValue:b}));return R},Uh}var dj=hj();const Bh=zb(dj);function wd(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function mj(){const e=[],n={run:r,use:a};return n;function r(...l){let u=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...l);function f(m,...d){const y=e[++u];let g=-1;if(m){c(m);return}for(;++g<l.length;)(d[g]===null||d[g]===void 0)&&(d[g]=l[g]);l=d,y?pj(y,f)(...d):c(null,...d)}}function a(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),n}}function pj(e,n){let r;return a;function a(...c){const f=e.length>c.length;let m;f&&c.push(l);try{m=e.apply(this,c)}catch(d){const y=d;if(f&&r)throw y;return l(y)}f||(m&&m.then&&typeof m.then=="function"?m.then(u,l):m instanceof Error?l(m):u(m))}function l(c,...f){r||(r=!0,n(c,...f))}function u(c){l(null,c)}}const kr={basename:gj,dirname:yj,extname:bj,join:xj,sep:"/"};function gj(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Gl(e);let r=0,a=-1,l=e.length,u;if(n===void 0||n.length===0||n.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else a<0&&(u=!0,a=l+1);return a<0?"":e.slice(r,a)}if(n===e)return"";let c=-1,f=n.length-1;for(;l--;)if(e.codePointAt(l)===47){if(u){r=l+1;break}}else c<0&&(u=!0,c=l+1),f>-1&&(e.codePointAt(l)===n.codePointAt(f--)?f<0&&(a=l):(f=-1,a=c));return r===a?a=c:a<0&&(a=e.length),e.slice(r,a)}function yj(e){if(Gl(e),e.length===0)return".";let n=-1,r=e.length,a;for(;--r;)if(e.codePointAt(r)===47){if(a){n=r;break}}else a||(a=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function bj(e){Gl(e);let n=e.length,r=-1,a=0,l=-1,u=0,c;for(;n--;){const f=e.codePointAt(n);if(f===47){if(c){a=n+1;break}continue}r<0&&(c=!0,r=n+1),f===46?l<0?l=n:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||r<0||u===0||u===1&&l===r-1&&l===a+1?"":e.slice(l,r)}function xj(...e){let n=-1,r;for(;++n<e.length;)Gl(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":vj(r)}function vj(e){Gl(e);const n=e.codePointAt(0)===47;let r=wj(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function wj(e,n){let r="",a=0,l=-1,u=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(l===c-1||u===1))if(l!==c-1&&u===2){if(r.length<2||a!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",a=0):(r=r.slice(0,m),a=r.length-1-r.lastIndexOf("/")),l=c,u=0;continue}}else if(r.length>0){r="",a=0,l=c,u=0;continue}}n&&(r=r.length>0?r+"/..":"..",a=2)}else r.length>0?r+="/"+e.slice(l+1,c):r=e.slice(l+1,c),a=c-l-1;l=c,u=0}else f===46&&u>-1?u++:u=-1}return r}function Gl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Sj={cwd:_j};function _j(){return"/"}function Sd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function kj(e){if(typeof e=="string")e=new URL(e);else if(!Sd(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Ej(e)}function Ej(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const a=n.codePointAt(r+2);if(a===70||a===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(n)}const Ph=["history","path","basename","stem","extname","dirname"];class c1{constructor(n){let r;n?Sd(n)?r={path:n}:typeof n=="string"||Cj(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":Sj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Ph.length;){const u=Ph[a];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)Ph.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?kr.basename(this.path):void 0}set basename(n){qh(n,"basename"),Hh(n,"basename"),this.path=kr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?kr.dirname(this.path):void 0}set dirname(n){vb(this.basename,"dirname"),this.path=kr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?kr.extname(this.path):void 0}set extname(n){if(Hh(n,"extname"),vb(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=kr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Sd(n)&&(n=kj(n)),qh(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?kr.basename(this.path,this.extname):void 0}set stem(n){qh(n,"stem"),Hh(n,"stem"),this.path=kr.join(this.dirname||"",n+(this.extname||""))}fail(n,r,a){const l=this.message(n,r,a);throw l.fatal=!0,l}info(n,r,a){const l=this.message(n,r,a);return l.fatal=void 0,l}message(n,r,a){const l=new pn(n,r,a);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function Hh(e,n){if(e&&e.includes(kr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+kr.sep+"`")}function qh(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function vb(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function Cj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Aj=(function(e){const a=this.constructor.prototype,l=a[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,a),u}),Tj={}.hasOwnProperty;class tm extends Aj{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=mj()}copy(){const n=new tm;let r=-1;for(;++r<this.attachers.length;){const a=this.attachers[r];n.use(...a)}return n.data(Bh(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?($h("data",this.frozen),this.namespace[n]=r,this):Tj.call(this.namespace,n)&&this.namespace[n]||void 0:n?($h("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const l=r.call(n,...a);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=mu(n),a=this.parser||this.Parser;return Ih("parse",a),a(String(r),r)}process(n,r){const a=this;return this.freeze(),Ih("process",this.parser||this.Parser),Fh("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=mu(n),m=a.parse(f);a.run(m,f,function(y,g,b){if(y||!g||!b)return d(y);const w=g,k=a.stringify(w,b);Oj(k)?b.value=k:b.result=k,d(y,b)});function d(y,g){y||!g?c(y):u?u(g):r(void 0,g)}}}processSync(n){let r=!1,a;return this.freeze(),Ih("processSync",this.parser||this.Parser),Fh("processSync",this.compiler||this.Compiler),this.process(n,l),Sb("processSync","process",r),a;function l(u,c){r=!0,bb(u),a=c}}run(n,r,a){wb(n),this.freeze();const l=this.transformers;return!a&&typeof r=="function"&&(a=r,r=void 0),a?u(void 0,a):new Promise(u);function u(c,f){const m=mu(r);l.run(n,m,d);function d(y,g,b){const w=g||n;y?f(y):c?c(w):a(void 0,w,b)}}}runSync(n,r){let a=!1,l;return this.run(n,r,u),Sb("runSync","run",a),l;function u(c,f){bb(c),l=f,a=!0}}stringify(n,r){this.freeze();const a=mu(r),l=this.compiler||this.Compiler;return Fh("stringify",l),wb(n),l(n,a)}use(n,...r){const a=this.attachers,l=this.namespace;if($h("use",this.frozen),n!=null)if(typeof n=="function")m(n,r);else if(typeof n=="object")Array.isArray(n)?f(n):c(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function u(d){if(typeof d=="function")m(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[y,...g]=d;m(y,g)}else c(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function c(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(d.plugins),d.settings&&(l.settings=Bh(!0,l.settings,d.settings))}function f(d){let y=-1;if(d!=null)if(Array.isArray(d))for(;++y<d.length;){const g=d[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function m(d,y){let g=-1,b=-1;for(;++g<a.length;)if(a[g][0]===d){b=g;break}if(b===-1)a.push([d,...y]);else if(y.length>0){let[w,...k]=y;const R=a[b][1];wd(R)&&wd(w)&&(w=Bh(!0,R,w)),a[b]=[d,w,...k]}}}}const jj=new tm().freeze();function Ih(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Fh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $h(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function wb(e){if(!wd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Sb(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function mu(e){return Nj(e)?e:new c1(e)}function Nj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Oj(e){return typeof e=="string"||Rj(e)}function Rj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Mj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_b=[],kb={allowDangerousHtml:!0},Dj=/^(https?|ircs?|mailto|xmpp)$/i,zj=[{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 Eb(e){const n=Lj(e),r=Uj(e);return Bj(n.runSync(n.parse(r),r),e)}function Lj(e){const n=e.rehypePlugins||_b,r=e.remarkPlugins||_b,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kb}:kb;return jj().use(yT).use(r).use(fj,a).use(n)}function Uj(e){const n=e.children||"",r=new c1;return typeof n=="string"&&(r.value=n),r}function Bj(e,n){const r=n.allowedElements,a=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||Pj;for(const y of zj)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+Mj+y.id,void 0);return em(e,d),eC(e,{Fragment:v.Fragment,components:l,ignoreInvalidStyle:!0,jsx:v.jsx,jsxs:v.jsxs,passKeys:!0,passNode:!0});function d(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return c?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let w;for(w in Dh)if(Object.hasOwn(Dh,w)&&Object.hasOwn(y.properties,w)){const k=y.properties[w],R=Dh[w];(R===null||R.includes(y.tagName))&&(y.properties[w]=m(String(k||""),w,y))}}if(y.type==="element"){let w=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!w&&a&&typeof g=="number"&&(w=!a(y,g,b)),w&&b&&typeof g=="number")return f&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function Pj(e){const n=e.indexOf(":"),r=e.indexOf("?"),a=e.indexOf("#"),l=e.indexOf("/");return n===-1||l!==-1&&n>l||r!==-1&&n>r||a!==-1&&n>a||Dj.test(e.slice(0,n))?e:""}function Cb(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let a=0,l=r.indexOf(n);for(;l!==-1;)a++,l=r.indexOf(n,l+n.length);return a}function Hj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function f1(e,n,r){const l=Xu((r||{}).ignore||[]),u=qj(n);let c=-1;for(;++c<u.length;)u1(e,"text",f);function f(d,y){let g=-1,b;for(;++g<y.length;){const w=y[g],k=b?b.children:void 0;if(l(w,k?k.indexOf(w):void 0,b))return;b=w}if(b)return m(d,y)}function m(d,y){const g=y[y.length-1],b=u[c][0],w=u[c][1];let k=0;const U=g.children.indexOf(d);let T=!1,F=[];b.lastIndex=0;let V=b.exec(d.value);for(;V;){const le=V.index,L={index:V.index,input:V.input,stack:[...y,d]};let D=w(...V,L);if(typeof D=="string"&&(D=D.length>0?{type:"text",value:D}:void 0),D===!1?b.lastIndex=le+1:(k!==le&&F.push({type:"text",value:d.value.slice(k,le)}),Array.isArray(D)?F.push(...D):D&&F.push(D),k=le+V[0].length,T=!0),!b.global)break;V=b.exec(d.value)}return T?(k<d.value.length&&F.push({type:"text",value:d.value.slice(k)}),g.children.splice(U,1,...F)):F=[d],U+F.length}}function qj(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<r.length;){const l=r[a];n.push([Ij(l[0]),Fj(l[1])])}return n}function Ij(e){return typeof e=="string"?new RegExp(Hj(e),"g"):e}function Fj(e){return typeof e=="function"?e:function(){return e}}const Gh="phrasing",Yh=["autolink","link","image","label"];function $j(){return{transforms:[Qj],enter:{literalAutolink:Yj,literalAutolinkEmail:Vh,literalAutolinkHttp:Vh,literalAutolinkWww:Vh},exit:{literalAutolink:Kj,literalAutolinkEmail:Xj,literalAutolinkHttp:Vj,literalAutolinkWww:Jj}}}function Gj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Gh,notInConstruct:Yh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Gh,notInConstruct:Yh},{character:":",before:"[ps]",after:"\\/",inConstruct:Gh,notInConstruct:Yh}]}}function Yj(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Vh(e){this.config.enter.autolinkProtocol.call(this,e)}function Vj(e){this.config.exit.autolinkProtocol.call(this,e)}function Jj(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function Xj(e){this.config.exit.autolinkEmail.call(this,e)}function Kj(e){this.exit(e)}function Qj(e){f1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Zj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Wj]],{ignore:["link","linkReference"]})}function Zj(e,n,r,a,l){let u="";if(!h1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!e3(r)))return!1;const c=t3(r+a);if(!c[0])return!1;const f={type:"link",title:null,url:u+n+c[0],children:[{type:"text",value:n+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function Wj(e,n,r,a){return!h1(a,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function e3(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function t3(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],a=r.indexOf(")");const l=Cb(e,"(");let u=Cb(e,")");for(;a!==-1&&l>u;)e+=r.slice(0,a+1),r=r.slice(a+1),a=r.indexOf(")"),u++;return[e,r]}function h1(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ha(r)||Yu(r))&&(!n||r!==47)}d1.peek=c3;function n3(){this.buffer()}function r3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function i3(){this.buffer()}function a3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function s3(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=br(this.sliceSerialize(e)).toLowerCase(),r.label=n}function l3(e){this.exit(e)}function o3(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=br(this.sliceSerialize(e)).toLowerCase(),r.label=n}function u3(e){this.exit(e)}function c3(){return"["}function d1(e,n,r,a){const l=r.createTracker(a);let u=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return u+=l.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),c(),u+=l.move("]"),u}function f3(){return{enter:{gfmFootnoteCallString:n3,gfmFootnoteCall:r3,gfmFootnoteDefinitionLabelString:i3,gfmFootnoteDefinition:a3},exit:{gfmFootnoteCallString:s3,gfmFootnoteCall:l3,gfmFootnoteDefinitionLabelString:o3,gfmFootnoteDefinition:u3}}}function h3(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:d1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(a,l,u,c){const f=u.createTracker(c);let m=f.move("[^");const d=u.enter("footnoteDefinition"),y=u.enter("label");return m+=f.move(u.safe(u.associationId(a),{before:m,after:"]"})),y(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((n?`
106
- `:" ")+u.indentLines(u.containerFlow(a,f.current()),n?m1:d3))),d(),m}}function d3(e,n,r){return n===0?e:m1(e,n,r)}function m1(e,n,r){return(r?"":" ")+e}const m3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];p1.peek=x3;function p3(){return{canContainEols:["delete"],enter:{strikethrough:y3},exit:{strikethrough:b3}}}function g3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:m3}],handlers:{delete:p1}}}function y3(e){this.enter({type:"delete",children:[]},e)}function b3(e){this.exit(e)}function p1(e,n,r,a){const l=r.createTracker(a),u=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(e,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),u(),c}function x3(){return"~"}function v3(e){return e.length}function w3(e,n){const r=n||{},a=(r.align||[]).concat(),l=r.stringLength||v3,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const R=[],U=[];let T=-1;for(e[y].length>d&&(d=e[y].length);++T<e[y].length;){const F=S3(e[y][T]);if(r.alignDelimiters!==!1){const V=l(F);U[T]=V,(m[T]===void 0||V>m[T])&&(m[T]=V)}R.push(F)}c[y]=R,f[y]=U}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<d;)u[g]=Ab(a[g]);else{const R=Ab(a);for(;++g<d;)u[g]=R}g=-1;const b=[],w=[];for(;++g<d;){const R=u[g];let U="",T="";R===99?(U=":",T=":"):R===108?U=":":R===114&&(T=":");let F=r.alignDelimiters===!1?1:Math.max(1,m[g]-U.length-T.length);const V=U+"-".repeat(F)+T;r.alignDelimiters!==!1&&(F=U.length+F+T.length,F>m[g]&&(m[g]=F),w[g]=F),b[g]=V}c.splice(1,0,b),f.splice(1,0,w),y=-1;const k=[];for(;++y<c.length;){const R=c[y],U=f[y];g=-1;const T=[];for(;++g<d;){const F=R[g]||"";let V="",le="";if(r.alignDelimiters!==!1){const L=m[g]-(U[g]||0),D=u[g];D===114?V=" ".repeat(L):D===99?L%2?(V=" ".repeat(L/2+.5),le=" ".repeat(L/2-.5)):(V=" ".repeat(L/2),le=V):le=" ".repeat(L)}r.delimiterStart!==!1&&!g&&T.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&F==="")&&(r.delimiterStart!==!1||g)&&T.push(" "),r.alignDelimiters!==!1&&T.push(V),T.push(F),r.alignDelimiters!==!1&&T.push(le),r.padding!==!1&&T.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&T.push("|")}k.push(r.delimiterEnd===!1?T.join("").replace(/ +$/,""):T.join(""))}return k.join(`
107
- `)}function S3(e){return e==null?"":String(e)}function Ab(e){const n=typeof e=="string"?e.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function _3(e,n,r,a){const l=r.enter("blockquote"),u=r.createTracker(a);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(e,u.current()),k3);return l(),c}function k3(e,n,r){return">"+(r?"":" ")+e}function E3(e,n){return Tb(e,n.inConstruct,!0)&&!Tb(e,n.notInConstruct,!1)}function Tb(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let a=-1;for(;++a<n.length;)if(e.includes(n[a]))return!0;return!1}function jb(e,n,r,a){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
108
- `&&E3(r.stack,r.unsafe[l]))return/[ \t]/.test(a.before)?"":" ";return`\\
109
- `}function C3(e,n){const r=String(e);let a=r.indexOf(n),l=a,u=0,c=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===l?++u>c&&(c=u):u=1,l=a+n.length,a=r.indexOf(n,l);return c}function A3(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function T3(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function j3(e,n,r,a){const l=T3(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(A3(e,r)){const g=r.enter("codeIndented"),b=r.indentLines(u,N3);return g(),b}const f=r.createTracker(a),m=l.repeat(Math.max(C3(u,l)+1,3)),d=r.enter("codeFenced");let y=f.move(m);if(e.lang){const g=r.enter(`codeFencedLang${c}`);y+=f.move(r.safe(e.lang,{before:y,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${c}`);y+=f.move(" "),y+=f.move(r.safe(e.meta,{before:y,after:`
110
- `,encode:["`"],...f.current()})),g()}return y+=f.move(`
111
- `),u&&(y+=f.move(u+`
112
- `)),y+=f.move(m),d(),y}function N3(e,n,r){return(r?"":" ")+e}function nm(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function O3(e,n,r,a){const l=nm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const m=r.createTracker(a);let d=m.move("[");return d+=m.move(r.safe(r.associationId(e),{before:d,after:"]",...m.current()})),d+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":`
113
- `,...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),c(),d}function R3(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function Ll(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Uu(e,n,r){const a=ms(e),l=ms(n);return a===void 0?l===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}g1.peek=M3;function g1(e,n,r,a){const l=R3(r),u=r.enter("emphasis"),c=r.createTracker(a),f=c.move(l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Uu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=Ll(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Uu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Ll(g));const w=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+w}function M3(e,n,r){return r.options.emphasis||"*"}function D3(e,n){let r=!1;return em(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return r=!0,xd}),!!((!e.depth||e.depth<3)&&Vd(e)&&(n.options.setext||r))}function z3(e,n,r,a){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(a);if(D3(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),b=r.containerPhrasing(e,{...u.current(),before:`
114
- `,after:`
115
- `});return g(),y(),b+`
116
- `+(l===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
117
- `))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),m=r.enter("phrasing");u.move(c+" ");let d=r.containerPhrasing(e,{before:"# ",after:`
118
- `,...u.current()});return/^[\t ]/.test(d)&&(d=Ll(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}y1.peek=L3;function y1(e){return e.value||""}function L3(){return"<"}b1.peek=U3;function b1(e,n,r,a){const l=nm(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("image");let f=r.enter("label");const m=r.createTracker(a);let d=m.move("![");return d+=m.move(r.safe(e.alt,{before:d,after:"]",...m.current()})),d+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),d+=m.move(")"),c(),d}function U3(){return"!"}x1.peek=B3;function x1(e,n,r,a){const l=e.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(a);let m=f.move("![");const d=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function B3(){return"!"}v1.peek=P3;function v1(e,n,r){let a=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(a);)l+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++u<r.unsafe.length;){const c=r.unsafe[u],f=r.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(a);){let d=m.index;a.charCodeAt(d)===10&&a.charCodeAt(d-1)===13&&d--,a=a.slice(0,d)+" "+a.slice(m.index+1)}}return l+a+l}function P3(){return"`"}function w1(e,n){const r=Vd(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}S1.peek=H3;function S1(e,n,r,a){const l=nm(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(a);let f,m;if(w1(e,r)){const y=r.stack;r.stack=[],f=r.enter("autolink");let g=c.move("<");return g+=c.move(r.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),f(),r.stack=y,g}f=r.enter("link"),m=r.enter("label");let d=c.move("[");return d+=c.move(r.containerPhrasing(e,{before:d,after:"](",...c.current()})),d+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(r.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(m=r.enter("destinationRaw"),d+=c.move(r.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=r.enter(`title${u}`),d+=c.move(" "+l),d+=c.move(r.safe(e.title,{before:d,after:l,...c.current()})),d+=c.move(l),m()),d+=c.move(")"),f(),d}function H3(e,n,r){return w1(e,r)?"<":"["}_1.peek=q3;function _1(e,n,r,a){const l=e.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(a);let m=f.move("[");const d=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(d+"]["),c();const y=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return c(),r.stack=y,u(),l==="full"||!d||d!==g?m+=f.move(g+"]"):l==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function q3(){return"["}function rm(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function I3(e){const n=rm(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function F3(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function k1(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function $3(e,n,r,a){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?F3(r):rm(r);const f=e.ordered?c==="."?")":".":I3(r);let m=n&&r.bulletLastUsed?c===r.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&y&&(!y.children||!y.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),k1(r)===c&&y){let g=-1;for(;++g<e.children.length;){const b=e.children[g];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),r.bulletCurrent=c;const d=r.containerFlow(e,a);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),d}function G3(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function Y3(e,n,r,a){const l=G3(r);let u=r.bulletCurrent||rm(r);n&&n.type==="list"&&n.ordered&&(u=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+u);let c=u.length+1;(l==="tab"||l==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=r.createTracker(a);f.move(u+" ".repeat(c-u.length)),f.shift(c);const m=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,f.current()),y);return m(),d;function y(g,b,w){return b?(w?"":" ".repeat(c))+g:(w?u:u+" ".repeat(c-u.length))+g}}function V3(e,n,r,a){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,a);return u(),l(),c}const J3=Xu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function X3(e,n,r,a){return(e.children.some(function(c){return J3(c)})?r.containerPhrasing:r.containerFlow).call(r,e,a)}function K3(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}E1.peek=Q3;function E1(e,n,r,a){const l=K3(r),u=r.enter("strong"),c=r.createTracker(a),f=c.move(l+l);let m=c.move(r.containerPhrasing(e,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Uu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=Ll(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=Uu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Ll(g));const w=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+w}function Q3(e,n,r){return r.options.strong||"*"}function Z3(e,n,r,a){return r.safe(e.value,a)}function W3(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function eN(e,n,r){const a=(k1(r)+(r.options.ruleSpaces?" ":"")).repeat(W3(r));return r.options.ruleSpaces?a.slice(0,-1):a}const C1={blockquote:_3,break:jb,code:j3,definition:O3,emphasis:g1,hardBreak:jb,heading:z3,html:y1,image:b1,imageReference:x1,inlineCode:v1,link:S1,linkReference:_1,list:$3,listItem:Y3,paragraph:V3,root:X3,strong:E1,text:Z3,thematicBreak:eN};function tN(){return{enter:{table:nN,tableData:Nb,tableHeader:Nb,tableRow:iN},exit:{codeText:aN,table:rN,tableData:Jh,tableHeader:Jh,tableRow:Jh}}}function nN(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function rN(e){this.exit(e),this.data.inTable=void 0}function iN(e){this.enter({type:"tableRow",children:[]},e)}function Jh(e){this.exit(e)}function Nb(e){this.enter({type:"tableCell",children:[]},e)}function aN(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,sN));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function sN(e,n){return n==="|"?n:e}function lN(e){const n=e||{},r=n.tableCellPadding,a=n.tablePipeAlign,l=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
119
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:m,tableRow:f}};function c(w,k,R,U){return d(y(w,R,U),w.align)}function f(w,k,R,U){const T=g(w,R,U),F=d([T]);return F.slice(0,F.indexOf(`
120
- `))}function m(w,k,R,U){const T=R.enter("tableCell"),F=R.enter("phrasing"),V=R.containerPhrasing(w,{...U,before:u,after:u});return F(),T(),V}function d(w,k){return w3(w,{align:k,alignDelimiters:a,padding:r,stringLength:l})}function y(w,k,R){const U=w.children;let T=-1;const F=[],V=k.enter("table");for(;++T<U.length;)F[T]=g(U[T],k,R);return V(),F}function g(w,k,R){const U=w.children;let T=-1;const F=[],V=k.enter("tableRow");for(;++T<U.length;)F[T]=m(U[T],w,k,R);return V(),F}function b(w,k,R){let U=C1.inlineCode(w,k,R);return R.stack.includes("tableCell")&&(U=U.replace(/\|/g,"\\$&")),U}}function oN(){return{exit:{taskListCheckValueChecked:Ob,taskListCheckValueUnchecked:Ob,paragraph:cN}}}function uN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:fN}}}function Ob(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function cN(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const a=r.children[0];if(a&&a.type==="text"){const l=n.children;let u=-1,c;for(;++u<l.length;){const f=l[u];if(f.type==="paragraph"){c=f;break}}c===r&&(a.value=a.value.slice(1),a.value.length===0?r.children.shift():r.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,r.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function fN(e,n,r,a){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(a);u&&f.move(c);let m=C1.listItem(e,n,r,{...a,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function hN(){return[$j(),f3(),p3(),tN(),oN()]}function dN(e){return{extensions:[Gj(),h3(e),g3(),lN(e),uN()]}}const mN={tokenize:vN,partial:!0},A1={tokenize:wN,partial:!0},T1={tokenize:SN,partial:!0},j1={tokenize:_N,partial:!0},pN={tokenize:kN,partial:!0},N1={name:"wwwAutolink",tokenize:bN,previous:R1},O1={name:"protocolAutolink",tokenize:xN,previous:M1},ni={name:"emailAutolink",tokenize:yN,previous:D1},Or={};function gN(){return{text:Or}}let oa=48;for(;oa<123;)Or[oa]=ni,oa++,oa===58?oa=65:oa===91&&(oa=97);Or[43]=ni;Or[45]=ni;Or[46]=ni;Or[95]=ni;Or[72]=[ni,O1];Or[104]=[ni,O1];Or[87]=[ni,N1];Or[119]=[ni,N1];function yN(e,n,r){const a=this;let l,u;return c;function c(g){return!_d(g)||!D1.call(a,a.previous)||im(a.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return _d(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(pN,y,d)(g):g===45||g===95||mn(g)?(u=!0,e.consume(g),m):y(g)}function d(g){return e.consume(g),l=!0,m}function y(g){return u&&l&&vn(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function bN(e,n,r){const a=this;return l;function l(c){return c!==87&&c!==119||!R1.call(a,a.previous)||im(a.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(mN,e.attempt(A1,e.attempt(T1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function xN(e,n,r){const a=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&M1.call(a,a.previous)&&!im(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(vn(g)&&l.length<5)return l+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const b=l.toLowerCase();if(b==="http"||b==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),u?d:(u=!0,m)):r(g)}function d(g){return g===null||Du(g)||Tt(g)||ha(g)||Yu(g)?r(g):e.attempt(A1,e.attempt(T1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function vN(e,n,r){let a=0;return l;function l(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),l):c===46&&a===3?(e.consume(c),u):r(c)}function u(c){return c===null?r(c):n(c)}}function wN(e,n,r){let a,l,u;return c;function c(d){return d===46||d===95?e.check(j1,m,f)(d):d===null||Tt(d)||ha(d)||d!==45&&Yu(d)?m(d):(u=!0,e.consume(d),c)}function f(d){return d===95?a=!0:(l=a,a=void 0),e.consume(d),c}function m(d){return l||a||!u?r(d):n(d)}}function SN(e,n){let r=0,a=0;return l;function l(c){return c===40?(r++,e.consume(c),l):c===41&&a<r?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(j1,n,u)(c):c===null||Tt(c)||ha(c)?n(c):(e.consume(c),l)}function u(c){return c===41&&a++,e.consume(c),l}}function _N(e,n,r){return a;function a(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),a):f===38?(e.consume(f),u):f===93?(e.consume(f),l):f===60||f===null||Tt(f)||ha(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||Tt(f)||ha(f)?n(f):a(f)}function u(f){return vn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),a):vn(f)?(e.consume(f),c):r(f)}}function kN(e,n,r){return a;function a(u){return e.consume(u),l}function l(u){return mn(u)?r(u):n(u)}}function R1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function M1(e){return!vn(e)}function D1(e){return!(e===47||_d(e))}function _d(e){return e===43||e===45||e===46||e===95||mn(e)}function im(e){let n=e.length,r=!1;for(;n--;){const a=e[n][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){r=!0;break}if(a._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const EN={tokenize:MN,partial:!0};function CN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:NN,continuation:{tokenize:ON},exit:RN}},text:{91:{name:"gfmFootnoteCall",tokenize:jN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:AN,resolveTo:TN}}}}function AN(e,n,r){const a=this;let l=a.events.length;const u=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;l--;){const m=a.events[l][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return r(m);const d=br(a.sliceSerialize({start:c.end,end:a.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function TN(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",a,n],e[r+3],e[r+4],["enter",l,n],["exit",l,n],["enter",u,n],["enter",c,n],["exit",c,n],["exit",u,n],e[e.length-2],e[e.length-1],["exit",a,n]];return e.splice(r,e.length-r+1,...f),e}function jN(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(g){if(u>999||g===93&&!c||g===null||g===91||Tt(g))return r(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return l.includes(br(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(g)}return Tt(g)||(c=!0),u++,e.consume(g),g===92?y:d}function y(g){return g===91||g===92||g===93?(e.consume(g),u++,d):d(g)}}function NN(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(k)}function y(k){if(c>999||k===93&&!f||k===null||k===91||Tt(k))return r(k);if(k===93){e.exit("chunkString");const R=e.exit("gfmFootnoteDefinitionLabelString");return u=br(a.sliceSerialize(R)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Tt(k)||(f=!0),c++,e.consume(k),k===92?g:y}function g(k){return k===91||k===92||k===93?(e.consume(k),c++,y):y(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),l.includes(u)||l.push(u),lt(e,w,"gfmFootnoteDefinitionWhitespace")):r(k)}function w(k){return n(k)}}function ON(e,n,r){return e.check($l,n,e.attempt(EN,n,r))}function RN(e){e.exit("gfmFootnoteDefinition")}function MN(e,n,r){const a=this;return lt(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?n(u):r(u)}}function DN(e){let r=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:u,resolveAll:l};return r==null&&(r=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function l(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let d=m;for(;d--;)if(c[d][0]==="exit"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[d][1].end.offset-c[d][1].start.offset){c[m][1].type="strikethroughSequence",c[d][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[d][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[d][1].end),end:Object.assign({},c[m][1].start)},b=[["enter",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",g,f]],w=f.parser.constructs.insideSpan.null;w&&Gn(b,b.length,0,Vu(w,c.slice(d+1,m),f)),Gn(b,b.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),Gn(c,d-1,m-d+3,b),m=d+b.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const d=this.previous,y=this.events;let g=0;return b;function b(k){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),w(k))}function w(k){const R=ms(d);if(k===126)return g>1?m(k):(c.consume(k),g++,w);if(g<2&&!r)return m(k);const U=c.exit("strikethroughSequenceTemporary"),T=ms(k);return U._open=!T||T===2&&!!R,U._close=!R||R===2&&!!T,f(k)}}}class zN{constructor(){this.map=[]}add(n,r,a){LN(this,n,r,a)}consume(n){if(this.map.sort(function(u,c){return u[0]-c[0]}),this.map.length===0)return;let r=this.map.length;const a=[];for(;r>0;)r-=1,a.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];a.push(n.slice()),n.length=0;let l=a.pop();for(;l;){for(const u of l)n.push(u);l=a.pop()}this.map.length=0}}function LN(e,n,r,a){let l=0;if(!(r===0&&a.length===0)){for(;l<e.map.length;){if(e.map[l][0]===n){e.map[l][1]+=r,e.map[l][2].push(...a);return}l+=1}e.map.push([n,r,a])}}function UN(e,n){let r=!1;const a=[];for(;n<e.length;){const l=e[n];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&a.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const u=a.length-1;a[u]=a[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return a}function BN(){return{flow:{null:{name:"table",tokenize:PN,resolveAll:HN}}}}function PN(e,n,r){const a=this;let l=0,u=0,c;return f;function f(A){let K=a.events.length-1;for(;K>-1;){const he=a.events[K][1].type;if(he==="lineEnding"||he==="linePrefix")K--;else break}const Z=K>-1?a.events[K][1].type:null,ue=Z==="tableHead"||Z==="tableRow"?D:m;return ue===D&&a.parser.lazy[a.now().line]?r(A):ue(A)}function m(A){return e.enter("tableHead"),e.enter("tableRow"),d(A)}function d(A){return A===124||(c=!0,u+=1),y(A)}function y(A){return A===null?r(A):Be(A)?u>1?(u=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),w):r(A):et(A)?lt(e,y,"whitespace")(A):(u+=1,c&&(c=!1,l+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(A)))}function g(A){return A===null||A===124||Tt(A)?(e.exit("data"),y(A)):(e.consume(A),A===92?b:g)}function b(A){return A===92||A===124?(e.consume(A),g):g(A)}function w(A){return a.interrupt=!1,a.parser.lazy[a.now().line]?r(A):(e.enter("tableDelimiterRow"),c=!1,et(A)?lt(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):k(A))}function k(A){return A===45||A===58?U(A):A===124?(c=!0,e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),R):L(A)}function R(A){return et(A)?lt(e,U,"whitespace")(A):U(A)}function U(A){return A===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),T):A===45?(u+=1,T(A)):A===null||Be(A)?le(A):L(A)}function T(A){return A===45?(e.enter("tableDelimiterFiller"),F(A)):L(A)}function F(A){return A===45?(e.consume(A),F):A===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),V):(e.exit("tableDelimiterFiller"),V(A))}function V(A){return et(A)?lt(e,le,"whitespace")(A):le(A)}function le(A){return A===124?k(A):A===null||Be(A)?!c||l!==u?L(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(A)):L(A)}function L(A){return r(A)}function D(A){return e.enter("tableRow"),J(A)}function J(A){return A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),J):A===null||Be(A)?(e.exit("tableRow"),n(A)):et(A)?lt(e,J,"whitespace")(A):(e.enter("data"),B(A))}function B(A){return A===null||A===124||Tt(A)?(e.exit("data"),J(A)):(e.consume(A),A===92?q:B)}function q(A){return A===92||A===124?(e.consume(A),B):B(A)}}function HN(e,n){let r=-1,a=!0,l=0,u=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,d,y,g;const b=new zN;for(;++r<e.length;){const w=e[r],k=w[1];w[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(Rb(b,n,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",d,n]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,g=void 0,u=[0,0,0,0],c=[0,r+1,0,0],f&&(f=!1,y={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(r,0,[["enter",y,n]])),l=k.type==="tableDelimiterRow"?2:y?3:1):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=pu(b,n,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):k.type==="tableCellDivider"&&(a?a=!1:(u[1]!==0&&(c[0]=c[1],g=pu(b,n,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):k.type==="tableHead"?(f=!0,m=r):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=r,u[1]!==0?(c[0]=c[1],g=pu(b,n,u,l,r,g)):c[1]!==0&&(g=pu(b,n,c,l,r,g)),l=0):l&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&Rb(b,n,m,d,y),b.consume(n.events),r=-1;++r<n.events.length;){const w=n.events[r];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=UN(n.events,r))}return e}function pu(e,n,r,a,l,u){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},es(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=es(n.events,r[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",u,n]]),r[2]!==0){const d=es(n.events,r[2]),y=es(n.events,r[3]),g={type:f,start:Object.assign({},d),end:Object.assign({},y)};if(e.add(r[2],0,[["enter",g,n]]),a!==2){const b=n.events[r[2]],w=n.events[r[3]];if(b[1].end=Object.assign({},w[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const k=r[2]+1,R=r[3]-r[2]-1;e.add(k,R,[])}}e.add(r[3]+1,0,[["exit",g,n]])}return l!==void 0&&(u.end=Object.assign({},es(n.events,l)),e.add(l,0,[["exit",u,n]]),u=void 0),u}function Rb(e,n,r,a,l){const u=[],c=es(n.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,n])),a.end=Object.assign({},c),u.push(["exit",a,n]),e.add(r+1,0,u)}function es(e,n){const r=e[n],a=r[0]==="enter"?"start":"end";return r[1][a]}const qN={name:"tasklistCheck",tokenize:FN};function IN(){return{text:{91:qN}}}function FN(e,n,r){const a=this;return l;function l(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return Tt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):r(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(m)}function f(m){return Be(m)?n(m):et(m)?e.check({tokenize:$N},n,r)(m):r(m)}}function $N(e,n,r){return lt(e,a,"whitespace");function a(l){return l===null?r(l):n(l)}}function GN(e){return $x([gN(),CN(),DN(e),BN(),IN()])}const YN={};function Mb(e){const n=this,r=e||YN,a=n.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),u=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(GN(r)),u.push(hN()),c.push(dN(r))}function VN(e){f1(e,[/\r?\n|\r/g,JN])}function JN(){return{type:"break"}}function Db(){return function(e){VN(e)}}function XN({connected:e,hostId:n,request:r,subscribeEvents:a,taskId:l,runId:u}){const c=da(),[f,m]=z.useState(!0),[d,y]=z.useState([]),[g,b]=z.useState(),[w,k]=z.useState(),R=g==="started"||g==="monitoring",U=g==="followup",T=g==="started"||g==="followup",[F,V]=z.useState(null),[le,L]=z.useState(!1),[D,J]=z.useState(""),[B,q]=z.useState(!1),A=z.useRef(null);async function K(){try{const I=await r("task.result",{id:l,run_id:u});if(I.error){console.error("No result:",I.error),c("/runs",{replace:!0});return}y(I.messages??[]),b(I.running_state),k(I.agent)}catch(I){console.error("Failed to load result:",I),c("/runs",{replace:!0})}finally{m(!1)}}async function Z(I){var Y;try{const ce=(Y=(await r("task.reports",{id:l,run_id:u,report_files:[I]})).reports)==null?void 0:Y[0];ce!=null&&ce.data_url?V({file:I,data_url:ce.data_url}):V({file:I,content:(ce==null?void 0:ce.content)??"Report not found."})}catch{V({file:I,content:"Failed to load report."})}}z.useEffect(()=>{e&&(m(!0),K())},[e,l,u]),z.useEffect(()=>!e||!n?void 0:a(n,async Y=>{try{const ae=JSON.parse(new TextDecoder().decode(Y.data));if(ae.event_type!=="running-state"&&ae.event_type!=="result-updated"||Y.subject.split(".").pop()!==l||ae.event_type==="result-updated"&&ae.run_id&&ae.run_id!==u)return;K()}catch{}}),[e,n,l,a,r]),z.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[d]);function ue(I){if(I==="input")return"User Input";if(I==="permission")return"Permission";if(I==="confirmation")return"Confirmation"}function he(I){return I==="started"?"Task started":I==="finished"?"Task finished":I==="failed"?"Task failed":I==="error"?"Command failed":I==="aborted"?"Task aborted":I==="confirmation"?"Task confirmed":I==="stopped"?"Follow-up stopped":I??""}return v.jsxs("div",{className:"run-detail",children:[v.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:v.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),f?v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[v.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),v.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),v.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"chat-thread",ref:A,children:[d.map((I,Y)=>{const ae=T&&I.role==="assistant"&&!d.slice(Y+1).some(ce=>ce.role==="assistant"||ce.role==="user");return I.role==="status"&&I.type==="monitoring"?null:I.role==="status"?v.jsxs("div",{className:`chat-status${I.type==="error"?" chat-status--error":""}`,children:[v.jsxs("div",{children:[he(I.type),I.time>0&&v.jsx("span",{className:"chat-status-time",children:Mu(I.time)})]}),I.content&&v.jsx("pre",{className:"chat-status-detail",children:I.content})]},Y):v.jsxs("div",{className:`chat-message chat-message--${I.role}`,children:[I.role==="assistant"&&w&&v.jsx("div",{className:"chat-message-agent",children:hd(w)}),v.jsxs("div",{className:"chat-message-content",children:[v.jsx(Eb,{remarkPlugins:[Mb,Db],children:I.content}),ae&&v.jsxs("div",{className:"chat-typing-indicator",children:[v.jsx("span",{}),v.jsx("span",{}),v.jsx("span",{})]})]}),I.attachments&&I.attachments.length>0&&v.jsx("div",{className:"chat-message-attachments",children:I.attachments.map(ce=>v.jsx("button",{className:"chat-attachment-chip",onClick:()=>Z(ce),children:ce},ce))}),v.jsxs("div",{className:"chat-message-meta",children:[ue(I.type)&&v.jsx("span",{className:"chat-message-type",children:ue(I.type)}),I.time>0&&v.jsx("span",{children:Mu(I.time)})]})]},Y)}),T&&(()=>{const I=d.filter(Y=>Y.role!=="status");return I.length===0||I[I.length-1].role!=="assistant"})()&&v.jsxs("div",{className:"chat-message chat-message--assistant",children:[w&&v.jsx("div",{className:"chat-message-agent",children:hd(w)}),v.jsxs("div",{className:"chat-typing-indicator",children:[v.jsx("span",{}),v.jsx("span",{}),v.jsx("span",{})]})]}),g==="monitoring"&&v.jsxs("div",{className:"chat-monitoring-indicator",children:[v.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),R?v.jsx("div",{className:"chat-abort-bar",children:v.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:le,onClick:async()=>{if(confirm("Abort this task?")){L(!0);try{await r("task.abort",{id:l})}catch(I){console.error("Abort failed:",I)}finally{L(!1)}}},children:le?"Aborting...":"Abort Task"})}):U?v.jsx("div",{className:"chat-input-bar",children:v.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:le,onClick:async()=>{L(!0);try{await r("task.stop_followup",{id:l,run_id:u})}catch(I){console.error("Stop failed:",I)}finally{L(!1)}},children:v.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:v.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):v.jsxs("form",{className:"chat-input-bar",onSubmit:async I=>{I.preventDefault();const Y=D.trim();if(!(!Y||B)){q(!0);try{await r("task.followup",{id:l,run_id:u,message:Y}),J("")}catch(ae){console.error("Follow-up failed:",ae)}finally{q(!1)}}},children:[v.jsx("input",{className:"chat-input",type:"text",placeholder:"Follow-up message",value:D,onChange:I=>J(I.target.value),disabled:B}),v.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!D.trim()||B,children:v.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),v.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),F&&v.jsx("div",{className:"report-dialog-overlay",onClick:()=>V(null),children:v.jsxs("div",{className:"report-dialog",onClick:I=>I.stopPropagation(),children:[v.jsxs("div",{className:"report-dialog-header",children:[v.jsx("span",{className:"report-dialog-title",children:F.file}),v.jsx("button",{className:"report-dialog-close",onClick:()=>V(null),"aria-label":"Close",children:v.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),v.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),v.jsx("div",{className:"report-dialog-body",children:F.data_url?v.jsx("img",{src:F.data_url,alt:F.file,style:{maxWidth:"100%",height:"auto"}}):v.jsx(Eb,{remarkPlugins:[Mb,Db],components:{a:({...I})=>v.jsx("a",{...I,target:"_blank",rel:"noopener noreferrer"})},children:F.content??""})})]})})]})}function KN(){const{getActiveHost:e}=Hl(),n=e(),r=z.useRef(null);z.useEffect(()=>{if(Nn.isNativePlatform()||!n||n.directUrl||r.current===n.hostId)return;async function a(){var l;try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){console.warn("[Push] Push notifications not supported");return}const u=await navigator.serviceWorker.ready;(l=u.active)==null||l.postMessage({type:"set-host-id",hostId:n.hostId});let c=await u.pushManager.getSubscription();if(!c){const{publicKey:m}=await rE("/api/push/vapid-key");if(!m){console.warn("[Push] No VAPID public key configured on server");return}if(await Notification.requestPermission()!=="granted"){console.log("[Push] Permission denied");return}c=await u.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:m})}const f=c.toJSON();await nE("/api/push/subscribe",{hostId:n.hostId,endpoint:f.endpoint,keys:{p256dh:f.keys.p256dh,auth:f.keys.auth}}),r.current=n.hostId}catch(u){console.error("[Push] Subscription failed:",u)}}a()},[n])}const QN="0.7.8";function ZN(e,n){if(e.includes("-"))return!1;const r=e.split(".").map(Number),a=n.split(".").map(Number);for(let l=0;l<3;l++){if((r[l]??0)<(a[l]??0))return!0;if((r[l]??0)>(a[l]??0))return!1}return!1}function xl(){var qe;const{pairedHosts:e,activeHostId:n,removePairedHost:r}=Hl(),{connected:a,request:l,subscribeEvents:u,unauthorized:c}=Gu(),f=da(),m=Nr(),d=zS(),y=jx("(min-width: 768px)"),g=m.pathname.startsWith("/tasks"),b=d.runId?void 0:d.taskId,[w,k]=z.useState(null),R=d.runId,U=R==="latest";z.useEffect(()=>{if(!U||!d.taskId||!a){k(null);return}l("taskrun.list",{task_id:d.taskId,limit:1}).then(ge=>{var Ke,kt;const Le=(kt=(Ke=ge.entries)==null?void 0:Ke[0])==null?void 0:kt.run_id;k(Le??null)}).catch(()=>k(null))},[U,d.taskId,a]);const T=U?w:R,F=!!(d.taskId&&T&&T!=="latest"),[V,le]=z.useState(!1),[L,D]=z.useState(!1),[J,B]=z.useState(null),[q,A]=z.useState(null),[K,Z]=z.useState({}),[ue,he]=z.useState([]),[I,Y]=z.useState(),[ae,ce]=z.useState(new Map),[Ae,O]=z.useState(new Map),[P,re]=z.useState(new Map),[j,be]=z.useState(new Map);KN(),z.useEffect(()=>{window.scrollTo(0,0)},[n]),z.useEffect(()=>{a&&l("host.info").then(ge=>{var it,Ie,ht,Et,He,ln;he(ge.agents??[]),Y(ge.host_platform),Z(ge.capability_tokens??{}),sE(ge.agents??[]);const Le=ge.version??null;A(Le),le(!!Le&&ZN(Le,QN));const Ke=new Map,kt=new Map,bt=new Map,Mt=new Map;for(const ie of ge.pending_prompts??[])if(ie.type==="confirmation")Ke.set(ie.key,{description:((it=ie.meta)==null?void 0:it.description)??"",sessionName:(Ie=ie.meta)==null?void 0:Ie.session_name});else if(ie.type==="permission")kt.set(ie.key,{permissions:ie.params??[],sessionName:(ht=ie.meta)==null?void 0:ht.session_name});else if(ie.type==="input"){const ve=ie.params??((Et=ie.meta)==null?void 0:Et.input_questions)??[];bt.set(ie.key,{questions:ve,description:(He=ie.meta)==null?void 0:He.description,sessionName:(ln=ie.meta)==null?void 0:ln.session_name}),Mt.set(ie.key,new Array(ve.length).fill(""))}ce(Ke),O(kt),re(bt),be(Mt)}).catch(()=>{})},[a,n,l]),z.useEffect(()=>!a||!n?void 0:u(n,Le=>{const Ke=Le.subject.split(".");if(Ke.length<3)return;const kt=Ke.slice(2).join(".");let bt={};try{bt=JSON.parse(new TextDecoder().decode(Le.data))}catch{return}const Mt=bt.event_type,it=bt.session_id;if(Mt==="input-request"&&it){const Ie=bt.input_questions,ht=bt.session_name,Et=bt.description;Ie!=null&&Ie.length&&(re(He=>{if(He.has(it))return He;const ln=new Map(He);return ln.set(it,{questions:Ie,description:Et,sessionName:ht}),ln}),be(He=>{if(He.has(it))return He;const ln=new Map(He);return ln.set(it,new Array(Ie.length).fill("")),ln}));return}if(Mt==="input-resolved"&&it){re(Ie=>{if(!Ie.has(it))return Ie;const ht=new Map(Ie);return ht.delete(it),ht}),be(Ie=>{const ht=new Map(Ie);return ht.delete(it),ht});return}if(Mt==="confirm-request"&&it){const Ie=bt.description,ht=bt.session_name;Ie&&ce(Et=>{if(Et.has(it))return Et;const He=new Map(Et);return He.set(it,{description:Ie,sessionName:ht}),He});return}if(Mt==="confirm-resolved"&&it){ce(Ie=>{if(!Ie.has(it))return Ie;const ht=new Map(Ie);return ht.delete(it),ht});return}if(Mt==="permission-request"){const Ie=bt.required_permissions,ht=bt.session_name;Ie!=null&&Ie.length&&O(Et=>{if(Et.has(kt))return Et;const He=new Map(Et);return He.set(kt,{permissions:Ie,sessionName:ht}),He});return}if(Mt==="permission-resolved"){O(Ie=>{if(!Ie.has(kt))return Ie;const ht=new Map(Ie);return ht.delete(kt),ht});return}}),[a,n,u]);async function Re(ge,Le){try{await l("task.user_input",{id:ge,value:[Le]})}catch(Ke){console.error("[Dashboard] Failed to respond to confirmation:",Ke)}}async function Te(ge,Le){try{await l("task.user_input",{id:ge,value:[Le]})}catch(Ke){console.error("[Dashboard] Failed to respond to permission request:",Ke)}}async function De(ge,Le){try{await l("task.user_input",{id:ge,value:Le})}catch(Ke){console.error("[Dashboard] Failed to respond to input request:",Ke)}}function Fe(ge,Le){fa()&&f(Le?`/runs/${encodeURIComponent(ge)}/${encodeURIComponent(Le)}`:`/runs/${encodeURIComponent(ge)}`)}async function Ce(){D(!0),B(null);try{const ge=await l("host.update");if(ge.error){B(ge.error),D(!1);return}}catch{}setTimeout(()=>window.location.reload(),1e4)}const tt=e.length>0,It=tt&&a&&n&&!c,_e=((qe=e.find(ge=>ge.hostId===n))==null?void 0:qe.clientToken)??null;return v.jsxs("div",{className:"dashboard",children:[y&&v.jsx(q0,{daemonVersion:q,capabilityTokens:K,activeClientToken:_e,request:l,onCapabilityTokensChange:Z}),v.jsxs("div",{className:"dashboard-content",children:[v.jsxs("div",{className:"tab-bar",children:[!y&&v.jsx(q0,{daemonVersion:q,capabilityTokens:K,activeClientToken:_e,request:l,onCapabilityTokensChange:Z}),v.jsx(xE,{})]}),v.jsx("main",{className:"dashboard-main",children:c?v.jsxs("div",{className:"revoked-state",children:[v.jsx("div",{className:"revoked-icon",children:v.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[v.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),v.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),v.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),v.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),v.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),v.jsx("div",{className:"revoked-command",children:v.jsx("code",{children:"palmier pair"})}),v.jsxs("div",{className:"revoked-actions",children:[v.jsx("button",{className:"btn btn-primary",onClick:()=>{fa()&&f("/pair")},children:"Re-pair Device"}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):It?v.jsxs(v.Fragment,{children:[g&&!F&&v.jsx(bE,{connected:a,hostId:n,request:l,subscribeEvents:u,agents:ue,hostPlatform:I,onViewRun:Fe}),F?v.jsx(XN,{connected:a,hostId:n,request:l,subscribeEvents:u,taskId:d.taskId,runId:decodeURIComponent(T)}):g?null:v.jsx(EE,{connected:a,hostId:n,request:l,subscribeEvents:u,agents:ue,filterTaskId:b,onClearFilter:()=>{fa()&&f("/")}})]}):v.jsxs("div",{className:"empty-state",children:[v.jsx("p",{children:tt?"Connecting to host...":"No hosts paired yet."}),!tt&&v.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Pair Host"})]})}),V&&!L&&!J&&v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),v.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",q?` (v${q})`:""," is too old for this version of the app. Please update to continue."]}),v.jsx("div",{className:"confirm-modal-actions",children:v.jsx("button",{className:"btn btn-primary",onClick:Ce,children:"Update Now"})})]})}),L&&v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),v.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),J&&v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),v.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:J}),v.jsx("div",{className:"confirm-modal-actions",children:v.jsx("button",{className:"btn btn-secondary",onClick:()=>{B(null)},children:"Retry"})})]})})]}),Su.createPortal(v.jsxs(v.Fragment,{children:[[...ae.entries()].map(([ge,{description:Le,sessionName:Ke}])=>v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),Ke&&v.jsx("p",{className:"confirm-modal-subtitle",children:Ke}),v.jsx("p",{className:"confirm-modal-message",children:Le}),v.jsxs("div",{className:"confirm-modal-actions",children:[v.jsx("button",{className:"btn btn-primary",onClick:()=>Re(ge,"confirmed"),children:"Confirm"}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>Re(ge,"aborted"),children:"Abort"})]})]})},ge)),[...Ae.entries()].map(([ge,{permissions:Le,sessionName:Ke}])=>v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal permission-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),v.jsx("p",{className:"confirm-modal-message",children:v.jsx("strong",{children:Ke||ge})}),v.jsx("div",{className:"permission-list",children:Le.map((kt,bt)=>v.jsxs("div",{className:"permission-item",children:[v.jsx("span",{className:"permission-name",children:kt.name}),kt.description&&v.jsx("span",{className:"permission-desc",children:kt.description})]},bt))}),v.jsxs("div",{className:"permission-actions",children:[v.jsx("button",{className:"btn btn-primary",onClick:()=>Te(ge,"granted"),children:"Allow Once"}),v.jsx("button",{className:"btn btn-secondary",onClick:()=>Te(ge,"granted_all"),children:"Allow Always"})]}),v.jsx("button",{className:"permission-abort-link",onClick:()=>Te(ge,"aborted"),children:"Deny & Abort Task"})]})},ge)),[...P.entries()].map(([ge,{questions:Le,description:Ke,sessionName:kt}])=>{const bt=j.get(ge)??new Array(Le.length).fill("");return v.jsx("div",{className:"confirm-modal-overlay",children:v.jsxs("div",{className:"confirm-modal input-modal",children:[v.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),kt&&v.jsx("p",{className:"confirm-modal-subtitle",children:kt}),Ke&&v.jsx("p",{className:"confirm-modal-message",children:Ke}),v.jsx("div",{className:"input-list",children:Le.map((Mt,it)=>v.jsxs("div",{className:"input-item",children:[v.jsx("label",{className:"input-label",children:Mt}),v.jsx("input",{type:"text",className:"input-field",value:bt[it]??"",onChange:Ie=>{be(ht=>{const Et=new Map(ht),He=[...Et.get(ge)??[]];return He[it]=Ie.target.value,Et.set(ge,He),Et})},autoFocus:it===0})]},it))}),v.jsx("div",{className:"input-actions",children:v.jsx("button",{className:"btn btn-primary",disabled:bt.some(Mt=>!Mt.trim()),onClick:()=>De(ge,bt),children:"Submit"})}),v.jsx("button",{className:"permission-abort-link",onClick:()=>De(ge,["aborted"]),children:"Cancel"})]})},ge)})]}),document.body)]})}const vl=!!window.__PALMIER_SERVE__;function WN(){const[e,n]=z.useState(""),[r,a]=z.useState(!1),[l,u]=z.useState(null),{addPairedHost:c}=Hl(),f=da();async function m(){const d=e.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}a(!0),u(null);try{let y;if(vl){const b=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,label:navigator.userAgent})});if(!b.ok){const w=await b.json().catch(()=>({error:"Connection failed"}));throw new Error(w.error||`HTTP ${b.status}`)}y=await b.json()}else{const b=await fetch(`${Hd}/api/config`);if(!b.ok)throw new Error("Failed to fetch server config");const w=await b.json();if(!w.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const k=await kx({servers:w.natsWsUrl,authenticator:px(w.natsJwt,new TextEncoder().encode(w.natsNkeySeed))}),R=Cu(),U=`pair.${d}`,T=await k.request(U,R.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(R.decode(T.data)),await k.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:vl?window.location.origin:void 0};c(g),Nn.isNativePlatform()&&await rn.set({key:"hostId",value:y.hostId}),f("/")}catch(y){const g=y instanceof Error?y.message:String(y);g.includes("timeout")||g.includes("TIMEOUT")||g.includes("503")||g.toLowerCase().includes("no responders")?u("Code not found or expired. Check the code and try again."):u(g)}finally{a(!1)}}return v.jsx("div",{className:"pair-page",children:v.jsxs("div",{className:"pair-card",children:[v.jsxs("div",{className:"pair-header",children:[v.jsx("h1",{className:"pair-title",children:vl?"Pair":"Pair with Host"}),v.jsx("p",{className:"pair-subtitle",children:vl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!vl&&v.jsxs("div",{className:"pair-instructions",children:[v.jsxs("div",{className:"pair-instruction-block",children:[v.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),v.jsxs("ol",{className:"pair-steps",children:[v.jsxs("li",{children:["Install at least one agent CLI (e.g., ",v.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),v.jsxs("li",{children:["Install Palmier on your host machine:",v.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),v.jsxs("li",{children:["Run the setup wizard:",v.jsx("code",{className:"pair-command",children:"palmier init"})]}),v.jsx("li",{children:"A pairing code will display automatically"})]})]}),v.jsx("div",{className:"pair-instruction-divider"}),v.jsxs("div",{className:"pair-instruction-block",children:[v.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),v.jsxs("ol",{className:"pair-steps",children:[v.jsxs("li",{children:["Run ",v.jsx("code",{children:"palmier pair"})," on the host machine"]}),v.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),v.jsxs("div",{className:"pair-form",children:[v.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",v.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:d=>n(d.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:r})]}),l&&v.jsx("p",{className:"pair-error",children:l}),v.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!e.trim(),children:[r&&v.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),v.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),v.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",v.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",v.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function eO(){return v.jsx(D_,{children:v.jsx(aE,{children:v.jsxs(KS,{children:[v.jsx(ua,{path:"/",element:v.jsx(xl,{})}),v.jsx(ua,{path:"/tasks",element:v.jsx(xl,{})}),v.jsx(ua,{path:"/runs",element:v.jsx(xl,{})}),v.jsx(ua,{path:"/runs/:taskId",element:v.jsx(xl,{})}),v.jsx(ua,{path:"/runs/:taskId/:runId",element:v.jsx(xl,{})}),v.jsx(ua,{path:"/pair",element:v.jsx(WN,{})})]})})})}Zw.createRoot(document.getElementById("root")).render(v.jsx(z.StrictMode,{children:v.jsx(v_,{children:v.jsx(eO,{})})}));export{Pd as W};