palmier 0.7.4 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/shared-prompt.js +1 -1
- package/dist/commands/init.js +3 -2
- package/dist/commands/pair.js +1 -1
- package/dist/commands/run.js +4 -4
- package/dist/commands/serve.js +1 -1
- package/dist/config.js +2 -2
- package/dist/device-capabilities.d.ts +1 -1
- package/dist/events.js +1 -1
- package/dist/mcp-tools.js +64 -1
- package/dist/nats-client.d.ts +1 -1
- package/dist/nats-client.js +6 -3
- package/dist/pwa/assets/index-Bt8Hhaw3.js +118 -0
- package/dist/pwa/assets/{web-Dc9-IiRD.js → web-CkWrlNwc.js} +1 -1
- package/dist/pwa/assets/{web-_b3Dvcvz.js → web-lx34oBi7.js} +1 -1
- package/dist/pwa/index.html +1 -1
- package/dist/pwa/service-worker.js +1 -1
- package/dist/rpc-handler.js +6 -2
- package/dist/types.d.ts +2 -1
- package/package.json +1 -1
- package/palmier-server/PRODUCTION.md +31 -28
- package/palmier-server/README.md +35 -5
- package/palmier-server/nats.conf +9 -5
- package/palmier-server/package.json +2 -1
- package/palmier-server/pnpm-lock.yaml +6 -0
- package/palmier-server/pwa/src/components/HostMenu.tsx +98 -158
- package/palmier-server/pwa/src/components/TaskListView.tsx +4 -4
- package/palmier-server/pwa/src/constants.ts +1 -1
- package/palmier-server/pwa/src/contexts/HostConnectionContext.tsx +9 -5
- package/palmier-server/pwa/src/pages/Dashboard.tsx +4 -4
- package/palmier-server/pwa/src/pages/PairHost.tsx +6 -3
- package/palmier-server/server/package.json +3 -1
- package/palmier-server/server/src/index.ts +83 -2
- package/palmier-server/server/src/nats-jwt.ts +299 -0
- package/palmier-server/server/src/nats-setup.ts +48 -0
- package/palmier-server/server/src/nats.ts +12 -4
- package/palmier-server/server/src/routes/device.ts +24 -0
- package/palmier-server/server/src/routes/hosts.ts +13 -2
- package/palmier-server/spec.md +6 -5
- package/src/agents/shared-prompt.ts +1 -1
- package/src/commands/init.ts +7 -5
- package/src/commands/pair.ts +1 -1
- package/src/commands/run.ts +4 -4
- package/src/commands/serve.ts +1 -1
- package/src/config.ts +2 -2
- package/src/device-capabilities.ts +1 -0
- package/src/events.ts +1 -1
- package/src/mcp-tools.ts +68 -1
- package/src/nats-client.ts +10 -3
- package/src/rpc-handler.ts +6 -2
- package/src/types.ts +3 -2
- package/test/agent-instructions.test.ts +10 -10
- package/dist/pwa/assets/index-BirmfPUC.js +0 -118
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var Uw=Object.defineProperty;var Bw=(e,n,r)=>n in e?Uw(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var k=(e,n,r)=>Bw(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 Nb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nh={exports:{}},ol={};/**
|
|
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 qy;function Pw(){if(qy)return ol;qy=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 ol.Fragment=n,ol.jsx=r,ol.jsxs=r,ol}var Iy;function Hw(){return Iy||(Iy=1,nh.exports=Pw()),nh.exports}var w=Hw(),rh={exports:{}},Ge={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Fy;function qw(){if(Fy)return Ge;Fy=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 v(U){return U===null||typeof U!="object"?null:(U=b&&U[b]||U["@@iterator"],typeof U=="function"?U:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,B={};function M(U,te,E){this.props=U,this.context=te,this.refs=B,this.updater=E||C}M.prototype.isReactComponent={},M.prototype.setState=function(U,te){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,te,"setState")},M.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function F(){}F.prototype=M.prototype;function G(U,te,E){this.props=U,this.context=te,this.refs=B,this.updater=E||C}var se=G.prototype=new F;se.constructor=G,z(se,M.prototype),se.isPureReactComponent=!0;var O=Array.isArray;function j(){}var Y={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function V(U,te,E){var ue=E.ref;return{$$typeof:e,type:U,key:te,ref:ue!==void 0?ue:null,props:E}}function N(U,te){return V(U.type,te,U.props)}function K(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function Z(U){var te={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(E){return te[E]})}var ge=/\/+/g;function he(U,te){return typeof U=="object"&&U!==null&&U.key!=null?Z(""+U.key):te.toString(36)}function H(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(j,j):(U.status="pending",U.then(function(te){U.status==="pending"&&(U.status="fulfilled",U.value=te)},function(te){U.status==="pending"&&(U.status="rejected",U.reason=te)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function q(U,te,E,ue,pe){var ve=typeof U;(ve==="undefined"||ve==="boolean")&&(U=null);var je=!1;if(U===null)je=!0;else switch(ve){case"bigint":case"string":case"number":je=!0;break;case"object":switch(U.$$typeof){case e:case n:je=!0;break;case y:return je=U._init,q(je(U._payload),te,E,ue,pe)}}if(je)return pe=pe(U),je=ue===""?"."+he(U,0):ue,O(pe)?(E="",je!=null&&(E=je.replace(ge,"$&/")+"/"),q(pe,te,E,"",function(ze){return ze})):pe!=null&&(K(pe)&&(pe=N(pe,E+(pe.key==null||U&&U.key===pe.key?"":(""+pe.key).replace(ge,"$&/")+"/")+je)),te.push(pe)),1;je=0;var De=ue===""?".":ue+":";if(O(U))for(var Ce=0;Ce<U.length;Ce++)ue=U[Ce],ve=De+he(ue,Ce),je+=q(ue,te,E,ve,pe);else if(Ce=v(U),typeof Ce=="function")for(U=Ce.call(U),Ce=0;!(ue=U.next()).done;)ue=ue.value,ve=De+he(ue,Ce++),je+=q(ue,te,E,ve,pe);else if(ve==="object"){if(typeof U.then=="function")return q(H(U),te,E,ue,pe);throw te=String(U),Error("Objects are not valid as a React child (found: "+(te==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":te)+"). If you meant to render a collection of children, use an array instead.")}return je}function re(U,te,E){if(U==null)return U;var ue=[],pe=0;return q(U,ue,"","",function(ve){return te.call(E,ve,pe++)}),ue}function ye(U){if(U._status===-1){var te=U._result;te=te(),te.then(function(E){(U._status===0||U._status===-1)&&(U._status=1,U._result=E)},function(E){(U._status===0||U._status===-1)&&(U._status=2,U._result=E)}),U._status===-1&&(U._status=0,U._result=te)}if(U._status===1)return U._result.default;throw U._result}var Ee=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var te=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(te))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},R={map:re,forEach:function(U,te,E){re(U,function(){te.apply(this,arguments)},E)},count:function(U){var te=0;return re(U,function(){te++}),te},toArray:function(U){return re(U,function(te){return te})||[]},only:function(U){if(!K(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Ge.Activity=g,Ge.Children=R,Ge.Component=M,Ge.Fragment=r,Ge.Profiler=l,Ge.PureComponent=G,Ge.StrictMode=a,Ge.Suspense=m,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Y,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(U){return Y.H.useMemoCache(U)}},Ge.cache=function(U){return function(){return U.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(U,te,E){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var ue=z({},U.props),pe=U.key;if(te!=null)for(ve in te.key!==void 0&&(pe=""+te.key),te)!J.call(te,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&te.ref===void 0||(ue[ve]=te[ve]);var ve=arguments.length-2;if(ve===1)ue.children=E;else if(1<ve){for(var je=Array(ve),De=0;De<ve;De++)je[De]=arguments[De+2];ue.children=je}return V(U.type,pe,ue)},Ge.createContext=function(U){return U={$$typeof:c,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:u,_context:U},U},Ge.createElement=function(U,te,E){var ue,pe={},ve=null;if(te!=null)for(ue in te.key!==void 0&&(ve=""+te.key),te)J.call(te,ue)&&ue!=="key"&&ue!=="__self"&&ue!=="__source"&&(pe[ue]=te[ue]);var je=arguments.length-2;if(je===1)pe.children=E;else if(1<je){for(var De=Array(je),Ce=0;Ce<je;Ce++)De[Ce]=arguments[Ce+2];pe.children=De}if(U&&U.defaultProps)for(ue in je=U.defaultProps,je)pe[ue]===void 0&&(pe[ue]=je[ue]);return V(U,ve,pe)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(U){return{$$typeof:f,render:U}},Ge.isValidElement=K,Ge.lazy=function(U){return{$$typeof:y,_payload:{_status:-1,_result:U},_init:ye}},Ge.memo=function(U,te){return{$$typeof:d,type:U,compare:te===void 0?null:te}},Ge.startTransition=function(U){var te=Y.T,E={};Y.T=E;try{var ue=U(),pe=Y.S;pe!==null&&pe(E,ue),typeof ue=="object"&&ue!==null&&typeof ue.then=="function"&&ue.then(j,Ee)}catch(ve){Ee(ve)}finally{te!==null&&E.types!==null&&(te.types=E.types),Y.T=te}},Ge.unstable_useCacheRefresh=function(){return Y.H.useCacheRefresh()},Ge.use=function(U){return Y.H.use(U)},Ge.useActionState=function(U,te,E){return Y.H.useActionState(U,te,E)},Ge.useCallback=function(U,te){return Y.H.useCallback(U,te)},Ge.useContext=function(U){return Y.H.useContext(U)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(U,te){return Y.H.useDeferredValue(U,te)},Ge.useEffect=function(U,te){return Y.H.useEffect(U,te)},Ge.useEffectEvent=function(U){return Y.H.useEffectEvent(U)},Ge.useId=function(){return Y.H.useId()},Ge.useImperativeHandle=function(U,te,E){return Y.H.useImperativeHandle(U,te,E)},Ge.useInsertionEffect=function(U,te){return Y.H.useInsertionEffect(U,te)},Ge.useLayoutEffect=function(U,te){return Y.H.useLayoutEffect(U,te)},Ge.useMemo=function(U,te){return Y.H.useMemo(U,te)},Ge.useOptimistic=function(U,te){return Y.H.useOptimistic(U,te)},Ge.useReducer=function(U,te,E){return Y.H.useReducer(U,te,E)},Ge.useRef=function(U){return Y.H.useRef(U)},Ge.useState=function(U){return Y.H.useState(U)},Ge.useSyncExternalStore=function(U,te,E){return Y.H.useSyncExternalStore(U,te,E)},Ge.useTransition=function(){return Y.H.useTransition()},Ge.version="19.2.4",Ge}var $y;function vd(){return $y||($y=1,rh.exports=qw()),rh.exports}var L=vd(),ih={exports:{}},ul={},ah={exports:{}},sh={};/**
|
|
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 Gy;function Iw(){return Gy||(Gy=1,(function(e){function n(q,re){var ye=q.length;q.push(re);e:for(;0<ye;){var Ee=ye-1>>>1,R=q[Ee];if(0<l(R,re))q[Ee]=re,q[ye]=R,ye=Ee;else break e}}function r(q){return q.length===0?null:q[0]}function a(q){if(q.length===0)return null;var re=q[0],ye=q.pop();if(ye!==re){q[0]=ye;e:for(var Ee=0,R=q.length,U=R>>>1;Ee<U;){var te=2*(Ee+1)-1,E=q[te],ue=te+1,pe=q[ue];if(0>l(E,ye))ue<R&&0>l(pe,E)?(q[Ee]=pe,q[ue]=ye,Ee=ue):(q[Ee]=E,q[te]=ye,Ee=te);else if(ue<R&&0>l(pe,ye))q[Ee]=pe,q[ue]=ye,Ee=ue;else break e}}return re}function l(q,re){var ye=q.sortIndex-re.sortIndex;return ye!==0?ye:q.id-re.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],d=[],y=1,g=null,b=3,v=!1,C=!1,z=!1,B=!1,M=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;function se(q){for(var re=r(d);re!==null;){if(re.callback===null)a(d);else if(re.startTime<=q)a(d),re.sortIndex=re.expirationTime,n(m,re);else break;re=r(d)}}function O(q){if(z=!1,se(q),!C)if(r(m)!==null)C=!0,j||(j=!0,Z());else{var re=r(d);re!==null&&H(O,re.startTime-q)}}var j=!1,Y=-1,J=5,V=-1;function N(){return B?!0:!(e.unstable_now()-V<J)}function K(){if(B=!1,j){var q=e.unstable_now();V=q;var re=!0;try{e:{C=!1,z&&(z=!1,F(Y),Y=-1),v=!0;var ye=b;try{t:{for(se(q),g=r(m);g!==null&&!(g.expirationTime>q&&N());){var Ee=g.callback;if(typeof Ee=="function"){g.callback=null,b=g.priorityLevel;var R=Ee(g.expirationTime<=q);if(q=e.unstable_now(),typeof R=="function"){g.callback=R,se(q),re=!0;break t}g===r(m)&&a(m),se(q)}else a(m);g=r(m)}if(g!==null)re=!0;else{var U=r(d);U!==null&&H(O,U.startTime-q),re=!1}}break e}finally{g=null,b=ye,v=!1}re=void 0}}finally{re?Z():j=!1}}}var Z;if(typeof G=="function")Z=function(){G(K)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,he=ge.port2;ge.port1.onmessage=K,Z=function(){he.postMessage(null)}}else Z=function(){M(K,0)};function H(q,re){Y=M(function(){q(e.unstable_now())},re)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(q){switch(b){case 1:case 2:case 3:var re=3;break;default:re=b}var ye=b;b=re;try{return q()}finally{b=ye}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(q,re){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ye=b;b=q;try{return re()}finally{b=ye}},e.unstable_scheduleCallback=function(q,re,ye){var Ee=e.unstable_now();switch(typeof ye=="object"&&ye!==null?(ye=ye.delay,ye=typeof ye=="number"&&0<ye?Ee+ye:Ee):ye=Ee,q){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=ye+R,q={id:y++,callback:re,priorityLevel:q,startTime:ye,expirationTime:R,sortIndex:-1},ye>Ee?(q.sortIndex=ye,n(d,q),r(m)===null&&q===r(d)&&(z?(F(Y),Y=-1):z=!0,H(O,ye-Ee))):(q.sortIndex=R,n(m,q),C||v||(C=!0,j||(j=!0,Z()))),q},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(q){var re=b;return function(){var ye=b;b=re;try{return q.apply(this,arguments)}finally{b=ye}}}})(sh)),sh}var Vy;function Fw(){return Vy||(Vy=1,ah.exports=Iw()),ah.exports}var lh={exports:{}},ln={};/**
|
|
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 Yy;function $w(){if(Yy)return ln;Yy=1;var e=vd();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 ln.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,ln.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)},ln.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()}},ln.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))},ln.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},ln.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,v=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:v}):y==="script"&&a.d.X(m,{crossOrigin:g,integrity:b,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},ln.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)},ln.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})}},ln.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)},ln.requestFormReset=function(m){a.d.r(m)},ln.unstable_batchedUpdates=function(m,d){return m(d)},ln.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},ln.useFormStatus=function(){return c.H.useHostTransitionStatus()},ln.version="19.2.4",ln}var Jy;function Ob(){if(Jy)return lh.exports;Jy=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=$w(),lh.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 Xy;function Gw(){if(Xy)return ul;Xy=1;var e=Fw(),n=vd(),r=Ob();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"),v=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),G=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),N=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 ge=Symbol.for("react.client.reference");function he(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ge?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case z:return"Fragment";case M:return"Profiler";case B:return"StrictMode";case O:return"Suspense";case j:return"SuspenseList";case V:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case C:return"Portal";case G:return t.displayName||"Context";case F:return(t._context.displayName||"Context")+".Consumer";case se:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Y:return i=t.displayName||null,i!==null?i:he(t.type)||"Memo";case J:i=t._payload,t=t._init;try{return he(t(i))}catch{}}return null}var H=Array.isArray,q=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye={pending:!1,data:null,method:null,action:null},Ee=[],R=-1;function U(t){return{current:t}}function te(t){0>R||(t.current=Ee[R],Ee[R]=null,R--)}function E(t,i){R++,Ee[R]=t.current,t.current=i}var ue=U(null),pe=U(null),ve=U(null),je=U(null);function De(t,i){switch(E(ve,i),E(pe,t),E(ue,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?cy(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=cy(i),t=fy(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}te(ue),E(ue,t)}function Ce(){te(ue),te(pe),te(ve)}function ze(t){t.memoizedState!==null&&E(je,t);var i=ue.current,s=fy(i,t.type);i!==s&&(E(pe,t),E(ue,s))}function lt(t){pe.current===t&&(te(ue),te(pe)),je.current===t&&(te(je),il._currentValue=ye)}var Fe,qe;function Be(t){if(Fe===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);Fe=i&&i[1]||"",qe=-1<s.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Fe+t+qe}var we=!1;function Le(t,i){if(!t||we)return"";we=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(ae){var ne=ae}Reflect.construct(t,[],me)}else{try{me.call()}catch(ae){ne=ae}t.call(me.prototype)}}else{try{throw Error()}catch(ae){ne=ae}(me=t())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(ae){if(ae&&ne&&typeof ae.stack=="string")return[ae.stack,ne.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),x=p[0],S=p[1];if(x&&S){var P=x.split(`
|
|
44
|
+
`),ee=S.split(`
|
|
45
|
+
`);for(h=o=0;o<P.length&&!P[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ee.length&&!ee[h].includes("DetermineComponentFrameRoot");)h++;if(o===P.length||h===ee.length)for(o=P.length-1,h=ee.length-1;1<=o&&0<=h&&P[o]!==ee[h];)h--;for(;1<=o&&0<=h;o--,h--)if(P[o]!==ee[h]){if(o!==1||h!==1)do if(o--,h--,0>h||P[o]!==ee[h]){var oe=`
|
|
46
|
+
`+P[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{we=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?Be(s):""}function $e(t,i){switch(t.tag){case 26:case 27:case 5:return Be(t.type);case 16:return Be("Lazy");case 13:return t.child!==i&&i!==null?Be("Suspense Fallback"):Be("Suspense");case 19:return Be("SuspenseList");case 0:case 15:return Le(t.type,!1);case 11:return Le(t.type.render,!1);case 1:return Le(t.type,!0);case 31:return Be("Activity");default:return""}}function jt(t){try{var i="",s=null;do i+=$e(t,s),s=t,t=t.return;while(t);return i}catch(o){return`
|
|
47
|
+
Error generating stack: `+o.message+`
|
|
48
|
+
`+o.stack}}var gn=Object.prototype.hasOwnProperty,ar=e.unstable_scheduleCallback,An=e.unstable_cancelCallback,ti=e.unstable_shouldYield,gr=e.unstable_requestPaint,gt=e.unstable_now,ni=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,Pe=e.unstable_NormalPriority,Je=e.unstable_LowPriority,it=e.unstable_IdlePriority,Kt=e.log,yn=e.unstable_setDisableYieldValue,It=null,ht=null;function Dt(t){if(typeof Kt=="function"&&yn(t),ht&&typeof ht.setStrictMode=="function")try{ht.setStrictMode(It,t)}catch{}}var xe=Math.clz32?Math.clz32:Fn,Ve=Math.log,ot=Math.LN2;function Fn(t){return t>>>=0,t===0?32:31-(Ve(t)/ot|0)|0}var Bt=256,Nr=262144,ri=4194304;function sr(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=sr(o):(x&=S,x!==0?h=sr(x):s||(s=S&~t,s!==0&&(h=sr(s))))):(S=o&~p,S!==0?h=sr(S):x!==0?h=sr(x):s||(s=o&~t,s!==0&&(h=sr(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 bs(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 da(){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 lr(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,P=t.expirationTimes,ee=t.hiddenUpdates;for(s=x&~s;0<s;){var oe=31-xe(s),me=1<<oe;S[oe]=0,P[oe]=-1;var ne=ee[oe];if(ne!==null)for(ee[oe]=null,oe=0;oe<ne.length;oe++){var ae=ne[oe];ae!==null&&(ae.lane&=-536870913)}s&=~me}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:Or(s),(s&(t.suspendedLanes|i))!==0?0:s}function Or(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 xs(){var t=re.p;return t!==0?t:(t=window.event,t===void 0?32:Dy(t.type))}function Fl(t,i){var s=re.p;try{return re.p=t,i()}finally{re.p=s}}var yr=Math.random().toString(36).slice(2),St="__reactFiber$"+yr,zt="__reactProps$"+yr,Tn="__reactContainer$"+yr,Gi="__reactEvents$"+yr,vs="__reactListeners$"+yr,$l="__reactHandles$"+yr,Gl="__reactResources$"+yr,Jt="__reactMarker$"+yr;function ma(t){delete t[St],delete t[zt],delete t[Gi],delete t[vs],delete t[$l]}function _(t){var i=t[St];if(i)return i;for(var s=t.parentNode;s;){if(i=s[Tn]||s[St]){if(s=i.alternate,i.child!==null||s!==null&&s.child!==null)for(t=by(t);t!==null;){if(s=t[St])return s;t=by(t)}return i}t=s,s=t.parentNode}return null}function T(t){if(t=t[St]||t[Tn]){var i=t.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return t}return null}function A(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t.stateNode;throw Error(a(33))}function D(t){var i=t[Gl];return i||(i=t[Gl]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function I(t){t[Jt]=!0}var Q=new Set,de={};function be(t,i){ie(t,i),ie(t+"Capture",i)}function ie(t,i){for(de[t]=i,t=0;t<i.length;t++)Q.add(i[t])}var fe=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Oe={},Qe={};function Ct(t){return gn.call(Qe,t)?!0:gn.call(Oe,t)?!1:fe.test(t)?Qe[t]=!0:(Oe[t]=!0,!1)}function sn(t,i,s){if(Ct(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 or(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 Rr(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 $n(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function nm(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function N1(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 Ju(t){if(!t._valueTracker){var i=nm(t)?"checked":"value";t._valueTracker=N1(t,i,""+t[i])}}function rm(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var s=i.getValue(),o="";return t&&(o=nm(t)?t.checked?"true":"false":t.value),t=o,t!==s?(i.setValue(t),!0):!1}function Vl(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 O1=/[\n"\\]/g;function Gn(t){return t.replace(O1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Xu(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=""+$n(i)):t.value!==""+$n(i)&&(t.value=""+$n(i)):x!=="submit"&&x!=="reset"||t.removeAttribute("value"),i!=null?Ku(t,x,$n(i)):s!=null?Ku(t,x,$n(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=""+$n(S):t.removeAttribute("name")}function im(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)){Ju(t);return}s=s!=null?""+$n(s):"",i=i!=null?""+$n(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),Ju(t)}function Ku(t,i,s){i==="number"&&Vl(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function pa(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=""+$n(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 am(t,i,s){if(i!=null&&(i=""+$n(i),i!==t.value&&(t.value=i),s==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=s!=null?""+$n(s):""}function sm(t,i,s,o){if(i==null){if(o!=null){if(s!=null)throw Error(a(92));if(H(o)){if(1<o.length)throw Error(a(93));o=o[0]}s=o}s==null&&(s=""),i=s}s=$n(i),t.defaultValue=s,o=t.textContent,o===s&&o!==""&&o!==null&&(t.value=o),Ju(t)}function ga(t,i){if(i){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=i;return}}t.textContent=i}var R1=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 lm(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||R1.has(i)?i==="float"?t.cssFloat=s:t[i]=(""+s).trim():t[i]=s+"px"}function om(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&&lm(t,h,o)}else for(var p in i)i.hasOwnProperty(p)&&lm(t,p,i[p])}function Qu(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 M1=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"]]),D1=/^[\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 Yl(t){return D1.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Mr(){}var Zu=null;function Wu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ya=null,ba=null;function um(t){var i=T(t);if(i&&(t=i.stateNode)){var s=t[zt]||null;e:switch(t=i.stateNode,i.type){case"input":if(Xu(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="'+Gn(""+i)+'"][type="radio"]'),i=0;i<s.length;i++){var o=s[i];if(o!==t&&o.form===t.form){var h=o[zt]||null;if(!h)throw Error(a(90));Xu(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&&rm(o)}break e;case"textarea":am(t,s.value,s.defaultValue);break e;case"select":i=s.value,i!=null&&pa(t,!!s.multiple,i,!1)}}}var ec=!1;function cm(t,i,s){if(ec)return t(i,s);ec=!0;try{var o=t(i);return o}finally{if(ec=!1,(ya!==null||ba!==null)&&(zo(),ya&&(i=ya,t=ba,ba=ya=null,um(i),t)))for(i=0;i<t.length;i++)um(t[i])}}function ws(t,i){var s=t.stateNode;if(s===null)return null;var o=s[zt]||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 Dr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tc=!1;if(Dr)try{var Ss={};Object.defineProperty(Ss,"passive",{get:function(){tc=!0}}),window.addEventListener("test",Ss,Ss),window.removeEventListener("test",Ss,Ss)}catch{tc=!1}var oi=null,nc=null,Jl=null;function fm(){if(Jl)return Jl;var t,i=nc,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 Jl=h.slice(t,1<o?1-o:void 0)}function Xl(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 Kl(){return!0}function hm(){return!1}function bn(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)?Kl:hm,this.isPropagationStopped=hm,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=Kl)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Kl)},persist:function(){},isPersistent:Kl}),i}var Vi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ql=bn(Vi),_s=g({},Vi,{view:0,detail:0}),z1=bn(_s),rc,ic,Es,Zl=g({},_s,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sc,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!==Es&&(Es&&t.type==="mousemove"?(rc=t.screenX-Es.screenX,ic=t.screenY-Es.screenY):ic=rc=0,Es=t),rc)},movementY:function(t){return"movementY"in t?t.movementY:ic}}),dm=bn(Zl),L1=g({},Zl,{dataTransfer:0}),U1=bn(L1),B1=g({},_s,{relatedTarget:0}),ac=bn(B1),P1=g({},Vi,{animationName:0,elapsedTime:0,pseudoElement:0}),H1=bn(P1),q1=g({},Vi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),I1=bn(q1),F1=g({},Vi,{data:0}),mm=bn(F1),$1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},G1={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"},V1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Y1(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=V1[t])?!!i[t]:!1}function sc(){return Y1}var J1=g({},_s,{key:function(t){if(t.key){var i=$1[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=Xl(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?G1[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sc,charCode:function(t){return t.type==="keypress"?Xl(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Xl(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),X1=bn(J1),K1=g({},Zl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),pm=bn(K1),Q1=g({},_s,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sc}),Z1=bn(Q1),W1=g({},Vi,{propertyName:0,elapsedTime:0,pseudoElement:0}),ev=bn(W1),tv=g({},Zl,{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}),nv=bn(tv),rv=g({},Vi,{newState:0,oldState:0}),iv=bn(rv),av=[9,13,27,32],lc=Dr&&"CompositionEvent"in window,ks=null;Dr&&"documentMode"in document&&(ks=document.documentMode);var sv=Dr&&"TextEvent"in window&&!ks,gm=Dr&&(!lc||ks&&8<ks&&11>=ks),ym=" ",bm=!1;function xm(t,i){switch(t){case"keyup":return av.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var xa=!1;function lv(t,i){switch(t){case"compositionend":return vm(i);case"keypress":return i.which!==32?null:(bm=!0,ym);case"textInput":return t=i.data,t===ym&&bm?null:t;default:return null}}function ov(t,i){if(xa)return t==="compositionend"||!lc&&xm(t,i)?(t=fm(),Jl=nc=oi=null,xa=!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 gm&&i.locale!=="ko"?null:i.data;default:return null}}var uv={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 wm(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!uv[t.type]:i==="textarea"}function Sm(t,i,s,o){ya?ba?ba.push(o):ba=[o]:ya=o,i=Io(i,"onChange"),0<i.length&&(s=new Ql("onChange","change",null,s,o),t.push({event:s,listeners:i}))}var Cs=null,As=null;function cv(t){iy(t,0)}function Wl(t){var i=A(t);if(rm(i))return t}function _m(t,i){if(t==="change")return i}var Em=!1;if(Dr){var oc;if(Dr){var uc="oninput"in document;if(!uc){var km=document.createElement("div");km.setAttribute("oninput","return;"),uc=typeof km.oninput=="function"}oc=uc}else oc=!1;Em=oc&&(!document.documentMode||9<document.documentMode)}function Cm(){Cs&&(Cs.detachEvent("onpropertychange",Am),As=Cs=null)}function Am(t){if(t.propertyName==="value"&&Wl(As)){var i=[];Sm(i,As,t,Wu(t)),cm(cv,i)}}function fv(t,i,s){t==="focusin"?(Cm(),Cs=i,As=s,Cs.attachEvent("onpropertychange",Am)):t==="focusout"&&Cm()}function hv(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Wl(As)}function dv(t,i){if(t==="click")return Wl(i)}function mv(t,i){if(t==="input"||t==="change")return Wl(i)}function pv(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var jn=typeof Object.is=="function"?Object.is:pv;function Ts(t,i){if(jn(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(!gn.call(i,h)||!jn(t[h],i[h]))return!1}return!0}function Tm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function jm(t,i){var s=Tm(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=Tm(s)}}function Nm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Nm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Om(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Vl(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=Vl(t.document)}return i}function cc(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 gv=Dr&&"documentMode"in document&&11>=document.documentMode,va=null,fc=null,js=null,hc=!1;function Rm(t,i,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;hc||va==null||va!==Vl(o)||(o=va,"selectionStart"in o&&cc(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}),js&&Ts(js,o)||(js=o,o=Io(fc,"onSelect"),0<o.length&&(i=new Ql("onSelect","select",null,i,s),t.push({event:i,listeners:o}),i.target=va)))}function Yi(t,i){var s={};return s[t.toLowerCase()]=i.toLowerCase(),s["Webkit"+t]="webkit"+i,s["Moz"+t]="moz"+i,s}var wa={animationend:Yi("Animation","AnimationEnd"),animationiteration:Yi("Animation","AnimationIteration"),animationstart:Yi("Animation","AnimationStart"),transitionrun:Yi("Transition","TransitionRun"),transitionstart:Yi("Transition","TransitionStart"),transitioncancel:Yi("Transition","TransitionCancel"),transitionend:Yi("Transition","TransitionEnd")},dc={},Mm={};Dr&&(Mm=document.createElement("div").style,"AnimationEvent"in window||(delete wa.animationend.animation,delete wa.animationiteration.animation,delete wa.animationstart.animation),"TransitionEvent"in window||delete wa.transitionend.transition);function Ji(t){if(dc[t])return dc[t];if(!wa[t])return t;var i=wa[t],s;for(s in i)if(i.hasOwnProperty(s)&&s in Mm)return dc[t]=i[s];return t}var Dm=Ji("animationend"),zm=Ji("animationiteration"),Lm=Ji("animationstart"),yv=Ji("transitionrun"),bv=Ji("transitionstart"),xv=Ji("transitioncancel"),Um=Ji("transitionend"),Bm=new Map,mc="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(" ");mc.push("scrollEnd");function ur(t,i){Bm.set(t,i),be(i,[t])}var eo=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)},Vn=[],Sa=0,pc=0;function to(){for(var t=Sa,i=pc=Sa=0;i<t;){var s=Vn[i];Vn[i++]=null;var o=Vn[i];Vn[i++]=null;var h=Vn[i];Vn[i++]=null;var p=Vn[i];if(Vn[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&&Pm(s,h,p)}}function no(t,i,s,o){Vn[Sa++]=t,Vn[Sa++]=i,Vn[Sa++]=s,Vn[Sa++]=o,pc|=o,t.lanes|=o,t=t.alternate,t!==null&&(t.lanes|=o)}function gc(t,i,s,o){return no(t,i,s,o),ro(t)}function Xi(t,i){return no(t,null,null,i),ro(t)}function Pm(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 ro(t){if(50<Qs)throw Qs=0,Cf=null,Error(a(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var _a={};function vv(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 Nn(t,i,s,o){return new vv(t,i,s,o)}function yc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function zr(t,i){var s=t.alternate;return s===null?(s=Nn(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 Hm(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 io(t,i,s,o,h,p){var x=0;if(o=t,typeof t=="function")yc(t)&&(x=1);else if(typeof t=="string")x=kw(t,s,ue.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case V:return t=Nn(31,s,i,h),t.elementType=V,t.lanes=p,t;case z:return Ki(s.children,h,p,i);case B:x=8,h|=24;break;case M:return t=Nn(12,s,i,h|2),t.elementType=M,t.lanes=p,t;case O:return t=Nn(13,s,i,h),t.elementType=O,t.lanes=p,t;case j:return t=Nn(19,s,i,h),t.elementType=j,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case G:x=10;break e;case F:x=9;break e;case se:x=11;break e;case Y:x=14;break e;case J:x=16,o=null;break e}x=29,s=Error(a(130,t===null?"null":typeof t,"")),o=null}return i=Nn(x,s,i,h),i.elementType=t,i.type=o,i.lanes=p,i}function Ki(t,i,s,o){return t=Nn(7,t,o,i),t.lanes=s,t}function bc(t,i,s){return t=Nn(6,t,null,i),t.lanes=s,t}function qm(t){var i=Nn(18,null,null,0);return i.stateNode=t,i}function xc(t,i,s){return i=Nn(4,t.children!==null?t.children:[],t.key,i),i.lanes=s,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var Im=new WeakMap;function Yn(t,i){if(typeof t=="object"&&t!==null){var s=Im.get(t);return s!==void 0?s:(i={value:t,source:i,stack:jt(i)},Im.set(t,i),i)}return{value:t,source:i,stack:jt(i)}}var Ea=[],ka=0,ao=null,Ns=0,Jn=[],Xn=0,ui=null,br=1,xr="";function Lr(t,i){Ea[ka++]=Ns,Ea[ka++]=ao,ao=t,Ns=i}function Fm(t,i,s){Jn[Xn++]=br,Jn[Xn++]=xr,Jn[Xn++]=ui,ui=t;var o=br;t=xr;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,br=1<<32-xe(i)+h|s<<h|o,xr=p+t}else br=1<<p|s<<h|o,xr=t}function vc(t){t.return!==null&&(Lr(t,1),Fm(t,1,0))}function wc(t){for(;t===ao;)ao=Ea[--ka],Ea[ka]=null,Ns=Ea[--ka],Ea[ka]=null;for(;t===ui;)ui=Jn[--Xn],Jn[Xn]=null,xr=Jn[--Xn],Jn[Xn]=null,br=Jn[--Xn],Jn[Xn]=null}function $m(t,i){Jn[Xn++]=br,Jn[Xn++]=xr,Jn[Xn++]=ui,br=i.id,xr=i.overflow,ui=t}var tn=null,At=null,rt=!1,ci=null,Kn=!1,Sc=Error(a(519));function fi(t){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Os(Yn(i,t)),Sc}function Gm(t){var i=t.stateNode,s=t.type,o=t.memoizedProps;switch(i[St]=t,i[zt]=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<Ws.length;s++)We(Ws[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),im(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),sm(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||oy(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=Mr),i=!0):i=!1,i||fi(t,!0)}function Vm(t){for(tn=t.return;tn;)switch(tn.tag){case 5:case 31:case 13:Kn=!1;return;case 27:case 3:Kn=!0;return;default:tn=tn.return}}function Ca(t){if(t!==tn)return!1;if(!rt)return Vm(t),rt=!0,!1;var i=t.tag,s;if((s=i!==3&&i!==27)&&((s=i===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||qf(t.type,t.memoizedProps)),s=!s),s&&At&&fi(t),Vm(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));At=yy(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));At=yy(t)}else i===27?(i=At,ki(t.type)?(t=Vf,Vf=null,At=t):At=i):At=tn?Zn(t.stateNode.nextSibling):null;return!0}function Qi(){At=tn=null,rt=!1}function _c(){var t=ci;return t!==null&&(Sn===null?Sn=t:Sn.push.apply(Sn,t),ci=null),t}function Os(t){ci===null?ci=[t]:ci.push(t)}var Ec=U(null),Zi=null,Ur=null;function hi(t,i,s){E(Ec,i._currentValue),i._currentValue=s}function Br(t){t._currentValue=Ec.current,te(Ec)}function kc(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 Cc(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 P=0;P<i.length;P++)if(S.context===i[P]){p.lanes|=s,S=p.alternate,S!==null&&(S.lanes|=s),kc(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),kc(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 Aa(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;jn(h.pendingProps.value,x.value)||(t!==null?t.push(S):t=[S])}}else if(h===je.current){if(x=h.alternate,x===null)throw Error(a(387));x.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(il):t=[il])}h=h.return}t!==null&&Cc(i,t,s,o),i.flags|=262144}function so(t){for(t=t.firstContext;t!==null;){if(!jn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Wi(t){Zi=t,Ur=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function nn(t){return Ym(Zi,t)}function lo(t,i){return Zi===null&&Wi(t),Ym(t,i)}function Ym(t,i){var s=i._currentValue;if(i={context:i,memoizedValue:s,next:null},Ur===null){if(t===null)throw Error(a(308));Ur=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else Ur=Ur.next=i;return s}var wv=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()})}},Sv=e.unstable_scheduleCallback,_v=e.unstable_NormalPriority,Ft={$$typeof:G,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ac(){return{controller:new wv,data:new Map,refCount:0}}function Rs(t){t.refCount--,t.refCount===0&&Sv(_v,function(){t.controller.abort()})}var Ms=null,Tc=0,Ta=0,ja=null;function Ev(t,i){if(Ms===null){var s=Ms=[];Tc=0,Ta=Rf(),ja={status:"pending",value:void 0,then:function(o){s.push(o)}}}return Tc++,i.then(Jm,Jm),i}function Jm(){if(--Tc===0&&Ms!==null){ja!==null&&(ja.status="fulfilled");var t=Ms;Ms=null,Ta=0,ja=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function kv(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 Xm=q.S;q.S=function(t,i){Rg=gt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Ev(t,i),Xm!==null&&Xm(t,i)};var ea=U(null);function jc(){var t=ea.current;return t!==null?t:_t.pooledCache}function oo(t,i){i===null?E(ea,ea.current):E(ea,i.pool)}function Km(){var t=jc();return t===null?null:{parent:Ft._currentValue,pool:t}}var Na=Error(a(460)),Nc=Error(a(474)),uo=Error(a(542)),co={then:function(){}};function Qm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Zm(t,i,s){switch(s=t[s],s===void 0?t.push(i):s!==i&&(i.then(Mr,Mr),i=s),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,ep(t),t;default:if(typeof i.status=="string")i.then(Mr,Mr);else{if(t=_t,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,ep(t),t}throw na=i,Na}}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,Na):s}}var na=null;function Wm(){if(na===null)throw Error(a(459));var t=na;return na=null,t}function ep(t){if(t===Na||t===uo)throw Error(a(483))}var Oa=null,Ds=0;function fo(t){var i=Ds;return Ds+=1,Oa===null&&(Oa=[]),Zm(Oa,t,i)}function zs(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function ho(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 tp(t){function i(X,$){if(t){var W=X.deletions;W===null?(X.deletions=[$],X.flags|=16):W.push($)}}function s(X,$){if(!t)return null;for(;$!==null;)i(X,$),$=$.sibling;return null}function o(X){for(var $=new Map;X!==null;)X.key!==null?$.set(X.key,X):$.set(X.index,X),X=X.sibling;return $}function h(X,$){return X=zr(X,$),X.index=0,X.sibling=null,X}function p(X,$,W){return X.index=W,t?(W=X.alternate,W!==null?(W=W.index,W<$?(X.flags|=67108866,$):W):(X.flags|=67108866,$)):(X.flags|=1048576,$)}function x(X){return t&&X.alternate===null&&(X.flags|=67108866),X}function S(X,$,W,ce){return $===null||$.tag!==6?($=bc(W,X.mode,ce),$.return=X,$):($=h($,W),$.return=X,$)}function P(X,$,W,ce){var Ue=W.type;return Ue===z?oe(X,$,W.props.children,ce,W.key):$!==null&&($.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===J&&ta(Ue)===$.type)?($=h($,W.props),zs($,W),$.return=X,$):($=io(W.type,W.key,W.props,null,X.mode,ce),zs($,W),$.return=X,$)}function ee(X,$,W,ce){return $===null||$.tag!==4||$.stateNode.containerInfo!==W.containerInfo||$.stateNode.implementation!==W.implementation?($=xc(W,X.mode,ce),$.return=X,$):($=h($,W.children||[]),$.return=X,$)}function oe(X,$,W,ce,Ue){return $===null||$.tag!==7?($=Ki(W,X.mode,ce,Ue),$.return=X,$):($=h($,W),$.return=X,$)}function me(X,$,W){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=bc(""+$,X.mode,W),$.return=X,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case v:return W=io($.type,$.key,$.props,null,X.mode,W),zs(W,$),W.return=X,W;case C:return $=xc($,X.mode,W),$.return=X,$;case J:return $=ta($),me(X,$,W)}if(H($)||Z($))return $=Ki($,X.mode,W,null),$.return=X,$;if(typeof $.then=="function")return me(X,fo($),W);if($.$$typeof===G)return me(X,lo(X,$),W);ho(X,$)}return null}function ne(X,$,W,ce){var Ue=$!==null?$.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return Ue!==null?null:S(X,$,""+W,ce);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case v:return W.key===Ue?P(X,$,W,ce):null;case C:return W.key===Ue?ee(X,$,W,ce):null;case J:return W=ta(W),ne(X,$,W,ce)}if(H(W)||Z(W))return Ue!==null?null:oe(X,$,W,ce,null);if(typeof W.then=="function")return ne(X,$,fo(W),ce);if(W.$$typeof===G)return ne(X,$,lo(X,W),ce);ho(X,W)}return null}function ae(X,$,W,ce,Ue){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return X=X.get(W)||null,S($,X,""+ce,Ue);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return X=X.get(ce.key===null?W:ce.key)||null,P($,X,ce,Ue);case C:return X=X.get(ce.key===null?W:ce.key)||null,ee($,X,ce,Ue);case J:return ce=ta(ce),ae(X,$,W,ce,Ue)}if(H(ce)||Z(ce))return X=X.get(W)||null,oe($,X,ce,Ue,null);if(typeof ce.then=="function")return ae(X,$,W,fo(ce),Ue);if(ce.$$typeof===G)return ae(X,$,W,lo($,ce),Ue);ho($,ce)}return null}function Re(X,$,W,ce){for(var Ue=null,ut=null,Me=$,Xe=$=0,nt=null;Me!==null&&Xe<W.length;Xe++){Me.index>Xe?(nt=Me,Me=null):nt=Me.sibling;var ct=ne(X,Me,W[Xe],ce);if(ct===null){Me===null&&(Me=nt);break}t&&Me&&ct.alternate===null&&i(X,Me),$=p(ct,$,Xe),ut===null?Ue=ct:ut.sibling=ct,ut=ct,Me=nt}if(Xe===W.length)return s(X,Me),rt&&Lr(X,Xe),Ue;if(Me===null){for(;Xe<W.length;Xe++)Me=me(X,W[Xe],ce),Me!==null&&($=p(Me,$,Xe),ut===null?Ue=Me:ut.sibling=Me,ut=Me);return rt&&Lr(X,Xe),Ue}for(Me=o(Me);Xe<W.length;Xe++)nt=ae(Me,X,Xe,W[Xe],ce),nt!==null&&(t&&nt.alternate!==null&&Me.delete(nt.key===null?Xe:nt.key),$=p(nt,$,Xe),ut===null?Ue=nt:ut.sibling=nt,ut=nt);return t&&Me.forEach(function(Ni){return i(X,Ni)}),rt&&Lr(X,Xe),Ue}function Ie(X,$,W,ce){if(W==null)throw Error(a(151));for(var Ue=null,ut=null,Me=$,Xe=$=0,nt=null,ct=W.next();Me!==null&&!ct.done;Xe++,ct=W.next()){Me.index>Xe?(nt=Me,Me=null):nt=Me.sibling;var Ni=ne(X,Me,ct.value,ce);if(Ni===null){Me===null&&(Me=nt);break}t&&Me&&Ni.alternate===null&&i(X,Me),$=p(Ni,$,Xe),ut===null?Ue=Ni:ut.sibling=Ni,ut=Ni,Me=nt}if(ct.done)return s(X,Me),rt&&Lr(X,Xe),Ue;if(Me===null){for(;!ct.done;Xe++,ct=W.next())ct=me(X,ct.value,ce),ct!==null&&($=p(ct,$,Xe),ut===null?Ue=ct:ut.sibling=ct,ut=ct);return rt&&Lr(X,Xe),Ue}for(Me=o(Me);!ct.done;Xe++,ct=W.next())ct=ae(Me,X,Xe,ct.value,ce),ct!==null&&(t&&ct.alternate!==null&&Me.delete(ct.key===null?Xe:ct.key),$=p(ct,$,Xe),ut===null?Ue=ct:ut.sibling=ct,ut=ct);return t&&Me.forEach(function(Lw){return i(X,Lw)}),rt&&Lr(X,Xe),Ue}function xt(X,$,W,ce){if(typeof W=="object"&&W!==null&&W.type===z&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case v:e:{for(var Ue=W.key;$!==null;){if($.key===Ue){if(Ue=W.type,Ue===z){if($.tag===7){s(X,$.sibling),ce=h($,W.props.children),ce.return=X,X=ce;break e}}else if($.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===J&&ta(Ue)===$.type){s(X,$.sibling),ce=h($,W.props),zs(ce,W),ce.return=X,X=ce;break e}s(X,$);break}else i(X,$);$=$.sibling}W.type===z?(ce=Ki(W.props.children,X.mode,ce,W.key),ce.return=X,X=ce):(ce=io(W.type,W.key,W.props,null,X.mode,ce),zs(ce,W),ce.return=X,X=ce)}return x(X);case C:e:{for(Ue=W.key;$!==null;){if($.key===Ue)if($.tag===4&&$.stateNode.containerInfo===W.containerInfo&&$.stateNode.implementation===W.implementation){s(X,$.sibling),ce=h($,W.children||[]),ce.return=X,X=ce;break e}else{s(X,$);break}else i(X,$);$=$.sibling}ce=xc(W,X.mode,ce),ce.return=X,X=ce}return x(X);case J:return W=ta(W),xt(X,$,W,ce)}if(H(W))return Re(X,$,W,ce);if(Z(W)){if(Ue=Z(W),typeof Ue!="function")throw Error(a(150));return W=Ue.call(W),Ie(X,$,W,ce)}if(typeof W.then=="function")return xt(X,$,fo(W),ce);if(W.$$typeof===G)return xt(X,$,lo(X,W),ce);ho(X,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,$!==null&&$.tag===6?(s(X,$.sibling),ce=h($,W),ce.return=X,X=ce):(s(X,$),ce=bc(W,X.mode,ce),ce.return=X,X=ce),x(X)):s(X,$)}return function(X,$,W,ce){try{Ds=0;var Ue=xt(X,$,W,ce);return Oa=null,Ue}catch(Me){if(Me===Na||Me===uo)throw Me;var ut=Nn(29,Me,null,X.mode);return ut.lanes=ce,ut.return=X,ut}finally{}}}var ra=tp(!0),np=tp(!1),di=!1;function Oc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rc(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,(ft&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=ro(t),Pm(t,null,s),i}return no(t,o,i,s),ro(t)}function Ls(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 Mc(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 Dc=!1;function Us(){if(Dc){var t=ja;if(t!==null)throw t}}function Bs(t,i,s,o){Dc=!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 P=S,ee=P.next;P.next=null,x===null?p=ee:x.next=ee,x=P;var oe=t.alternate;oe!==null&&(oe=oe.updateQueue,S=oe.lastBaseUpdate,S!==x&&(S===null?oe.firstBaseUpdate=ee:S.next=ee,oe.lastBaseUpdate=P))}if(p!==null){var me=h.baseState;x=0,oe=ee=P=null,S=p;do{var ne=S.lane&-536870913,ae=ne!==S.lane;if(ae?(tt&ne)===ne:(o&ne)===ne){ne!==0&&ne===Ta&&(Dc=!0),oe!==null&&(oe=oe.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Re=t,Ie=S;ne=i;var xt=s;switch(Ie.tag){case 1:if(Re=Ie.payload,typeof Re=="function"){me=Re.call(xt,me,ne);break e}me=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Ie.payload,ne=typeof Re=="function"?Re.call(xt,me,ne):Re,ne==null)break e;me=g({},me,ne);break e;case 2:di=!0}}ne=S.callback,ne!==null&&(t.flags|=64,ae&&(t.flags|=8192),ae=h.callbacks,ae===null?h.callbacks=[ne]:ae.push(ne))}else ae={lane:ne,tag:S.tag,payload:S.payload,callback:S.callback,next:null},oe===null?(ee=oe=ae,P=me):oe=oe.next=ae,x|=ne;if(S=S.next,S===null){if(S=h.shared.pending,S===null)break;ae=S,S=ae.next,ae.next=null,h.lastBaseUpdate=ae,h.shared.pending=null}}while(!0);oe===null&&(P=me),h.baseState=P,h.firstBaseUpdate=ee,h.lastBaseUpdate=oe,p===null&&(h.shared.lanes=0),vi|=x,t.lanes=x,t.memoizedState=me}}function rp(t,i){if(typeof t!="function")throw Error(a(191,t));t.call(i)}function ip(t,i){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)rp(s[t],i)}var Ra=U(null),mo=U(0);function ap(t,i){t=Yr,E(mo,t),E(Ra,i),Yr=t|i.baseLanes}function zc(){E(mo,Yr),E(Ra,Ra.current)}function Lc(){Yr=mo.current,te(Ra),te(mo)}var On=U(null),Qn=null;function gi(t){var i=t.alternate;E(Pt,Pt.current&1),E(On,t),Qn===null&&(i===null||Ra.current!==null||i.memoizedState!==null)&&(Qn=t)}function Uc(t){E(Pt,Pt.current),E(On,t),Qn===null&&(Qn=t)}function sp(t){t.tag===22?(E(Pt,Pt.current),E(On,t),Qn===null&&(Qn=t)):yi()}function yi(){E(Pt,Pt.current),E(On,On.current)}function Rn(t){te(On),Qn===t&&(Qn=null),te(Pt)}var Pt=U(0);function po(t){for(var i=t;i!==null;){if(i.tag===13){var s=i.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||$f(s)||Gf(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 Pr=0,Ye=null,yt=null,$t=null,go=!1,Ma=!1,ia=!1,yo=0,Ps=0,Da=null,Cv=0;function Lt(){throw Error(a(321))}function Bc(t,i){if(i===null)return!1;for(var s=0;s<i.length&&s<t.length;s++)if(!jn(t[s],i[s]))return!1;return!0}function Pc(t,i,s,o,h,p){return Pr=p,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=t===null||t.memoizedState===null?Fp:ef,ia=!1,p=s(o,h),ia=!1,Ma&&(p=op(i,s,o,h)),lp(t),p}function lp(t){q.H=Is;var i=yt!==null&&yt.next!==null;if(Pr=0,$t=yt=Ye=null,go=!1,Ps=0,Da=null,i)throw Error(a(300));t===null||Gt||(t=t.dependencies,t!==null&&so(t)&&(Gt=!0))}function op(t,i,s,o){Ye=t;var h=0;do{if(Ma&&(Da=null),Ps=0,Ma=!1,25<=h)throw Error(a(301));if(h+=1,$t=yt=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}q.H=$p,p=i(s,o)}while(Ma);return p}function Av(){var t=q.H,i=t.useState()[0];return i=typeof i.then=="function"?Hs(i):i,t=t.useState()[0],(yt!==null?yt.memoizedState:null)!==t&&(Ye.flags|=1024),i}function Hc(){var t=yo!==0;return yo=0,t}function qc(t,i,s){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~s}function Ic(t){if(go){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}go=!1}Pr=0,$t=yt=Ye=null,Ma=!1,Ps=yo=0,Da=null}function cn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $t===null?Ye.memoizedState=$t=t:$t=$t.next=t,$t}function Ht(){if(yt===null){var t=Ye.alternate;t=t!==null?t.memoizedState:null}else t=yt.next;var i=$t===null?Ye.memoizedState:$t.next;if(i!==null)$t=i,yt=t;else{if(t===null)throw Ye.alternate===null?Error(a(467)):Error(a(310));yt=t,t={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},$t===null?Ye.memoizedState=$t=t:$t=$t.next=t}return $t}function bo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Hs(t){var i=Ps;return Ps+=1,Da===null&&(Da=[]),t=Zm(Da,t,i),i=Ye,($t===null?i.memoizedState:$t.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?Fp:ef),t}function xo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Hs(t);if(t.$$typeof===G)return nn(t)}throw Error(a(438,String(t)))}function Fc(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=bo(),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]=N;return i.index++,s}function Hr(t,i){return typeof i=="function"?i(t):i}function vo(t){var i=Ht();return $c(i,yt,t)}function $c(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,P=null,ee=i,oe=!1;do{var me=ee.lane&-536870913;if(me!==ee.lane?(tt&me)===me:(Pr&me)===me){var ne=ee.revertLane;if(ne===0)P!==null&&(P=P.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),me===Ta&&(oe=!0);else if((Pr&ne)===ne){ee=ee.next,ne===Ta&&(oe=!0);continue}else me={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},P===null?(S=P=me,x=p):P=P.next=me,Ye.lanes|=ne,vi|=ne;me=ee.action,ia&&s(p,me),p=ee.hasEagerState?ee.eagerState:s(p,me)}else ne={lane:me,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},P===null?(S=P=ne,x=p):P=P.next=ne,Ye.lanes|=me,vi|=me;ee=ee.next}while(ee!==null&&ee!==i);if(P===null?x=p:P.next=S,!jn(p,t.memoizedState)&&(Gt=!0,oe&&(s=ja,s!==null)))throw s;t.memoizedState=p,t.baseState=x,t.baseQueue=P,o.lastRenderedState=p}return h===null&&(o.lanes=0),[t.memoizedState,o.dispatch]}function Gc(t){var i=Ht(),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);jn(p,i.memoizedState)||(Gt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),s.lastRenderedState=p}return[p,o]}function up(t,i,s){var o=Ye,h=Ht(),p=rt;if(p){if(s===void 0)throw Error(a(407));s=s()}else s=i();var x=!jn((yt||h).memoizedState,s);if(x&&(h.memoizedState=s,Gt=!0),h=h.queue,Jc(hp.bind(null,o,h,t),[t]),h.getSnapshot!==i||x||$t!==null&&$t.memoizedState.tag&1){if(o.flags|=2048,za(9,{destroy:void 0},fp.bind(null,o,h,s,i),null),_t===null)throw Error(a(349));p||(Pr&127)!==0||cp(o,i,s)}return s}function cp(t,i,s){t.flags|=16384,t={getSnapshot:i,value:s},i=Ye.updateQueue,i===null?(i=bo(),Ye.updateQueue=i,i.stores=[t]):(s=i.stores,s===null?i.stores=[t]:s.push(t))}function fp(t,i,s,o){i.value=s,i.getSnapshot=o,dp(i)&&mp(t)}function hp(t,i,s){return s(function(){dp(i)&&mp(t)})}function dp(t){var i=t.getSnapshot;t=t.value;try{var s=i();return!jn(t,s)}catch{return!0}}function mp(t){var i=Xi(t,2);i!==null&&_n(i,t,2)}function Vc(t){var i=cn();if(typeof t=="function"){var s=t;if(t=s(),ia){Dt(!0);try{s()}finally{Dt(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:t},i}function pp(t,i,s,o){return t.baseState=s,$c(t,yt,typeof o=="function"?o:Hr)}function Tv(t,i,s,o,h){if(_o(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)}};q.T!==null?s(!0):p.isTransition=!1,o(p),s=i.pending,s===null?(p.next=i.pending=p,gp(i,p)):(p.next=s.next,i.pending=s.next=p)}}function gp(t,i){var s=i.action,o=i.payload,h=t.state;if(i.isTransition){var p=q.T,x={};q.T=x;try{var S=s(h,o),P=q.S;P!==null&&P(x,S),yp(t,i,S)}catch(ee){Yc(t,i,ee)}finally{p!==null&&x.types!==null&&(p.types=x.types),q.T=p}}else try{p=s(h,o),yp(t,i,p)}catch(ee){Yc(t,i,ee)}}function yp(t,i,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(o){bp(t,i,o)},function(o){return Yc(t,i,o)}):bp(t,i,s)}function bp(t,i,s){i.status="fulfilled",i.value=s,xp(i),t.state=s,i=t.pending,i!==null&&(s=i.next,s===i?t.pending=null:(s=s.next,i.next=s,gp(t,s)))}function Yc(t,i,s){var o=t.pending;if(t.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=s,xp(i),i=i.next;while(i!==o)}t.action=null}function xp(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function vp(t,i){return i}function wp(t,i){if(rt){var s=_t.formState;if(s!==null){e:{var o=Ye;if(rt){if(At){t:{for(var h=At,p=Kn;h.nodeType!==8;){if(!p){h=null;break t}if(h=Zn(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){At=Zn(h.nextSibling),o=h.data==="F!";break e}}fi(o)}o=!1}o&&(i=s[0])}}return s=cn(),s.memoizedState=s.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vp,lastRenderedState:i},s.queue=o,s=Hp.bind(null,Ye,o),o.dispatch=s,o=Vc(!1),p=Wc.bind(null,Ye,!1,o.queue),o=cn(),h={state:i,dispatch:null,action:t,pending:null},o.queue=h,s=Tv.bind(null,Ye,h,p,s),h.dispatch=s,o.memoizedState=t,[i,s,!1]}function Sp(t){var i=Ht();return _p(i,yt,t)}function _p(t,i,s){if(i=$c(t,i,vp)[0],t=vo(Hr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Hs(i)}catch(x){throw x===Na?uo:x}else o=i;i=Ht();var h=i.queue,p=h.dispatch;return s!==i.memoizedState&&(Ye.flags|=2048,za(9,{destroy:void 0},jv.bind(null,h,s),null)),[o,p,t]}function jv(t,i){t.action=i}function Ep(t){var i=Ht(),s=yt;if(s!==null)return _p(i,s,t);Ht(),i=i.memoizedState,s=Ht();var o=s.queue.dispatch;return s.memoizedState=t,[i,o,!1]}function za(t,i,s,o){return t={tag:t,create:s,deps:o,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=bo(),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 kp(){return Ht().memoizedState}function wo(t,i,s,o){var h=cn();Ye.flags|=t,h.memoizedState=za(1|i,{destroy:void 0},s,o===void 0?null:o)}function So(t,i,s,o){var h=Ht();o=o===void 0?null:o;var p=h.memoizedState.inst;yt!==null&&o!==null&&Bc(o,yt.memoizedState.deps)?h.memoizedState=za(i,p,s,o):(Ye.flags|=t,h.memoizedState=za(1|i,p,s,o))}function Cp(t,i){wo(8390656,8,t,i)}function Jc(t,i){So(2048,8,t,i)}function Nv(t){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=bo(),Ye.updateQueue=i,i.events=[t];else{var s=i.events;s===null?i.events=[t]:s.push(t)}}function Ap(t){var i=Ht().memoizedState;return Nv({ref:i,nextImpl:t}),function(){if((ft&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function Tp(t,i){return So(4,2,t,i)}function jp(t,i){return So(4,4,t,i)}function Np(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 Op(t,i,s){s=s!=null?s.concat([t]):null,So(4,4,Np.bind(null,i,t),s)}function Xc(){}function Rp(t,i){var s=Ht();i=i===void 0?null:i;var o=s.memoizedState;return i!==null&&Bc(i,o[1])?o[0]:(s.memoizedState=[t,i],t)}function Mp(t,i){var s=Ht();i=i===void 0?null:i;var o=s.memoizedState;if(i!==null&&Bc(i,o[1]))return o[0];if(o=t(),ia){Dt(!0);try{t()}finally{Dt(!1)}}return s.memoizedState=[o,i],o}function Kc(t,i,s){return s===void 0||(Pr&1073741824)!==0&&(tt&261930)===0?t.memoizedState=i:(t.memoizedState=s,t=Dg(),Ye.lanes|=t,vi|=t,s)}function Dp(t,i,s,o){return jn(s,i)?s:Ra.current!==null?(t=Kc(t,s,o),jn(t,i)||(Gt=!0),t):(Pr&42)===0||(Pr&1073741824)!==0&&(tt&261930)===0?(Gt=!0,t.memoizedState=s):(t=Dg(),Ye.lanes|=t,vi|=t,i)}function zp(t,i,s,o,h){var p=re.p;re.p=p!==0&&8>p?p:8;var x=q.T,S={};q.T=S,Wc(t,!1,i,s);try{var P=h(),ee=q.S;if(ee!==null&&ee(S,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var oe=kv(P,o);qs(t,i,oe,zn(t))}else qs(t,i,o,zn(t))}catch(me){qs(t,i,{then:function(){},status:"rejected",reason:me},zn())}finally{re.p=p,x!==null&&S.types!==null&&(x.types=S.types),q.T=x}}function Ov(){}function Qc(t,i,s,o){if(t.tag!==5)throw Error(a(476));var h=Lp(t).queue;zp(t,h,i,ye,s===null?Ov:function(){return Up(t),s(o)})}function Lp(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:ye,baseState:ye,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:ye},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:s},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function Up(t){var i=Lp(t);i.next===null&&(i=t.alternate.memoizedState),qs(t,i.next.queue,{},zn())}function Zc(){return nn(il)}function Bp(){return Ht().memoizedState}function Pp(){return Ht().memoizedState}function Rv(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var s=zn();t=mi(s);var o=pi(i,t,s);o!==null&&(_n(o,i,s),Ls(o,i,s)),i={cache:Ac()},t.payload=i;return}i=i.return}}function Mv(t,i,s){var o=zn();s={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},_o(t)?qp(i,s):(s=gc(t,i,s,o),s!==null&&(_n(s,t,o),Ip(s,i,o)))}function Hp(t,i,s){var o=zn();qs(t,i,s,o)}function qs(t,i,s,o){var h={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(_o(t))qp(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,jn(S,x))return no(t,i,h,0),_t===null&&to(),!1}catch{}finally{}if(s=gc(t,i,h,o),s!==null)return _n(s,t,o),Ip(s,i,o),!0}return!1}function Wc(t,i,s,o){if(o={lane:2,revertLane:Rf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},_o(t)){if(i)throw Error(a(479))}else i=gc(t,s,o,2),i!==null&&_n(i,t,2)}function _o(t){var i=t.alternate;return t===Ye||i!==null&&i===Ye}function qp(t,i){Ma=go=!0;var s=t.pending;s===null?i.next=i:(i.next=s.next,s.next=i),t.pending=i}function Ip(t,i,s){if((s&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,s|=o,i.lanes=s,Fi(t,s)}}var Is={readContext:nn,use:xo,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt};Is.useEffectEvent=Lt;var Fp={readContext:nn,use:xo,useCallback:function(t,i){return cn().memoizedState=[t,i===void 0?null:i],t},useContext:nn,useEffect:Cp,useImperativeHandle:function(t,i,s){s=s!=null?s.concat([t]):null,wo(4194308,4,Np.bind(null,i,t),s)},useLayoutEffect:function(t,i){return wo(4194308,4,t,i)},useInsertionEffect:function(t,i){wo(4,2,t,i)},useMemo:function(t,i){var s=cn();i=i===void 0?null:i;var o=t();if(ia){Dt(!0);try{t()}finally{Dt(!1)}}return s.memoizedState=[o,i],o},useReducer:function(t,i,s){var o=cn();if(s!==void 0){var h=s(i);if(ia){Dt(!0);try{s(i)}finally{Dt(!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=Mv.bind(null,Ye,t),[o.memoizedState,t]},useRef:function(t){var i=cn();return t={current:t},i.memoizedState=t},useState:function(t){t=Vc(t);var i=t.queue,s=Hp.bind(null,Ye,i);return i.dispatch=s,[t.memoizedState,s]},useDebugValue:Xc,useDeferredValue:function(t,i){var s=cn();return Kc(s,t,i)},useTransition:function(){var t=Vc(!1);return t=zp.bind(null,Ye,t.queue,!0,!1),cn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,s){var o=Ye,h=cn();if(rt){if(s===void 0)throw Error(a(407));s=s()}else{if(s=i(),_t===null)throw Error(a(349));(tt&127)!==0||cp(o,i,s)}h.memoizedState=s;var p={value:s,getSnapshot:i};return h.queue=p,Cp(hp.bind(null,o,p,t),[t]),o.flags|=2048,za(9,{destroy:void 0},fp.bind(null,o,p,s,i),null),s},useId:function(){var t=cn(),i=_t.identifierPrefix;if(rt){var s=xr,o=br;s=(o&~(1<<32-xe(o)-1)).toString(32)+s,i="_"+i+"R_"+s,s=yo++,0<s&&(i+="H"+s.toString(32)),i+="_"}else s=Cv++,i="_"+i+"r_"+s.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:Zc,useFormState:wp,useActionState:wp,useOptimistic:function(t){var i=cn();i.memoizedState=i.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=s,i=Wc.bind(null,Ye,!0,s),s.dispatch=i,[t,i]},useMemoCache:Fc,useCacheRefresh:function(){return cn().memoizedState=Rv.bind(null,Ye)},useEffectEvent:function(t){var i=cn(),s={impl:t};return i.memoizedState=s,function(){if((ft&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}},ef={readContext:nn,use:xo,useCallback:Rp,useContext:nn,useEffect:Jc,useImperativeHandle:Op,useInsertionEffect:Tp,useLayoutEffect:jp,useMemo:Mp,useReducer:vo,useRef:kp,useState:function(){return vo(Hr)},useDebugValue:Xc,useDeferredValue:function(t,i){var s=Ht();return Dp(s,yt.memoizedState,t,i)},useTransition:function(){var t=vo(Hr)[0],i=Ht().memoizedState;return[typeof t=="boolean"?t:Hs(t),i]},useSyncExternalStore:up,useId:Bp,useHostTransitionStatus:Zc,useFormState:Sp,useActionState:Sp,useOptimistic:function(t,i){var s=Ht();return pp(s,yt,t,i)},useMemoCache:Fc,useCacheRefresh:Pp};ef.useEffectEvent=Ap;var $p={readContext:nn,use:xo,useCallback:Rp,useContext:nn,useEffect:Jc,useImperativeHandle:Op,useInsertionEffect:Tp,useLayoutEffect:jp,useMemo:Mp,useReducer:Gc,useRef:kp,useState:function(){return Gc(Hr)},useDebugValue:Xc,useDeferredValue:function(t,i){var s=Ht();return yt===null?Kc(s,t,i):Dp(s,yt.memoizedState,t,i)},useTransition:function(){var t=Gc(Hr)[0],i=Ht().memoizedState;return[typeof t=="boolean"?t:Hs(t),i]},useSyncExternalStore:up,useId:Bp,useHostTransitionStatus:Zc,useFormState:Ep,useActionState:Ep,useOptimistic:function(t,i){var s=Ht();return yt!==null?pp(s,yt,t,i):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:Fc,useCacheRefresh:Pp};$p.useEffectEvent=Ap;function tf(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 nf={enqueueSetState:function(t,i,s){t=t._reactInternals;var o=zn(),h=mi(o);h.payload=i,s!=null&&(h.callback=s),i=pi(t,h,o),i!==null&&(_n(i,t,o),Ls(i,t,o))},enqueueReplaceState:function(t,i,s){t=t._reactInternals;var o=zn(),h=mi(o);h.tag=1,h.payload=i,s!=null&&(h.callback=s),i=pi(t,h,o),i!==null&&(_n(i,t,o),Ls(i,t,o))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var s=zn(),o=mi(s);o.tag=2,i!=null&&(o.callback=i),i=pi(t,o,s),i!==null&&(_n(i,t,s),Ls(i,t,s))}};function Gp(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?!Ts(s,o)||!Ts(h,p):!0}function Vp(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&&nf.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 Yp(t){eo(t)}function Jp(t){console.error(t)}function Xp(t){eo(t)}function Eo(t,i){try{var s=t.onUncaughtError;s(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function Kp(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 rf(t,i,s){return s=mi(s),s.tag=3,s.payload={element:null},s.callback=function(){Eo(t,i)},s}function Qp(t){return t=mi(t),t.tag=3,t}function Zp(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(){Kp(i,s,o)}}var x=s.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(t.callback=function(){Kp(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 Dv(t,i,s,o,h){if(s.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=s.alternate,i!==null&&Aa(i,s,h,!0),s=On.current,s!==null){switch(s.tag){case 31:case 13:return Qn===null?Lo():s.alternate===null&&Ut===0&&(Ut=3),s.flags&=-257,s.flags|=65536,s.lanes=h,o===co?s.flags|=16384:(i=s.updateQueue,i===null?s.updateQueue=new Set([o]):i.add(o),jf(t,o,h)),!1;case 22:return s.flags|=65536,o===co?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)),jf(t,o,h)),!1}throw Error(a(435,s.tag))}return jf(t,o,h),Lo(),!1}if(rt)return i=On.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==Sc&&(t=Error(a(422),{cause:o}),Os(Yn(t,s)))):(o!==Sc&&(i=Error(a(423),{cause:o}),Os(Yn(i,s))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,o=Yn(o,s),h=rf(t.stateNode,o,h),Mc(t,h),Ut!==4&&(Ut=2)),!1;var p=Error(a(520),{cause:o});if(p=Yn(p,s),Ks===null?Ks=[p]:Ks.push(p),Ut!==4&&(Ut=2),i===null)return!0;o=Yn(o,s),s=i;do{switch(s.tag){case 3:return s.flags|=65536,t=h&-h,s.lanes|=t,t=rf(s.stateNode,o,t),Mc(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=Qp(h),Zp(h,t,s,o),Mc(s,h),!1}s=s.return}while(s!==null);return!1}var af=Error(a(461)),Gt=!1;function rn(t,i,s,o){i.child=t===null?np(i,null,s,o):ra(i,t.child,s,o)}function Wp(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=Pc(t,i,s,x,p,h),S=Hc(),t!==null&&!Gt?(qc(t,i,h),qr(t,i,h)):(rt&&S&&vc(i),i.flags|=1,rn(t,i,o,h),i.child)}function eg(t,i,s,o,h){if(t===null){var p=s.type;return typeof p=="function"&&!yc(p)&&p.defaultProps===void 0&&s.compare===null?(i.tag=15,i.type=p,tg(t,i,p,o,h)):(t=io(s.type,null,o,i,i.mode,h),t.ref=i.ref,t.return=i,i.child=t)}if(p=t.child,!df(t,h)){var x=p.memoizedProps;if(s=s.compare,s=s!==null?s:Ts,s(x,o)&&t.ref===i.ref)return qr(t,i,h)}return i.flags|=1,t=zr(p,o),t.ref=i.ref,t.return=i,i.child=t}function tg(t,i,s,o,h){if(t!==null){var p=t.memoizedProps;if(Ts(p,o)&&t.ref===i.ref)if(Gt=!1,i.pendingProps=o=p,df(t,h))(t.flags&131072)!==0&&(Gt=!0);else return i.lanes=t.lanes,qr(t,i,h)}return sf(t,i,s,o,h)}function ng(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 rg(t,i,p,s,o)}if((s&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&oo(i,p!==null?p.cachePool:null),p!==null?ap(i,p):zc(),sp(i);else return o=i.lanes=536870912,rg(t,i,p!==null?p.baseLanes|s:s,s,o)}else p!==null?(oo(i,p.cachePool),ap(i,p),yi(),i.memoizedState=null):(t!==null&&oo(i,null),zc(),yi());return rn(t,i,h,s),i.child}function Fs(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function rg(t,i,s,o,h){var p=jc();return p=p===null?null:{parent:Ft._currentValue,pool:p},i.memoizedState={baseLanes:s,cachePool:p},t!==null&&oo(i,null),zc(),sp(i),t!==null&&Aa(t,i,o,!0),i.childLanes=h,null}function ko(t,i){return i=Ao({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function ig(t,i,s){return ra(i,t.child,null,s),t=ko(i,i.pendingProps),t.flags|=2,Rn(i),i.memoizedState=null,t}function zv(t,i,s){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(rt){if(o.mode==="hidden")return t=ko(i,o),i.lanes=536870912,Fs(null,t);if(Uc(i),(t=At)?(t=gy(t,Kn),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ui!==null?{id:br,overflow:xr}:null,retryLane:536870912,hydrationErrors:null},s=qm(t),s.return=i,i.child=s,tn=i,At=null)):t=null,t===null)throw fi(i);return i.lanes=536870912,null}return ko(i,o)}var p=t.memoizedState;if(p!==null){var x=p.dehydrated;if(Uc(i),h)if(i.flags&256)i.flags&=-257,i=ig(t,i,s);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(a(558));else if(Gt||Aa(t,i,s,!1),h=(s&t.childLanes)!==0,Gt||h){if(o=_t,o!==null&&(x=li(o,s),x!==0&&x!==p.retryLane))throw p.retryLane=x,Xi(t,x),_n(o,t,x),af;Lo(),i=ig(t,i,s)}else t=p.treeContext,At=Zn(x.nextSibling),tn=i,rt=!0,ci=null,Kn=!1,t!==null&&$m(i,t),i=ko(i,o),i.flags|=4096;return i}return t=zr(t.child,{mode:o.mode,children:o.children}),t.ref=i.ref,i.child=t,t.return=i,t}function Co(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 sf(t,i,s,o,h){return Wi(i),s=Pc(t,i,s,o,void 0,h),o=Hc(),t!==null&&!Gt?(qc(t,i,h),qr(t,i,h)):(rt&&o&&vc(i),i.flags|=1,rn(t,i,s,h),i.child)}function ag(t,i,s,o,h,p){return Wi(i),i.updateQueue=null,s=op(i,o,s,h),lp(t),o=Hc(),t!==null&&!Gt?(qc(t,i,p),qr(t,i,p)):(rt&&o&&vc(i),i.flags|=1,rn(t,i,s,p),i.child)}function sg(t,i,s,o,h){if(Wi(i),i.stateNode===null){var p=_a,x=s.contextType;typeof x=="object"&&x!==null&&(p=nn(x)),p=new s(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=nf,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},Oc(i),x=s.contextType,p.context=typeof x=="object"&&x!==null?nn(x):_a,p.state=i.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(tf(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&&nf.enqueueReplaceState(p,p.state,null),Bs(i,o,p,h),Us(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(t===null){p=i.stateNode;var S=i.memoizedProps,P=aa(s,S);p.props=P;var ee=p.context,oe=s.contextType;x=_a,typeof oe=="object"&&oe!==null&&(x=nn(oe));var me=s.getDerivedStateFromProps;oe=typeof me=="function"||typeof p.getSnapshotBeforeUpdate=="function",S=i.pendingProps!==S,oe||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(S||ee!==x)&&Vp(i,p,o,x),di=!1;var ne=i.memoizedState;p.state=ne,Bs(i,o,p,h),Us(),ee=i.memoizedState,S||ne!==ee||di?(typeof me=="function"&&(tf(i,s,me,o),ee=i.memoizedState),(P=di||Gp(i,s,P,o,ne,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=P):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,Rc(t,i),x=i.memoizedProps,oe=aa(s,x),p.props=oe,me=i.pendingProps,ne=p.context,ee=s.contextType,P=_a,typeof ee=="object"&&ee!==null&&(P=nn(ee)),S=s.getDerivedStateFromProps,(ee=typeof S=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==me||ne!==P)&&Vp(i,p,o,P),di=!1,ne=i.memoizedState,p.state=ne,Bs(i,o,p,h),Us();var ae=i.memoizedState;x!==me||ne!==ae||di||t!==null&&t.dependencies!==null&&so(t.dependencies)?(typeof S=="function"&&(tf(i,s,S,o),ae=i.memoizedState),(oe=di||Gp(i,s,oe,o,ne,ae,P)||t!==null&&t.dependencies!==null&&so(t.dependencies))?(ee||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,ae,P),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,ae,P)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===t.memoizedProps&&ne===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&ne===t.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=ae),p.props=o,p.state=ae,p.context=P,o=oe):(typeof p.componentDidUpdate!="function"||x===t.memoizedProps&&ne===t.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===t.memoizedProps&&ne===t.memoizedState||(i.flags|=1024),o=!1)}return p=o,Co(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)):rn(t,i,s,h),i.memoizedState=p.state,t=i.child):t=qr(t,i,h),t}function lg(t,i,s,o){return Qi(),i.flags|=256,rn(t,i,s,o),i.child}var lf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function of(t){return{baseLanes:t,cachePool:Km()}}function uf(t,i,s){return t=t!==null?t.childLanes&~s:0,i&&(t|=Dn),t}function og(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:(Pt.current&2)!==0),x&&(h=!0,i.flags&=-129),x=(i.flags&32)!==0,i.flags&=-33,t===null){if(rt){if(h?gi(i):yi(),(t=At)?(t=gy(t,Kn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:ui!==null?{id:br,overflow:xr}:null,retryLane:536870912,hydrationErrors:null},s=qm(t),s.return=i,i.child=s,tn=i,At=null)):t=null,t===null)throw fi(i);return Gf(t)?i.lanes=32:i.lanes=536870912,null}var S=o.children;return o=o.fallback,h?(yi(),h=i.mode,S=Ao({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=of(s),o.childLanes=uf(t,x,s),i.memoizedState=lf,Fs(null,o)):(gi(i),cf(i,S))}var P=t.memoizedState;if(P!==null&&(S=P.dehydrated,S!==null)){if(p)i.flags&256?(gi(i),i.flags&=-257,i=ff(t,i,s)):i.memoizedState!==null?(yi(),i.child=t.child,i.flags|=128,i=null):(yi(),S=o.fallback,h=i.mode,o=Ao({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=of(s),o.childLanes=uf(t,x,s),i.memoizedState=lf,i=Fs(null,o));else if(gi(i),Gf(S)){if(x=S.nextSibling&&S.nextSibling.dataset,x)var ee=x.dgst;x=ee,o=Error(a(419)),o.stack="",o.digest=x,Os({value:o,source:null,stack:null}),i=ff(t,i,s)}else if(Gt||Aa(t,i,s,!1),x=(s&t.childLanes)!==0,Gt||x){if(x=_t,x!==null&&(o=li(x,s),o!==0&&o!==P.retryLane))throw P.retryLane=o,Xi(t,o),_n(x,t,o),af;$f(S)||Lo(),i=ff(t,i,s)}else $f(S)?(i.flags|=192,i.child=t.child,i=null):(t=P.treeContext,At=Zn(S.nextSibling),tn=i,rt=!0,ci=null,Kn=!1,t!==null&&$m(i,t),i=cf(i,o.children),i.flags|=4096);return i}return h?(yi(),S=o.fallback,h=i.mode,P=t.child,ee=P.sibling,o=zr(P,{mode:"hidden",children:o.children}),o.subtreeFlags=P.subtreeFlags&65011712,ee!==null?S=zr(ee,S):(S=Ki(S,h,s,null),S.flags|=2),S.return=i,o.return=i,o.sibling=S,i.child=o,Fs(null,o),o=i.child,S=t.child.memoizedState,S===null?S=of(s):(h=S.cachePool,h!==null?(P=Ft._currentValue,h=h.parent!==P?{parent:P,pool:P}:h):h=Km(),S={baseLanes:S.baseLanes|s,cachePool:h}),o.memoizedState=S,o.childLanes=uf(t,x,s),i.memoizedState=lf,Fs(t.child,o)):(gi(i),s=t.child,t=s.sibling,s=zr(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 cf(t,i){return i=Ao({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function Ao(t,i){return t=Nn(22,t,null,i),t.lanes=0,t}function ff(t,i,s){return ra(i,t.child,null,s),t=cf(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function ug(t,i,s){t.lanes|=i;var o=t.alternate;o!==null&&(o.lanes|=i),kc(t.return,i,s)}function hf(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 cg(t,i,s){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var x=Pt.current,S=(x&2)!==0;if(S?(x=x&1|2,i.flags|=128):x&=1,E(Pt,x),rn(t,i,o,s),o=rt?Ns:0,!S&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&ug(t,s,i);else if(t.tag===19)ug(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&&po(t)===null&&(h=s),s=s.sibling;s=h,s===null?(h=i.child,i.child=null):(h=s.sibling,s.sibling=null),hf(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&&po(t)===null){i.child=h;break}t=h.sibling,h.sibling=s,s=h,h=t}hf(i,!0,s,null,p,o);break;case"together":hf(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function qr(t,i,s){if(t!==null&&(i.dependencies=t.dependencies),vi|=i.lanes,(s&i.childLanes)===0)if(t!==null){if(Aa(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=zr(t,t.pendingProps),i.child=s,s.return=i;t.sibling!==null;)t=t.sibling,s=s.sibling=zr(t,t.pendingProps),s.return=i;s.sibling=null}return i.child}function df(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&so(t)))}function Lv(t,i,s){switch(i.tag){case 3:De(i,i.stateNode.containerInfo),hi(i,Ft,t.memoizedState.cache),Qi();break;case 27:case 5:ze(i);break;case 4:De(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,Uc(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?og(t,i,s):(gi(i),t=qr(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||(Aa(t,i,s,!1),o=(s&i.childLanes)!==0),h){if(o)return cg(t,i,s);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),E(Pt,Pt.current),o)break;return null;case 22:return i.lanes=0,ng(t,i,s,i.pendingProps);case 24:hi(i,Ft,t.memoizedState.cache)}return qr(t,i,s)}function fg(t,i,s){if(t!==null)if(t.memoizedProps!==i.pendingProps)Gt=!0;else{if(!df(t,s)&&(i.flags&128)===0)return Gt=!1,Lv(t,i,s);Gt=(t.flags&131072)!==0}else Gt=!1,rt&&(i.flags&1048576)!==0&&Fm(i,Ns,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")yc(t)?(o=aa(t,o),i.tag=1,i=sg(null,i,t,o,s)):(i.tag=0,i=sf(null,i,t,o,s));else{if(t!=null){var h=t.$$typeof;if(h===se){i.tag=11,i=Wp(null,i,t,o,s);break e}else if(h===Y){i.tag=14,i=eg(null,i,t,o,s);break e}}throw i=he(t)||t,Error(a(306,i,""))}}return i;case 0:return sf(t,i,i.type,i.pendingProps,s);case 1:return o=i.type,h=aa(o,i.pendingProps),sg(t,i,o,h,s);case 3:e:{if(De(i,i.stateNode.containerInfo),t===null)throw Error(a(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,Rc(t,i),Bs(i,o,null,s);var x=i.memoizedState;if(o=x.cache,hi(i,Ft,o),o!==p.cache&&Cc(i,[Ft],s,!0),Us(),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=lg(t,i,o,s);break e}else if(o!==h){h=Yn(Error(a(424)),i),Os(h),i=lg(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(At=Zn(t.firstChild),tn=i,rt=!0,ci=null,Kn=!0,s=np(i,null,o,s),i.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(Qi(),o===h){i=qr(t,i,s);break e}rn(t,i,o,s)}i=i.child}return i;case 26:return Co(t,i),t===null?(s=Sy(i.type,null,i.pendingProps,null))?i.memoizedState=s:rt||(s=i.type,t=i.pendingProps,o=Fo(ve.current).createElement(s),o[St]=i,o[zt]=t,an(o,s,t),I(o),i.stateNode=o):i.memoizedState=Sy(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return ze(i),t===null&&rt&&(o=i.stateNode=xy(i.type,i.pendingProps,ve.current),tn=i,Kn=!0,h=At,ki(i.type)?(Vf=h,At=Zn(o.firstChild)):At=h),rn(t,i,i.pendingProps.children,s),Co(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&rt&&((h=o=At)&&(o=hw(o,i.type,i.pendingProps,Kn),o!==null?(i.stateNode=o,tn=i,At=Zn(o.firstChild),Kn=!1,h=!0):h=!1),h||fi(i)),ze(i),h=i.type,p=i.pendingProps,x=t!==null?t.memoizedProps:null,o=p.children,qf(h,p)?o=null:x!==null&&qf(h,x)&&(i.flags|=32),i.memoizedState!==null&&(h=Pc(t,i,Av,null,null,s),il._currentValue=h),Co(t,i),rn(t,i,o,s),i.child;case 6:return t===null&&rt&&((t=s=At)&&(s=dw(s,i.pendingProps,Kn),s!==null?(i.stateNode=s,tn=i,At=null,t=!0):t=!1),t||fi(i)),null;case 13:return og(t,i,s);case 4:return De(i,i.stateNode.containerInfo),o=i.pendingProps,t===null?i.child=ra(i,null,o,s):rn(t,i,o,s),i.child;case 11:return Wp(t,i,i.type,i.pendingProps,s);case 7:return rn(t,i,i.pendingProps,s),i.child;case 8:return rn(t,i,i.pendingProps.children,s),i.child;case 12:return rn(t,i,i.pendingProps.children,s),i.child;case 10:return o=i.pendingProps,hi(i,i.type,o.value),rn(t,i,o.children,s),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,Wi(i),h=nn(h),o=o(h),i.flags|=1,rn(t,i,o,s),i.child;case 14:return eg(t,i,i.type,i.pendingProps,s);case 15:return tg(t,i,i.type,i.pendingProps,s);case 19:return cg(t,i,s);case 31:return zv(t,i,s);case 22:return ng(t,i,s,i.pendingProps);case 24:return Wi(i),o=nn(Ft),t===null?(h=jc(),h===null&&(h=_t,p=Ac(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=s),h=p),i.memoizedState={parent:o,cache:h},Oc(i),hi(i,Ft,h)):((t.lanes&s)!==0&&(Rc(t,i),Bs(i,null,null,s),Us()),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,Ft,o)):(o=p.cache,hi(i,Ft,o),o!==h.cache&&Cc(i,[Ft],s,!0))),rn(t,i,i.pendingProps.children,s),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Ir(t){t.flags|=4}function mf(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(Bg())t.flags|=8192;else throw na=co,Nc}else t.flags&=-16777217}function hg(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Ay(i))if(Bg())t.flags|=8192;else throw na=co,Nc}function To(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?da():536870912,t.lanes|=i,Pa|=i)}function $s(t,i){if(!rt)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 Tt(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 Uv(t,i,s){var o=i.pendingProps;switch(wc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Tt(i),null;case 1:return Tt(i),null;case 3:return s=i.stateNode,o=null,t!==null&&(o=t.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Br(Ft),Ce(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(Ca(i)?Ir(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,_c())),Tt(i),null;case 26:var h=i.type,p=i.memoizedState;return t===null?(Ir(i),p!==null?(Tt(i),hg(i,p)):(Tt(i),mf(i,h,null,o,s))):p?p!==t.memoizedState?(Ir(i),Tt(i),hg(i,p)):(Tt(i),i.flags&=-16777217):(t=t.memoizedProps,t!==o&&Ir(i),Tt(i),mf(i,h,t,o,s)),null;case 27:if(lt(i),s=ve.current,h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Ir(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Tt(i),null}t=ue.current,Ca(i)?Gm(i):(t=xy(h,o,s),i.stateNode=t,Ir(i))}return Tt(i),null;case 5:if(lt(i),h=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==o&&Ir(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return Tt(i),null}if(p=ue.current,Ca(i))Gm(i);else{var x=Fo(ve.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[St]=i,p[zt]=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(an(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&&Ir(i)}}return Tt(i),mf(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,s),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Ir(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(a(166));if(t=ve.current,Ca(i)){if(t=i.stateNode,s=i.memoizedProps,o=null,h=tn,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}t[St]=i,t=!!(t.nodeValue===s||o!==null&&o.suppressHydrationWarning===!0||oy(t.nodeValue,s)),t||fi(i,!0)}else t=Fo(t).createTextNode(o),t[St]=i,i.stateNode=t}return Tt(i),null;case 31:if(s=i.memoizedState,t===null||t.memoizedState!==null){if(o=Ca(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[St]=i}else Qi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Tt(i),t=!1}else s=_c(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return i.flags&256?(Rn(i),i):(Rn(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Tt(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=Ca(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[St]=i}else Qi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Tt(i),h=!1}else h=_c(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Rn(i),i):(Rn(i),null)}return Rn(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),To(i,i.updateQueue),Tt(i),null);case 4:return Ce(),t===null&&Lf(i.stateNode.containerInfo),Tt(i),null;case 10:return Br(i.type),Tt(i),null;case 19:if(te(Pt),o=i.memoizedState,o===null)return Tt(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)$s(o,!1);else{if(Ut!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(p=po(t),p!==null){for(i.flags|=128,$s(o,!1),t=p.updateQueue,i.updateQueue=t,To(i,t),i.subtreeFlags=0,t=s,s=i.child;s!==null;)Hm(s,t),s=s.sibling;return E(Pt,Pt.current&1|2),rt&&Lr(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&>()>Mo&&(i.flags|=128,h=!0,$s(o,!1),i.lanes=4194304)}else{if(!h)if(t=po(p),t!==null){if(i.flags|=128,h=!0,t=t.updateQueue,i.updateQueue=t,To(i,t),$s(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!rt)return Tt(i),null}else 2*gt()-o.renderingStartTime>Mo&&s!==536870912&&(i.flags|=128,h=!0,$s(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=gt(),t.sibling=null,s=Pt.current,E(Pt,h?s&1|2:s&1),rt&&Lr(i,o.treeForkCount),t):(Tt(i),null);case 22:case 23:return Rn(i),Lc(),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&&(Tt(i),i.subtreeFlags&6&&(i.flags|=8192)):Tt(i),s=i.updateQueue,s!==null&&To(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&&te(ea),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),Br(Ft),Tt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function Bv(t,i){switch(wc(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Br(Ft),Ce(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return lt(i),null;case 31:if(i.memoizedState!==null){if(Rn(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(Rn(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 te(Pt),null;case 4:return Ce(),null;case 10:return Br(i.type),null;case 22:case 23:return Rn(i),Lc(),t!==null&&te(ea),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return Br(Ft),null;case 25:return null;default:return null}}function dg(t,i){switch(wc(i),i.tag){case 3:Br(Ft),Ce();break;case 26:case 27:case 5:lt(i);break;case 4:Ce();break;case 31:i.memoizedState!==null&&Rn(i);break;case 13:Rn(i);break;case 19:te(Pt);break;case 10:Br(i.type);break;case 22:case 23:Rn(i),Lc(),t!==null&&te(ea);break;case 24:Br(Ft)}}function Gs(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){pt(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 P=s,ee=S;try{ee()}catch(oe){pt(h,P,oe)}}}o=o.next}while(o!==p)}}catch(oe){pt(i,i.return,oe)}}function mg(t){var i=t.updateQueue;if(i!==null){var s=t.stateNode;try{ip(i,s)}catch(o){pt(t,t.return,o)}}}function pg(t,i,s){s.props=aa(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(o){pt(t,i,o)}}function Vs(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){pt(t,i,h)}}function vr(t,i){var s=t.ref,o=t.refCleanup;if(s!==null)if(typeof o=="function")try{o()}catch(h){pt(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){pt(t,i,h)}else s.current=null}function gg(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){pt(t,t.return,h)}}function pf(t,i,s){try{var o=t.stateNode;sw(o,t.type,s,i),o[zt]=i}catch(h){pt(t,t.return,h)}}function yg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ki(t.type)||t.tag===4}function gf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||yg(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&&ki(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 yf(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=Mr));else if(o!==4&&(o===27&&ki(t.type)&&(s=t.stateNode,i=null),t=t.child,t!==null))for(yf(t,i,s),t=t.sibling;t!==null;)yf(t,i,s),t=t.sibling}function jo(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&&ki(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(jo(t,i,s),t=t.sibling;t!==null;)jo(t,i,s),t=t.sibling}function bg(t){var i=t.stateNode,s=t.memoizedProps;try{for(var o=t.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);an(i,o,s),i[St]=t,i[zt]=s}catch(p){pt(t,t.return,p)}}var Fr=!1,Vt=!1,bf=!1,xg=typeof WeakSet=="function"?WeakSet:Set,Qt=null;function Pv(t,i){if(t=t.containerInfo,Pf=Ko,t=Om(t),cc(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,P=-1,ee=0,oe=0,me=t,ne=null;t:for(;;){for(var ae;me!==s||h!==0&&me.nodeType!==3||(S=x+h),me!==p||o!==0&&me.nodeType!==3||(P=x+o),me.nodeType===3&&(x+=me.nodeValue.length),(ae=me.firstChild)!==null;)ne=me,me=ae;for(;;){if(me===t)break t;if(ne===s&&++ee===h&&(S=x),ne===p&&++oe===o&&(P=x),(ae=me.nextSibling)!==null)break;me=ne,ne=me.parentNode}me=ae}s=S===-1||P===-1?null:{start:S,end:P}}else s=null}s=s||{start:0,end:0}}else s=null;for(Hf={focusedElem:t,selectionRange:s},Ko=!1,Qt=i;Qt!==null;)if(i=Qt,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Qt=t;else for(;Qt!==null;){switch(i=Qt,p=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s<t.length;s++)h=t[s],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,s=i,h=p.memoizedProps,p=p.memoizedState,o=s.stateNode;try{var Re=aa(s.type,h);t=o.getSnapshotBeforeUpdate(Re,p),o.__reactInternalSnapshotBeforeUpdate=t}catch(Ie){pt(s,s.return,Ie)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,s=t.nodeType,s===9)Ff(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Ff(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,Qt=t;break}Qt=i.return}}function vg(t,i,s){var o=s.flags;switch(s.tag){case 0:case 11:case 15:Gr(t,s),o&4&&Gs(5,s);break;case 1:if(Gr(t,s),o&4)if(t=s.stateNode,i===null)try{t.componentDidMount()}catch(x){pt(s,s.return,x)}else{var h=aa(s.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(h,i,t.__reactInternalSnapshotBeforeUpdate)}catch(x){pt(s,s.return,x)}}o&64&&mg(s),o&512&&Vs(s,s.return);break;case 3:if(Gr(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{ip(t,i)}catch(x){pt(s,s.return,x)}}break;case 27:i===null&&o&4&&bg(s);case 26:case 5:Gr(t,s),i===null&&o&4&&gg(s),o&512&&Vs(s,s.return);break;case 12:Gr(t,s);break;case 31:Gr(t,s),o&4&&_g(t,s);break;case 13:Gr(t,s),o&4&&Eg(t,s),o&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=Jv.bind(null,s),mw(t,s))));break;case 22:if(o=s.memoizedState!==null||Fr,!o){i=i!==null&&i.memoizedState!==null||Vt,h=Fr;var p=Vt;Fr=o,(Vt=i)&&!p?Vr(t,s,(s.subtreeFlags&8772)!==0):Gr(t,s),Fr=h,Vt=p}break;case 30:break;default:Gr(t,s)}}function wg(t){var i=t.alternate;i!==null&&(t.alternate=null,wg(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&ma(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 Nt=null,xn=!1;function $r(t,i,s){for(s=s.child;s!==null;)Sg(t,i,s),s=s.sibling}function Sg(t,i,s){if(ht&&typeof ht.onCommitFiberUnmount=="function")try{ht.onCommitFiberUnmount(It,s)}catch{}switch(s.tag){case 26:Vt||vr(s,i),$r(t,i,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Vt||vr(s,i);var o=Nt,h=xn;ki(s.type)&&(Nt=s.stateNode,xn=!1),$r(t,i,s),tl(s.stateNode),Nt=o,xn=h;break;case 5:Vt||vr(s,i);case 6:if(o=Nt,h=xn,Nt=null,$r(t,i,s),Nt=o,xn=h,Nt!==null)if(xn)try{(Nt.nodeType===9?Nt.body:Nt.nodeName==="HTML"?Nt.ownerDocument.body:Nt).removeChild(s.stateNode)}catch(p){pt(s,i,p)}else try{Nt.removeChild(s.stateNode)}catch(p){pt(s,i,p)}break;case 18:Nt!==null&&(xn?(t=Nt,my(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),Ya(t)):my(Nt,s.stateNode));break;case 4:o=Nt,h=xn,Nt=s.stateNode.containerInfo,xn=!0,$r(t,i,s),Nt=o,xn=h;break;case 0:case 11:case 14:case 15:bi(2,s,i),Vt||bi(4,s,i),$r(t,i,s);break;case 1:Vt||(vr(s,i),o=s.stateNode,typeof o.componentWillUnmount=="function"&&pg(s,i,o)),$r(t,i,s);break;case 21:$r(t,i,s);break;case 22:Vt=(o=Vt)||s.memoizedState!==null,$r(t,i,s),Vt=o;break;default:$r(t,i,s)}}function _g(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ya(t)}catch(s){pt(i,i.return,s)}}}function Eg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ya(t)}catch(s){pt(i,i.return,s)}}function Hv(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new xg),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new xg),i;default:throw Error(a(435,t.tag))}}function No(t,i){var s=Hv(t);i.forEach(function(o){if(!s.has(o)){s.add(o);var h=Xv.bind(null,t,o);o.then(h,h)}})}function vn(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(ki(S.type)){Nt=S.stateNode,xn=!1;break e}break;case 5:Nt=S.stateNode,xn=!1;break e;case 3:case 4:Nt=S.stateNode.containerInfo,xn=!0;break e}S=S.return}if(Nt===null)throw Error(a(160));Sg(p,x,h),Nt=null,xn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)kg(i,t),i=i.sibling}var cr=null;function kg(t,i){var s=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:vn(i,t),wn(t),o&4&&(bi(3,t,t.return),Gs(3,t),bi(5,t,t.return));break;case 1:vn(i,t),wn(t),o&512&&(Vt||s===null||vr(s,s.return)),o&64&&Fr&&(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=cr;if(vn(i,t),wn(t),o&512&&(Vt||s===null||vr(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[Jt]||p[St]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),an(p,o,s),p[St]=t,I(p),o=p;break e;case"link":var x=ky("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),an(p,o,s),h.head.appendChild(p);break;case"meta":if(x=ky("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),an(p,o,s),h.head.appendChild(p);break;default:throw Error(a(468,o))}p[St]=t,I(p),o=p}t.stateNode=o}else Cy(h,t.type,t.stateNode);else t.stateNode=Ey(h,o,t.memoizedProps);else p!==o?(p===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):p.count--,o===null?Cy(h,t.type,t.stateNode):Ey(h,o,t.memoizedProps)):o===null&&t.stateNode!==null&&pf(t,t.memoizedProps,s.memoizedProps)}break;case 27:vn(i,t),wn(t),o&512&&(Vt||s===null||vr(s,s.return)),s!==null&&o&4&&pf(t,t.memoizedProps,s.memoizedProps);break;case 5:if(vn(i,t),wn(t),o&512&&(Vt||s===null||vr(s,s.return)),t.flags&32){h=t.stateNode;try{ga(h,"")}catch(Re){pt(t,t.return,Re)}}o&4&&t.stateNode!=null&&(h=t.memoizedProps,pf(t,h,s!==null?s.memoizedProps:h)),o&1024&&(bf=!0);break;case 6:if(vn(i,t),wn(t),o&4){if(t.stateNode===null)throw Error(a(162));o=t.memoizedProps,s=t.stateNode;try{s.nodeValue=o}catch(Re){pt(t,t.return,Re)}}break;case 3:if(Vo=null,h=cr,cr=$o(i.containerInfo),vn(i,t),cr=h,wn(t),o&4&&s!==null&&s.memoizedState.isDehydrated)try{Ya(i.containerInfo)}catch(Re){pt(t,t.return,Re)}bf&&(bf=!1,Cg(t));break;case 4:o=cr,cr=$o(t.stateNode.containerInfo),vn(i,t),wn(t),cr=o;break;case 12:vn(i,t),wn(t);break;case 31:vn(i,t),wn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,No(t,o)));break;case 13:vn(i,t),wn(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Ro=gt()),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,No(t,o)));break;case 22:h=t.memoizedState!==null;var P=s!==null&&s.memoizedState!==null,ee=Fr,oe=Vt;if(Fr=ee||h,Vt=oe||P,vn(i,t),Vt=oe,Fr=ee,wn(t),o&8192)e:for(i=t.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(s===null||P||Fr||Vt||sa(t)),s=null,i=t;;){if(i.tag===5||i.tag===26){if(s===null){P=s=i;try{if(p=P.stateNode,h)x=p.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{S=P.stateNode;var me=P.memoizedProps.style,ne=me!=null&&me.hasOwnProperty("display")?me.display:null;S.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Re){pt(P,P.return,Re)}}}else if(i.tag===6){if(s===null){P=i;try{P.stateNode.nodeValue=h?"":P.memoizedProps}catch(Re){pt(P,P.return,Re)}}}else if(i.tag===18){if(s===null){P=i;try{var ae=P.stateNode;h?py(ae,!0):py(P.stateNode,!1)}catch(Re){pt(P,P.return,Re)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===t)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;s===i&&(s=null),i=i.return}s===i&&(s=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=t.updateQueue,o!==null&&(s=o.retryQueue,s!==null&&(o.retryQueue=null,No(t,s))));break;case 19:vn(i,t),wn(t),o&4&&(o=t.updateQueue,o!==null&&(t.updateQueue=null,No(t,o)));break;case 30:break;case 21:break;default:vn(i,t),wn(t)}}function wn(t){var i=t.flags;if(i&2){try{for(var s,o=t.return;o!==null;){if(yg(o)){s=o;break}o=o.return}if(s==null)throw Error(a(160));switch(s.tag){case 27:var h=s.stateNode,p=gf(t);jo(t,p,h);break;case 5:var x=s.stateNode;s.flags&32&&(ga(x,""),s.flags&=-33);var S=gf(t);jo(t,S,x);break;case 3:case 4:var P=s.stateNode.containerInfo,ee=gf(t);yf(t,ee,P);break;default:throw Error(a(161))}}catch(oe){pt(t,t.return,oe)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function Cg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;Cg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function Gr(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)vg(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:vr(i,i.return);var s=i.stateNode;typeof s.componentWillUnmount=="function"&&pg(i,i.return,s),sa(i);break;case 27:tl(i.stateNode);case 26:case 5:vr(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 Vr(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:Vr(h,p,s),Gs(4,p);break;case 1:if(Vr(h,p,s),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ee){pt(o,o.return,ee)}if(o=p,h=o.updateQueue,h!==null){var S=o.stateNode;try{var P=h.shared.hiddenCallbacks;if(P!==null)for(h.shared.hiddenCallbacks=null,h=0;h<P.length;h++)rp(P[h],S)}catch(ee){pt(o,o.return,ee)}}s&&x&64&&mg(p),Vs(p,p.return);break;case 27:bg(p);case 26:case 5:Vr(h,p,s),s&&o===null&&x&4&&gg(p),Vs(p,p.return);break;case 12:Vr(h,p,s);break;case 31:Vr(h,p,s),s&&x&4&&_g(h,p);break;case 13:Vr(h,p,s),s&&x&4&&Eg(h,p);break;case 22:p.memoizedState===null&&Vr(h,p,s),Vs(p,p.return);break;case 30:break;default:Vr(h,p,s)}i=i.sibling}}function xf(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&&Rs(s))}function vf(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Rs(t))}function fr(t,i,s,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Ag(t,i,s,o),i=i.sibling}function Ag(t,i,s,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:fr(t,i,s,o),h&2048&&Gs(9,i);break;case 1:fr(t,i,s,o);break;case 3:fr(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&&Rs(t)));break;case 12:if(h&2048){fr(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(P){pt(i,i.return,P)}}else fr(t,i,s,o);break;case 31:fr(t,i,s,o);break;case 13:fr(t,i,s,o);break;case 23:break;case 22:p=i.stateNode,x=i.alternate,i.memoizedState!==null?p._visibility&2?fr(t,i,s,o):Ys(t,i):p._visibility&2?fr(t,i,s,o):(p._visibility|=2,La(t,i,s,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&xf(x,i);break;case 24:fr(t,i,s,o),h&2048&&vf(i.alternate,i);break;default:fr(t,i,s,o)}}function La(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,P=o,ee=x.flags;switch(x.tag){case 0:case 11:case 15:La(p,x,S,P,h),Gs(8,x);break;case 23:break;case 22:var oe=x.stateNode;x.memoizedState!==null?oe._visibility&2?La(p,x,S,P,h):Ys(p,x):(oe._visibility|=2,La(p,x,S,P,h)),h&&ee&2048&&xf(x.alternate,x);break;case 24:La(p,x,S,P,h),h&&ee&2048&&vf(x.alternate,x);break;default:La(p,x,S,P,h)}i=i.sibling}}function Ys(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:Ys(s,o),h&2048&&xf(o.alternate,o);break;case 24:Ys(s,o),h&2048&&vf(o.alternate,o);break;default:Ys(s,o)}i=i.sibling}}var Js=8192;function Ua(t,i,s){if(t.subtreeFlags&Js)for(t=t.child;t!==null;)Tg(t,i,s),t=t.sibling}function Tg(t,i,s){switch(t.tag){case 26:Ua(t,i,s),t.flags&Js&&t.memoizedState!==null&&Cw(s,cr,t.memoizedState,t.memoizedProps);break;case 5:Ua(t,i,s);break;case 3:case 4:var o=cr;cr=$o(t.stateNode.containerInfo),Ua(t,i,s),cr=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=Js,Js=16777216,Ua(t,i,s),Js=o):Ua(t,i,s));break;default:Ua(t,i,s)}}function jg(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 Xs(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];Qt=o,Og(o,t)}jg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ng(t),t=t.sibling}function Ng(t){switch(t.tag){case 0:case 11:case 15:Xs(t),t.flags&2048&&bi(9,t,t.return);break;case 3:Xs(t);break;case 12:Xs(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,Oo(t)):Xs(t);break;default:Xs(t)}}function Oo(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];Qt=o,Og(o,t)}jg(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:bi(8,i,i.return),Oo(i);break;case 22:s=i.stateNode,s._visibility&2&&(s._visibility&=-3,Oo(i));break;default:Oo(i)}t=t.sibling}}function Og(t,i){for(;Qt!==null;){var s=Qt;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:Rs(s.memoizedState.cache)}if(o=s.child,o!==null)o.return=s,Qt=o;else e:for(s=t;Qt!==null;){o=Qt;var h=o.sibling,p=o.return;if(wg(o),o===s){Qt=null;break e}if(h!==null){h.return=p,Qt=h;break e}Qt=p}}}var qv={getCacheForType:function(t){var i=nn(Ft),s=i.data.get(t);return s===void 0&&(s=t(),i.data.set(t,s)),s},cacheSignal:function(){return nn(Ft).controller.signal}},Iv=typeof WeakMap=="function"?WeakMap:Map,ft=0,_t=null,Ze=null,tt=0,mt=0,Mn=null,xi=!1,Ba=!1,wf=!1,Yr=0,Ut=0,vi=0,la=0,Sf=0,Dn=0,Pa=0,Ks=null,Sn=null,_f=!1,Ro=0,Rg=0,Mo=1/0,Do=null,wi=null,Xt=0,Si=null,Ha=null,Jr=0,Ef=0,kf=null,Mg=null,Qs=0,Cf=null;function zn(){return(ft&2)!==0&&tt!==0?tt&-tt:q.T!==null?Rf():xs()}function Dg(){if(Dn===0)if((tt&536870912)===0||rt){var t=Nr;Nr<<=1,(Nr&3932160)===0&&(Nr=262144),Dn=t}else Dn=536870912;return t=On.current,t!==null&&(t.flags|=32),Dn}function _n(t,i,s){(t===_t&&(mt===2||mt===9)||t.cancelPendingCommit!==null)&&(qa(t,0),_i(t,tt,Dn,!1)),lr(t,s),((ft&2)===0||t!==_t)&&(t===_t&&((ft&2)===0&&(la|=s),Ut===4&&_i(t,tt,Dn,!1)),wr(t))}function zg(t,i,s){if((ft&6)!==0)throw Error(a(327));var o=!s&&(i&127)===0&&(i&t.expiredLanes)===0||Ii(t,i),h=o?Gv(t,i):Tf(t,i,!0),p=o;do{if(h===0){Ba&&!o&&_i(t,i,0,!1);break}else{if(s=t.current.alternate,p&&!Fv(s)){h=Tf(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=Ks;var P=S.current.memoizedState.isDehydrated;if(P&&(qa(S,x).flags|=256),x=Tf(S,x,!1),x!==2){if(wf&&!P){S.errorRecoveryDisabledLanes|=p,la|=p,h=4;break e}p=Sn,Sn=h,p!==null&&(Sn===null?Sn=p:Sn.push.apply(Sn,p))}h=x}if(p=!1,h!==2)continue}}if(h===1){qa(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,Dn,!xi);break e;case 2:Sn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(h=Ro+300-gt(),10<h)){if(_i(o,i,Dn,!xi),qi(o,0,!0)!==0)break e;Jr=i,o.timeoutHandle=hy(Lg.bind(null,o,s,Sn,Do,_f,i,Dn,la,Pa,xi,p,"Throttled",-0,0),h);break e}Lg(o,s,Sn,Do,_f,i,Dn,la,Pa,xi,p,null,-0,0)}}break}while(!0);wr(t)}function Lg(t,i,s,o,h,p,x,S,P,ee,oe,me,ne,ae){if(t.timeoutHandle=-1,me=i.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Mr},Tg(i,p,me);var Re=(p&62914560)===p?Ro-gt():(p&4194048)===p?Rg-gt():0;if(Re=Aw(me,Re),Re!==null){Jr=p,t.cancelPendingCommit=Re($g.bind(null,t,i,p,s,o,h,x,S,P,oe,me,null,ne,ae)),_i(t,p,x,!ee);return}}$g(t,i,p,s,o,h,x,S,P)}function Fv(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(!jn(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&=~Sf,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 zo(){return(ft&6)===0?(Zs(0),!1):!0}function Af(){if(Ze!==null){if(mt===0)var t=Ze.return;else t=Ze,Ur=Zi=null,Ic(t),Oa=null,Ds=0,t=Ze;for(;t!==null;)dg(t.alternate,t),t=t.return;Ze=null}}function qa(t,i){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,uw(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),Jr=0,Af(),_t=t,Ze=s=zr(t.current,null),tt=i,mt=0,Mn=null,xi=!1,Ba=Ii(t,i),wf=!1,Pa=Dn=Sf=la=vi=Ut=0,Sn=Ks=null,_f=!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 Yr=i,to(),s}function Ug(t,i){Ye=null,q.H=Is,i===Na||i===uo?(i=Wm(),mt=3):i===Nc?(i=Wm(),mt=4):mt=i===af?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Mn=i,Ze===null&&(Ut=1,Eo(t,Yn(i,t.current)))}function Bg(){var t=On.current;return t===null?!0:(tt&4194048)===tt?Qn===null:(tt&62914560)===tt||(tt&536870912)!==0?t===Qn:!1}function Pg(){var t=q.H;return q.H=Is,t===null?Is:t}function Hg(){var t=q.A;return q.A=qv,t}function Lo(){Ut=4,xi||(tt&4194048)!==tt&&On.current!==null||(Ba=!0),(vi&134217727)===0&&(la&134217727)===0||_t===null||_i(_t,tt,Dn,!1)}function Tf(t,i,s){var o=ft;ft|=2;var h=Pg(),p=Hg();(_t!==t||tt!==i)&&(Do=null,qa(t,i)),i=!1;var x=Ut;e:do try{if(mt!==0&&Ze!==null){var S=Ze,P=Mn;switch(mt){case 8:Af(),x=6;break e;case 3:case 2:case 9:case 6:On.current===null&&(i=!0);var ee=mt;if(mt=0,Mn=null,Ia(t,S,P,ee),s&&Ba){x=0;break e}break;default:ee=mt,mt=0,Mn=null,Ia(t,S,P,ee)}}$v(),x=Ut;break}catch(oe){Ug(t,oe)}while(!0);return i&&t.shellSuspendCounter++,Ur=Zi=null,ft=o,q.H=h,q.A=p,Ze===null&&(_t=null,tt=0,to()),x}function $v(){for(;Ze!==null;)qg(Ze)}function Gv(t,i){var s=ft;ft|=2;var o=Pg(),h=Hg();_t!==t||tt!==i?(Do=null,Mo=gt()+500,qa(t,i)):Ba=Ii(t,i);e:do try{if(mt!==0&&Ze!==null){i=Ze;var p=Mn;t:switch(mt){case 1:mt=0,Mn=null,Ia(t,i,p,1);break;case 2:case 9:if(Qm(p)){mt=0,Mn=null,Ig(i);break}i=function(){mt!==2&&mt!==9||_t!==t||(mt=7),wr(t)},p.then(i,i);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:Qm(p)?(mt=0,Mn=null,Ig(i)):(mt=0,Mn=null,Ia(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?Ay(x):S.stateNode.complete){mt=0,Mn=null;var P=S.sibling;if(P!==null)Ze=P;else{var ee=S.return;ee!==null?(Ze=ee,Uo(ee)):Ze=null}break t}}mt=0,Mn=null,Ia(t,i,p,5);break;case 6:mt=0,Mn=null,Ia(t,i,p,6);break;case 8:Af(),Ut=6;break e;default:throw Error(a(462))}}Vv();break}catch(oe){Ug(t,oe)}while(!0);return Ur=Zi=null,q.H=o,q.A=h,ft=s,Ze!==null?0:(_t=null,tt=0,to(),Ut)}function Vv(){for(;Ze!==null&&!ti();)qg(Ze)}function qg(t){var i=fg(t.alternate,t,Yr);t.memoizedProps=t.pendingProps,i===null?Uo(t):Ze=i}function Ig(t){var i=t,s=i.alternate;switch(i.tag){case 15:case 0:i=ag(s,i,i.pendingProps,i.type,void 0,tt);break;case 11:i=ag(s,i,i.pendingProps,i.type.render,i.ref,tt);break;case 5:Ic(i);default:dg(s,i),i=Ze=Hm(i,Yr),i=fg(s,i,Yr)}t.memoizedProps=t.pendingProps,i===null?Uo(t):Ze=i}function Ia(t,i,s,o){Ur=Zi=null,Ic(i),Oa=null,Ds=0;var h=i.return;try{if(Dv(t,h,i,s,tt)){Ut=1,Eo(t,Yn(s,t.current)),Ze=null;return}}catch(p){if(h!==null)throw Ze=h,p;Ut=1,Eo(t,Yn(s,t.current)),Ze=null;return}i.flags&32768?(rt||o===1?t=!0:Ba||(tt&536870912)!==0?t=!1:(xi=t=!0,(o===2||o===9||o===3||o===6)&&(o=On.current,o!==null&&o.tag===13&&(o.flags|=16384))),Fg(i,t)):Uo(i)}function Uo(t){var i=t;do{if((i.flags&32768)!==0){Fg(i,xi);return}t=i.return;var s=Uv(i.alternate,i,Yr);if(s!==null){Ze=s;return}if(i=i.sibling,i!==null){Ze=i;return}Ze=i=t}while(i!==null);Ut===0&&(Ut=5)}function Fg(t,i){do{var s=Bv(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);Ut=6,Ze=null}function $g(t,i,s,o,h,p,x,S,P){t.cancelPendingCommit=null;do Bo();while(Xt!==0);if((ft&6)!==0)throw Error(a(327));if(i!==null){if(i===t.current)throw Error(a(177));if(p=i.lanes|i.childLanes,p|=pc,ai(t,s,p,x,S,P),t===_t&&(Ze=_t=null,tt=0),Ha=i,Si=t,Jr=s,Ef=p,kf=h,Mg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Kv(Pe,function(){return Xg(),null})):(t.callbackNode=null,t.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=q.T,q.T=null,h=re.p,re.p=2,x=ft,ft|=4;try{Pv(t,i,s)}finally{ft=x,re.p=h,q.T=o}}Xt=1,Gg(),Vg(),Yg()}}function Gg(){if(Xt===1){Xt=0;var t=Si,i=Ha,s=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||s){s=q.T,q.T=null;var o=re.p;re.p=2;var h=ft;ft|=4;try{kg(i,t);var p=Hf,x=Om(t.containerInfo),S=p.focusedElem,P=p.selectionRange;if(x!==S&&S&&S.ownerDocument&&Nm(S.ownerDocument.documentElement,S)){if(P!==null&&cc(S)){var ee=P.start,oe=P.end;if(oe===void 0&&(oe=ee),"selectionStart"in S)S.selectionStart=ee,S.selectionEnd=Math.min(oe,S.value.length);else{var me=S.ownerDocument||document,ne=me&&me.defaultView||window;if(ne.getSelection){var ae=ne.getSelection(),Re=S.textContent.length,Ie=Math.min(P.start,Re),xt=P.end===void 0?Ie:Math.min(P.end,Re);!ae.extend&&Ie>xt&&(x=xt,xt=Ie,Ie=x);var X=jm(S,Ie),$=jm(S,xt);if(X&&$&&(ae.rangeCount!==1||ae.anchorNode!==X.node||ae.anchorOffset!==X.offset||ae.focusNode!==$.node||ae.focusOffset!==$.offset)){var W=me.createRange();W.setStart(X.node,X.offset),ae.removeAllRanges(),Ie>xt?(ae.addRange(W),ae.extend($.node,$.offset)):(W.setEnd($.node,$.offset),ae.addRange(W))}}}}for(me=[],ae=S;ae=ae.parentNode;)ae.nodeType===1&&me.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<me.length;S++){var ce=me[S];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Ko=!!Pf,Hf=Pf=null}finally{ft=h,re.p=o,q.T=s}}t.current=i,Xt=2}}function Vg(){if(Xt===2){Xt=0;var t=Si,i=Ha,s=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||s){s=q.T,q.T=null;var o=re.p;re.p=2;var h=ft;ft|=4;try{vg(t,i.alternate,i)}finally{ft=h,re.p=o,q.T=s}}Xt=3}}function Yg(){if(Xt===4||Xt===3){Xt=0,gr();var t=Si,i=Ha,s=Jr,o=Mg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Xt=5:(Xt=0,Ha=Si=null,Jg(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(wi=null),$i(s),i=i.stateNode,ht&&typeof ht.onCommitFiberRoot=="function")try{ht.onCommitFiberRoot(It,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=q.T,h=re.p,re.p=2,q.T=null;try{for(var p=t.onRecoverableError,x=0;x<o.length;x++){var S=o[x];p(S.value,{componentStack:S.stack})}}finally{q.T=i,re.p=h}}(Jr&3)!==0&&Bo(),wr(t),h=t.pendingLanes,(s&261930)!==0&&(h&42)!==0?t===Cf?Qs++:(Qs=0,Cf=t):Qs=0,Zs(0)}}function Jg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,Rs(i)))}function Bo(){return Gg(),Vg(),Yg(),Xg()}function Xg(){if(Xt!==5)return!1;var t=Si,i=Ef;Ef=0;var s=$i(Jr),o=q.T,h=re.p;try{re.p=32>s?32:s,q.T=null,s=kf,kf=null;var p=Si,x=Jr;if(Xt=0,Ha=Si=null,Jr=0,(ft&6)!==0)throw Error(a(331));var S=ft;if(ft|=4,Ng(p.current),Ag(p,p.current,x,s),ft=S,Zs(0,!1),ht&&typeof ht.onPostCommitFiberRoot=="function")try{ht.onPostCommitFiberRoot(It,p)}catch{}return!0}finally{re.p=h,q.T=o,Jg(t,i)}}function Kg(t,i,s){i=Yn(s,i),i=rf(t.stateNode,i,2),t=pi(t,i,2),t!==null&&(lr(t,2),wr(t))}function pt(t,i,s){if(t.tag===3)Kg(t,t,s);else for(;i!==null;){if(i.tag===3){Kg(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=Yn(s,t),s=Qp(2),o=pi(i,s,2),o!==null&&(Zp(s,o,i,t),lr(o,2),wr(o));break}}i=i.return}}function jf(t,i,s){var o=t.pingCache;if(o===null){o=t.pingCache=new Iv;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)||(wf=!0,h.add(s),t=Yv.bind(null,t,i,s),i.then(t,t))}function Yv(t,i,s){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,_t===t&&(tt&s)===s&&(Ut===4||Ut===3&&(tt&62914560)===tt&&300>gt()-Ro?(ft&2)===0&&qa(t,0):Sf|=s,Pa===tt&&(Pa=0)),wr(t)}function Qg(t,i){i===0&&(i=da()),t=Xi(t,i),t!==null&&(lr(t,i),wr(t))}function Jv(t){var i=t.memoizedState,s=0;i!==null&&(s=i.retryLane),Qg(t,s)}function Xv(t,i){var s=0;switch(t.tag){case 31:case 13:var o=t.stateNode,h=t.memoizedState;h!==null&&(s=h.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(i),Qg(t,s)}function Kv(t,i){return ar(t,i)}var Po=null,Fa=null,Nf=!1,Ho=!1,Of=!1,Ei=0;function wr(t){t!==Fa&&t.next===null&&(Fa===null?Po=Fa=t:Fa=Fa.next=t),Ho=!0,Nf||(Nf=!0,Zv())}function Zs(t,i){if(!Of&&Ho){Of=!0;do for(var s=!1,o=Po;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,ty(o,p))}else p=tt,p=qi(o,o===_t?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Ii(o,p)||(s=!0,ty(o,p));o=o.next}while(s);Of=!1}}function Qv(){Zg()}function Zg(){Ho=Nf=!1;var t=0;Ei!==0&&ow()&&(t=Ei);for(var i=gt(),s=null,o=Po;o!==null;){var h=o.next,p=Wg(o,i);p===0?(o.next=null,s===null?Po=h:s.next=h,h===null&&(Fa=s)):(s=o,(t!==0||(p&3)!==0)&&(Ho=!0)),o=h}Xt!==0&&Xt!==5||Zs(t),Ei!==0&&(Ei=0)}function Wg(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,P=h[x];P===-1?((S&s)===0||(S&o)!==0)&&(h[x]=bs(S,i)):P<=i&&(t.expiredLanes|=S),p&=~S}if(i=_t,s=tt,s=qi(t,t===i?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o=t.callbackNode,s===0||t===i&&(mt===2||mt===9)||t.cancelPendingCommit!==null)return o!==null&&o!==null&&An(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&&An(o),$i(s)){case 2:case 8:s=Se;break;case 32:s=Pe;break;case 268435456:s=it;break;default:s=Pe}return o=ey.bind(null,t),s=ar(s,o),t.callbackPriority=i,t.callbackNode=s,i}return o!==null&&o!==null&&An(o),t.callbackPriority=2,t.callbackNode=null,2}function ey(t,i){if(Xt!==0&&Xt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(Bo()&&t.callbackNode!==s)return null;var o=tt;return o=qi(t,t===_t?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),o===0?null:(zg(t,o,i),Wg(t,gt()),t.callbackNode!=null&&t.callbackNode===s?ey.bind(null,t):null)}function ty(t,i){if(Bo())return null;zg(t,i,!0)}function Zv(){cw(function(){(ft&6)!==0?ar(le,Qv):Zg()})}function Rf(){if(Ei===0){var t=Ta;t===0&&(t=Bt,Bt<<=1,(Bt&261888)===0&&(Bt=256)),Ei=t}return Ei}function ny(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Yl(""+t)}function ry(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 Wv(t,i,s,o,h){if(i==="submit"&&s&&s.stateNode===h){var p=ny((h[zt]||null).action),x=o.submitter;x&&(i=(i=x[zt]||null)?ny(i.formAction):x.getAttribute("formAction"),i!==null&&(p=i,x=null));var S=new Ql("action","action",null,o,h);t.push({event:S,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Ei!==0){var P=x?ry(h,x):new FormData(h);Qc(s,{pending:!0,data:P,method:h.method,action:p},null,P)}}else typeof p=="function"&&(S.preventDefault(),P=x?ry(h,x):new FormData(h),Qc(s,{pending:!0,data:P,method:h.method,action:p},p,P))},currentTarget:h}]})}}for(var Mf=0;Mf<mc.length;Mf++){var Df=mc[Mf],ew=Df.toLowerCase(),tw=Df[0].toUpperCase()+Df.slice(1);ur(ew,"on"+tw)}ur(Dm,"onAnimationEnd"),ur(zm,"onAnimationIteration"),ur(Lm,"onAnimationStart"),ur("dblclick","onDoubleClick"),ur("focusin","onFocus"),ur("focusout","onBlur"),ur(yv,"onTransitionRun"),ur(bv,"onTransitionStart"),ur(xv,"onTransitionCancel"),ur(Um,"onTransitionEnd"),ie("onMouseEnter",["mouseout","mouseover"]),ie("onMouseLeave",["mouseout","mouseover"]),ie("onPointerEnter",["pointerout","pointerover"]),ie("onPointerLeave",["pointerout","pointerover"]),be("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),be("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),be("onBeforeInput",["compositionend","keypress","textInput","paste"]),be("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),be("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ws="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(" "),nw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ws));function iy(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],P=S.instance,ee=S.currentTarget;if(S=S.listener,P!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=ee;try{p(h)}catch(oe){eo(oe)}h.currentTarget=null,p=P}else for(x=0;x<o.length;x++){if(S=o[x],P=S.instance,ee=S.currentTarget,S=S.listener,P!==p&&h.isPropagationStopped())break e;p=S,h.currentTarget=ee;try{p(h)}catch(oe){eo(oe)}h.currentTarget=null,p=P}}}}function We(t,i){var s=i[Gi];s===void 0&&(s=i[Gi]=new Set);var o=t+"__bubble";s.has(o)||(ay(i,t,2,!1),s.add(o))}function zf(t,i,s){var o=0;i&&(o|=4),ay(s,t,o,i)}var qo="_reactListening"+Math.random().toString(36).slice(2);function Lf(t){if(!t[qo]){t[qo]=!0,Q.forEach(function(s){s!=="selectionchange"&&(nw.has(s)||zf(s,!1,t),zf(s,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[qo]||(i[qo]=!0,zf("selectionchange",!1,i))}}function ay(t,i,s,o){switch(Dy(i)){case 2:var h=Nw;break;case 8:h=Ow;break;default:h=Qf}s=h.bind(null,i,s,t),h=void 0,!tc||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 Uf(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 P=x.tag;if((P===3||P===4)&&x.stateNode.containerInfo===h)return;x=x.return}for(;S!==null;){if(x=_(S),x===null)return;if(P=x.tag,P===5||P===6||P===26||P===27){o=p=x;continue e}S=S.parentNode}}o=o.return}cm(function(){var ee=p,oe=Wu(s),me=[];e:{var ne=Bm.get(t);if(ne!==void 0){var ae=Ql,Re=t;switch(t){case"keypress":if(Xl(s)===0)break e;case"keydown":case"keyup":ae=X1;break;case"focusin":Re="focus",ae=ac;break;case"focusout":Re="blur",ae=ac;break;case"beforeblur":case"afterblur":ae=ac;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=dm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=U1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=Z1;break;case Dm:case zm:case Lm:ae=H1;break;case Um:ae=ev;break;case"scroll":case"scrollend":ae=z1;break;case"wheel":ae=nv;break;case"copy":case"cut":case"paste":ae=I1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=pm;break;case"toggle":case"beforetoggle":ae=iv}var Ie=(i&4)!==0,xt=!Ie&&(t==="scroll"||t==="scrollend"),X=Ie?ne!==null?ne+"Capture":null:ne;Ie=[];for(var $=ee,W;$!==null;){var ce=$;if(W=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||W===null||X===null||(ce=ws($,X),ce!=null&&Ie.push(el($,ce,W))),xt)break;$=$.return}0<Ie.length&&(ne=new ae(ne,Re,null,s,oe),me.push({event:ne,listeners:Ie}))}}if((i&7)===0){e:{if(ne=t==="mouseover"||t==="pointerover",ae=t==="mouseout"||t==="pointerout",ne&&s!==Zu&&(Re=s.relatedTarget||s.fromElement)&&(_(Re)||Re[Tn]))break e;if((ae||ne)&&(ne=oe.window===oe?oe:(ne=oe.ownerDocument)?ne.defaultView||ne.parentWindow:window,ae?(Re=s.relatedTarget||s.toElement,ae=ee,Re=Re?_(Re):null,Re!==null&&(xt=u(Re),Ie=Re.tag,Re!==xt||Ie!==5&&Ie!==27&&Ie!==6)&&(Re=null)):(ae=null,Re=ee),ae!==Re)){if(Ie=dm,ce="onMouseLeave",X="onMouseEnter",$="mouse",(t==="pointerout"||t==="pointerover")&&(Ie=pm,ce="onPointerLeave",X="onPointerEnter",$="pointer"),xt=ae==null?ne:A(ae),W=Re==null?ne:A(Re),ne=new Ie(ce,$+"leave",ae,s,oe),ne.target=xt,ne.relatedTarget=W,ce=null,_(oe)===ee&&(Ie=new Ie(X,$+"enter",Re,s,oe),Ie.target=W,Ie.relatedTarget=xt,ce=Ie),xt=ce,ae&&Re)t:{for(Ie=rw,X=ae,$=Re,W=0,ce=X;ce;ce=Ie(ce))W++;ce=0;for(var Ue=$;Ue;Ue=Ie(Ue))ce++;for(;0<W-ce;)X=Ie(X),W--;for(;0<ce-W;)$=Ie($),ce--;for(;W--;){if(X===$||$!==null&&X===$.alternate){Ie=X;break t}X=Ie(X),$=Ie($)}Ie=null}else Ie=null;ae!==null&&sy(me,ne,ae,Ie,!1),Re!==null&&xt!==null&&sy(me,xt,Re,Ie,!0)}}e:{if(ne=ee?A(ee):window,ae=ne.nodeName&&ne.nodeName.toLowerCase(),ae==="select"||ae==="input"&&ne.type==="file")var ut=_m;else if(wm(ne))if(Em)ut=mv;else{ut=hv;var Me=fv}else ae=ne.nodeName,!ae||ae.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&Qu(ee.elementType)&&(ut=_m):ut=dv;if(ut&&(ut=ut(t,ee))){Sm(me,ut,s,oe);break e}Me&&Me(t,ne,ee),t==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&Ku(ne,"number",ne.value)}switch(Me=ee?A(ee):window,t){case"focusin":(wm(Me)||Me.contentEditable==="true")&&(va=Me,fc=ee,js=null);break;case"focusout":js=fc=va=null;break;case"mousedown":hc=!0;break;case"contextmenu":case"mouseup":case"dragend":hc=!1,Rm(me,s,oe);break;case"selectionchange":if(gv)break;case"keydown":case"keyup":Rm(me,s,oe)}var Xe;if(lc)e:{switch(t){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else xa?xm(t,s)&&(nt="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(nt="onCompositionStart");nt&&(gm&&s.locale!=="ko"&&(xa||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&xa&&(Xe=fm()):(oi=oe,nc="value"in oi?oi.value:oi.textContent,xa=!0)),Me=Io(ee,nt),0<Me.length&&(nt=new mm(nt,t,null,s,oe),me.push({event:nt,listeners:Me}),Xe?nt.data=Xe:(Xe=vm(s),Xe!==null&&(nt.data=Xe)))),(Xe=sv?lv(t,s):ov(t,s))&&(nt=Io(ee,"onBeforeInput"),0<nt.length&&(Me=new mm("onBeforeInput","beforeinput",null,s,oe),me.push({event:Me,listeners:nt}),Me.data=Xe)),Wv(me,t,ee,s,oe)}iy(me,i)})}function el(t,i,s){return{instance:t,listener:i,currentTarget:s}}function Io(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=ws(t,s),h!=null&&o.unshift(el(t,h,p)),h=ws(t,i),h!=null&&o.push(el(t,h,p))),t.tag===3)return o;t=t.return}return[]}function rw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function sy(t,i,s,o,h){for(var p=i._reactName,x=[];s!==null&&s!==o;){var S=s,P=S.alternate,ee=S.stateNode;if(S=S.tag,P!==null&&P===o)break;S!==5&&S!==26&&S!==27||ee===null||(P=ee,h?(ee=ws(s,p),ee!=null&&x.unshift(el(s,ee,P))):h||(ee=ws(s,p),ee!=null&&x.push(el(s,ee,P)))),s=s.return}x.length!==0&&t.push({event:i,listeners:x})}var iw=/\r\n?/g,aw=/\u0000|\uFFFD/g;function ly(t){return(typeof t=="string"?t:""+t).replace(iw,`
|
|
49
|
+
`).replace(aw,"")}function oy(t,i){return i=ly(i),ly(t)===i}function bt(t,i,s,o,h,p){switch(s){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||ga(t,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&ga(t,""+o);break;case"className":or(t,"class",o);break;case"tabIndex":or(t,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":or(t,s,o);break;case"style":om(t,o,p);break;case"data":if(i!=="object"){or(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=Yl(""+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"&&bt(t,i,"name",h.name,h,null),bt(t,i,"formEncType",h.formEncType,h,null),bt(t,i,"formMethod",h.formMethod,h,null),bt(t,i,"formTarget",h.formTarget,h,null)):(bt(t,i,"encType",h.encType,h,null),bt(t,i,"method",h.method,h,null),bt(t,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){t.removeAttribute(s);break}o=Yl(""+o),t.setAttribute(s,o);break;case"onClick":o!=null&&(t.onclick=Mr);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=Yl(""+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),sn(t,"popover",o);break;case"xlinkActuate":Rr(t,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Rr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Rr(t,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Rr(t,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Rr(t,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Rr(t,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Rr(t,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Rr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Rr(t,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":sn(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=M1.get(s)||s,sn(t,s,o))}}function Bf(t,i,s,o,h,p){switch(s){case"style":om(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"?ga(t,o):(typeof o=="number"||typeof o=="bigint")&&ga(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=Mr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!de.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(h=s.endsWith("Capture"),i=s.slice(2,h?s.length-7:void 0),p=t[zt]||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,""):sn(t,s,o)}}}function an(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:bt(t,i,p,x,s,null)}}h&&bt(t,i,"srcSet",s.srcSet,s,null),o&&bt(t,i,"src",s.src,s,null);return;case"input":We("invalid",t);var S=p=x=h=null,P=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":P=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:bt(t,i,o,oe,s,null)}}im(t,p,S,P,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:bt(t,i,h,S,s,null)}i=p,s=x,t.multiple=!!o,i!=null?pa(t,!!o,i,!1):s!=null&&pa(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:bt(t,i,x,S,s,null)}sm(t,o,h,p);return;case"option":for(P in s)if(s.hasOwnProperty(P)&&(o=s[P],o!=null))switch(P){case"selected":t.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:bt(t,i,P,o,s,null)}return;case"dialog":We("beforetoggle",t),We("toggle",t),We("cancel",t),We("close",t);break;case"iframe":case"object":We("load",t);break;case"video":case"audio":for(o=0;o<Ws.length;o++)We(Ws[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:bt(t,i,ee,o,s,null)}return;default:if(Qu(i)){for(oe in s)s.hasOwnProperty(oe)&&(o=s[oe],o!==void 0&&Bf(t,i,oe,o,s,void 0));return}}for(S in s)s.hasOwnProperty(S)&&(o=s[S],o!=null&&bt(t,i,S,o,s,null))}function sw(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,P=null,ee=null,oe=null;for(ae in s){var me=s[ae];if(s.hasOwnProperty(ae)&&me!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":P=me;default:o.hasOwnProperty(ae)||bt(t,i,ae,null,o,me)}}for(var ne in o){var ae=o[ne];if(me=s[ne],o.hasOwnProperty(ne)&&(ae!=null||me!=null))switch(ne){case"type":p=ae;break;case"name":h=ae;break;case"checked":ee=ae;break;case"defaultChecked":oe=ae;break;case"value":x=ae;break;case"defaultValue":S=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,i));break;default:ae!==me&&bt(t,i,ne,ae,o,me)}}Xu(t,x,S,P,ee,oe,p,h);return;case"select":ae=x=S=ne=null;for(p in s)if(P=s[p],s.hasOwnProperty(p)&&P!=null)switch(p){case"value":break;case"multiple":ae=P;default:o.hasOwnProperty(p)||bt(t,i,p,null,o,P)}for(h in o)if(p=o[h],P=s[h],o.hasOwnProperty(h)&&(p!=null||P!=null))switch(h){case"value":ne=p;break;case"defaultValue":S=p;break;case"multiple":x=p;default:p!==P&&bt(t,i,h,p,o,P)}i=S,s=x,o=ae,ne!=null?pa(t,!!s,ne,!1):!!o!=!!s&&(i!=null?pa(t,!!s,i,!0):pa(t,!!s,s?[]:"",!1));return;case"textarea":ae=ne=null;for(S in s)if(h=s[S],s.hasOwnProperty(S)&&h!=null&&!o.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:bt(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":ne=h;break;case"defaultValue":ae=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(a(91));break;default:h!==p&&bt(t,i,x,h,o,p)}am(t,ne,ae);return;case"option":for(var Re in s)if(ne=s[Re],s.hasOwnProperty(Re)&&ne!=null&&!o.hasOwnProperty(Re))switch(Re){case"selected":t.selected=!1;break;default:bt(t,i,Re,null,o,ne)}for(P in o)if(ne=o[P],ae=s[P],o.hasOwnProperty(P)&&ne!==ae&&(ne!=null||ae!=null))switch(P){case"selected":t.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:bt(t,i,P,ne,o,ae)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ie in s)ne=s[Ie],s.hasOwnProperty(Ie)&&ne!=null&&!o.hasOwnProperty(Ie)&&bt(t,i,Ie,null,o,ne);for(ee in o)if(ne=o[ee],ae=s[ee],o.hasOwnProperty(ee)&&ne!==ae&&(ne!=null||ae!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(a(137,i));break;default:bt(t,i,ee,ne,o,ae)}return;default:if(Qu(i)){for(var xt in s)ne=s[xt],s.hasOwnProperty(xt)&&ne!==void 0&&!o.hasOwnProperty(xt)&&Bf(t,i,xt,void 0,o,ne);for(oe in o)ne=o[oe],ae=s[oe],!o.hasOwnProperty(oe)||ne===ae||ne===void 0&&ae===void 0||Bf(t,i,oe,ne,o,ae);return}}for(var X in s)ne=s[X],s.hasOwnProperty(X)&&ne!=null&&!o.hasOwnProperty(X)&&bt(t,i,X,null,o,ne);for(me in o)ne=o[me],ae=s[me],!o.hasOwnProperty(me)||ne===ae||ne==null&&ae==null||bt(t,i,me,ne,o,ae)}function uy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function lw(){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&&uy(x)){for(x=0,S=h.responseEnd,o+=1;o<s.length;o++){var P=s[o],ee=P.startTime;if(ee>S)break;var oe=P.transferSize,me=P.initiatorType;oe&&uy(me)&&(P=P.responseEnd,x+=oe*(P<S?1:(S-ee)/(P-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 Pf=null,Hf=null;function Fo(t){return t.nodeType===9?t:t.ownerDocument}function cy(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 fy(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 qf(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 If=null;function ow(){var t=window.event;return t&&t.type==="popstate"?t===If?!1:(If=t,!0):(If=null,!1)}var hy=typeof setTimeout=="function"?setTimeout:void 0,uw=typeof clearTimeout=="function"?clearTimeout:void 0,dy=typeof Promise=="function"?Promise:void 0,cw=typeof queueMicrotask=="function"?queueMicrotask:typeof dy<"u"?function(t){return dy.resolve(null).then(t).catch(fw)}:hy;function fw(t){setTimeout(function(){throw t})}function ki(t){return t==="head"}function my(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),Ya(i);return}o--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")o++;else if(s==="html")tl(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,tl(s);for(var p=s.firstChild;p;){var x=p.nextSibling,S=p.nodeName;p[Jt]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&p.rel.toLowerCase()==="stylesheet"||s.removeChild(p),p=x}}else s==="body"&&tl(t.ownerDocument.body);s=h}while(s);Ya(i)}function py(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 Ff(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":Ff(s),ma(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function hw(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[Jt])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=Zn(t.nextSibling),t===null)break}return null}function dw(t,i,s){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=Zn(t.nextSibling),t===null))return null;return t}function gy(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Zn(t.nextSibling),t===null))return null;return t}function $f(t){return t.data==="$?"||t.data==="$~"}function Gf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function mw(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 Zn(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 Vf=null;function yy(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(i===0)return Zn(t.nextSibling);i--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||i++}t=t.nextSibling}return null}function by(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 xy(t,i,s){switch(i=Fo(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 tl(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);ma(t)}var Wn=new Map,vy=new Set;function $o(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Xr=re.d;re.d={f:pw,r:gw,D:yw,C:bw,L:xw,m:vw,X:Sw,S:ww,M:_w};function pw(){var t=Xr.f(),i=zo();return t||i}function gw(t){var i=T(t);i!==null&&i.tag===5&&i.type==="form"?Up(i):Xr.r(t)}var $a=typeof document>"u"?null:document;function wy(t,i,s){var o=$a;if(o&&typeof i=="string"&&i){var h=Gn(i);h='link[rel="'+t+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),vy.has(h)||(vy.add(h),t={rel:t,crossOrigin:s,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),an(i,"link",t),I(i),o.head.appendChild(i)))}}function yw(t){Xr.D(t),wy("dns-prefetch",t,null)}function bw(t,i){Xr.C(t,i),wy("preconnect",t,i)}function xw(t,i,s){Xr.L(t,i,s);var o=$a;if(o&&t&&i){var h='link[rel="preload"][as="'+Gn(i)+'"]';i==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+Gn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+Gn(s.imageSizes)+'"]')):h+='[href="'+Gn(t)+'"]';var p=h;switch(i){case"style":p=Ga(t);break;case"script":p=Va(t)}Wn.has(p)||(t=g({rel:"preload",href:i==="image"&&s&&s.imageSrcSet?void 0:t,as:i},s),Wn.set(p,t),o.querySelector(h)!==null||i==="style"&&o.querySelector(nl(p))||i==="script"&&o.querySelector(rl(p))||(i=o.createElement("link"),an(i,"link",t),I(i),o.head.appendChild(i)))}}function vw(t,i){Xr.m(t,i);var s=$a;if(s&&t){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Gn(o)+'"][href="'+Gn(t)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Va(t)}if(!Wn.has(p)&&(t=g({rel:"modulepreload",href:t},i),Wn.set(p,t),s.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(rl(p)))return}o=s.createElement("link"),an(o,"link",t),I(o),s.head.appendChild(o)}}}function ww(t,i,s){Xr.S(t,i,s);var o=$a;if(o&&t){var h=D(o).hoistableStyles,p=Ga(t);i=i||"default";var x=h.get(p);if(!x){var S={loading:0,preload:null};if(x=o.querySelector(nl(p)))S.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":i},s),(s=Wn.get(p))&&Yf(t,s);var P=x=o.createElement("link");I(P),an(P,"link",t),P._p=new Promise(function(ee,oe){P.onload=ee,P.onerror=oe}),P.addEventListener("load",function(){S.loading|=1}),P.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Go(x,i,o)}x={type:"stylesheet",instance:x,count:1,state:S},h.set(p,x)}}}function Sw(t,i){Xr.X(t,i);var s=$a;if(s&&t){var o=D(s).hoistableScripts,h=Va(t),p=o.get(h);p||(p=s.querySelector(rl(h)),p||(t=g({src:t,async:!0},i),(i=Wn.get(h))&&Jf(t,i),p=s.createElement("script"),I(p),an(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function _w(t,i){Xr.M(t,i);var s=$a;if(s&&t){var o=D(s).hoistableScripts,h=Va(t),p=o.get(h);p||(p=s.querySelector(rl(h)),p||(t=g({src:t,async:!0,type:"module"},i),(i=Wn.get(h))&&Jf(t,i),p=s.createElement("script"),I(p),an(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function Sy(t,i,s,o){var h=(h=ve.current)?$o(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=Ga(s.href),s=D(h).hoistableStyles,o=s.get(i),o||(o={type:"style",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=Ga(s.href);var p=D(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(nl(t)))&&!p._p&&(x.instance=p,x.state.loading=5),Wn.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},Wn.set(t,s),p||Ew(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=Va(s),s=D(h).hoistableScripts,o=s.get(i),o||(o={type:"script",instance:null,count:0,state:null},s.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function Ga(t){return'href="'+Gn(t)+'"'}function nl(t){return'link[rel="stylesheet"]['+t+"]"}function _y(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function Ew(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}),an(i,"link",s),I(i),t.head.appendChild(i))}function Va(t){return'[src="'+Gn(t)+'"]'}function rl(t){return"script[async]"+t}function Ey(t,i,s){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Gn(s.href)+'"]');if(o)return i.instance=o,I(o),o;var h=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),I(o),an(o,"style",h),Go(o,s.precedence,t),i.instance=o;case"stylesheet":h=Ga(s.href);var p=t.querySelector(nl(h));if(p)return i.state.loading|=4,i.instance=p,I(p),p;o=_y(s),(h=Wn.get(h))&&Yf(o,h),p=(t.ownerDocument||t).createElement("link"),I(p);var x=p;return x._p=new Promise(function(S,P){x.onload=S,x.onerror=P}),an(p,"link",o),i.state.loading|=4,Go(p,s.precedence,t),i.instance=p;case"script":return p=Va(s.src),(h=t.querySelector(rl(p)))?(i.instance=h,I(h),h):(o=s,(h=Wn.get(p))&&(o=g({},s),Jf(o,h)),t=t.ownerDocument||t,h=t.createElement("script"),I(h),an(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,Go(o,s.precedence,t));return i.instance}function Go(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 Yf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function Jf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var Vo=null;function ky(t,i,s){if(Vo===null){var o=new Map,h=Vo=new Map;h.set(s,o)}else h=Vo,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[Jt]||p[St]||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 Cy(t,i,s){t=t.ownerDocument||t,t.head.insertBefore(s,i==="title"?t.querySelector("head > title"):null)}function kw(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 Ay(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Cw(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=Ga(o.href),p=i.querySelector(nl(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=Yo.bind(t),i.then(t,t)),s.state.loading|=4,s.instance=p,I(p);return}p=i.ownerDocument||i,o=_y(o),(h=Wn.get(h))&&Yf(o,h),p=p.createElement("link"),I(p);var x=p;x._p=new Promise(function(S,P){x.onload=S,x.onerror=P}),an(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=Yo.bind(t),i.addEventListener("load",s),i.addEventListener("error",s))}}var Xf=0;function Aw(t,i){return t.stylesheets&&t.count===0&&Xo(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var o=setTimeout(function(){if(t.stylesheets&&Xo(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+i);0<t.imgBytes&&Xf===0&&(Xf=62500*lw());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Xo(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>Xf?50:800)+i);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Yo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xo(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Jo=null;function Xo(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Jo=new Map,i.forEach(Tw,t),Jo=null,Yo.call(t))}function Tw(t,i){if(!(i.state.loading&4)){var s=Jo.get(t);if(s)var o=s.get(null);else{s=new Map,Jo.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=Yo.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 il={$$typeof:G,Provider:null,Consumer:null,_currentValue:ye,_currentValue2:ye,_threadCount:0};function jw(t,i,s,o,h,p,x,S,P){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=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=P,this.incompleteTransitions=new Map}function Ty(t,i,s,o,h,p,x,S,P,ee,oe,me){return t=new jw(t,i,s,x,P,ee,oe,me,S),i=1,p===!0&&(i|=24),p=Nn(3,null,null,i),t.current=p,p.stateNode=t,i=Ac(),i.refCount++,t.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:s,cache:i},Oc(p),t}function jy(t){return t?(t=_a,t):_a}function Ny(t,i,s,o,h,p){h=jy(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&&(_n(s,t,i),Ls(s,t,i))}function Oy(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<i?s:i}}function Kf(t,i){Oy(t,i),(t=t.alternate)&&Oy(t,i)}function Ry(t){if(t.tag===13||t.tag===31){var i=Xi(t,67108864);i!==null&&_n(i,t,67108864),Kf(t,67108864)}}function My(t){if(t.tag===13||t.tag===31){var i=zn();i=Or(i);var s=Xi(t,i);s!==null&&_n(s,t,i),Kf(t,i)}}var Ko=!0;function Nw(t,i,s,o){var h=q.T;q.T=null;var p=re.p;try{re.p=2,Qf(t,i,s,o)}finally{re.p=p,q.T=h}}function Ow(t,i,s,o){var h=q.T;q.T=null;var p=re.p;try{re.p=8,Qf(t,i,s,o)}finally{re.p=p,q.T=h}}function Qf(t,i,s,o){if(Ko){var h=Zf(o);if(h===null)Uf(t,i,o,Qo,s),zy(t,o);else if(Mw(h,t,i,s,o))o.stopPropagation();else if(zy(t,o),i&4&&-1<Rw.indexOf(t)){for(;h!==null;){var p=T(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var x=sr(p.pendingLanes);if(x!==0){var S=p;for(S.pendingLanes|=2,S.entangledLanes|=2;x;){var P=1<<31-xe(x);S.entanglements[1]|=P,x&=~P}wr(p),(ft&6)===0&&(Mo=gt()+500,Zs(0))}}break;case 31:case 13:S=Xi(p,2),S!==null&&_n(S,p,2),zo(),Kf(p,2)}if(p=Zf(o),p===null&&Uf(t,i,o,Qo,s),p===h)break;h=p}h!==null&&o.stopPropagation()}else Uf(t,i,o,null,s)}}function Zf(t){return t=Wu(t),Wf(t)}var Qo=null;function Wf(t){if(Qo=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 Qo=t,null}function Dy(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(ni()){case le:return 2;case Se:return 8;case Pe:case Je:return 32;case it:return 268435456;default:return 32}default:return 32}}var eh=!1,Ci=null,Ai=null,Ti=null,al=new Map,sl=new Map,ji=[],Rw="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 zy(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":al.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":sl.delete(i.pointerId)}}function ll(t,i,s,o,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:i,domEventName:s,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=T(i),i!==null&&Ry(i)),t):(t.eventSystemFlags|=o,i=t.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),t)}function Mw(t,i,s,o,h){switch(i){case"focusin":return Ci=ll(Ci,t,i,s,o,h),!0;case"dragenter":return Ai=ll(Ai,t,i,s,o,h),!0;case"mouseover":return Ti=ll(Ti,t,i,s,o,h),!0;case"pointerover":var p=h.pointerId;return al.set(p,ll(al.get(p)||null,t,i,s,o,h)),!0;case"gotpointercapture":return p=h.pointerId,sl.set(p,ll(sl.get(p)||null,t,i,s,o,h)),!0}return!1}function Ly(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,Fl(t.priority,function(){My(s)});return}}else if(i===31){if(i=f(s),i!==null){t.blockedOn=i,Fl(t.priority,function(){My(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 Zo(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var s=Zf(t.nativeEvent);if(s===null){s=t.nativeEvent;var o=new s.constructor(s.type,s);Zu=o,s.target.dispatchEvent(o),Zu=null}else return i=T(s),i!==null&&Ry(i),t.blockedOn=s,!1;i.shift()}return!0}function Uy(t,i,s){Zo(t)&&s.delete(i)}function Dw(){eh=!1,Ci!==null&&Zo(Ci)&&(Ci=null),Ai!==null&&Zo(Ai)&&(Ai=null),Ti!==null&&Zo(Ti)&&(Ti=null),al.forEach(Uy),sl.forEach(Uy)}function Wo(t,i){t.blockedOn===i&&(t.blockedOn=null,eh||(eh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Dw)))}var eu=null;function By(t){eu!==t&&(eu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){eu===t&&(eu=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(Wf(o||s)===null)continue;break}var p=T(s);p!==null&&(t.splice(i,3),i-=3,Qc(p,{pending:!0,data:h,method:s.method,action:o},o,h))}}))}function Ya(t){function i(P){return Wo(P,t)}Ci!==null&&Wo(Ci,t),Ai!==null&&Wo(Ai,t),Ti!==null&&Wo(Ti,t),al.forEach(i),sl.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);)Ly(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[zt]||null;if(typeof p=="function")x||By(s);else if(x){var S=null;if(p&&p.hasAttribute("formAction")){if(h=p,x=p[zt]||null)S=x.formAction;else if(Wf(h)!==null)continue}else S=x.action;typeof S=="function"?s[o+1]=S:(s.splice(o,3),o-=3),By(s)}}}function Py(){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 th(t){this._internalRoot=t}tu.prototype.render=th.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(a(409));var s=i.current,o=zn();Ny(s,o,t,i,null,null)},tu.prototype.unmount=th.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;Ny(t.current,2,null,t,null,null),zo(),i[Tn]=null}};function tu(t){this._internalRoot=t}tu.prototype.unstable_scheduleHydration=function(t){if(t){var i=xs();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&&Ly(t)}};var Hy=n.version;if(Hy!=="19.2.4")throw Error(a(527,Hy,"19.2.4"));re.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=d(i),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var zw={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nu.isDisabled&&nu.supportsFiber)try{It=nu.inject(zw),ht=nu}catch{}}return ul.createRoot=function(t,i){if(!l(t))throw Error(a(299));var s=!1,o="",h=Yp,p=Jp,x=Xp;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=Ty(t,1,!1,null,null,s,o,null,h,p,x,Py),t[Tn]=i.current,Lf(t),new th(i)},ul.hydrateRoot=function(t,i,s){if(!l(t))throw Error(a(299));var o=!1,h="",p=Yp,x=Jp,S=Xp,P=null;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(S=s.onRecoverableError),s.formState!==void 0&&(P=s.formState)),i=Ty(t,1,!0,i,s??null,o,h,P,p,x,S,Py),i.context=jy(null),s=i.current,o=zn(),o=Or(o),h=mi(o),h.callback=null,pi(s,h,o),s=o,i.current.lanes=s,lr(i,s),wr(i),t[Tn]=i.current,Lf(t),new tu(i)},ul.version="19.2.4",ul}var Ky;function Vw(){if(Ky)return ih.exports;Ky=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(),ih.exports=Gw(),ih.exports}var Yw=Vw();/**
|
|
50
|
+
* react-router v7.13.1
|
|
51
|
+
*
|
|
52
|
+
* Copyright (c) Remix Software Inc.
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
+
*
|
|
57
|
+
* @license MIT
|
|
58
|
+
*/var Qy="popstate";function Zy(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Jw(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 Gh("",{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:Al(l)}return Kw(n,r,null,e)}function Mt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Cr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Xw(){return Math.random().toString(36).substring(2,10)}function Wy(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 Gh(e,n,r=null,a,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?ds(n):n,state:r,key:n&&n.key||a||Xw(),unstable_mask:l}}function Al({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 ds(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 Kw(e,n,r,a={}){let{window:l=document.defaultView,v5Compat:u=!1}=a,c=l.history,f="POP",m=null,d=y();d==null&&(d=0,c.replaceState({...c.state,idx:d},""));function y(){return(c.state||{idx:null}).idx}function g(){f="POP";let B=y(),M=B==null?null:B-d;d=B,m&&m({action:f,location:z.location,delta:M})}function b(B,M){f="PUSH";let F=Zy(B)?B:Gh(z.location,B,M);d=y()+1;let G=Wy(F,d),se=z.createHref(F.unstable_mask||F);try{c.pushState(G,"",se)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;l.location.assign(se)}u&&m&&m({action:f,location:z.location,delta:1})}function v(B,M){f="REPLACE";let F=Zy(B)?B:Gh(z.location,B,M);d=y();let G=Wy(F,d),se=z.createHref(F.unstable_mask||F);c.replaceState(G,"",se),u&&m&&m({action:f,location:z.location,delta:0})}function C(B){return Qw(B)}let z={get action(){return f},get location(){return e(l,c)},listen(B){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(Qy,g),m=B,()=>{l.removeEventListener(Qy,g),m=null}},createHref(B){return n(l,B)},createURL:C,encodeLocation(B){let M=C(B);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:b,replace:v,go(B){return c.go(B)}};return z}function Qw(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Mt(r,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:Al(e);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function Rb(e,n,r="/"){return Zw(e,n,r,!1)}function Zw(e,n,r,a){let l=typeof n=="string"?ds(n):n,u=Zr(l.pathname||"/",r);if(u==null)return null;let c=Mb(e);Ww(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=cS(u);f=oS(c[m],d,a)}return f}function Mb(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;Mt(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=kr([a,y.relativePath]),b=r.concat(y);c.children&&c.children.length>0&&(Mt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Mb(c.children,n,b,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:sS(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 Db(c.path))u(c,f,!0,d)}),n}function Db(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=Db(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 Ww(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:lS(n.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var eS=/^:[\w-]+$/,tS=3,nS=2,rS=1,iS=10,aS=-2,e0=e=>e==="*";function sS(e,n){let r=e.split("/"),a=r.length;return r.some(e0)&&(a+=aS),n&&(a+=nS),r.filter(l=>!e0(l)).reduce((l,u)=>l+(eS.test(u)?tS:u===""?rS:iS),a)}function lS(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 oS(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=xu({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),b=m.route;if(!g&&d&&r&&!a[a.length-1].route.index&&(g=xu({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:kr([u,g.pathname]),pathnameBase:mS(kr([u,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(u=kr([u,g.pathnameBase]))}return c}function xu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=uS(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 C=f[b]||"";c=u.slice(0,u.length-C.length).replace(/(.)\/+$/,"$1")}const v=f[b];return g&&!v?d[y]=void 0:d[y]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:e}}function uS(e,n=!1,r=!0){Cr(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 cS(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Cr(!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 Zr(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 fS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function hS(e,n="/"){let{pathname:r,search:a="",hash:l=""}=typeof e=="string"?ds(e):e,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=t0(r.substring(1),"/"):u=t0(r,n)):u=n,{pathname:u,search:pS(a),hash:gS(l)}}function t0(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 oh(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 dS(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function zb(e){let n=dS(e);return n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase)}function wd(e,n,r,a=!1){let l;typeof e=="string"?l=ds(e):(l={...e},Mt(!l.pathname||!l.pathname.includes("?"),oh("?","pathname","search",l)),Mt(!l.pathname||!l.pathname.includes("#"),oh("#","pathname","hash",l)),Mt(!l.search||!l.search.includes("#"),oh("#","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=hS(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var kr=e=>e.join("/").replace(/\/\/+/g,"/"),mS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),pS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,gS=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,yS=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 bS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function xS(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Lb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ub(e,n){let r=e;if(typeof r!="string"||!fS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,l=!1;if(Lb)try{let u=new URL(window.location.href),c=r.startsWith("//")?new URL(u.protocol+r):new URL(r),f=Zr(c.pathname,n);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{Cr(!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 Bb=["POST","PUT","PATCH","DELETE"];new Set(Bb);var vS=["GET",...Bb];new Set(vS);var ms=L.createContext(null);ms.displayName="DataRouter";var Lu=L.createContext(null);Lu.displayName="DataRouterState";var wS=L.createContext(!1),Pb=L.createContext({isTransitioning:!1});Pb.displayName="ViewTransition";var SS=L.createContext(new Map);SS.displayName="Fetchers";var _S=L.createContext(null);_S.displayName="Await";var rr=L.createContext(null);rr.displayName="Navigation";var Dl=L.createContext(null);Dl.displayName="Location";var Ar=L.createContext({outlet:null,matches:[],isDataRoute:!1});Ar.displayName="Route";var Sd=L.createContext(null);Sd.displayName="RouteError";var Hb="REACT_ROUTER_ERROR",ES="REDIRECT",kS="ROUTE_ERROR_RESPONSE";function CS(e){if(e.startsWith(`${Hb}:${ES}:{`))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 AS(e){if(e.startsWith(`${Hb}:${kS}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new yS(n.status,n.statusText,n.data)}catch{}}function TS(e,{relative:n}={}){Mt(zl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=L.useContext(rr),{hash:l,pathname:u,search:c}=Ll(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:kr([r,u])),a.createHref({pathname:f,search:c,hash:l})}function zl(){return L.useContext(Dl)!=null}function Tr(){return Mt(zl(),"useLocation() may be used only in the context of a <Router> component."),L.useContext(Dl).location}var qb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ib(e){L.useContext(rr).static||L.useLayoutEffect(e)}function fa(){let{isDataRoute:e}=L.useContext(Ar);return e?IS():jS()}function jS(){Mt(zl(),"useNavigate() may be used only in the context of a <Router> component.");let e=L.useContext(ms),{basename:n,navigator:r}=L.useContext(rr),{matches:a}=L.useContext(Ar),{pathname:l}=Tr(),u=JSON.stringify(zb(a)),c=L.useRef(!1);return Ib(()=>{c.current=!0}),L.useCallback((m,d={})=>{if(Cr(c.current,qb),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=wd(m,JSON.parse(u),l,d.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:kr([n,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[n,r,u,l,e])}L.createContext(null);function NS(){let{matches:e}=L.useContext(Ar),n=e[e.length-1];return n?n.params:{}}function Ll(e,{relative:n}={}){let{matches:r}=L.useContext(Ar),{pathname:a}=Tr(),l=JSON.stringify(zb(r));return L.useMemo(()=>wd(e,JSON.parse(l),a,n==="path"),[e,l,a,n])}function OS(e,n){return Fb(e,n)}function Fb(e,n,r){var B;Mt(zl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=L.useContext(rr),{matches:l}=L.useContext(Ar),u=l[l.length-1],c=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",d=u&&u.route;{let M=d&&d.path||"";Gb(f,!d||M.endsWith("*")||M.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${M}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
+
|
|
60
|
+
Please change the parent <Route path="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let y=Tr(),g;if(n){let M=typeof n=="string"?ds(n):n;Mt(m==="/"||((B=M.pathname)==null?void 0:B.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${M.pathname}" was given in the \`location\` prop.`),g=M}else g=y;let b=g.pathname||"/",v=b;if(m!=="/"){let M=m.replace(/^\//,"").split("/");v="/"+b.replace(/^\//,"").split("/").slice(M.length).join("/")}let C=Rb(e,{pathname:v});Cr(d||C!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Cr(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let z=LS(C&&C.map(M=>Object.assign({},M,{params:Object.assign({},c,M.params),pathname:kr([m,a.encodeLocation?a.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?m:kr([m,a.encodeLocation?a.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),l,r);return n&&z?L.createElement(Dl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},z):z}function RS(){let e=qS(),n=bS(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:a},u={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=L.createElement(L.Fragment,null,L.createElement("p",null,"💿 Hey developer 👋"),L.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",L.createElement("code",{style:u},"ErrorBoundary")," or"," ",L.createElement("code",{style:u},"errorElement")," prop on your route.")),L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},n),r?L.createElement("pre",{style:l},r):null,c)}var MS=L.createElement(RS,null),$b=class extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=AS(e.digest);r&&(e=r)}let n=e!==void 0?L.createElement(Ar.Provider,{value:this.props.routeContext},L.createElement(Sd.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?L.createElement(DS,{error:e},n):n}};$b.contextType=wS;var uh=new WeakMap;function DS({children:e,error:n}){let{basename:r}=L.useContext(rr);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let a=CS(n.digest);if(a){let l=uh.get(n);if(l)throw l;let u=Ub(a.location,r);if(Lb&&!uh.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 uh.set(n,c),c}return L.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function zS({routeContext:e,match:n,children:r}){let a=L.useContext(ms);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),L.createElement(Ar.Provider,{value:e},r)}function LS(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);Mt(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:v}=a,C=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!v||v[g.route.id]===void 0);if(g.route.lazy||C){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,v;m(y,{location:a.location,params:((v=(b=a.matches)==null?void 0:b[0])==null?void 0:v.params)??{},unstable_pattern:xS(a.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,b)=>{let v,C=!1,z=null,B=null;a&&(v=u&&g.route.id?u[g.route.id]:void 0,z=g.route.errorElement||MS,c&&(f<0&&b===0?(Gb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,B=null):f===b&&(C=!0,B=g.route.hydrateFallbackElement||null)));let M=n.concat(l.slice(0,b+1)),F=()=>{let G;return v?G=z:C?G=B:g.route.Component?G=L.createElement(g.route.Component,null):g.route.element?G=g.route.element:G=y,L.createElement(zS,{match:g,routeContext:{outlet:y,matches:M,isDataRoute:a!=null},children:G})};return a&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?L.createElement($b,{location:a.location,revalidation:a.revalidation,component:z,error:v,children:F(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:d}):F()},null)}function _d(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function US(e){let n=L.useContext(ms);return Mt(n,_d(e)),n}function BS(e){let n=L.useContext(Lu);return Mt(n,_d(e)),n}function PS(e){let n=L.useContext(Ar);return Mt(n,_d(e)),n}function Ed(e){let n=PS(e),r=n.matches[n.matches.length-1];return Mt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function HS(){return Ed("useRouteId")}function qS(){var a;let e=L.useContext(Sd),n=BS("useRouteError"),r=Ed("useRouteError");return e!==void 0?e:(a=n.errors)==null?void 0:a[r]}function IS(){let{router:e}=US("useNavigate"),n=Ed("useNavigate"),r=L.useRef(!1);return Ib(()=>{r.current=!0}),L.useCallback(async(l,u={})=>{Cr(r.current,qb),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...u}))},[e,n])}var n0={};function Gb(e,n,r){!n&&!n0[e]&&(n0[e]=!0,Cr(!1,r))}L.memo(FS);function FS({routes:e,future:n,state:r,isStatic:a,onError:l}){return Fb(e,void 0,{state:r,isStatic:a,onError:l})}function Qa(e){Mt(!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 $S({basename:e="/",children:n=null,location:r,navigationType:a="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Mt(!zl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=L.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=ds(r));let{pathname:d="/",search:y="",hash:g="",state:b=null,key:v="default",unstable_mask:C}=r,z=L.useMemo(()=>{let B=Zr(d,f);return B==null?null:{location:{pathname:B,search:y,hash:g,state:b,key:v,unstable_mask:C},navigationType:a}},[f,d,y,g,b,v,a,C]);return Cr(z!=null,`<Router basename="${f}"> is not able to match the URL "${d}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),z==null?null:L.createElement(rr.Provider,{value:m},L.createElement(Dl.Provider,{children:n,value:z}))}function GS({children:e,location:n}){return OS(Vh(e),n)}function Vh(e,n=[]){let r=[];return L.Children.forEach(e,(a,l)=>{if(!L.isValidElement(a))return;let u=[...n,l];if(a.type===L.Fragment){r.push.apply(r,Vh(a.props.children,u));return}Mt(a.type===Qa,`[${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>`),Mt(!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=Vh(a.props.children,u)),r.push(c)}),r}var mu="get",pu="application/x-www-form-urlencoded";function Uu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function VS(e){return Uu(e)&&e.tagName.toLowerCase()==="button"}function YS(e){return Uu(e)&&e.tagName.toLowerCase()==="form"}function JS(e){return Uu(e)&&e.tagName.toLowerCase()==="input"}function XS(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function KS(e,n){return e.button===0&&(!n||n==="_self")&&!XS(e)}var ru=null;function QS(){if(ru===null)try{new FormData(document.createElement("form"),0),ru=!1}catch{ru=!0}return ru}var ZS=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ch(e){return e!=null&&!ZS.has(e)?(Cr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${pu}"`),null):e}function WS(e,n){let r,a,l,u,c;if(YS(e)){let f=e.getAttribute("action");a=f?Zr(f,n):null,r=e.getAttribute("method")||mu,l=ch(e.getAttribute("enctype"))||pu,u=new FormData(e)}else if(VS(e)||JS(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?Zr(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||mu,l=ch(e.getAttribute("formenctype"))||ch(f.getAttribute("enctype"))||pu,u=new FormData(f,e),!QS()){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(Uu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=mu,a=null,l=pu,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 kd(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function e_(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&&Zr(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${a}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${a}`,l}async function t_(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 n_(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 r_(e,n,r){let a=await Promise.all(e.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await t_(u,r);return c.links?c.links():[]}return[]}));return l_(a.flat(1).filter(n_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function r0(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 i_(e,n,{includeHydrateFallback:r}={}){return a_(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 a_(e){return[...new Set(e)]}function s_(e){let n={},r=Object.keys(e).sort();for(let a of r)n[a]=e[a];return n}function l_(e,n){let r=new Set;return new Set(n),e.reduce((a,l)=>{let u=JSON.stringify(s_(l));return r.has(u)||(r.add(u),a.push({key:u,link:l})),a},[])}function Vb(){let e=L.useContext(ms);return kd(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function o_(){let e=L.useContext(Lu);return kd(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Cd=L.createContext(void 0);Cd.displayName="FrameworkContext";function Yb(){let e=L.useContext(Cd);return kd(e,"You must render this element inside a <HydratedRouter> element"),e}function u_(e,n){let r=L.useContext(Cd),[a,l]=L.useState(!1),[u,c]=L.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,b=L.useRef(null);L.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let z=M=>{M.forEach(F=>{c(F.isIntersecting)})},B=new IntersectionObserver(z,{threshold:.5});return b.current&&B.observe(b.current),()=>{B.disconnect()}}},[e]),L.useEffect(()=>{if(a){let z=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(z)}}},[a]);let v=()=>{l(!0)},C=()=>{l(!1),c(!1)};return r?e!=="intent"?[u,b,{}]:[u,b,{onFocus:cl(f,v),onBlur:cl(m,C),onMouseEnter:cl(d,v),onMouseLeave:cl(y,C),onTouchStart:cl(g,v)}]:[!1,b,{}]}function cl(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function c_({page:e,...n}){let{router:r}=Vb(),a=L.useMemo(()=>Rb(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?L.createElement(h_,{page:e,matches:a,...n}):null}function f_(e){let{manifest:n,routeModules:r}=Yb(),[a,l]=L.useState([]);return L.useEffect(()=>{let u=!1;return r_(e,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[e,n,r]),a}function h_({page:e,matches:n,...r}){let a=Tr(),{future:l,manifest:u,routeModules:c}=Yb(),{basename:f}=Vb(),{loaderData:m,matches:d}=o_(),y=L.useMemo(()=>r0(e,n,d,u,a,"data"),[e,n,d,u,a]),g=L.useMemo(()=>r0(e,n,d,u,a,"assets"),[e,n,d,u,a]),b=L.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let z=new Set,B=!1;if(n.forEach(F=>{var se;let G=u.routes[F.route.id];!G||!G.hasLoader||(!y.some(O=>O.route.id===F.route.id)&&F.route.id in m&&((se=c[F.route.id])!=null&&se.shouldRevalidate)||G.hasClientLoader?B=!0:z.add(F.route.id))}),z.size===0)return[];let M=e_(e,f,l.unstable_trailingSlashAwareDataRequests,"data");return B&&z.size>0&&M.searchParams.set("_routes",n.filter(F=>z.has(F.route.id)).map(F=>F.route.id).join(",")),[M.pathname+M.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,a,u,y,n,e,c]),v=L.useMemo(()=>i_(g,u),[g,u]),C=f_(g);return L.createElement(L.Fragment,null,b.map(z=>L.createElement("link",{key:z,rel:"prefetch",as:"fetch",href:z,...r})),v.map(z=>L.createElement("link",{key:z,rel:"modulepreload",href:z,...r})),C.map(({key:z,link:B})=>L.createElement("link",{key:z,nonce:r.nonce,...B,crossOrigin:B.crossOrigin??r.crossOrigin})))}function d_(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var m_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{m_&&(window.__reactRouterVersion="7.13.1")}catch{}function p_({basename:e,children:n,unstable_useTransitions:r,window:a}){let l=L.useRef();l.current==null&&(l.current=Jw({window:a,v5Compat:!0}));let u=l.current,[c,f]=L.useState({action:u.action,location:u.location}),m=L.useCallback(d=>{r===!1?f(d):L.startTransition(()=>f(d))},[r]);return L.useLayoutEffect(()=>u.listen(m),[u,m]),L.createElement($S,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var Jb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xb=L.forwardRef(function({onClick:n,discover:r="render",prefetch:a="none",relative:l,reloadDocument:u,replace:c,unstable_mask:f,state:m,target:d,to:y,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:v,...C},z){let{basename:B,navigator:M,unstable_useTransitions:F}=L.useContext(rr),G=typeof y=="string"&&Jb.test(y),se=Ub(y,B);y=se.to;let O=TS(y,{relative:l}),j=Tr(),Y=null;if(f){let H=wd(f,[],j.unstable_mask?j.unstable_mask.pathname:"/",!0);B!=="/"&&(H.pathname=H.pathname==="/"?B:kr([B,H.pathname])),Y=M.createHref(H)}let[J,V,N]=u_(a,C),K=x_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:b,unstable_defaultShouldRevalidate:v,unstable_useTransitions:F});function Z(H){n&&n(H),H.defaultPrevented||K(H)}let ge=!(se.isExternal||u),he=L.createElement("a",{...C,...N,href:(ge?Y:void 0)||se.absoluteURL||O,onClick:ge?Z:n,ref:d_(z,V),target:d,"data-discover":!G&&r==="render"?"true":void 0});return J&&!G?L.createElement(L.Fragment,null,he,L.createElement(c_,{page:O})):he});Xb.displayName="Link";var g_=L.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:a="",end:l=!1,style:u,to:c,viewTransition:f,children:m,...d},y){let g=Ll(c,{relative:d.relative}),b=Tr(),v=L.useContext(Lu),{navigator:C,basename:z}=L.useContext(rr),B=v!=null&&E_(g)&&f===!0,M=C.encodeLocation?C.encodeLocation(g).pathname:g.pathname,F=b.pathname,G=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(F=F.toLowerCase(),G=G?G.toLowerCase():null,M=M.toLowerCase()),G&&z&&(G=Zr(G,z)||G);const se=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let O=F===M||!l&&F.startsWith(M)&&F.charAt(se)==="/",j=G!=null&&(G===M||!l&&G.startsWith(M)&&G.charAt(M.length)==="/"),Y={isActive:O,isPending:j,isTransitioning:B},J=O?n:void 0,V;typeof a=="function"?V=a(Y):V=[a,O?"active":null,j?"pending":null,B?"transitioning":null].filter(Boolean).join(" ");let N=typeof u=="function"?u(Y):u;return L.createElement(Xb,{...d,"aria-current":J,className:V,ref:y,style:N,to:c,viewTransition:f},typeof m=="function"?m(Y):m)});g_.displayName="NavLink";var y_=L.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:a,replace:l,state:u,method:c=mu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b,...v},C)=>{let{unstable_useTransitions:z}=L.useContext(rr),B=S_(),M=__(f,{relative:d}),F=c.toLowerCase()==="get"?"get":"post",G=typeof f=="string"&&Jb.test(f),se=O=>{if(m&&m(O),O.defaultPrevented)return;O.preventDefault();let j=O.nativeEvent.submitter,Y=(j==null?void 0:j.getAttribute("formmethod"))||c,J=()=>B(j||O.currentTarget,{fetcherKey:n,method:Y,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:b});z&&r!==!1?L.startTransition(()=>J()):J()};return L.createElement("form",{ref:C,method:F,action:M,onSubmit:a?m:se,...v,"data-discover":!G&&e==="render"?"true":void 0})});y_.displayName="Form";function b_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Kb(e){let n=L.useContext(ms);return Mt(n,b_(e)),n}function x_(e,{target:n,replace:r,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=fa(),g=Tr(),b=Ll(e,{relative:c});return L.useCallback(v=>{if(KS(v,n)){v.preventDefault();let C=r!==void 0?r:Al(g)===Al(b),z=()=>y(e,{replace:C,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?L.startTransition(()=>z()):z()}},[g,y,b,r,a,l,n,e,u,c,f,m,d])}var v_=0,w_=()=>`__${String(++v_)}__`;function S_(){let{router:e}=Kb("useSubmit"),{basename:n}=L.useContext(rr),r=HS(),a=e.fetch,l=e.navigate;return L.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=WS(u,n);if(c.navigate===!1){let b=c.fetcherKey||w_();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 __(e,{relative:n}={}){let{basename:r}=L.useContext(rr),a=L.useContext(Ar);Mt(a,"useFormAction must be used inside a RouteContext");let[l]=a.matches.slice(-1),u={...Ll(e||".",{relative:n})},c=Tr();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:kr([r,u.pathname])),Al(u)}function E_(e,{relative:n}={}){let r=L.useContext(Pb);Mt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Kb("useViewTransitionState"),l=Ll(e,{relative:n});if(!r.isTransitioning)return!1;let u=Zr(r.currentLocation.pathname,a)||r.currentLocation.pathname,c=Zr(r.nextLocation.pathname,a)||r.nextLocation.pathname;return xu(l.pathname,c)!=null||xu(l.pathname,u)!=null}var vu=Ob();const Qb=L.createContext(null),Zb="palmier_paired_hosts",Yh="palmier_active_host";function fh(){try{const e=localStorage.getItem(Zb);if(e)return JSON.parse(e)}catch{}return[]}function k_(e){localStorage.setItem(Zb,JSON.stringify(e))}function C_(){return localStorage.getItem(Yh)}function A_(e){e?localStorage.setItem(Yh,e):localStorage.removeItem(Yh)}const T_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function j_({children:e}){const[n,r]=L.useState(fh),[a,l]=L.useState(()=>{const y=C_(),g=fh();return y&&g.some(b=>b.hostId===y)?y:g.length>0?g[0].hostId:null});L.useEffect(()=>{if(!T_)return;const y="local";if(!fh().find(b=>b.hostId===y)){const b={hostId:y,clientToken:"",directUrl:window.location.origin};r(v=>[...v.filter(C=>C.hostId!==y),b]),l(y)}},[]),L.useEffect(()=>{k_(n)},[n]),L.useEffect(()=>{A_(a)},[a]);const u=L.useCallback(y=>{r(g=>[...g.filter(v=>v.hostId!==y.hostId),y]),l(y.hostId)},[]),c=L.useCallback(y=>{r(g=>{const b=g.filter(v=>v.hostId!==y);return b.length>0?l(b[0].hostId):l(null),b})},[]),f=L.useCallback((y,g)=>{r(b=>b.map(v=>v.hostId===y?{...v,name:g}:v))},[]),m=L.useCallback(y=>{l(y)},[]),d=L.useCallback(()=>n.find(y=>y.hostId===a)??null,[n,a]);return w.jsx(Qb.Provider,{value:{pairedHosts:n,activeHostId:a,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setActiveHostId:m,getActiveHost:d},children:e})}function Ul(){const e=L.useContext(Qb);if(!e)throw new Error("useHostStore must be used within HostStoreProvider");return e}const In=new Uint8Array(0),Pi=new TextEncoder,Pn=new TextDecoder;function N_(...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 vl(...e){const n=[];for(let r=0;r<e.length;r++)n.push(Pi.encode(e[r]));return n.length===0?In:n.length===1?n[0]:N_(...n)}function i0(e){return!e||e.length===0?"":Pn.decode(e)}const a0="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",s0=36,O_=0xcfd41b9100000,l0=33,R_=333,o0=22;function M_(e){for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*255)}function D_(e){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(e):M_(e)}class z_{constructor(){k(this,"buf");k(this,"seq");k(this,"inc");k(this,"inited");this.buf=new Uint8Array(o0),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*O_),this.inc=Math.floor(Math.random()*(R_-l0)+l0)}setPre(){const n=new Uint8Array(12);D_(n);for(let r=0;r<12;r++){const a=n[r]%36;this.buf[r]=a0.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let r=o0-1;r>=12;r--)this.buf[r]=a0.charCodeAt(n%s0),n=Math.floor(n/s0)}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 z_;var Kr;(function(e){e.Disconnect="disconnect",e.Reconnect="reconnect",e.Update="update",e.LDM="ldm",e.Error="error"})(Kr||(Kr={}));var ns;(function(e){e.Reconnecting="reconnecting",e.PingTimer="pingTimer",e.StaleConnection="staleConnection",e.ClientInitiatedReconnect="client initiated reconnect"})(ns||(ns={}));var ke;(function(e){e.ApiError="BAD API",e.BadAuthentication="BAD_AUTHENTICATION",e.BadCreds="BAD_CREDS",e.BadHeader="BAD_HEADER",e.BadJson="BAD_JSON",e.BadPayload="BAD_PAYLOAD",e.BadSubject="BAD_SUBJECT",e.Cancelled="CANCELLED",e.ConnectionClosed="CONNECTION_CLOSED",e.ConnectionDraining="CONNECTION_DRAINING",e.ConnectionRefused="CONNECTION_REFUSED",e.ConnectionTimeout="CONNECTION_TIMEOUT",e.Disconnect="DISCONNECT",e.InvalidOption="INVALID_OPTION",e.InvalidPayload="INVALID_PAYLOAD",e.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",e.NoResponders="503",e.NotFunction="NOT_FUNC",e.RequestError="REQUEST_ERROR",e.ServerOptionNotAvailable="SERVER_OPT_NA",e.SubClosed="SUB_CLOSED",e.SubDraining="SUB_DRAINING",e.Timeout="TIMEOUT",e.Tls="TLS",e.Unknown="UNKNOWN_ERROR",e.WssRequired="WSS_REQUIRED",e.JetStreamInvalidAck="JESTREAM_INVALID_ACK",e.JetStream404NoMessages="404",e.JetStream408RequestTimeout="408",e.JetStream409MaxAckPendingExceeded="409",e.JetStream409="409",e.JetStreamNotEnabled="503",e.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",e.AuthorizationViolation="AUTHORIZATION_VIOLATION",e.AuthenticationExpired="AUTHENTICATION_EXPIRED",e.ProtocolError="NATS_PROTOCOL_ERR",e.PermissionsViolation="PERMISSIONS_VIOLATION",e.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",e.AccountExpired="ACCOUNT_EXPIRED"})(ke||(ke={}));function L_(e){return typeof e.code=="string"}class Wb{constructor(){k(this,"messages");this.messages=new Map,this.messages.set(ke.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(ke.BadJson,"Bad JSON"),this.messages.set(ke.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return U_.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const U_=new Wb;class Ne extends Error{constructor(r,a,l){super(r);k(this,"name");k(this,"message");k(this,"code");k(this,"permissionContext");k(this,"chainedError");k(this,"api_error");this.name="NatsError",this.message=r,this.code=a,this.chainedError=l}static errorForCode(r,a){const l=Wb.getMessage(r);return new Ne(l,r,a)}isAuthError(){return this.code===ke.AuthenticationExpired||this.code===ke.AuthorizationViolation||this.code===ke.AccountExpired}isAuthTimeout(){return this.code===ke.AuthenticationTimeout}isPermissionError(){return this.code===ke.PermissionsViolation}isProtocolError(){return this.code===ke.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Un;(function(e){e[e.Exact=0]="Exact",e[e.CanonicalMIME=1]="CanonicalMIME",e[e.IgnoreCase=2]="IgnoreCase"})(Un||(Un={}));var dr;(function(e){e.Timer="timer",e.Count="count",e.JitterTimer="jitterTimer",e.SentinelMsg="sentinelMsg"})(dr||(dr={}));var wl;(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"})(wl||(wl={}));const wu="Nats-Service-Error",Su="Nats-Service-Error-Code";class _u extends Error{constructor(r,a){super(a);k(this,"code");this.code=r}static isServiceError(r){return _u.toServiceError(r)!==null}static toServiceError(r){var l,u;const a=((l=r==null?void 0:r.headers)==null?void 0:l.get(Su))||"";if(a!==""){const c=parseInt(a)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(wu))||"";return new _u(c,f.length?f:a)}return null}}function Qr(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 Jh="127.0.0.1";var Di;(function(e){e.PING="PING",e.STATS="STATS",e.INFO="INFO"})(Di||(Di={}));function Bu(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 iu(e){return Pn.decode(e).replace(/\n/g,"␊").replace(/\r/g,"␍")}function os(e,n=!0){const r=n?Ne.errorForCode(ke.Timeout):null;let a,l;const u=new Promise((c,f)=>{a={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Ne.errorForCode(ke.Timeout):r)},e)});return Object.assign(u,a)}function ps(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 Rt(){let e={};const n=new Promise((r,a)=>{e={resolve:r,reject:a}});return Object.assign(n,e)}function ex(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 B_(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Ad(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 B_(r>n?e[n]:e[r])}}}function Ot(e){return e*1e6}function Td(e){return Math.floor(e/1e6)}function u0(e){let a=!0;const l=new Array(e.length);for(let u=0;u<e.length;u++){let c=e.charCodeAt(u);if(c===58||c<33||c>126)throw new Ne(`'${e[u]}' is not a valid character for a header key`,ke.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 Wr(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 hh="NATS/1.0";class zi{constructor(n=0,r=""){k(this,"_code");k(this,"headers");k(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=Pn.decode(n).split(`\r
|
|
61
|
+
`),u=l[0];if(u!==hh){let c=u.replace(hh,"").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=hh;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 Ne("invalid header value - \\r and \\n are not allowed.",ke.BadHeader);return n.trim()}keys(){const n=[];for(const r of this.headers.keys())n.push(r);return n}findKeys(n,r=Un.Exact){const a=this.keys();switch(r){case Un.Exact:return a.filter(l=>l===n);case Un.CanonicalMIME:return n=u0(n),a.filter(l=>l===n);default:{const l=n.toLowerCase();return a.filter(u=>l===u.toLowerCase())}}}get(n,r=Un.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=Un.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=Un.Exact){return this.findKeys(n,r).length>0}set(n,r,a=Un.Exact){this.delete(n,a),this.append(n,r,a)}append(n,r,a=Un.Exact){const l=u0(n);a===Un.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=Un.Exact){const a=[];return this.findKeys(n,r).forEach(u=>{const c=this.headers.get(u);c&&a.push(...c)}),a}delete(n,r=Un.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 Eu(){return{encode(e){return Pi.encode(e)},decode(e){return Pn.decode(e)}}}function mr(e){return{encode(n){try{return n===void 0&&(n=null),Pi.encode(JSON.stringify(n))}catch(r){throw Ne.errorForCode(ke.BadJson,r)}},decode(n){try{return JSON.parse(Pn.decode(n),e)}catch(r){throw Ne.errorForCode(ke.BadJson,r)}}}}function tx(e){var n;return e&&e.data.length===0&&((n=e.headers)==null?void 0:n.code)===503?Ne.errorForCode(ke.NoResponders):null}class jd{constructor(n,r,a){k(this,"_headers");k(this,"_msg");k(this,"_rdata");k(this,"_reply");k(this,"_subject");k(this,"publisher");this._msg=n,this._rdata=r,this.publisher=a}get subject(){return this._subject?this._subject:(this._subject=Pn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Pn.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=In,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 mr(n).decode(this.data)}string(){return Pn.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}}k(jd,"jc");function rs(e){return Pu("durable",e)}function fn(e){return Pu("stream",e)}function Pu(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 bl(e,n=""){if(n==="")throw Error(`${e} name required`);const r=P_(n);if(r.length)throw new Error(`invalid ${e} name - ${e} name ${r}`)}function P_(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 Xh(e){if(e.data.length>0)return!1;const n=e.headers;return n?n.code>=100&&n.code<200:!1}function Kh(e){var n;return Xh(e)&&((n=e.headers)==null?void 0:n.description)==="Idle Heartbeat"}function H_(e,n,r){const a=Wr(e,n),l={hdr:1,sid:0,size:0},u=new jd(l,In,{});return u._headers=a,u._subject=r,u}function is(e){if(e.data.length!==0)return null;const n=e.headers;return n?nx(n.code,n.description):null}var tr;(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"})(tr||(tr={}));function q_(e){return e.code!==ke.JetStream409?!1:[tr.MaxBatchExceeded,tr.MaxExpiresExceeded,tr.MaxBytesExceeded,tr.MaxMessageSizeExceeded,tr.PushConsumer,tr.IdleHeartbeatMissed,tr.ConsumerDeleted].find(r=>e.message.indexOf(r)!==-1)!==void 0}function nx(e,n=""){if(e<300)return null;switch(n=n.toLowerCase(),e){case 404:return new Ne(n,ke.JetStream404NoMessages);case 408:return new Ne(n,ke.JetStream408RequestTimeout);case 409:{const r=n.startsWith(tr.IdleHeartbeatMissed)?ke.JetStreamIdleHeartBeat:ke.JetStream409;return new Ne(n,r)}case 503:return Ne.errorForCode(ke.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=ke.Unknown),new Ne(n,`${e}`)}}class en{constructor(){k(this,"inflight");k(this,"processed");k(this,"received");k(this,"noIterator");k(this,"iterClosed");k(this,"done");k(this,"signal");k(this,"yields");k(this,"filtered");k(this,"pendingFiltered");k(this,"ingestionFilterFn");k(this,"protocolFilterFn");k(this,"dispatchedFn");k(this,"ctx");k(this,"_data");k(this,"err");k(this,"time");k(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=Rt(),this.yields=[],this.iterClosed=Rt(),this.time=0,this.yielding=!1}[Symbol.asyncIterator](){return this.iterate()}push(n){if(this.done)return;if(typeof n=="function"){this.yields.push(n),this.signal.resolve();return}const{ingest:r,protocol:a}=this.ingestionFilterFn?this.ingestionFilterFn(n,this.ctx||this):{ingest:!0,protocol:!1};r&&(a&&(this.filtered++,this.pendingFiltered++),this.yields.push(n),this.signal.resolve())}async*iterate(){if(this.noIterator)throw new Ne("unsupported iterator",ke.ApiError);if(this.yielding)throw new Ne("already yielding",ke.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=Rt())}}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 Nd{constructor(n,r,a={maxOut:2}){k(this,"interval");k(this,"maxOut");k(this,"cancelAfter");k(this,"timer");k(this,"autoCancelTimer");k(this,"last");k(this,"missed");k(this,"count");k(this,"callback");this.interval=n,this.maxOut=(a==null?void 0:a.maxOut)||2,this.cancelAfter=(a==null?void 0:a.cancelAfter)||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=r,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(n,r=0,a=2){this.interval=n,this.maxOut=a,this.cancelAfter=r,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(n){console.log(n)}},this.interval)}}var Qh;(function(e){e.Limits="limits",e.Interest="interest",e.Workqueue="workqueue"})(Qh||(Qh={}));var Tl;(function(e){e.Old="old",e.New="new"})(Tl||(Tl={}));var Zh;(function(e){e.File="file",e.Memory="memory"})(Zh||(Zh={}));var qt;(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"})(qt||(qt={}));var Wt;(function(e){e.None="none",e.All="all",e.Explicit="explicit",e.NotSet=""})(Wt||(Wt={}));var us;(function(e){e.Instant="instant",e.Original="original"})(us||(us={}));var Bi;(function(e){e.None="none",e.S2="s2"})(Bi||(Bi={}));var ku;(function(e){e.CreateOrUpdate="",e.Update="update",e.Create="create"})(ku||(ku={}));function I_(e,n={}){return Object.assign({name:e,deliver_policy:qt.All,ack_policy:Wt.Explicit,ack_wait:Ot(30*1e3),replay_policy:us.Instant},n)}var c0;(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"})(c0||(c0={}));var pn;(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"})(pn||(pn={}));var hr;(function(e){e.LastValue="",e.AllHistory="history",e.UpdatesOnly="updates"})(hr||(hr={}));var es;(function(e){e.Stream="Nats-Stream",e.Sequence="Nats-Sequence",e.TimeStamp="Nats-Time-Stamp",e.Subject="Nats-Subject"})(es||(es={}));var f0;(function(e){e.Stream="Nats-Stream",e.Subject="Nats-Subject",e.Sequence="Nats-Sequence",e.LastSequence="Nats-Last-Sequence",e.Size="Nats-Msg-Size"})(f0||(f0={}));const Bn="KV_";class F_{constructor(n){k(this,"config");k(this,"ordered");k(this,"mack");k(this,"stream");k(this,"callbackFn");k(this,"max");k(this,"qname");k(this,"isBind");k(this,"filters");this.stream="",this.mack=!1,this.ordered=!1,this.config=I_("",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?Wt.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 rs(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=qt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=qt.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=qt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=qt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=qt.Last,this}deliverNew(){return this.config.deliver_policy=qt.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=Wt.None,this}ackAll(){return this.config.ack_policy=Wt.All,this}ackExplicit(){return this.config.ack_policy=Wt.Explicit,this}ackWait(n){return this.config.ack_wait=Ot(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=us.Instant,this}replayOriginal(){return this.config.replay_policy=us.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=Ot(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=Ot(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=Ot(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 F_(e)}function h0(e){return typeof e.getOpts=="function"}class $_{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 as{static encode(n){return as.toB64URLEncoding($_.encode(n))}static decode(n,r=!1){return as.decode(as.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class cs{constructor(){k(this,"buffers");k(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 Pn.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 G_(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 V_=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},fl=V_.performance||{};fl.now||fl.mozNow||fl.msNow||fl.oNow||fl.webkitNow;var d0={versions:{}},Y_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function J_(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 dh,Hu={exports:{}},m0={},p0=J_(G_({__proto__:null,default:m0},[m0]));dh=Hu,(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&&d0.versions&&d0.versions.node;l?r=Y_:a&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&dh.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),m=[-2147483648,8388608,32768,128],d=[24,16,8,0],y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=["hex","array","digest","arrayBuffer"],b=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(O){return Object.prototype.toString.call(O)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(O){return typeof O=="object"&&O.buffer&&O.buffer.constructor===ArrayBuffer});var v=function(O,j){return function(Y){return new F(j,!0).update(Y)[O]()}},C=function(O){var j=v("hex",O);l&&(j=z(j,O)),j.create=function(){return new F(O)},j.update=function(V){return j.create().update(V)};for(var Y=0;Y<g.length;++Y){var J=g[Y];j[J]=v(J,O)}return j},z=function(O,j){var Y,J=p0,V=p0.Buffer,N=j?"sha224":"sha256";return Y=V.from&&!r.JS_SHA256_NO_BUFFER_FROM?V.from:function(K){return new V(K)},function(K){if(typeof K=="string")return J.createHash(N).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===V?J.createHash(N).update(Y(K)).digest("hex"):O(K)}},B=function(O,j){return function(Y,J){return new G(Y,j,!0).update(J)[O]()}},M=function(O){var j=B("hex",O);j.create=function(V){return new G(V,O)},j.update=function(V,N){return j.create(V).update(N)};for(var Y=0;Y<g.length;++Y){var J=g[Y];j[J]=B(J,O)}return j};function F(O,j){j?(b[0]=b[16]=b[1]=b[2]=b[3]=b[4]=b[5]=b[6]=b[7]=b[8]=b[9]=b[10]=b[11]=b[12]=b[13]=b[14]=b[15]=0,this.blocks=b):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=O}function G(O,j,Y){var J,V=typeof O;if(V==="string"){var N,K=[],Z=O.length,ge=0;for(J=0;J<Z;++J)(N=O.charCodeAt(J))<128?K[ge++]=N:N<2048?(K[ge++]=192|N>>>6,K[ge++]=128|63&N):N<55296||N>=57344?(K[ge++]=224|N>>>12,K[ge++]=128|N>>>6&63,K[ge++]=128|63&N):(N=65536+((1023&N)<<10|1023&O.charCodeAt(++J)),K[ge++]=240|N>>>18,K[ge++]=128|N>>>12&63,K[ge++]=128|N>>>6&63,K[ge++]=128|63&N);O=K}else{if(V!=="object")throw new Error(e);if(O===null)throw new Error(e);if(c&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!(Array.isArray(O)||c&&ArrayBuffer.isView(O)))throw new Error(e)}O.length>64&&(O=new F(j,!0).update(O).array());var he=[],H=[];for(J=0;J<64;++J){var q=O[J]||0;he[J]=92^q,H[J]=54^q}F.call(this,j,Y),this.update(H),this.oKeyPad=he,this.inner=!0,this.sharedMemory=Y}F.prototype.update=function(O){if(!this.finalized){var j,Y=typeof O;if(Y!=="string"){if(Y!=="object")throw new Error(e);if(O===null)throw new Error(e);if(c&&O.constructor===ArrayBuffer)O=new Uint8Array(O);else if(!(Array.isArray(O)||c&&ArrayBuffer.isView(O)))throw new Error(e);j=!0}for(var J,V,N=0,K=O.length,Z=this.blocks;N<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),j)for(V=this.start;N<K&&V<64;++N)Z[V>>>2]|=O[N]<<d[3&V++];else for(V=this.start;N<K&&V<64;++N)(J=O.charCodeAt(N))<128?Z[V>>>2]|=J<<d[3&V++]:J<2048?(Z[V>>>2]|=(192|J>>>6)<<d[3&V++],Z[V>>>2]|=(128|63&J)<<d[3&V++]):J<55296||J>=57344?(Z[V>>>2]|=(224|J>>>12)<<d[3&V++],Z[V>>>2]|=(128|J>>>6&63)<<d[3&V++],Z[V>>>2]|=(128|63&J)<<d[3&V++]):(J=65536+((1023&J)<<10|1023&O.charCodeAt(++N)),Z[V>>>2]|=(240|J>>>18)<<d[3&V++],Z[V>>>2]|=(128|J>>>12&63)<<d[3&V++],Z[V>>>2]|=(128|J>>>6&63)<<d[3&V++],Z[V>>>2]|=(128|63&J)<<d[3&V++]);this.lastByteIndex=V,this.bytes+=V-this.start,V>=64?(this.block=Z[16],this.start=V-64,this.hash(),this.hashed=!0):this.start=V}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},F.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var O=this.blocks,j=this.lastByteIndex;O[16]=this.block,O[j>>>2]|=m[3&j],this.block=O[16],j>=56&&(this.hashed||this.hash(),O[0]=this.block,O[16]=O[1]=O[2]=O[3]=O[4]=O[5]=O[6]=O[7]=O[8]=O[9]=O[10]=O[11]=O[12]=O[13]=O[14]=O[15]=0),O[14]=this.hBytes<<3|this.bytes>>>29,O[15]=this.bytes<<3,this.hash()}},F.prototype.hash=function(){var O,j,Y,J,V,N,K,Z,ge,he=this.h0,H=this.h1,q=this.h2,re=this.h3,ye=this.h4,Ee=this.h5,R=this.h6,U=this.h7,te=this.blocks;for(O=16;O<64;++O)j=((V=te[O-15])>>>7|V<<25)^(V>>>18|V<<14)^V>>>3,Y=((V=te[O-2])>>>17|V<<15)^(V>>>19|V<<13)^V>>>10,te[O]=te[O-16]+j+te[O-7]+Y|0;for(ge=H&q,O=0;O<64;O+=4)this.first?(this.is224?(N=300032,U=(V=te[0]-1413257819)-150054599|0,re=V+24177077|0):(N=704751109,U=(V=te[0]-210244248)-1521486534|0,re=V+143694565|0),this.first=!1):(j=(he>>>2|he<<30)^(he>>>13|he<<19)^(he>>>22|he<<10),J=(N=he&H)^he&q^ge,U=re+(V=U+(Y=(ye>>>6|ye<<26)^(ye>>>11|ye<<21)^(ye>>>25|ye<<7))+(ye&Ee^~ye&R)+y[O]+te[O])|0,re=V+(j+J)|0),j=(re>>>2|re<<30)^(re>>>13|re<<19)^(re>>>22|re<<10),J=(K=re&he)^re&H^N,R=q+(V=R+(Y=(U>>>6|U<<26)^(U>>>11|U<<21)^(U>>>25|U<<7))+(U&ye^~U&Ee)+y[O+1]+te[O+1])|0,j=((q=V+(j+J)|0)>>>2|q<<30)^(q>>>13|q<<19)^(q>>>22|q<<10),J=(Z=q&re)^q&he^K,Ee=H+(V=Ee+(Y=(R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7))+(R&U^~R&ye)+y[O+2]+te[O+2])|0,j=((H=V+(j+J)|0)>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),J=(ge=H&q)^H&re^Z,ye=he+(V=ye+(Y=(Ee>>>6|Ee<<26)^(Ee>>>11|Ee<<21)^(Ee>>>25|Ee<<7))+(Ee&R^~Ee&U)+y[O+3]+te[O+3])|0,he=V+(j+J)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+he|0,this.h1=this.h1+H|0,this.h2=this.h2+q|0,this.h3=this.h3+re|0,this.h4=this.h4+ye|0,this.h5=this.h5+Ee|0,this.h6=this.h6+R|0,this.h7=this.h7+U|0},F.prototype.hex=function(){this.finalize();var O=this.h0,j=this.h1,Y=this.h2,J=this.h3,V=this.h4,N=this.h5,K=this.h6,Z=this.h7,ge=f[O>>>28&15]+f[O>>>24&15]+f[O>>>20&15]+f[O>>>16&15]+f[O>>>12&15]+f[O>>>8&15]+f[O>>>4&15]+f[15&O]+f[j>>>28&15]+f[j>>>24&15]+f[j>>>20&15]+f[j>>>16&15]+f[j>>>12&15]+f[j>>>8&15]+f[j>>>4&15]+f[15&j]+f[Y>>>28&15]+f[Y>>>24&15]+f[Y>>>20&15]+f[Y>>>16&15]+f[Y>>>12&15]+f[Y>>>8&15]+f[Y>>>4&15]+f[15&Y]+f[J>>>28&15]+f[J>>>24&15]+f[J>>>20&15]+f[J>>>16&15]+f[J>>>12&15]+f[J>>>8&15]+f[J>>>4&15]+f[15&J]+f[V>>>28&15]+f[V>>>24&15]+f[V>>>20&15]+f[V>>>16&15]+f[V>>>12&15]+f[V>>>8&15]+f[V>>>4&15]+f[15&V]+f[N>>>28&15]+f[N>>>24&15]+f[N>>>20&15]+f[N>>>16&15]+f[N>>>12&15]+f[N>>>8&15]+f[N>>>4&15]+f[15&N]+f[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||(ge+=f[Z>>>28&15]+f[Z>>>24&15]+f[Z>>>20&15]+f[Z>>>16&15]+f[Z>>>12&15]+f[Z>>>8&15]+f[Z>>>4&15]+f[15&Z]),ge},F.prototype.toString=F.prototype.hex,F.prototype.digest=function(){this.finalize();var O=this.h0,j=this.h1,Y=this.h2,J=this.h3,V=this.h4,N=this.h5,K=this.h6,Z=this.h7,ge=[O>>>24&255,O>>>16&255,O>>>8&255,255&O,j>>>24&255,j>>>16&255,j>>>8&255,255&j,Y>>>24&255,Y>>>16&255,Y>>>8&255,255&Y,J>>>24&255,J>>>16&255,J>>>8&255,255&J,V>>>24&255,V>>>16&255,V>>>8&255,255&V,N>>>24&255,N>>>16&255,N>>>8&255,255&N,K>>>24&255,K>>>16&255,K>>>8&255,255&K];return this.is224||ge.push(Z>>>24&255,Z>>>16&255,Z>>>8&255,255&Z),ge},F.prototype.array=F.prototype.digest,F.prototype.arrayBuffer=function(){this.finalize();var O=new ArrayBuffer(this.is224?28:32),j=new DataView(O);return j.setUint32(0,this.h0),j.setUint32(4,this.h1),j.setUint32(8,this.h2),j.setUint32(12,this.h3),j.setUint32(16,this.h4),j.setUint32(20,this.h5),j.setUint32(24,this.h6),this.is224||j.setUint32(28,this.h7),O},G.prototype=new F,G.prototype.finalize=function(){if(F.prototype.finalize.call(this),this.inner){this.inner=!1;var O=this.array();F.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(O),F.prototype.finalize.call(this)}};var se=C();se.sha256=se,se.sha224=C(!0),se.sha256.hmac=M(),se.sha224.hmac=M(!0),u?dh.exports=se:(r.sha256=se.sha256,r.sha224=se.sha224)})();Hu.exports;Hu.exports.sha224;var g0=Hu.exports.sha256;function Wh(e){return e2(e)}function X_(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 K_(e){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(e)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(e)}function Q_(e){return X_(e)?"hex":K_(e)?"b64":""}function Z_(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 W_(e){e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/");const n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))}function e2(e){switch(Q_(e)){case"hex":return Z_(e);case"b64":return W_(e)}return null}function t2(e,n){const r=typeof e=="string"?Wh(e):e,a=typeof n=="string"?Wh(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 rx{constructor(n,r,a=!0){k(this,"token");k(this,"received");k(this,"ctx");k(this,"requestSubject");k(this,"mux");this.mux=n,this.requestSubject=r,this.received=0,this.token=Ui.next(),a&&(this.ctx=new Error)}}class n2 extends rx{constructor(r,a,l={maxWait:1e3}){super(r,a);k(this,"callback");k(this,"done");k(this,"timer");k(this,"max");k(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=Rt(),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===dr.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===dr.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===dr.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class ix extends rx{constructor(r,a,l={timeout:1e3},u=!0){super(r,a,u);k(this,"deferred");k(this,"timer");this.deferred=Rt(),this.timer=os(l.timeout,u)}resolver(r,a){this.timer&&this.timer.cancel(),r?(this.ctx&&(r.stack+=`
|
|
69
|
+
|
|
70
|
+
${this.ctx.stack}`),this.deferred.reject(r)):this.deferred.resolve(a),this.cancel()}cancel(r){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(r||Ne.errorForCode(ke.Cancelled))}}const r2="$JS.API";function i2(e){return e=e||{},e.domain&&(e.apiPrefix=`$JS.${e.domain}.API`,delete e.domain),Bu({apiPrefix:r2,timeout:5e3},e)}class Bl{constructor(n,r){k(this,"nc");k(this,"opts");k(this,"prefix");k(this,"timeout");k(this,"jc");this.nc=n,this.opts=i2(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=mr()}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=In;r&&(l=this.jc.encode(r));let{retries:u}=a;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=Ad();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===ke.Timeout)&&f+1<u)await ps(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=nx(a.error.code,a.error.description);if(l!==null)throw l.api_error=a.error,l}return r}}class xl{constructor(n,r,a,l){k(this,"err");k(this,"offset");k(this,"pageInfo");k(this,"subject");k(this,"jsm");k(this,"filter");k(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 ua(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 ed(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 st;(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"})(st||(st={}));class a2{constructor(n){k(this,"server");k(this,"features");k(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=ua(n)),this.server=n,this.set(st.JS_KV,"2.6.2"),this.set(st.JS_OBJECTSTORE,"2.6.3"),this.set(st.JS_PULL_MAX_BYTES,"2.8.3"),this.set(st.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(st.JS_ALLOW_DIRECT,"2.9.0"),this.set(st.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(st.JS_SIMPLIFICATION,"2.9.4"),this.set(st.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(st.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(st.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(st.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(st.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(st.JS_STREAM_COMPRESSION,"2.10.0"),this.set(st.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(st.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:ed(this.server,ua(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=ua(n)),ed(this.server,n)>=0}}class Cu extends Bl{constructor(n,r){super(n,r)}async add(n,r,a=ku.Create){if(fn(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&&rs(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(st.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{Pu("name",m)}catch(b){const v=b.message,C=v.indexOf("cannot contain");throw C!==-1?new Error(`consumer 'name' ${v.substring(C)}`):b}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:b,ok:v}=u.features.get(st.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${b}`);f=!1}if(r.metadata){const{min:b,ok:v}=u.features.get(st.JS_STREAM_CONSUMER_METADATA);if(!v)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),ku.Update)}async info(n,r){return fn(n),rs(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return fn(n),rs(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){fn(n);const r=l=>l.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new xl(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 Ja(e,n,r=!1){if(r===!0&&!e)throw Ne.errorForCode(ke.ApiError,new Error(`${n} is not a function`));if(e&&typeof e!="function")throw Ne.errorForCode(ke.ApiError,new Error(`${n} is not a function`))}class s2 extends en{constructor(r,a,l){super();k(this,"sub");k(this,"adapter");k(this,"subIterDone");Ja(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&Ja(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(Ja(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(Ja(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(Ja(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&Ja(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,b)=>{const[v,C]=this.adapter(g,b);if(v){y(v,null);return}const{ingest:z}=this.ingestionFilterFn?this.ingestionFilterFn(C,this):{ingest:!0};z&&(!this.protocolFilterFn||this.protocolFilterFn(C))&&(y(v,C),this.dispatchedFn&&C&&this.dispatchedFn(C))}}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=Rt(),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 Hn;function l2(e){Hn=e}function ax(){return Hn!==void 0&&Hn.defaultPort!==void 0?Hn.defaultPort:4222}function mh(){return Hn!==void 0&&Hn.urlParseFn?Hn.urlParseFn:void 0}function o2(){if(!Hn||typeof Hn.factory!="function")throw new Error("transport fn is not set");return Hn.factory()}function td(){return Hn!==void 0&&Hn.dnsResolveFn?Hn.dnsResolveFn:void 0}const gu=`\r
|
|
71
|
+
`,Au=cs.fromAscii(gu),u2=new Uint8Array(Au)[0],c2=new Uint8Array(Au)[1];function f2(e){for(let n=0;n<e.length;n++){const r=n+1;if(e.byteLength>r&&e[n]===u2&&e[r]===c2)return r+1}return 0}function h2(e){const n=f2(e);if(n>0){const a=new Uint8Array(e).slice(0,n);return Pn.decode(a)}return""}const d2=4,sx=48,m2=65,p2=97;function g2(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 nd(e){return y2(e)!==void 0}function y2(e){for(let n=0;n<e.length;n++)switch(e[n]){case".":return lx(e);case":":return b2(e)}}function lx(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}=x2(e);if(!u||a>255)return;e=e.substring(l),n[r]=a}return g2(n[0],n[1],n[2],n[3])}function b2(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}=v2(e);if(!c||l>65535)return;if(u<e.length&&e[u]==="."){if(r<0&&a!=12||a+4>16)return;const f=lx(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+=d2;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 x2(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)-sx),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 v2(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)-sx;else if(97<=e.charCodeAt(r)&&e.charCodeAt(r)<=102)n*=16,n+=e.charCodeAt(r)-p2+10;else if(65<=e.charCodeAt(r)&&e.charCodeAt(r)<=70)n*=16,n+=e.charCodeAt(r)-m2+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 w2(e){return e.indexOf("[")!==-1||e.indexOf("::")!==-1?!1:e.indexOf(".")!==-1||e.split(":").length<=2}function rd(e){return!w2(e)}function S2(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 _2(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,"$2")),e=S2(e),rd(e)&&e.indexOf("[")===-1&&(e=`[${e}]`);const n=rd(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 Sl{constructor(n,r=!1){k(this,"src");k(this,"listen");k(this,"hostname");k(this,"port");k(this,"didConnect");k(this,"reconnects");k(this,"lastConnect");k(this,"gossiped");k(this,"tlsName");k(this,"resolves");this.src=n,this.tlsName="";const a=_2(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(nd(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}://${rd(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new Sl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&ex(r),this.resolves=r,r}}class E2{constructor(n=[],r={}){k(this,"firstSelect");k(this,"servers");k(this,"currentServer");k(this,"tlsName");k(this,"randomize");this.firstSelect=!0,this.servers=[],this.tlsName="",this.randomize=r.randomize||!1;const a=mh();n&&(n.forEach(l=>{l=a?a(l):l,this.servers.push(new Sl(l))}),this.randomize&&(this.servers=ex(this.servers))),this.servers.length===0&&this.addServer(`${Jh}:${ax()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();nd(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=mh();n=a?a(n):n;const l=new Sl(n,r);nd(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=mh(),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 Sl(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 k2{constructor(){k(this,"baseInbox");k(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${Qr(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=tx(r)),l.resolver(n,r))}}}close(){const n=Ne.errorForCode(ke.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class C2{constructor(n,r,a){k(this,"ph");k(this,"interval");k(this,"maxOut");k(this,"timer");k(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:ns.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=Rt();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 A2 extends Error{constructor(n){super(n),this.name="AssertionError"}}function T2(e,n="Assertion failed."){if(!e)throw new A2(n)}const y0=32*1024,ph=2**32-2;function au(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 gh{constructor(n){k(this,"_buf");k(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){T2(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=au(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 au(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)au(this._buf.subarray(this._off),this._buf);else{if(l+n>ph)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,ph));au(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,ph)),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(y0);for(;;){const l=this.capacity-this.length<y0,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 hn;(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"})(hn||(hn={}));function b0(){const e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}const j2=48;class x0{constructor(n){k(this,"dispatcher");k(this,"state");k(this,"as");k(this,"drop");k(this,"hdr");k(this,"ma");k(this,"argBuf");k(this,"msgBuf");this.dispatcher=n,this.state=Ae.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(n){let r;for(r=0;r<n.length;r++){const a=n[r];switch(this.state){case Ae.OP_START:switch(a){case Te.M:case Te.m:this.state=Ae.OP_M,this.hdr=-1,this.ma=b0();break;case Te.H:case Te.h:this.state=Ae.OP_H,this.hdr=0,this.ma=b0();break;case Te.P:case Te.p:this.state=Ae.OP_P;break;case Te.PLUS:this.state=Ae.OP_PLUS;break;case Te.MINUS:this.state=Ae.OP_MINUS;break;case Te.I:case Te.i:this.state=Ae.OP_I;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_H:switch(a){case Te.M:case Te.m:this.state=Ae.OP_M;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_M:switch(a){case Te.S:case Te.s:this.state=Ae.OP_MS;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MS:switch(a){case Te.G:case Te.g:this.state=Ae.OP_MSG;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MSG:switch(a){case Te.SPACE:case Te.TAB:this.state=Ae.OP_MSG_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MSG_SPC:switch(a){case Te.SPACE:case Te.TAB:continue;default:this.state=Ae.MSG_ARG,this.as=r}break;case Ae.MSG_ARG:switch(a){case Te.CR:this.drop=1;break;case Te.NL:{const l=this.argBuf?this.argBuf.bytes():n.subarray(this.as,r-this.drop);this.processMsgArgs(l),this.drop=0,this.as=r+1,this.state=Ae.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case Ae.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:hn.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ae.MSG_END}else{let l=this.ma.size-this.msgBuf.length;const u=n.length-r;u<l&&(l=u),l>0?(this.msgBuf.write(n.subarray(r,r+l)),r=r+l-1):this.msgBuf.writeByte(a)}else r-this.as>=this.ma.size&&(this.dispatcher.push({kind:hn.MSG,msg:this.ma,data:n.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ae.MSG_END);break;case Ae.MSG_END:switch(a){case Te.NL:this.drop=0,this.as=r+1,this.state=Ae.OP_START;break;default:continue}break;case Ae.OP_PLUS:switch(a){case Te.O:case Te.o:this.state=Ae.OP_PLUS_O;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PLUS_O:switch(a){case Te.K:case Te.k:this.state=Ae.OP_PLUS_OK;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PLUS_OK:switch(a){case Te.NL:this.dispatcher.push({kind:hn.OK}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_MINUS:switch(a){case Te.E:case Te.e:this.state=Ae.OP_MINUS_E;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_E:switch(a){case Te.R:case Te.r:this.state=Ae.OP_MINUS_ER;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ER:switch(a){case Te.R:case Te.r:this.state=Ae.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ERR:switch(a){case Te.SPACE:case Te.TAB:this.state=Ae.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_MINUS_ERR_SPC:switch(a){case Te.SPACE:case Te.TAB:continue;default:this.state=Ae.MINUS_ERR_ARG,this.as=r}break;case Ae.MINUS_ERR_ARG:switch(a){case Te.CR:this.drop=1;break;case Te.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:hn.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Ae.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case Ae.OP_P:switch(a){case Te.I:case Te.i:this.state=Ae.OP_PI;break;case Te.O:case Te.o:this.state=Ae.OP_PO;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PO:switch(a){case Te.N:case Te.n:this.state=Ae.OP_PON;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PON:switch(a){case Te.G:case Te.g:this.state=Ae.OP_PONG;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PONG:switch(a){case Te.NL:this.dispatcher.push({kind:hn.PONG}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_PI:switch(a){case Te.N:case Te.n:this.state=Ae.OP_PIN;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PIN:switch(a){case Te.G:case Te.g:this.state=Ae.OP_PING;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_PING:switch(a){case Te.NL:this.dispatcher.push({kind:hn.PING}),this.drop=0,this.state=Ae.OP_START;break}break;case Ae.OP_I:switch(a){case Te.N:case Te.n:this.state=Ae.OP_IN;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_IN:switch(a){case Te.F:case Te.f:this.state=Ae.OP_INF;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INF:switch(a){case Te.O:case Te.o:this.state=Ae.OP_INFO;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INFO:switch(a){case Te.SPACE:case Te.TAB:this.state=Ae.OP_INFO_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ae.OP_INFO_SPC:switch(a){case Te.SPACE:case Te.TAB:continue;default:this.state=Ae.INFO_ARG,this.as=r}break;case Ae.INFO_ARG:switch(a){case Te.CR:this.drop=1;break;case Te.NL:{let l;this.argBuf?(l=this.argBuf.bytes(),this.argBuf=void 0):l=n.subarray(this.as,r-this.drop),this.dispatcher.push({kind:hn.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Ae.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(r))}}(this.state===Ae.MSG_ARG||this.state===Ae.MINUS_ERR_ARG||this.state===Ae.INFO_ARG)&&!this.argBuf&&(this.argBuf=new gh(n.subarray(this.as,r-this.drop))),this.state===Ae.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new gh(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 gh(a),this.ma.subject=a.subarray(0,n),this.ma.reply&&(this.ma.reply=a.subarray(n))}processMsgArgs(n){if(this.hdr>=0)return this.processHeaderMsgArgs(n);const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Te.SPACE:case Te.TAB:case Te.CR:case Te.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),r.length){case 3:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(r[2]);break;case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.size=this.protoParseInt(r[3]);break;default:throw this.fail(n,"processMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processMsgArgs Bad or Missing Sid Error");if(this.ma.size<0)throw this.fail(n,"processMsgArgs Bad or Missing Size Error")}fail(n,r=""){return r?r=`${r} [${this.state}]`:r=`parse error [${this.state}]`,new Error(`${r}: ${Pn.decode(n)}`)}processHeaderMsgArgs(n){const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case Te.SPACE:case Te.TAB:case Te.CR:case Te.NL:a>=0&&(r.push(n.subarray(a,l)),a=-1);break;default:a<0&&(a=l)}switch(a>=0&&r.push(n.subarray(a)),r.length){case 4:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(r[2]),this.ma.size=this.protoParseInt(r[3]);break;case 5:this.ma.subject=r[0],this.ma.sid=this.protoParseInt(r[1]),this.ma.reply=r[2],this.ma.hdr=this.protoParseInt(r[3]),this.ma.size=this.protoParseInt(r[4]);break;default:throw this.fail(n,"processHeaderMsgArgs Parse Error")}if(this.ma.sid<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Sid Error");if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Header Size Error");if(this.ma.size<0)throw this.fail(n,"processHeaderMsgArgs Bad or Missing Size Error")}protoParseInt(n){if(n.length===0)return-1;let r=0;for(let a=0;a<n.length;a++){if(n[a]<48||n[a]>57)return-1;r=r*10+(n[a]-j2)}return r}}var Ae;(function(e){e[e.OP_START=0]="OP_START",e[e.OP_PLUS=1]="OP_PLUS",e[e.OP_PLUS_O=2]="OP_PLUS_O",e[e.OP_PLUS_OK=3]="OP_PLUS_OK",e[e.OP_MINUS=4]="OP_MINUS",e[e.OP_MINUS_E=5]="OP_MINUS_E",e[e.OP_MINUS_ER=6]="OP_MINUS_ER",e[e.OP_MINUS_ERR=7]="OP_MINUS_ERR",e[e.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",e[e.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",e[e.OP_M=10]="OP_M",e[e.OP_MS=11]="OP_MS",e[e.OP_MSG=12]="OP_MSG",e[e.OP_MSG_SPC=13]="OP_MSG_SPC",e[e.MSG_ARG=14]="MSG_ARG",e[e.MSG_PAYLOAD=15]="MSG_PAYLOAD",e[e.MSG_END=16]="MSG_END",e[e.OP_H=17]="OP_H",e[e.OP_P=18]="OP_P",e[e.OP_PI=19]="OP_PI",e[e.OP_PIN=20]="OP_PIN",e[e.OP_PING=21]="OP_PING",e[e.OP_PO=22]="OP_PO",e[e.OP_PON=23]="OP_PON",e[e.OP_PONG=24]="OP_PONG",e[e.OP_I=25]="OP_I",e[e.OP_IN=26]="OP_IN",e[e.OP_INF=27]="OP_INF",e[e.OP_INFO=28]="OP_INFO",e[e.OP_INFO_SPC=29]="OP_INFO_SPC",e[e.INFO_ARG=30]="INFO_ARG"})(Ae||(Ae={}));var Te;(function(e){e[e.CR=13]="CR",e[e.E=69]="E",e[e.e=101]="e",e[e.F=70]="F",e[e.f=102]="f",e[e.G=71]="G",e[e.g=103]="g",e[e.H=72]="H",e[e.h=104]="h",e[e.I=73]="I",e[e.i=105]="i",e[e.K=75]="K",e[e.k=107]="k",e[e.M=77]="M",e[e.m=109]="m",e[e.MINUS=45]="MINUS",e[e.N=78]="N",e[e.n=110]="n",e[e.NL=10]="NL",e[e.O=79]="O",e[e.o=111]="o",e[e.P=80]="P",e[e.p=112]="p",e[e.PLUS=43]="PLUS",e[e.R=82]="R",e[e.r=114]="r",e[e.S=83]="S",e[e.s=115]="s",e[e.SPACE=32]="SPACE",e[e.TAB=9]="TAB"})(Te||(Te={}));(function(e){var n=function(_,T){this.hi=_|0,this.lo=T|0},r=function(_){var T,A=new Float64Array(16);if(_)for(T=0;T<_.length;T++)A[T]=_[T];return A},a=function(){throw new Error("no PRNG")},l=new Uint8Array(16),u=new Uint8Array(32);u[0]=9;var c=r(),f=r([1]),m=r([56129,1]),d=r([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=r([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=r([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),b=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function C(_,T){return _<<T|_>>>32-T}function z(_,T){var A=_[T+3]&255;return A=A<<8|_[T+2]&255,A=A<<8|_[T+1]&255,A<<8|_[T+0]&255}function B(_,T){var A=_[T]<<24|_[T+1]<<16|_[T+2]<<8|_[T+3],D=_[T+4]<<24|_[T+5]<<16|_[T+6]<<8|_[T+7];return new n(A,D)}function M(_,T,A){var D;for(D=0;D<4;D++)_[T+D]=A&255,A>>>=8}function F(_,T,A){_[T]=A.hi>>24&255,_[T+1]=A.hi>>16&255,_[T+2]=A.hi>>8&255,_[T+3]=A.hi&255,_[T+4]=A.lo>>24&255,_[T+5]=A.lo>>16&255,_[T+6]=A.lo>>8&255,_[T+7]=A.lo&255}function G(_,T,A,D,I){var Q,de=0;for(Q=0;Q<I;Q++)de|=_[T+Q]^A[D+Q];return(1&de-1>>>8)-1}function se(_,T,A,D){return G(_,T,A,D,16)}function O(_,T,A,D){return G(_,T,A,D,32)}function j(_,T,A,D,I){var Q=new Uint32Array(16),de=new Uint32Array(16),be=new Uint32Array(16),ie=new Uint32Array(4),fe,Oe,Qe;for(fe=0;fe<4;fe++)de[5*fe]=z(D,4*fe),de[1+fe]=z(A,4*fe),de[6+fe]=z(T,4*fe),de[11+fe]=z(A,16+4*fe);for(fe=0;fe<16;fe++)be[fe]=de[fe];for(fe=0;fe<20;fe++){for(Oe=0;Oe<4;Oe++){for(Qe=0;Qe<4;Qe++)ie[Qe]=de[(5*Oe+4*Qe)%16];for(ie[1]^=C(ie[0]+ie[3]|0,7),ie[2]^=C(ie[1]+ie[0]|0,9),ie[3]^=C(ie[2]+ie[1]|0,13),ie[0]^=C(ie[3]+ie[2]|0,18),Qe=0;Qe<4;Qe++)Q[4*Oe+(Oe+Qe)%4]=ie[Qe]}for(Qe=0;Qe<16;Qe++)de[Qe]=Q[Qe]}if(I){for(fe=0;fe<16;fe++)de[fe]=de[fe]+be[fe]|0;for(fe=0;fe<4;fe++)de[5*fe]=de[5*fe]-z(D,4*fe)|0,de[6+fe]=de[6+fe]-z(T,4*fe)|0;for(fe=0;fe<4;fe++)M(_,4*fe,de[5*fe]),M(_,16+4*fe,de[6+fe])}else for(fe=0;fe<16;fe++)M(_,4*fe,de[fe]+be[fe]|0)}function Y(_,T,A,D){return j(_,T,A,D,!1),0}function J(_,T,A,D){return j(_,T,A,D,!0),0}var V=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function N(_,T,A,D,I,Q,de){var be=new Uint8Array(16),ie=new Uint8Array(64),fe,Oe;if(!I)return 0;for(Oe=0;Oe<16;Oe++)be[Oe]=0;for(Oe=0;Oe<8;Oe++)be[Oe]=Q[Oe];for(;I>=64;){for(Y(ie,be,de,V),Oe=0;Oe<64;Oe++)_[T+Oe]=(A?A[D+Oe]:0)^ie[Oe];for(fe=1,Oe=8;Oe<16;Oe++)fe=fe+(be[Oe]&255)|0,be[Oe]=fe&255,fe>>>=8;I-=64,T+=64,A&&(D+=64)}if(I>0)for(Y(ie,be,de,V),Oe=0;Oe<I;Oe++)_[T+Oe]=(A?A[D+Oe]:0)^ie[Oe];return 0}function K(_,T,A,D,I){return N(_,T,null,0,A,D,I)}function Z(_,T,A,D,I){var Q=new Uint8Array(32);return J(Q,D,I,V),K(_,T,A,D.subarray(16),Q)}function ge(_,T,A,D,I,Q,de){var be=new Uint8Array(32);return J(be,Q,de,V),N(_,T,A,D,I,Q.subarray(16),be)}function he(_,T){var A,D=0;for(A=0;A<17;A++)D=D+(_[A]+T[A]|0)|0,_[A]=D&255,D>>>=8}var H=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function q(_,T,A,D,I,Q){var de,be,ie,fe,Oe=new Uint32Array(17),Qe=new Uint32Array(17),Ct=new Uint32Array(17),sn=new Uint32Array(17),or=new Uint32Array(17);for(ie=0;ie<17;ie++)Qe[ie]=Ct[ie]=0;for(ie=0;ie<16;ie++)Qe[ie]=Q[ie];for(Qe[3]&=15,Qe[4]&=252,Qe[7]&=15,Qe[8]&=252,Qe[11]&=15,Qe[12]&=252,Qe[15]&=15;I>0;){for(ie=0;ie<17;ie++)sn[ie]=0;for(ie=0;ie<16&&ie<I;++ie)sn[ie]=A[D+ie];for(sn[ie]=1,D+=ie,I-=ie,he(Ct,sn),be=0;be<17;be++)for(Oe[be]=0,ie=0;ie<17;ie++)Oe[be]=Oe[be]+Ct[ie]*(ie<=be?Qe[be-ie]:320*Qe[be+17-ie]|0)|0|0;for(be=0;be<17;be++)Ct[be]=Oe[be];for(fe=0,ie=0;ie<16;ie++)fe=fe+Ct[ie]|0,Ct[ie]=fe&255,fe>>>=8;for(fe=fe+Ct[16]|0,Ct[16]=fe&3,fe=5*(fe>>>2)|0,ie=0;ie<16;ie++)fe=fe+Ct[ie]|0,Ct[ie]=fe&255,fe>>>=8;fe=fe+Ct[16]|0,Ct[16]=fe}for(ie=0;ie<17;ie++)or[ie]=Ct[ie];for(he(Ct,H),de=-(Ct[16]>>>7)|0,ie=0;ie<17;ie++)Ct[ie]^=de&(or[ie]^Ct[ie]);for(ie=0;ie<16;ie++)sn[ie]=Q[ie+16];for(sn[16]=0,he(Ct,sn),ie=0;ie<16;ie++)_[T+ie]=Ct[ie];return 0}function re(_,T,A,D,I,Q){var de=new Uint8Array(16);return q(de,0,A,D,I,Q),se(_,T,de,0)}function ye(_,T,A,D,I){var Q;if(A<32)return-1;for(ge(_,0,T,0,A,D,I),q(_,16,_,32,A-32,_),Q=0;Q<16;Q++)_[Q]=0;return 0}function Ee(_,T,A,D,I){var Q,de=new Uint8Array(32);if(A<32||(Z(de,0,32,D,I),re(T,16,T,32,A-32,de)!==0))return-1;for(ge(_,0,T,0,A,D,I),Q=0;Q<32;Q++)_[Q]=0;return 0}function R(_,T){var A;for(A=0;A<16;A++)_[A]=T[A]|0}function U(_){var T,A;for(A=0;A<16;A++)_[A]+=65536,T=Math.floor(_[A]/65536),_[(A+1)*(A<15?1:0)]+=T-1+37*(T-1)*(A===15?1:0),_[A]-=T*65536}function te(_,T,A){for(var D,I=~(A-1),Q=0;Q<16;Q++)D=I&(_[Q]^T[Q]),_[Q]^=D,T[Q]^=D}function E(_,T){var A,D,I,Q=r(),de=r();for(A=0;A<16;A++)de[A]=T[A];for(U(de),U(de),U(de),D=0;D<2;D++){for(Q[0]=de[0]-65517,A=1;A<15;A++)Q[A]=de[A]-65535-(Q[A-1]>>16&1),Q[A-1]&=65535;Q[15]=de[15]-32767-(Q[14]>>16&1),I=Q[15]>>16&1,Q[14]&=65535,te(de,Q,1-I)}for(A=0;A<16;A++)_[2*A]=de[A]&255,_[2*A+1]=de[A]>>8}function ue(_,T){var A=new Uint8Array(32),D=new Uint8Array(32);return E(A,_),E(D,T),O(A,0,D,0)}function pe(_){var T=new Uint8Array(32);return E(T,_),T[0]&1}function ve(_,T){var A;for(A=0;A<16;A++)_[A]=T[2*A]+(T[2*A+1]<<8);_[15]&=32767}function je(_,T,A){var D;for(D=0;D<16;D++)_[D]=T[D]+A[D]|0}function De(_,T,A){var D;for(D=0;D<16;D++)_[D]=T[D]-A[D]|0}function Ce(_,T,A){var D,I,Q=new Float64Array(31);for(D=0;D<31;D++)Q[D]=0;for(D=0;D<16;D++)for(I=0;I<16;I++)Q[D+I]+=T[D]*A[I];for(D=0;D<15;D++)Q[D]+=38*Q[D+16];for(D=0;D<16;D++)_[D]=Q[D];U(_),U(_)}function ze(_,T){Ce(_,T,T)}function lt(_,T){var A=r(),D;for(D=0;D<16;D++)A[D]=T[D];for(D=253;D>=0;D--)ze(A,A),D!==2&&D!==4&&Ce(A,A,T);for(D=0;D<16;D++)_[D]=A[D]}function Fe(_,T){var A=r(),D;for(D=0;D<16;D++)A[D]=T[D];for(D=250;D>=0;D--)ze(A,A),D!==1&&Ce(A,A,T);for(D=0;D<16;D++)_[D]=A[D]}function qe(_,T,A){var D=new Uint8Array(32),I=new Float64Array(80),Q,de,be=r(),ie=r(),fe=r(),Oe=r(),Qe=r(),Ct=r();for(de=0;de<31;de++)D[de]=T[de];for(D[31]=T[31]&127|64,D[0]&=248,ve(I,A),de=0;de<16;de++)ie[de]=I[de],Oe[de]=be[de]=fe[de]=0;for(be[0]=Oe[0]=1,de=254;de>=0;--de)Q=D[de>>>3]>>>(de&7)&1,te(be,ie,Q),te(fe,Oe,Q),je(Qe,be,fe),De(be,be,fe),je(fe,ie,Oe),De(ie,ie,Oe),ze(Oe,Qe),ze(Ct,be),Ce(be,fe,be),Ce(fe,ie,Qe),je(Qe,be,fe),De(be,be,fe),ze(ie,be),De(fe,Oe,Ct),Ce(be,fe,m),je(be,be,Oe),Ce(fe,fe,be),Ce(be,Oe,Ct),Ce(Oe,ie,I),ze(ie,Qe),te(be,ie,Q),te(fe,Oe,Q);for(de=0;de<16;de++)I[de+16]=be[de],I[de+32]=fe[de],I[de+48]=ie[de],I[de+64]=Oe[de];var sn=I.subarray(32),or=I.subarray(16);return lt(sn,sn),Ce(or,or,sn),E(_,or),0}function Be(_,T){return qe(_,T,u)}function we(_,T){return a(T,32),Be(_,T)}function Le(_,T,A){var D=new Uint8Array(32);return qe(D,A,T),J(_,l,D,V)}var $e=ye,jt=Ee;function gn(_,T,A,D,I,Q){var de=new Uint8Array(32);return Le(de,I,Q),$e(_,T,A,D,de)}function ar(_,T,A,D,I,Q){var de=new Uint8Array(32);return Le(de,I,Q),jt(_,T,A,D,de)}function An(){var _=0,T=0,A=0,D=0,I=65535,Q,de,be;for(be=0;be<arguments.length;be++)Q=arguments[be].lo,de=arguments[be].hi,_+=Q&I,T+=Q>>>16,A+=de&I,D+=de>>>16;return T+=_>>>16,A+=T>>>16,D+=A>>>16,new n(A&I|D<<16,_&I|T<<16)}function ti(_,T){return new n(_.hi>>>T,_.lo>>>T|_.hi<<32-T)}function gr(){var _=0,T=0,A;for(A=0;A<arguments.length;A++)_^=arguments[A].lo,T^=arguments[A].hi;return new n(T,_)}function gt(_,T){var A,D,I=32-T;return T<32?(A=_.hi>>>T|_.lo<<I,D=_.lo>>>T|_.hi<<I):T<64&&(A=_.lo>>>T|_.hi<<I,D=_.hi>>>T|_.lo<<I),new n(A,D)}function ni(_,T,A){var D=_.hi&T.hi^~_.hi&A.hi,I=_.lo&T.lo^~_.lo&A.lo;return new n(D,I)}function le(_,T,A){var D=_.hi&T.hi^_.hi&A.hi^T.hi&A.hi,I=_.lo&T.lo^_.lo&A.lo^T.lo&A.lo;return new n(D,I)}function Se(_){return gr(gt(_,28),gt(_,34),gt(_,39))}function Pe(_){return gr(gt(_,14),gt(_,18),gt(_,41))}function Je(_){return gr(gt(_,1),gt(_,8),ti(_,7))}function it(_){return gr(gt(_,19),gt(_,61),ti(_,6))}var Kt=[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 yn(_,T,A){var D=[],I=[],Q=[],de=[],be,ie,fe;for(ie=0;ie<8;ie++)D[ie]=Q[ie]=B(_,8*ie);for(var Oe=0;A>=128;){for(ie=0;ie<16;ie++)de[ie]=B(T,8*ie+Oe);for(ie=0;ie<80;ie++){for(fe=0;fe<8;fe++)I[fe]=Q[fe];for(be=An(Q[7],Pe(Q[4]),ni(Q[4],Q[5],Q[6]),Kt[ie],de[ie%16]),I[7]=An(be,Se(Q[0]),le(Q[0],Q[1],Q[2])),I[3]=An(I[3],be),fe=0;fe<8;fe++)Q[(fe+1)%8]=I[fe];if(ie%16===15)for(fe=0;fe<16;fe++)de[fe]=An(de[fe],de[(fe+9)%16],Je(de[(fe+1)%16]),it(de[(fe+14)%16]))}for(ie=0;ie<8;ie++)Q[ie]=An(Q[ie],D[ie]),D[ie]=Q[ie];Oe+=128,A-=128}for(ie=0;ie<8;ie++)F(_,8*ie,D[ie]);return A}var It=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 ht(_,T,A){var D=new Uint8Array(64),I=new Uint8Array(256),Q,de=A;for(Q=0;Q<64;Q++)D[Q]=It[Q];for(yn(D,T,A),A%=128,Q=0;Q<256;Q++)I[Q]=0;for(Q=0;Q<A;Q++)I[Q]=T[de-A+Q];for(I[A]=128,A=256-128*(A<112?1:0),I[A-9]=0,F(I,A-8,new n(de/536870912|0,de<<3)),yn(D,I,A),Q=0;Q<64;Q++)_[Q]=D[Q];return 0}function Dt(_,T){var A=r(),D=r(),I=r(),Q=r(),de=r(),be=r(),ie=r(),fe=r(),Oe=r();De(A,_[1],_[0]),De(Oe,T[1],T[0]),Ce(A,A,Oe),je(D,_[0],_[1]),je(Oe,T[0],T[1]),Ce(D,D,Oe),Ce(I,_[3],T[3]),Ce(I,I,y),Ce(Q,_[2],T[2]),je(Q,Q,Q),De(de,D,A),De(be,Q,I),je(ie,Q,I),je(fe,D,A),Ce(_[0],de,be),Ce(_[1],fe,ie),Ce(_[2],ie,be),Ce(_[3],de,fe)}function xe(_,T,A){var D;for(D=0;D<4;D++)te(_[D],T[D],A)}function Ve(_,T){var A=r(),D=r(),I=r();lt(I,T[2]),Ce(A,T[0],I),Ce(D,T[1],I),E(_,D),_[31]^=pe(A)<<7}function ot(_,T,A){var D,I;for(R(_[0],c),R(_[1],f),R(_[2],f),R(_[3],c),I=255;I>=0;--I)D=A[I/8|0]>>(I&7)&1,xe(_,T,D),Dt(T,_),Dt(_,_),xe(_,T,D)}function Fn(_,T){var A=[r(),r(),r(),r()];R(A[0],g),R(A[1],b),R(A[2],f),Ce(A[3],g,b),ot(_,A,T)}function Bt(_,T,A){var D=new Uint8Array(64),I=[r(),r(),r(),r()],Q;for(A||a(T,32),ht(D,T,32),D[0]&=248,D[31]&=127,D[31]|=64,Fn(I,D),Ve(_,I),Q=0;Q<32;Q++)T[Q+32]=_[Q];return 0}var Nr=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(_,T){var A,D,I,Q;for(D=63;D>=32;--D){for(A=0,I=D-32,Q=D-12;I<Q;++I)T[I]+=A-16*T[D]*Nr[I-(D-32)],A=Math.floor((T[I]+128)/256),T[I]-=A*256;T[I]+=A,T[D]=0}for(A=0,I=0;I<32;I++)T[I]+=A-(T[31]>>4)*Nr[I],A=T[I]>>8,T[I]&=255;for(I=0;I<32;I++)T[I]-=A*Nr[I];for(D=0;D<32;D++)T[D+1]+=T[D]>>8,_[D]=T[D]&255}function sr(_){var T=new Float64Array(64),A;for(A=0;A<64;A++)T[A]=_[A];for(A=0;A<64;A++)_[A]=0;ri(_,T)}function qi(_,T,A,D){var I=new Uint8Array(64),Q=new Uint8Array(64),de=new Uint8Array(64),be,ie,fe=new Float64Array(64),Oe=[r(),r(),r(),r()];ht(I,D,32),I[0]&=248,I[31]&=127,I[31]|=64;var Qe=A+64;for(be=0;be<A;be++)_[64+be]=T[be];for(be=0;be<32;be++)_[32+be]=I[32+be];for(ht(de,_.subarray(32),A+32),sr(de),Fn(Oe,de),Ve(_,Oe),be=32;be<64;be++)_[be]=D[be];for(ht(Q,_,A+64),sr(Q),be=0;be<64;be++)fe[be]=0;for(be=0;be<32;be++)fe[be]=de[be];for(be=0;be<32;be++)for(ie=0;ie<32;ie++)fe[be+ie]+=Q[be]*I[ie];return ri(_.subarray(32),fe),Qe}function Ii(_,T){var A=r(),D=r(),I=r(),Q=r(),de=r(),be=r(),ie=r();return R(_[2],f),ve(_[1],T),ze(I,_[1]),Ce(Q,I,d),De(I,I,_[2]),je(Q,_[2],Q),ze(de,Q),ze(be,de),Ce(ie,be,de),Ce(A,ie,I),Ce(A,A,Q),Fe(A,A),Ce(A,A,I),Ce(A,A,Q),Ce(A,A,Q),Ce(_[0],A,Q),ze(D,_[0]),Ce(D,D,Q),ue(D,I)&&Ce(_[0],_[0],v),ze(D,_[0]),Ce(D,D,Q),ue(D,I)?-1:(pe(_[0])===T[31]>>7&&De(_[0],c,_[0]),Ce(_[3],_[0],_[1]),0)}function bs(_,T,A,D){var I,Q=new Uint8Array(32),de=new Uint8Array(64),be=[r(),r(),r(),r()],ie=[r(),r(),r(),r()];if(A<64||Ii(ie,D))return-1;for(I=0;I<A;I++)_[I]=T[I];for(I=0;I<32;I++)_[I+32]=D[I];if(ht(de,_,A),sr(de),ot(be,ie,de),Fn(ie,T.subarray(32)),Dt(be,ie),Ve(Q,be),A-=64,O(T,0,Q,0)){for(I=0;I<A;I++)_[I]=0;return-1}for(I=0;I<A;I++)_[I]=T[I+64];return A}var da=32,ii=24,lr=32,ai=16,si=32,Fi=32,li=32,Or=32,$i=32,xs=ii,Fl=lr,yr=ai,St=64,zt=32,Tn=64,Gi=32,vs=64;e.lowlevel={crypto_core_hsalsa20:J,crypto_stream_xor:ge,crypto_stream:Z,crypto_stream_salsa20_xor:N,crypto_stream_salsa20:K,crypto_onetimeauth:q,crypto_onetimeauth_verify:re,crypto_verify_16:se,crypto_verify_32:O,crypto_secretbox:ye,crypto_secretbox_open:Ee,crypto_scalarmult:qe,crypto_scalarmult_base:Be,crypto_box_beforenm:Le,crypto_box_afternm:$e,crypto_box:gn,crypto_box_open:ar,crypto_box_keypair:we,crypto_hash:ht,crypto_sign:qi,crypto_sign_keypair:Bt,crypto_sign_open:bs,crypto_secretbox_KEYBYTES:da,crypto_secretbox_NONCEBYTES:ii,crypto_secretbox_ZEROBYTES:lr,crypto_secretbox_BOXZEROBYTES:ai,crypto_scalarmult_BYTES:si,crypto_scalarmult_SCALARBYTES:Fi,crypto_box_PUBLICKEYBYTES:li,crypto_box_SECRETKEYBYTES:Or,crypto_box_BEFORENMBYTES:$i,crypto_box_NONCEBYTES:xs,crypto_box_ZEROBYTES:Fl,crypto_box_BOXZEROBYTES:yr,crypto_sign_BYTES:St,crypto_sign_PUBLICKEYBYTES:zt,crypto_sign_SECRETKEYBYTES:Tn,crypto_sign_SEEDBYTES:Gi,crypto_hash_BYTES:vs,gf:r,D:d,L:Nr,pack25519:E,unpack25519:ve,M:Ce,A:je,S:ze,Z:De,pow2523:Fe,add:Dt,set25519:R,modL:ri,scalarmult:ot,scalarbase:Fn};function $l(_,T){if(_.length!==da)throw new Error("bad key size");if(T.length!==ii)throw new Error("bad nonce size")}function Gl(_,T){if(_.length!==li)throw new Error("bad public key size");if(T.length!==Or)throw new Error("bad secret key size")}function Jt(){for(var _=0;_<arguments.length;_++)if(!(arguments[_]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ma(_){for(var T=0;T<_.length;T++)_[T]=0}e.randomBytes=function(_){var T=new Uint8Array(_);return a(T,_),T},e.secretbox=function(_,T,A){Jt(_,T,A),$l(A,T);for(var D=new Uint8Array(lr+_.length),I=new Uint8Array(D.length),Q=0;Q<_.length;Q++)D[Q+lr]=_[Q];return ye(I,D,D.length,T,A),I.subarray(ai)},e.secretbox.open=function(_,T,A){Jt(_,T,A),$l(A,T);for(var D=new Uint8Array(ai+_.length),I=new Uint8Array(D.length),Q=0;Q<_.length;Q++)D[Q+ai]=_[Q];return D.length<32||Ee(I,D,D.length,T,A)!==0?null:I.subarray(lr)},e.secretbox.keyLength=da,e.secretbox.nonceLength=ii,e.secretbox.overheadLength=ai,e.scalarMult=function(_,T){if(Jt(_,T),_.length!==Fi)throw new Error("bad n size");if(T.length!==si)throw new Error("bad p size");var A=new Uint8Array(si);return qe(A,_,T),A},e.scalarMult.base=function(_){if(Jt(_),_.length!==Fi)throw new Error("bad n size");var T=new Uint8Array(si);return Be(T,_),T},e.scalarMult.scalarLength=Fi,e.scalarMult.groupElementLength=si,e.box=function(_,T,A,D){var I=e.box.before(A,D);return e.secretbox(_,T,I)},e.box.before=function(_,T){Jt(_,T),Gl(_,T);var A=new Uint8Array($i);return Le(A,_,T),A},e.box.after=e.secretbox,e.box.open=function(_,T,A,D){var I=e.box.before(A,D);return e.secretbox.open(_,T,I)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var _=new Uint8Array(li),T=new Uint8Array(Or);return we(_,T),{publicKey:_,secretKey:T}},e.box.keyPair.fromSecretKey=function(_){if(Jt(_),_.length!==Or)throw new Error("bad secret key size");var T=new Uint8Array(li);return Be(T,_),{publicKey:T,secretKey:new Uint8Array(_)}},e.box.publicKeyLength=li,e.box.secretKeyLength=Or,e.box.sharedKeyLength=$i,e.box.nonceLength=xs,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(_,T){if(Jt(_,T),T.length!==Tn)throw new Error("bad secret key size");var A=new Uint8Array(St+_.length);return qi(A,_,_.length,T),A},e.sign.open=function(_,T){if(Jt(_,T),T.length!==zt)throw new Error("bad public key size");var A=new Uint8Array(_.length),D=bs(A,_,_.length,T);if(D<0)return null;for(var I=new Uint8Array(D),Q=0;Q<I.length;Q++)I[Q]=A[Q];return I},e.sign.detached=function(_,T){for(var A=e.sign(_,T),D=new Uint8Array(St),I=0;I<D.length;I++)D[I]=A[I];return D},e.sign.detached.verify=function(_,T,A){if(Jt(_,T,A),T.length!==St)throw new Error("bad signature size");if(A.length!==zt)throw new Error("bad public key size");var D=new Uint8Array(St+_.length),I=new Uint8Array(St+_.length),Q;for(Q=0;Q<St;Q++)D[Q]=T[Q];for(Q=0;Q<_.length;Q++)D[Q+St]=_[Q];return bs(I,D,D.length,A)>=0},e.sign.keyPair=function(){var _=new Uint8Array(zt),T=new Uint8Array(Tn);return Bt(_,T),{publicKey:_,secretKey:T}},e.sign.keyPair.fromSecretKey=function(_){if(Jt(_),_.length!==Tn)throw new Error("bad secret key size");for(var T=new Uint8Array(zt),A=0;A<T.length;A++)T[A]=_[32+A];return{publicKey:T,secretKey:new Uint8Array(_)}},e.sign.keyPair.fromSeed=function(_){if(Jt(_),_.length!==Gi)throw new Error("bad seed size");for(var T=new Uint8Array(zt),A=new Uint8Array(Tn),D=0;D<32;D++)A[D]=_[D];return Bt(T,A,!0),{publicKey:T,secretKey:A}},e.sign.publicKeyLength=zt,e.sign.secretKeyLength=Tn,e.sign.seedLength=Gi,e.sign.signatureLength=St,e.hash=function(_){Jt(_);var T=new Uint8Array(vs);return ht(T,_,_.length),T},e.hash.hashLength=vs,e.verify=function(_,T){return Jt(_,T),_.length===0||T.length===0||_.length!==T.length?!1:G(_,0,T,0,_.length)===0},e.setPRNG=function(_){a=_},(function(){var _=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(_&&_.getRandomValues){var T=65536;e.setPRNG(function(A,D){var I,Q=new Uint8Array(D);for(I=0;I<D;I+=T)_.getRandomValues(Q.subarray(I,I+Math.min(D-I,T)));for(I=0;I<D;I++)A[I]=Q[I];ma(Q)})}else typeof require<"u"&&(_=require("crypto"),_&&_.randomBytes&&e.setPRNG(function(A,D){var I,Q=_.randomBytes(D);for(I=0;I<D;I++)A[I]=Q[I];ma(Q)}))})()})(typeof module<"u"&&module.exports?module.exports:globalThis.nacl=globalThis.nacl||{});const su=typeof module<"u"&&module.exports?module.exports:globalThis.nacl,N2={fromSeed:su.sign.keyPair.fromSeed,sign:su.sign.detached,verify:su.sign.detached.verify,randomBytes:su.randomBytes};let ox;function O2(e){ox=e}function Ri(){return ox}const R2=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 Tu{static checksum(n){let r=0;for(let a=0;a<n.byteLength;a++){let l=n[a];r=r<<8&65535^R2[(r>>8^l)&255]}return r}static validate(n,r){return Tu.checksum(n)==r}}const yh="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";class v0{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++]=yh.charAt(m).charCodeAt(0),r-=5}if(r>0){let f=a<<5-r&31;u[c++]=yh.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=yh.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 wt extends Error{constructor(r,a){super(r);k(this,"name");k(this,"code");k(this,"chainedError");this.name="NKeysError",this.code=r,this.chainedError=a}}function M2(){return qu(vt.Operator)}function D2(){return qu(vt.Account)}function z2(){return qu(vt.User)}var dt;(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"})(dt||(dt={}));var vt;(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"})(vt||(vt={}));class ts{static isValidPublicPrefix(n){return n==vt.Server||n==vt.Operator||n==vt.Cluster||n==vt.Account||n==vt.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 vt.Seed:return vt.Seed;case vt.Private:return vt.Private;case vt.Operator:return vt.Operator;case vt.Server:return vt.Server;case vt.Cluster:return vt.Cluster;case vt.Account:return vt.Account;case vt.User:return vt.User;default:return-1}}}class dn{static encode(n,r){if(!r||!(r instanceof Uint8Array))throw new wt(dt.SerializationError);if(!ts.isValidPrefix(n))throw new wt(dt.InvalidPrefixByte);return dn._encode(!1,n,r)}static encodeSeed(n,r){if(!r)throw new wt(dt.ApiError);if(!ts.isValidPublicPrefix(n))throw new wt(dt.InvalidPrefixByte);if(r.byteLength!==32)throw new wt(dt.InvalidSeedLen);return dn._encode(!0,n,r)}static decode(n,r){if(!ts.isValidPrefix(n))throw new wt(dt.InvalidPrefixByte);const a=dn._decode(r);if(a[0]!==n)throw new wt(dt.InvalidPrefixByte);return a.slice(1)}static decodeSeed(n){const r=dn._decode(n),a=dn._decodePrefix(r);if(a[0]!=vt.Seed)throw new wt(dt.InvalidSeed);if(!ts.isValidPublicPrefix(a[1]))throw new wt(dt.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=dn._encodePrefix(vt.Seed,r);m.set(g)}else m[0]=r;m.set(a,l);const d=Tu.checksum(m.slice(0,f));return new DataView(m.buffer).setUint16(f,d,!0),v0.encode(m)}static _decode(n){if(n.byteLength<4)throw new wt(dt.InvalidEncoding);let r;try{r=v0.decode(n)}catch(f){throw new wt(dt.InvalidEncoding,f)}const a=r.byteLength-2,u=new DataView(r.buffer).getUint16(a,!0),c=r.slice(0,a);if(!Tu.validate(c,u))throw new wt(dt.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 ux{constructor(n){k(this,"seed");this.seed=n}getRawSeed(){if(!this.seed)throw new wt(dt.ClearedPair);return dn.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new wt(dt.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new wt(dt.ClearedPair);const n=dn.decodeSeed(this.seed),r=Ri().fromSeed(this.getRawSeed()),a=dn.encode(n.prefix,r.publicKey);return new TextDecoder().decode(a)}getPrivateKey(){if(!this.seed)throw new wt(dt.ClearedPair);const n=Ri().fromSeed(this.getRawSeed());return dn.encode(vt.Private,n.secretKey)}sign(n){if(!this.seed)throw new wt(dt.ClearedPair);const r=Ri().fromSeed(this.getRawSeed());return Ri().sign(n,r.secretKey)}verify(n,r){if(!this.seed)throw new wt(dt.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 qu(e){const n=Ri().randomBytes(32);let r=dn.encodeSeed(e,new Uint8Array(n));return new ux(r)}class L2{constructor(n){k(this,"publicKey");this.publicKey=n}getPublicKey(){if(!this.publicKey)throw new wt(dt.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new wt(dt.PublicKeyOnly):new wt(dt.ClearedPair)}getSeed(){throw this.publicKey?new wt(dt.PublicKeyOnly):new wt(dt.ClearedPair)}sign(n){throw this.publicKey?new wt(dt.CannotSign):new wt(dt.ClearedPair)}verify(n,r){if(!this.publicKey)throw new wt(dt.ClearedPair);let a=dn._decode(this.publicKey);return Ri().verify(n,r,a.slice(1))}clear(){this.publicKey&&(this.publicKey.fill(0),this.publicKey=void 0)}}function U2(e){const n=new TextEncoder().encode(e),r=dn._decode(n),a=ts.parsePrefix(r[0]);if(ts.isValidPublicPrefix(a))return new L2(n);throw new wt(dt.InvalidPublicKey)}function B2(e){return dn.decodeSeed(e),new ux(e)}function P2(e){return btoa(String.fromCharCode(...e))}function H2(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}O2(N2);const w0={createAccount:D2,createOperator:M2,createPair:qu,createUser:z2,fromPublic:U2,fromSeed:B2,NKeysError:wt,NKeysErrorCode:dt,Prefix:vt,decode:H2,encode:P2};function q2(e){return n=>{let r={};return e.forEach(a=>{const l=a(n)||{};r=Object.assign(r,l)}),r}}function I2(){return()=>{}}function F2(e,n){return()=>{const r=typeof e=="function"?e():e,a=typeof n=="function"?n():n;return{user:r,pass:a}}}function $2(e){return()=>({auth_token:typeof e=="function"?e():e})}function G2(e){return n=>{const r=typeof e=="function"?e():e,a=r?w0.fromSeed(r):void 0,l=a?a.getPublicKey():"",u=Pi.encode(n||""),c=a!==void 0&&n?a.sign(u):void 0,f=c?w0.encode(c):"";return{nkey:l,sig:f}}}function cx(e,n){return r=>{const a=typeof e=="function"?e():e,l=G2(n),{nkey:u,sig:c}=l(r);return{jwt:a,nkey:u,sig:c}}}const fx=120*1e3,V2=2,hx=2*1e3;function Y2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:fx,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:hx,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function J2(e){const n=[];return typeof e.authenticator=="function"&&n.push(e.authenticator),Array.isArray(e.authenticator)&&n.push(...e.authenticator),e.token&&n.push($2(e.token)),e.user&&n.push(F2(e.user,e.pass)),n.length===0?I2():q2(n)}function X2(e){const n=`${Jh}:${ax()}`;if(e=e||{servers:[n]},e.servers=e.servers||[],typeof e.servers=="string"&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw new Ne("port and servers options are mutually exclusive",ke.InvalidOption);e.servers.length===0&&e.port&&(e.servers=[`${Jh}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[n]);const r=Bu(Y2(),e);if(r.authenticator=J2(r),["reconnectDelayHandler","authenticator"].forEach(a=>{if(r[a]&&typeof r[a]!="function")throw new Ne(`${a} option should be a function`,ke.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{Qr(r.inboxPrefix)}catch(a){throw new Ne(a.message,ke.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof td()=="function"),r.resolve&&typeof td()!="function")throw new Ne("'resolve' is not supported on this client",ke.InvalidOption);return r}function K2(e,n){const{proto:r,tls_required:a,tls_available:l}=e;if((r===void 0||r<1)&&n.noEcho)throw new Ne("noEcho",ke.ServerOptionNotAvailable);const u=a||l||!1;if(n.tls&&!u)throw new Ne("tls",ke.ServerOptionNotAvailable)}const Q2=1024*32,Z2=/^INFO\s+([^\r\n]+)\r\n/i,W2=vl(`PONG\r
|
|
72
|
+
`),S0=vl(`PING\r
|
|
73
|
+
`);class eE{constructor(n,r,a){k(this,"echo");k(this,"no_responders");k(this,"protocol");k(this,"verbose");k(this,"pedantic");k(this,"jwt");k(this,"nkey");k(this,"sig");k(this,"user");k(this,"pass");k(this,"auth_token");k(this,"tls_required");k(this,"name");k(this,"lang");k(this,"version");k(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):{})||{};Bu(this,l)}}class dx extends en{constructor(r,a,l={}){var c;super();k(this,"sid");k(this,"queue");k(this,"draining");k(this,"max");k(this,"subject");k(this,"drained");k(this,"protocol");k(this,"timer");k(this,"info");k(this,"cleanupFn");k(this,"closed");k(this,"requestSubject");Bu(this,l),this.protocol=r,this.subject=a,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=Rt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=os(l.timeout,u),this.timer.then(()=>{this.timer=void 0}).catch(f=>{this.stop(f),this.noIterator&&this.callback(f,{})})),this.noIterator||this.iterClosed.then(()=>{this.closed.resolve(),this.unsubscribe()})}setPrePostHandlers(r){if(this.noIterator){const a=this.callback,l=r.ingestionFilterFn?r.ingestionFilterFn:()=>({ingest:!0,protocol:!1}),u=r.protocolFilterFn?r.protocolFilterFn:()=>!0,c=r.dispatchedFn?r.dispatchedFn:()=>{};this.callback=(f,m)=>{const{ingest:d}=l(m);d&&u(m)&&(a(f,m),c(m))}}else this.protocolFilterFn=r.protocolFilterFn,this.dispatchedFn=r.dispatchedFn}callback(r,a){this.cancelTimeout(),r?this.stop(r):this.push(a)}close(){if(!this.isClosed()){this.cancelTimeout();const r=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve()};this.noIterator?r():this.push(r)}}unsubscribe(r){this.protocol.unsubscribe(this,r)}cancelTimeout(){this.timer&&(this.timer.cancel(),this.timer=void 0)}drain(){return this.protocol.isClosed()?Promise.reject(Ne.errorForCode(ke.ConnectionClosed)):this.isClosed()?Promise.reject(Ne.errorForCode(ke.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(Rt()).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 tE{constructor(){k(this,"mux");k(this,"subs");k(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 ju{constructor(n,r){k(this,"connected");k(this,"connectedOnce");k(this,"infoReceived");k(this,"info");k(this,"muxSubscriptions");k(this,"options");k(this,"outbound");k(this,"pongs");k(this,"subscriptions");k(this,"transport");k(this,"noMorePublishing");k(this,"connectError");k(this,"publisher");k(this,"_closed");k(this,"closed");k(this,"listeners");k(this,"heartbeats");k(this,"parser");k(this,"outMsgs");k(this,"inMsgs");k(this,"outBytes");k(this,"inBytes");k(this,"pendingLimit");k(this,"lastError");k(this,"abortReconnect");k(this,"whyClosed");k(this,"servers");k(this,"server");k(this,"features");k(this,"connectPromise");this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=Q2,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new tE,this.muxSubscriptions=new k2,this.outbound=new cs,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new a2({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new E2(a,{randomize:!n.noRandomize}),this.closed=Rt(),this.parser=new x0(this),this.heartbeats=new C2(this,this.options.pingInterval||fx,this.options.maxPingOut||V2)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=Ne.errorForCode(ke.Disconnect);r.stack="",n.forEach(a=>{a.reject(r)}),this.parser=new x0(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new en;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=Rt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=o2(),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:ns.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:ns.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Kr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Kr.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===ke.AuthenticationExpired&&(this.lastError=void 0)}).catch(r=>{this._close(r)}):await this._close(n)}async dial(n){const r=this.prepare();let a;try{a=os(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:td(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of a)try{l=null,this.dispatchStatus({type:ns.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():hx;let a=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:Ne.errorForCode(ke.ConnectionRefused));const u=Date.now();if(l.lastConnect===0||l.lastConnect+r<=u){l.lastConnect=Date.now();try{await this._doDial(l);break}catch(c){if(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 ps(a)}}static async connect(n,r){const a=new ju(n,r);return await a.dialLoop(),a}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const a=new Ne(n,ke.PermissionsViolation),l=n.match(/(Publish|Subscription) to "(\S+)"/);if(l){a.permissionContext={operation:l[1].toLowerCase(),subject:l[2],queue:void 0};const u=n.match(/using queue "(\S+)"/);u&&(a.permissionContext.queue=u[1])}return a}else return r.indexOf("authorization violation")!==-1?new Ne(n,ke.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Ne(n,ke.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Ne(n,ke.AccountExpired):r.indexOf("authentication timeout")!==-1?new Ne(n,ke.AuthenticationTimeout):new Ne(n,ke.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 jd(n,r,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const r=i0(n),a=ju.toError(r),l={type:Kr.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(W2)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse(i0(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(ua(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new eE({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(vl(`CONNECT ${m}${gu}`)),this.transport.send(S0)}catch(f){this._close(f)}}a&&this.dispatchStatus({type:Kr.Update,data:a}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Kr.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case hn.MSG:{const{msg:r,data:a}=n;this.processMsg(r,a);break}case hn.OK:break;case hn.ERR:this.processError(n.data);break;case hn.PING:this.processPing();break;case hn.PONG:this.processPong();break;case hn.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const a=this.outbound.length();let l;typeof n=="string"?l=vl(n):l=n,this.outbound.fill(l,...r),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=In,a){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=Pi.encode(r);else throw Ne.errorForCode(ke.BadPayload);let u=l.length;a=a||{},a.reply=a.reply||"";let c=In,f=0;if(a.headers){if(this.info&&!this.info.headers)throw new Ne("headers",ke.ServerOptionNotAvailable);c=a.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw Ne.errorForCode(ke.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,Au)):(a.reply?m=`PUB ${n} ${a.reply} ${u}\r
|
|
76
|
+
`:m=`PUB ${n} ${u}\r
|
|
77
|
+
`,this.sendCommand(m,l,Au))}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=Rt()),this.pongs.push(n),this.outbound.fill(S0),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}${gu}`):n.push(`SUB ${a.subject} ${a.sid}${gu}`)}),n.length&&this.transport.send(vl(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 dx(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 nE="$SRV";class _0{constructor(n){k(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||Wr(),(u=l.headers)==null||u.set(Su,`${n}`),(c=l.headers)==null||c.set(wu,r),this.msg.respond(a,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class jl{constructor(n,r="",a=""){k(this,"subject");k(this,"queue");k(this,"srv");r!==""&&iE("service group",r);let l="";if(n instanceof Pl)this.srv=n,l="";else if(n instanceof jl){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;bl("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=a;l=l||n,f=f||this.queue,rE("endpoint subject",l),l=this.calcSubject(this.subject,l);const m={name:n,subject:l,queue:f,handler:u,metadata:c};return this.srv._addEndpoint(m)}addGroup(n="",r=""){return new jl(this,n,r)}}function rE(e,n){if(n==="")throw new Error(`${e} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${e} cannot contain spaces: '${n}'`);const r=n.split(".");r.forEach((a,l)=>{if(a===">"&&l!==r.length-1)throw new Error(`${e} cannot have internal '>': '${n}'`)})}function iE(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 Pl{constructor(n,r={name:"",version:""}){k(this,"nc");k(this,"_id");k(this,"config");k(this,"handlers");k(this,"internal");k(this,"_stopped");k(this,"_done");k(this,"started");this.nc=n,this.config=Object.assign({},r),this.config.queue||(this.config.queue="q"),bl("name",this.config.name),bl("queue",this.config.queue),ua(this.config.version),this._id=Ui.next(),this.internal=[],this._done=Rt(),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??nE;return r===""&&a===""?`${u}.${n}`:(bl("control subject name",r),a!==""?(bl("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=Wr();if(n instanceof _u){const a=n;r.set(wu,a.message),r.set(Su,`${a.code}`)}else r.set(wu,n.message),r.set(Su,"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 aE(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 _0(y))}catch(b){f.stats.countError(b),y==null||y.respond(In,{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:wl.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:wl.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=Pl.controlSubject(r,l,u),c.handler=a,this.setupHandler(c,!0)}start(){const n=mr(),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:wl.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 jl(this,n,r)}addEndpoint(n,r){return new jl(this).addEndpoint(n,r)}_addEndpoint(n){const r=new en;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new _0(u))},r.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=r,this.handlers.push(a),r}}class aE{constructor(n,r,a=""){k(this,"name");k(this,"subject");k(this,"average_processing_time");k(this,"num_requests");k(this,"processing_time");k(this,"num_errors");k(this,"last_error");k(this,"data");k(this,"metadata");k(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+=Ot(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=Ot(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 sE{constructor(n,r={strategy:dr.JitterTimer,maxWait:2e3},a){k(this,"nc");k(this,"prefix");k(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 en,u=mr(),c=Pl.controlSubject(n,r,a,this.prefix),f=await this.nc.requestMany(c,In,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 mx(){return{key:{encode(e){return e},decode(e){return e}},value:{encode(e){return e},decode(e){return e}}}}function lE(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:mx(),storage:Zh.File}}const Nu="KV-Operation",E0="$KV",oE=/^[-/=.\w]+$/,uE=/^[-/=.>*\w]+$/,cE=/^[-\w]+$/;function fE(e){if(e.startsWith(".")||e.endsWith(".")||!oE.test(e))throw new Error(`invalid key: ${e}`)}function hE(e){if(e.startsWith(".")||e.endsWith(".")||!uE.test(e))throw new Error(`invalid key: ${e}`)}function dE(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 yu(e){if(!cE.test(e))throw new Error(`invalid bucket name: ${e}`)}var _r;(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"})(_r||(_r={}));class Nl{constructor(n,r,a){k(this,"js");k(this,"jsm");k(this,"stream");k(this,"bucket");k(this,"direct");k(this,"codec");k(this,"prefix");k(this,"editPrefix");k(this,"useJsPrefix");k(this,"_prefixLen");k(this,"validateKey",fE);k(this,"validateSearchKey",hE);k(this,"hasWildcards",dE);yu(n),this.js=r,this.jsm=a,this.bucket=n,this.prefix=E0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,a={}){yu(r);const l=await n.jetstreamManager(),u=new Nl(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}};yu(r);const c=new Nl(r,n,l);return u.config.name=a.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=a.codec||mx(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(lE(),n);this.codec=r.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Qh.Limits,a.max_msgs_per_subject=r.history,r.maxBucketSize&&(r.max_bytes=r.maxBucketSize),r.max_bytes&&(a.max_bytes=r.max_bytes),a.max_msg_size=r.maxValueSize,a.storage=r.storage;const l=n.placementCluster??"";if(l&&(n.placement={},n.placement.cluster=l,n.placement.tags=[]),n.placement&&(a.placement=n.placement),n.republish&&(a.republish=n.republish),n.description&&(a.description=n.description),n.mirror){const g=Object.assign({},n.mirror);g.name.startsWith(Bn)||(g.name=`${Bn}${g.name}`),a.mirror=g,a.mirror_direct=!0}else if(n.sources){const g=n.sources.map(b=>{const v=Object.assign({},b),C=v.name.startsWith(Bn)?v.name.substring(Bn.length):v.name;return v.name.startsWith(Bn)||(v.name=`${Bn}${v.name}`),!b.external&&C!==this.bucket&&(v.subject_transforms=[{src:`$KV.${C}.>`,dest:`$KV.${this.bucket}.>`}]),v});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?ed(c,ua("2.7.2"))>=0:!1;a.discard=f?Tl.New:Tl.Old;const{ok:m,min:d}=u.features.get(st.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=Ot(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(Bn)&&(a=a.substring(Bn.length)),r.external&&r.external.api!==""){const l=r.name.substring(Bn.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${Bn}${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}`:`${E0}.${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(pn.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new TE(this.bucket,this.prefixLen,n)}jmToEntry(n){const r=this.decodeKey(n.subject.substring(this.prefixLen));return new jE(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=Wr();u.headers=m,m.set(_r.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===ke.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=Rt(),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=Wr();u.set(Nu,r),r==="PURGE"&&u.set(pn.RollupHdr,pn.RollupValueSubject),a!=null&&a.previousSeq&&u.set(_r.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),In,{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=qt.LastPerSubject;r===hr.AllHistory&&(c=qt.All),r===hr.UpdatesOnly&&(c=qt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:Wt.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:Ot(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",a=new en,l={};l.headers_only=n.headers_only||!1;let u;u=()=>{a.stop()};let c=0;const f=this._buildCC(r,hr.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 v=this.jmToEntry(b);a.push(v),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(v){a.stop(v)}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(st.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const r=n.key??">",a=new en,l={};l.headers_only=n.headers_only||!1;let u=hr.LastValue;n.include===hr.AllHistory?u=hr.AllHistory:n.include===hr.UpdatesOnly&&(u=hr.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((v,C)=>{if(v){a.stop(v);return}if(C){const z=this.jmToEntry(C);if(c&&z.operation==="DEL")return;a.push(z),a.received++,f&&(m>0&&a.received>=m||C.info.pending===0)&&(a.push(f),f=void 0)}});const b=await this.js.subscribe(y,g);if(f){const{info:{last:v}}=b,C=v.num_pending+v.delivered.consumer_seq;if(C===0||a.received>=C)try{f()}catch(z){a.stop(z)}finally{f=void 0}else m=C}return a._data=b,a.iterClosed.then(()=>{b.unsubscribe()}),b.closed.then(()=>{a.stop()}).catch(v=>{a.stop(v)}),a}async keys(n=">"){const r=new en,a=this._buildCC(n,hr.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(Nu);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 px(l,r)}}class px{constructor(n,r=""){k(this,"si");k(this,"cluster");this.si=n,this.cluster=r}get bucket(){return this.si.config.name.startsWith(Bn)?this.si.config.name.substring(Bn.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 Td(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 Od="OBJ_",k0="SHA-256=";function mE(e){return yu(e),`${Od}${e}`}function pE(e){return e.startsWith(Od)?e.substring(4):e}class id{constructor(n){k(this,"si");k(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return pE(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 lu(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 er;(function(e){e[e.Unset=-1]="Unset",e[e.Consume=0]="Consume",e[e.Fetch=1]="Fetch"})(er||(er={}));var Er;(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"})(Er||(Er={}));var ss;(function(e){e.DebugEvent="debug",e.Discard="discard",e.Reset="reset",e.Next="next"})(ss||(ss={}));const C0=Uint8Array.of(43,65,67,75),gE=Uint8Array.of(45,78,65,75),hl=Uint8Array.of(43,87,80,73),yE=Uint8Array.of(43,78,88,84),bE=Uint8Array.of(43,84,69,82,77),xE=Uint8Array.of(32);function Ol(e,n=5e3){return new LE(e,n)}class bh extends en{constructor(r,a,l=!1){super();k(this,"consumer");k(this,"opts");k(this,"sub");k(this,"monitor");k(this,"pending");k(this,"inbox");k(this,"refilling");k(this,"pong");k(this,"callback");k(this,"timeout");k(this,"cleanupHandler");k(this,"listeners");k(this,"statusIterator");k(this,"forOrderedConsumer");k(this,"resetHandler");k(this,"abortOnMissingResource");k(this,"bind");k(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=Qr(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,v,C;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(Kh(d))return;const z=(b=d.headers)==null?void 0:b.code,B=((C=(v=d.headers)==null?void 0:v.description)==null?void 0:C.toLowerCase())||"unknown",{msgsLeft:M,bytesLeft:F}=this.parseDiscard(d.headers);if(M>0||F>0)this.pending.msgs-=M,this.pending.bytes-=F,this.pending.requests--,this.notify(ss.Discard,{msgsLeft:M,bytesLeft:F});else if(z===400){this.stop(new Ne(B,`${z}`));return}else if(z===409&&B==="consumer deleted"){if(this.notify(Er.ConsumerDeleted,`${z} ${B}`),!this.refilling||this.abortOnMissingResource){const G=new Ne(B,`${z}`);this.stop(G);return}}else if(z===503){if(this.notify(Er.NoResponders,`${z} No Responders`),!this.refilling||this.abortOnMissingResource){const G=new Ne("no responders",`${z}`);this.stop(G);return}}else this.notify(ss.DebugEvent,`${z} ${B}`)}else this._push(Ol(d,this.consumer.api.timeout)),this.received++,this.pending.msgs&&this.pending.msgs--,this.pending.bytes&&(this.pending.bytes-=d.size());if(this.pending.msgs===0&&this.pending.bytes===0&&(this.pending.requests=0),this.refilling){if(r&&this.pending.msgs<=c||a&&this.pending.bytes<=u){const z=this.pullOptions();this.pull(z)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new Nd(l,m=>(this.notify(Er.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 Kr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Kr.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=Ad([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(Er.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(Er.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=ps(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(ss.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,l=Ot(this.opts.idle_heartbeat),u=Ot(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(pn.PendingMessagesHdr);l&&(a.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(pn.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 en;return this.listeners.push(r),Promise.resolve(r)}}class vE extends en{constructor(){super();k(this,"src");k(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 en;return this.listeners.push(r),Promise.resolve(r)}}class ad{constructor(n,r){k(this,"api");k(this,"_info");k(this,"stream");k(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 bh(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new bh(this,n,!1),a=Math.round(r.opts.expires*1.05),l=os(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=Rt(),a=n;a.max_messages=1;const l=new bh(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===Er.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=os(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 wE{constructor(n,r,a={}){k(this,"api");k(this,"consumerOpts");k(this,"consumer");k(this,"opts");k(this,"cursor");k(this,"stream");k(this,"namePrefix");k(this,"serial");k(this,"currentConsumer");k(this,"userCallback");k(this,"iter");k(this,"type");k(this,"startSeq");k(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"&&(Pu("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=er.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:qt.StartSequence,opt_start_seq:n,ack_policy:Wt.None,inactive_threshold:Ot(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||qt.StartSequence,(this.consumerOpts.deliver_policy===qt.LastPerSubject||this.consumerOpts.deliver_policy===qt.New||this.consumerOpts.deliver_policy===qt.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===qt.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=qt.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=Ot(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=Ad([((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(Er.OrderedConsumerRecreated,u.name);break}catch(b){if(b.message==="stream not found"&&((d=this.iter)==null||d.notify(Er.StreamNotFound,g),this.type===er.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 ps(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===er.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 vE),this.consumer=new ad(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===er.Fetch&&a?c=await this.consumer.fetch(n):this.type===er.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(ss.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===er.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===er.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=er.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===er.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=er.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=Rt();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 sd{constructor(n){k(this,"api");k(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(st.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 ad(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 ad(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,r){await this.checkVersion();const a=this.api;return new Rd(a.nc,a.opts).info(n).then(u=>Promise.resolve(new wE(this.api,n,r))).catch(u=>Promise.reject(u))}}class Iu{constructor(n,r){k(this,"api");k(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 Iu(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 sd(new Cu(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new sd(new Cu(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 Rd extends Bl{constructor(n,r){super(n,r)}checkStreamConfigVersions(n){const r=this.nc;if(n.metadata){const{min:l,ok:u}=r.features.get(st.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(st.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(st.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(st.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(st.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(st.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),fn(n.name),n.mirror=lu(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(lu);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return fn(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),fn(n);const a=await this.info(n),l=Object.assign(a.config,r);l.mirror=lu(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(lu);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,l);return this._fixInfo(c),c}async info(n,r){fn(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 v=await this._request(a,y);c=v.total,d.push(v);const C=Object.getOwnPropertyNames(v.state.subjects).length;if(m+=C,C<f)break}let b={};for(let v=0;v<d.length;v++)u=d[v],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 xl(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 fn(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,a=!0){fn(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){fn(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new gx(l)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var m;const u=a.streams.filter(d=>d.config.name.startsWith(Bn));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 px(d,c))},r=`${this.prefix}.STREAM.LIST`;return new xl(r,n,this)}listObjectStores(){const n=a=>{const u=a.streams.filter(f=>f.config.name.startsWith(Od));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new id(f))},r=`${this.prefix}.STREAM.LIST`;return new xl(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new xl(l,a,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new Iu(this,r))}}class SE extends Bl{constructor(n,r){super(n,r)}async getMessage(n,r){fn(n);let a=r;const{last_by_subj:l}=a;l&&(a=null);const u=a?this.jc.encode(a):In,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=is(m);if(d)return Promise.reject(d);const y=new ld(m);return Promise.resolve(y)}async getBatch(n,r){fn(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 en,f=await this.nc.requestMany(l,u,{strategy:dr.SentinelMsg});return(async()=>{var g,b,v;let m=!1,d=!1,y;for await(const C of f){if(!m){m=!0;const z=((g=C.headers)==null?void 0:g.code)||0;if(z!==0&&z<200||z>299){y=(b=C.headers)==null?void 0:b.description.toLowerCase();break}if(((v=C.headers)==null?void 0:v.get("Nats-Num-Pending"))===""){d=!0;break}}if(C.data.length===0)break;c.push(new ld(C))}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 ld{constructor(n){k(this,"data");k(this,"header");if(!n.headers)throw new Error("headers expected");this.data=n.data,this.header=n.headers}get subject(){return this.header.last(es.Subject)}get seq(){const n=this.header.last(es.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(es.TimeStamp)}get stream(){return this.header.last(es.Stream)}json(n){return mr(n).decode(this.data)}string(){return Pn.decode(this.data)}}k(ld,"jc");class _E extends Bl{constructor(r,a){super(r,a);k(this,"streams");k(this,"consumers");k(this,"direct");this.streams=new Rd(r,a),this.consumers=new Cu(r,a),this.direct=new SE(r,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new en;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 gx{constructor(n){k(this,"_header");k(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):In}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=Wr();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 mr(n).decode(this.data)}string(){return Pn.decode(this.data)}}k(gx,"jc");class EE{constructor(n){k(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new Iu(this.api,r))}}class xh{constructor(n){k(this,"info");k(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 A0(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 kE(){return new ReadableStream({pull(e){e.enqueue(new Uint8Array(0)),e.close()}})}class _l{constructor(n,r,a){k(this,"jsm");k(this,"js");k(this,"stream");k(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 xh(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=mr().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 id(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new id(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,r,a){var se;const l=this.js.getOptions();a=a||{timeout:l.timeout},a.timeout=a.timeout||l.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:u,previousRevision:c}=a,f=this.js.nc.info,m=(f==null?void 0:f.max_payload)||1024;n=n||{},n.options=n.options||{};let d=((se=n.options)==null?void 0:se.max_chunk_size)||128*1024;d=d>m?m:d,n.options.max_chunk_size=d;const y=await this.info(n.name),{name:g,error:b}=this._checkNotEmpty(n.name);if(b)return Promise.reject(b);const v=Ui.next(),C=this._chunkSubject(v),z=this._metaSubject(g),B=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},A0(n)),M=Rt(),F=[],G=new cs;try{const O=r?r.getReader():null,j=g0.create();for(;;){const{done:Y,value:J}=O?await O.read():{done:!0,value:void 0};if(Y){if(G.size()>0){const Z=G.drain();j.update(Z),B.chunks++,B.size+=Z.length,F.push(this.js.publish(C,Z,{timeout:u}))}await Promise.all(F),F.length=0,B.mtime=new Date().toISOString();const V=as.encode(j.digest());B.digest=`${k0}${V}`,B.deleted=!1;const N=Wr();typeof c=="number"&&N.set(_r.ExpectedLastSubjectSequenceHdr,`${c}`),N.set(pn.RollupHdr,pn.RollupValueSubject);const K=await this.js.publish(z,mr().encode(B),{headers:N,timeout:u});if(B.revision=K.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}M.resolve(new xh(B));break}if(J)for(G.fill(J);G.size()>d;){B.chunks++,B.size+=d;const V=G.drain(n.options.max_chunk_size);j.update(V),F.push(this.js.publish(C,V,{timeout:u}))}}}catch(O){await this.jsm.streams.purge(this.stream,{filter:C}),M.reject(O)}return M}putBlob(n,r,a){function l(u){return new ReadableStream({pull(c){c.enqueue(u),c.close()}})}return r===null&&(r=new Uint8Array(0)),this.put(n,l(r),a)}put(n,r,a){var l;return(l=n==null?void 0:n.options)!=null&&l.link?Promise.reject(new Error("link cannot be set when putting the object in bucket")):this._put(n,r,a)}async getBlob(n){async function r(u){const c=new cs,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 _l.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(k0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const a=Wh(r.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=Rt(),u={info:new xh(r),error:l};if(r.size===0)return u.data=kE(),l.resolve(null),Promise.resolve(u);let c;const f=Li();f.orderedConsumer();const m=g0.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&&(t2(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 _l))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=mr(),l=Wr();return l.set(pn.RollupHdr,pn.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,A0(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 en,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=mr(),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.${as.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=mE(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=Tl.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 _l(r,l,n);return await u.init(a),Promise.resolve(u)}}class CE{constructor(n){k(this,"js");this.js=n}kv(n,r={}){const a=this.js,{ok:l,min:u}=a.nc.features.get(st.JS_KV);return l?r.bindOnly?Nl.bind(this.js,n,r):Nl.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(st.JS_OBJECTSTORE);return l?_l.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class Md extends Bl{constructor(r,a){super(r,a);k(this,"consumers");k(this,"streams");k(this,"consumerAPI");k(this,"streamAPI");this.consumerAPI=new Cu(r,a),this.streamAPI=new Rd(r,a),this.consumers=new sd(this.consumerAPI),this.streams=new EE(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 CE(this)}async publish(r,a=In,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||Wr();l&&(l.msgID&&u.set(_r.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(_r.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(_r.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(_r.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(_r.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(v){if(v.code==="503"&&b+1<m)await ps(d);else throw v}const g=this.parseJsResponse(y);if(g.stream==="")throw Ne.errorForCode(ke.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,a,l=0){fn(r),rs(a);let u=this.timeout;l>u&&(u=l),l=l<0?0:Ot(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=is(f);if(m)throw m;return Ol(f,this.timeout)}fetch(r,a,l={}){fn(r),rs(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(st.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=Ot(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=Ot(b),l.delay_heartbeat===!0&&(y.idle_heartbeat=Ot(b*4)));const v=new en,C=y.batch;let z=0;v.protocolFilterFn=(F,G=!1)=>Kh(F.msg)?(d==null||d.work(),!1):!0,v.dispatchedFn=F=>{if(F){if(c&&(f+=F.data.length),z++,u&&F.info.pending===0)return;(v.getPending()===1&&F.info.pending===0||C===z||m>0&&f>=m)&&v.stop()}};const B=Qr(this.nc.options.inboxPrefix),M=this.nc.subscribe(B,{max:l.batch,callback:(F,G)=>{F===null&&(F=is(G)),F!==null?(u&&(u.cancel(),u=null),L_(F)?v.stop(bx(F)===null?void 0:F):v.stop(F)):(d==null||d.work(),v.received++,v.push(Ol(G,this.timeout)))}});return g&&(u=os(g),u.catch(()=>{M.isClosed()||(M.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{b&&(d=new Nd(b,F=>(v.push(()=>{v.err=new Ne(`${tr.IdleHeartbeatMissed}: ${F}`,ke.JetStreamIdleHeartBeat)}),!0)))}catch{}await M.closed,u!==null&&(u.cancel(),u=null),d&&d.cancel(),v.stop()})().catch(),this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${r}.${a}`,this.jc.encode(y),{reply:B}),v}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===Wt.None||u===Wt.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new NE(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 yx(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=h0(a)?a.getOpts():a;if(l.isBind=h0(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!==Wt.NotSet&&l.config.ack_policy!==Wt.None)throw new Ne("ordered consumer: ack_policy can only be set to 'none'",ke.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new Ne("ordered consumer: durable_name cannot be set",ke.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Ne("ordered consumer: deliver_subject cannot be set",ke.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Ne("ordered consumer: max_deliver cannot be set",ke.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Ne("ordered consumer: deliver_group cannot be set",ke.ApiError);l.config.deliver_subject=Qr(this.nc.options.inboxPrefix),l.config.ack_policy=Wt.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Ot(5e3),l.config.ack_wait=Ot(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===Wt.NotSet&&(l.config.ack_policy=Wt.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||Qr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const a={};return a.adapter=OE(r.callbackFn===void 0,this.timeout),a.ingestionFilterFn=Md.ingestionFn(r.ordered),a.protocolFilterFn=(l,u=!1)=>{const c=l;return Xh(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==Wt.None&&(a.dispatchedFn=DE),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:qt.All,ack_policy:Wt.Explicit,ack_wait:Ot(30*1e3),replay_policy:us.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(is(c.msg)||(m=u.monitor)==null||m.work(),Kh(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Xh(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(a):!0,protocol:!1}}}}class Dd{constructor(n){k(this,"options");k(this,"protocol");k(this,"draining");k(this,"listeners");k(this,"_services");this.draining=!1,this.options=X2(n),this.listeners=[]}static connect(n={}){return new Promise((r,a)=>{const l=new Dd(n);ju.connect(l.options,l).then(u=>{l.protocol=u,(async function(){for await(const c of u.status())l.listeners.forEach(f=>{f.push(c)})})(),r(l)}).catch(u=>{a(u)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}_check(n,r,a){if(this.isClosed())throw Ne.errorForCode(ke.ConnectionClosed);if(r&&this.isDraining()||a&&this.protocol.noMorePublishing)throw Ne.errorForCode(ke.ConnectionDraining);if(n=n||"",n.length===0)throw Ne.errorForCode(ke.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 dx(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=In,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||dr.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new Ne("timeout",ke.InvalidOption));const u=new en;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(Qr(this.options.inboxPrefix),{callback:(C,z)=>{var B,M;if(((B=z==null?void 0:z.data)==null?void 0:B.length)===0&&((M=z==null?void 0:z.headers)==null?void 0:M.status)===ke.NoResponders&&(C=Ne.errorForCode(ke.NoResponders)),C){m&&(C.stack+=`
|
|
82
|
+
|
|
83
|
+
${m}`),g(C);return}f(null,z),a.strategy===dr.Count&&(d--,d===0&&g()),a.strategy===dr.JitterTimer&&(v(),b=setTimeout(()=>{g()},300)),a.strategy===dr.SentinelMsg&&z&&z.data.length===0&&g()}});y.requestSubject=n,y.closed.then(()=>{c()}).catch(C=>{u.stop(C)});const g=C=>{C&&u.push(()=>{throw C}),v(),y.drain().then(()=>{c()}).catch(z=>{c()})};u.iterClosed.then(()=>{v(),y==null||y.unsubscribe()}).catch(C=>{v(),y==null||y.unsubscribe()});try{this.publish(n,r,{reply:y.getSubject()})}catch(C){g(C)}let b=setTimeout(()=>{g()},a.maxWait);const v=()=>{b&&clearTimeout(b)}}else{const m=a;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new n2(this.protocol.muxSubscriptions,n,m);this.protocol.request(d);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${d.token}`,headers:a.headers})}catch(y){d.cancel(y)}}return Promise.resolve(u)}request(n,r,a={timeout:1e3,noMux:!1}){try{this._check(n,!0,!0)}catch(u){return Promise.reject(u)}const l=!this.protocol.options.noAsyncTraces;if(a.timeout=a.timeout||1e3,a.timeout<1)return Promise.reject(new Ne("timeout",ke.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new Ne("reply can only be used with noMux",ke.InvalidOption));if(a.noMux){const u=a.reply?a.reply:Qr(this.options.inboxPrefix),c=Rt(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:a.timeout,callback:(d,y)=>{d?(f&&d.code!==ke.Timeout&&(d.stack+=`
|
|
84
|
+
|
|
85
|
+
${f.stack}`),m.unsubscribe(),c.reject(d)):(d=tx(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 ix(this.protocol.muxSubscriptions,n,a,l);this.protocol.request(u);try{this.publish(n,r,{reply:`${this.protocol.muxSubscriptions.baseInbox}${u.token}`,headers:a.headers})}catch(f){u.cancel(f)}const c=Promise.race([u.timer,u.deferred]);return c.catch(()=>{u.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(Ne.errorForCode(ke.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Ne.errorForCode(ke.ConnectionClosed)):this.isDraining()?Promise.reject(Ne.errorForCode(ke.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 en;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 _E(this,n);if(n.checkAPI!==!1)try{await r.getAccountInfo()}catch(a){const l=a;throw l.code===ke.NoResponders&&(l.code=ke.JetStreamNotEnabled),l}return r}jetstream(n={}){return new Md(this,n)}getServerVersion(){const n=this.info;return n?ua(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Ne.errorForCode(ke.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 AE(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Ne.errorForCode(ke.ConnectionClosed)):this.isDraining()?Promise.reject(Ne.errorForCode(ke.ConnectionDraining)):this.protocol.reconnect()}}class AE{constructor(n){k(this,"nc");this.nc=n}add(n){try{return new Pl(this.nc,n).start()}catch(r){return Promise.reject(r)}}client(n,r){return new sE(this.nc,n,r)}}class TE{constructor(n,r,a){k(this,"bucket");k(this,"sm");k(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(Nu)||"PUT"}get length(){const n=this.sm.header.get(pn.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class jE{constructor(n,r,a){k(this,"bucket");k(this,"key");k(this,"sm");this.bucket=n,this.key=r,this.sm=a}get value(){return this.sm.data}get created(){return new Date(Td(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(Nu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(pn.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class yx extends s2{constructor(r,a,l){super(r.nc,a,l);k(this,"js");k(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=Qr(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=qt.StartSequence,u.config.opt_start_seq=r;const c={};c.stream_name=this.info.stream,c.config=u.config;const f=`${u.api.prefix}.CONSUMER.CREATE.${u.stream}`;this.js._request(f,c,{retries:-1}).then(m=>{const d=m,y=this.sub.info;y.last=d,this.info.config=d.config,this.info.name=d.name}).catch(m=>{const d=new Ne(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,ke.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(Td(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,v;const m=H_(409,`${tr.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 C=((b=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:b.stream_seq)||0;return this._resetOrderedConsumer(C+1),(v=this.monitor)==null||v.restart(),!1}return!u.noIterator};this.monitor=new Nd(r,c,l)}_checkHbOrderConsumer(r){const a=r.headers.get(pn.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const l=parseInt(r.headers.get(pn.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 NE extends yx{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(st.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=Ot(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=Ot(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 OE(e,n){return e?ME(n):RE(n)}function RE(e){return(n,r)=>n?[n,null]:(n=is(r),n?[n,null]:[null,Ol(r,e)])}function ME(e){return(n,r)=>{if(n)return[n,null];const a=is(r);return a!==null?[bx(a),null]:[null,Ol(r,e)]}}function bx(e){if(e!==null)switch(e.code){case ke.JetStream404NoMessages:case ke.JetStream408RequestTimeout:return null;case ke.JetStream409:return q_(e)?e:null;default:return e}return null}function DE(e){e&&e.ack()}function zE(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 LE{constructor(n,r){k(this,"msg");k(this,"di");k(this,"didAck");k(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=zE(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]===hl[0]&&n[1]===hl[1]&&n[2]===hl[2]&&n[3]===hl[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const r=Rt();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 ix(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,C0,{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(C0)}nak(n){let r=gE;n&&(r=Eu().encode(`-NAK ${JSON.stringify({delay:Ot(n)})}`)),this.doAck(r)}working(){this.doAck(hl)}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=Ot(r.expires));const l=mr().encode(a),u=cs.concat(yE,xE,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=bE;(n==null?void 0:n.length)>0&&(r=Eu().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const UE="1.30.3",BE="nats.ws";class PE{constructor(){k(this,"version");k(this,"lang");k(this,"closeError");k(this,"connected");k(this,"done");k(this,"socket");k(this,"options");k(this,"socketClosed");k(this,"encrypted");k(this,"peeked");k(this,"yields");k(this,"signal");k(this,"closedNotification");this.version=UE,this.lang=BE,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=Rt(),this.closedNotification=Rt()}async connect(n,r){const a=Rt();if(r.tls)return a.reject(new Ne("tls",ke.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=cs.concat(...this.yields),f=h2(c);if(f!==""){const m=Z2.exec(f);if(!m){r.debug&&console.error("!!!",iu(c)),a.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);K2(d,this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),a.resolve()}catch(d){a.reject(d);return}}},this.socket.onclose=u=>{if(this.isDiscarded())return;this.socketClosed=!0;let c;this.done||(u.wasClean||(c=new Error(u.reason)),this._closed(c))},this.socket.onerror=u=>{if(this.isDiscarded())return;const c=u,f=new Ne(c.message,ke.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 ps(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(`> ${iu(n[r])}`),yield n[r];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=Rt())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${iu(n)}`);return}catch(r){this.options.debug&&console.error(`!!! ${iu(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 HE(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 xx(e={}){return l2({defaultPort:443,urlParseFn:HE,factory:()=>new PE}),Dd.connect(e)}/*! Capacitor: https://capacitorjs.com/ - MIT License */var fs;(function(e){e.Unimplemented="UNIMPLEMENTED",e.Unavailable="UNAVAILABLE"})(fs||(fs={}));class vh extends Error{constructor(n,r,a){super(n),this.message=n,this.code=r,this.data=a}}const qE=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"},IE=e=>{const n=e.CapacitorCustomPlatform||null,r=e.Capacitor||{},a=r.Plugins=r.Plugins||{},l=()=>n!==null?n.name:qE(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(v=>v.name===g)},m=g=>e.console.error(g),d=new Map,y=(g,b={})=>{const v=d.get(g);if(v)return console.warn(`Capacitor plugin "${g}" already registered. Cannot register plugins twice.`),v.proxy;const C=l(),z=f(g);let B;const M=async()=>(!B&&C in b?B=typeof b[C]=="function"?B=await b[C]():B=b[C]:n!==null&&!B&&"web"in b&&(B=typeof b.web=="function"?B=await b.web():B=b.web),B),F=(J,V)=>{var N,K;if(z){const Z=z==null?void 0:z.methods.find(ge=>V===ge.name);if(Z)return Z.rtype==="promise"?ge=>r.nativePromise(g,V.toString(),ge):(ge,he)=>r.nativeCallback(g,V.toString(),ge,he);if(J)return(N=J[V])===null||N===void 0?void 0:N.bind(J)}else{if(J)return(K=J[V])===null||K===void 0?void 0:K.bind(J);throw new vh(`"${g}" plugin is not implemented on ${C}`,fs.Unimplemented)}},G=J=>{let V;const N=(...K)=>{const Z=M().then(ge=>{const he=F(ge,J);if(he){const H=he(...K);return V=H==null?void 0:H.remove,H}else throw new vh(`"${g}.${J}()" is not implemented on ${C}`,fs.Unimplemented)});return J==="addListener"&&(Z.remove=async()=>V()),Z};return N.toString=()=>`${J.toString()}() { [capacitor code] }`,Object.defineProperty(N,"name",{value:J,writable:!1,configurable:!1}),N},se=G("addListener"),O=G("removeListener"),j=(J,V)=>{const N=se({eventName:J},V),K=async()=>{const ge=await N;O({eventName:J,callbackId:ge},V)},Z=new Promise(ge=>N.then(()=>ge({remove:K})));return Z.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await K()},Z},Y=new Proxy({},{get(J,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return z?j:se;case"removeListener":return O;default:return G(V)}}});return a[g]=Y,d.set(g,{name:g,proxy:Y,platforms:new Set([...Object.keys(b),...z?[C]:[]])}),Y};return r.convertFileSrc||(r.convertFileSrc=g=>g),r.getPlatform=l,r.handleError=m,r.isNativePlatform=u,r.isPluginAvailable=c,r.registerPlugin=y,r.Exception=vh,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},FE=e=>e.Capacitor=IE(e),kn=FE(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),ir=kn.registerPlugin;class zd{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 kn.Exception(n,fs.Unimplemented)}unavailable(n="not available"){return new kn.Exception(n,fs.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 T0=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),j0=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class $E extends zd{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=j0(l).trim(),u=j0(u).trim(),r[l]=u}),r}async setCookie(n){try{const r=T0(n.key),a=T0(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)}}}ir("CapacitorCookies",{web:()=>new $E});const GE=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)}),VE=(e={})=>{const n=Object.keys(e);return Object.keys(e).map(l=>l.toLocaleLowerCase()).reduce((l,u,c)=>(l[u]=e[n[c]],l),{})},YE=(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,JE=(e,n={})=>{const r=Object.assign({method:e.method||"GET",headers:e.headers},n),l=VE(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 XE extends zd{async request(n){const r=JE(n,n.webFetchExtra),a=YE(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 GE(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"}))}}ir("CapacitorHttp",{web:()=>new XE});var N0;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(N0||(N0={}));var O0;(function(e){e.StatusBar="StatusBar",e.NavigationBar="NavigationBar"})(O0||(O0={}));class KE extends zd{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")}}ir("SystemBars",{web:()=>new KE});const Ld=kn.isNativePlatform()?"https://app.palmier.me":"";async function vx(e,n,r,a){const l=`${Ld}${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 QE(e,n,r){return vx("POST",e,n)}function ZE(e,n){return vx("GET",e,void 0)}const wx=L.createContext({connected:!1,mode:"disconnected",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),WE=2e3,wh=6e3;function ek({children:e}){const{getActiveHost:n}=Ul(),r=n(),[a,l]=L.useState(null),[u,c]=L.useState(!1),f=L.useRef(null),[m,d]=L.useState(!1),[y,g]=L.useState(!1),b=L.useRef(Eu()),v=L.useRef(new Set),C=L.useRef(0),z=r!=null&&!!r.directUrl,B=r?z?m?"direct":"disconnected":u?"nats":"disconnected":"disconnected",M=B!=="disconnected";L.useEffect(()=>{g(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),L.useEffect(()=>{if(z){f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1));return}if(!r)return;let se=!1;async function O(){try{const j=await fetch(`${Ld}/api/nats-credentials/${r.hostId}`);if(!j.ok){console.error("[NATS] Failed to fetch credentials");return}const Y=await j.json();if(!Y.natsWsUrl){console.warn("[NATS] No WebSocket URL configured");return}if(se)return;console.log("[NATS] Connecting to",Y.natsWsUrl);const J=await xx({servers:Y.natsWsUrl,authenticator:cx(Y.natsJwt,new TextEncoder().encode(Y.natsNkeySeed))});if(se){J.close().catch(()=>{});return}console.log("[NATS] Connected"),f.current=J,l(J),c(!0),J.closed().then(()=>{console.log("[NATS] Connection closed"),se||(l(null),c(!1),f.current=null)})}catch(j){console.error("[NATS] Connection failed:",j),se||c(!1)}}return O(),()=>{se=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[z,r]),L.useEffect(()=>{if(!r||!z){d(!1);return}const se=new AbortController;async function O(){var V;const Y=new AbortController,J=setTimeout(()=>Y.abort(),WE);se.signal.addEventListener("abort",()=>Y.abort());try{const N=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:Y.signal});return clearTimeout(J),N.ok?((V=N.body)==null?void 0:V.getReader())??null:null}catch{return clearTimeout(J),null}}async function j(Y){d(!0),console.log("[HOST] SSE connected to",r.directUrl),C.current=Date.now();function J(){setTimeout(()=>{se.signal.aborted||Date.now()-C.current<wh||(console.log("[HOST] Heartbeat timeout — no data for",wh/1e3,"s"),se.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},wh)}J();const V=new TextDecoder;let N="";try{for(;;){const{done:K,value:Z}=await Y.read();if(K)break;N+=V.decode(Z,{stream:!0}),C.current=Date.now(),J();const ge=N.split(`
|
|
88
|
+
`);N=ge.pop()??"";for(const he of ge)if(he.startsWith("data: ")){const H=he.slice(6);try{const q=JSON.parse(H);if(q.task_id&&q.event_type){const re=`host-event.${r.hostId}.${q.task_id}`;for(const ye of v.current)ye({subject:re,data:b.current.encode(H)})}}catch{}}}}catch{}}return(async()=>{const Y=await O();Y&&await j(Y)})(),()=>{se.abort(),d(!1)}},[r,z]);const F=L.useCallback(async(se,O,j)=>{if(!r)throw new Error("No active host");function Y(ge){ge&&typeof ge=="object"&&ge.error==="Unauthorized"&&g(!0)}if(z){console.log(`[HOST/HTTP] → ${se}`,O??"");const ge=await fetch(`${r.directUrl}/rpc/${se}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.clientToken}`},body:O!=null?JSON.stringify(O):void 0,signal:j!=null&&j.timeout?AbortSignal.timeout(j.timeout):void 0});if(ge.status===401)throw g(!0),new Error("Unauthorized");const he=await ge.json();return Y(he),console.log(`[HOST/HTTP] ← ${se}`,he),he}if(!f.current)throw new Error("Not connected");const J=`host.${r.hostId}.rpc.${se}`,V={...O??{},clientToken:r.clientToken},N=b.current.encode(JSON.stringify(V));console.log(`[HOST/NATS] → ${se}`,O??"");const K=await f.current.request(J,N,{timeout:(j==null?void 0:j.timeout)??1e4}),Z=JSON.parse(b.current.decode(K.data));return Y(Z),console.log(`[HOST/NATS] ← ${se}`,Z),Z},[r,z]),G=L.useCallback((se,O)=>{if(z)return v.current.add(O),()=>{v.current.delete(O)};if(f.current){const j=f.current.subscribe(`host-event.${se}.>`);let Y=!1;return(async()=>{try{for await(const J of j){if(Y)break;O({subject:J.subject,data:J.data})}}catch{}})(),()=>{Y=!0,j.unsubscribe()}}return()=>{}},[r,z]);return w.jsx(wx.Provider,{value:{connected:M,mode:B,nc:a,request:F,subscribeEvents:G,activeHost:r,unauthorized:y},children:e})}function Ud(){return L.useContext(wx)}function Ou(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 Sx={};function tk(e){for(const n of e)Sx[n.key]=n.label}function od(e){return Sx[e]??e}const nk=()=>window.matchMedia("(max-width: 600px)").matches;function rk({task:e,lastEvent:n,onEdit:r,onDelete:a,onViewRun:l}){const{request:u}=Ud(),[c,f]=L.useState(!1),[m,d]=L.useState(!1),[y,g]=L.useState(!1),b=L.useRef(null),v=(n==null?void 0:n.running_state)==="started",C=!e.triggers_enabled||e.triggers.length===0?"var(--color-text-secondary)":v?"var(--color-success)":(n==null?void 0:n.running_state)==="failed"?"var(--color-error)":"var(--color-success)";L.useEffect(()=>{if(!m)return;function N(K){b.current&&!b.current.contains(K.target)&&d(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]);function z(){nk()?g(!0):d(N=>!N)}function B(){d(!1),g(!1)}async function M(){if(B(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:e.id})}catch(N){console.error("Abort failed:",N)}finally{f(!1)}}}async function F(){B();try{const N=await u("task.run",{id:e.id});l(e.id,N.run_id)}catch(N){console.error("Run failed:",N)}}async function G(){if(B(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:e.id}),a(e.id)}catch(N){console.error("Delete failed:",N)}}const se={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function O(N){if(N.length===0)return"";if(N.length===1)return Y(N[0]);const K=N.map(j);if(new Set(K.map(ge=>ge.kind)).size===1){const ge=K[0].kind;if(ge==="hourly")return"Every hour";const he=K.map(H=>H.detail);return`${ge.charAt(0).toUpperCase()+ge.slice(1)}: ${he.join(", ")}`}return N.map(Y).join(", ")}function j(N){if(N.type==="once"){const Ee=new Date(N.value);return{kind:"once",detail:isNaN(Ee.getTime())?N.value:`${Ee.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${Ee.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}}const K=N.value.split(" ");if(K.length!==5)return{kind:"unknown",detail:N.value};const[Z,ge,he,,H]=K,q=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ge==="*")return{kind:"hourly",detail:""};const re=new Date;re.setHours(Number(ge),Number(Z),0,0);const ye=re.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return H!=="*"?{kind:"weekly",detail:`${q[Number(H)]??H} at ${ye}`}:he!=="*"?{kind:"monthly",detail:`day ${he} at ${ye}`}:{kind:"daily",detail:ye}}function Y(N){const K=j(N);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 J=O(e.triggers),V=w.jsxs(w.Fragment,{children:[w.jsxs("button",{onClick:()=>{B(),r(e)},children:[w.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),w.jsxs("button",{onClick:()=>{B(),l(e.id)},children:[w.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),v?w.jsxs("button",{className:"menu-item-danger",onClick:M,disabled:c,children:[w.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):w.jsxs(w.Fragment,{children:[w.jsxs("button",{onClick:F,children:[w.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),w.jsxs("button",{className:"menu-item-danger",onClick:G,children:[w.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"task-card",onClick:()=>v?l(e.id,"latest"):l(e.id),children:[w.jsxs("div",{className:"task-card-header",children:[w.jsxs("div",{className:"task-card-title-row",children:[v?w.jsx("span",{className:"status-spinner",children:w.jsx("span",{})}):w.jsx("span",{className:"status-dot",style:{backgroundColor:C}}),w.jsx("h3",{className:"task-card-name",children:e.name||e.user_prompt})]}),w.jsx("div",{className:"task-card-actions",onClick:N=>N.stopPropagation(),children:w.jsxs("div",{className:"task-card-menu",ref:b,children:[w.jsx("button",{className:"task-card-menu-btn",onClick:z,"aria-label":"Task actions",children:"⋮"}),m&&w.jsx("div",{className:"task-card-menu-dropdown",children:V})]})})]}),w.jsxs("div",{className:"task-card-meta",children:[e.agent&&w.jsx("span",{className:"task-card-agent",children:od(e.agent)}),n&&se[n.running_state]&&w.jsxs("span",{className:"task-card-last-event",children:[se[n.running_state]," ",Ou(n.time_stamp)]}),e.triggers.length>0&&w.jsx("span",{className:"task-card-triggers",children:e.triggers_enabled?J:"Triggers disabled"})]})]}),y&&vu.createPortal(w.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:w.jsxs("div",{className:"bottom-sheet",onClick:N=>N.stopPropagation(),children:[w.jsx("div",{className:"bottom-sheet-handle"}),w.jsx("div",{className:"bottom-sheet-title",children:e.name||e.user_prompt}),w.jsx("div",{className:"bottom-sheet-actions",children:V})]})}),document.body)]})}function ik({permissions:e}){return w.jsxs("div",{className:"plan-dialog",children:[w.jsx("h2",{children:"Granted Permissions"}),w.jsx("div",{className:"plan-dialog-scroll",children:e&&e.length>0?w.jsx("div",{className:"permissions-section",children:w.jsx("ul",{className:"permissions-list",children:e.map((n,r)=>w.jsxs("li",{className:"permission-item",children:[w.jsx("span",{className:"permission-tool",children:n.name}),w.jsx("span",{className:"permission-desc",children:n.description})]},r))})}):w.jsx("p",{className:"plan-empty",children:"No permissions have been granted for this task."})}),w.jsx("div",{className:"plan-dialog-actions",children:w.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const Za=[];function ak(){const e=Za.pop();e&&(e.pushed.current=!1,e.close())}let R0=!1;function sk(){R0||(R0=!0,window.addEventListener("popstate",ak))}function lk(e,n){const r=L.useRef(!1),a=L.useRef(n);a.current=n;const l=L.useCallback(()=>a.current(),[]),u=L.useRef({close:l,pushed:r});u.current.close=l,L.useEffect(()=>{if(e&&!r.current)sk(),history.pushState({modal:!0},""),Za.push(u.current),r.current=!0;else if(!e&&r.current){r.current=!1;const c=Za.indexOf(u.current);c!==-1&&Za.splice(c,1),history.back()}},[e,l]),L.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=Za.indexOf(c);f!==-1&&Za.splice(f,1),history.back()}}},[])}const ok=["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 uk(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 M0(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 uk(e.value)}function ck(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 fk(e){return e.schedule==="once"?e.onceDate?{type:"once",value:`${e.onceDate}T${e.onceTime}`}:null:{type:"cron",value:ck(e)}}function hk({initial:e,agents:n,hostPlatform:r,onSaved:a,onRun:l,onCancel:u}){var Be;const{request:c}=Ud(),f=()=>{var $e;const we=localStorage.getItem("palmier:lastAgent"),Le=n.map(jt=>jt.key);return we&&Le.includes(we)?we:(($e=n[0])==null?void 0:$e.key)??""},[m,d]=L.useState((e==null?void 0:e.user_prompt)??""),[y,g]=L.useState((e==null?void 0:e.agent)??f()),b=!!((Be=e==null?void 0:e.permissions)!=null&&Be.length),[v,C]=L.useState(!1),z=L.useCallback(()=>C(!1),[]);lk(v,z);const[B,M]=L.useState(null),[F,G]=L.useState(()=>((e==null?void 0:e.triggers)??[]).map(M0)),[se,O]=L.useState(()=>{var we;return((we=((e==null?void 0:e.triggers)??[]).map(M0)[0])==null?void 0:we.schedule)??"daily"}),[j,Y]=L.useState((e==null?void 0:e.triggers_enabled)??!1),[J,V]=L.useState((e==null?void 0:e.requires_confirmation)??!1),[N,K]=L.useState((e==null?void 0:e.yolo_mode)??!1),[Z,ge]=L.useState((e==null?void 0:e.foreground_mode)??!1),[he,H]=L.useState(null),q=he!==null,[re,ye]=L.useState(!!(e!=null&&e.command)),[Ee,R]=L.useState((e==null?void 0:e.command)??""),U=L.useRef(null),te=!!e,E=!te||m!==((e==null?void 0:e.user_prompt)??"")||y!==((e==null?void 0:e.agent)??"")||j!==((e==null?void 0:e.triggers_enabled)??!0)||J!==((e==null?void 0:e.requires_confirmation)??!1)||N!==((e==null?void 0:e.yolo_mode)??!1)||Z!==((e==null?void 0:e.foreground_mode)??!1)||re!==!!(e!=null&&e.command)||re&&Ee!==((e==null?void 0:e.command)??"")||JSON.stringify(ze())!==JSON.stringify((e==null?void 0:e.triggers)??[]),ue=j&&F.some(we=>we.schedule==="once"&&(!we.onceDate||new Date(`${we.onceDate}T${we.onceTime}`)<=new Date)),pe=E&&!!m.trim()&&!ue&&(!re||!!Ee.trim());function ve(we,Le){G($e=>$e.map((jt,gn)=>gn===we?{...jt,...Le}:jt))}function je(we){G(Le=>{const $e=Le.filter((jt,gn)=>gn!==we);return $e.length===0&&(Y(!1),V(!1)),$e})}function De(){G(we=>[...we,Mi(se)])}function Ce(we){O(we),G([Mi(we)])}function ze(){return F.flatMap(we=>{const Le=fk(we);return Le?[Le]:[]})}function lt(){return N?confirm(`Yolo mode is enabled. The agent will auto-approve all tool calls — it can read, write, delete files, run arbitrary commands, and access the network without asking for permission.
|
|
89
|
+
|
|
90
|
+
Are you sure you want to continue?`):!0}async function Fe(){H("save"),M(null);try{const we=te?"task.update":"task.create",Le={user_prompt:m,agent:y,triggers:ze(),triggers_enabled:j,requires_confirmation:J,yolo_mode:N,foreground_mode:Z,command:re?Ee:""};te&&(Le.id=e.id);const $e=await c(we,Le,{timeout:45e3});return $e.error?(M($e.error),null):(te||localStorage.setItem("palmier:lastAgent",y),a($e),$e)}catch(we){return M(we instanceof Error?we.message:String(we)),null}finally{H(null)}}async function qe(){H("run"),M(null);try{const Le=await c("task.run_oneoff",{user_prompt:m,agent:y,requires_confirmation:J,yolo_mode:N,foreground_mode:Z,command:re?Ee:""});if(Le.error){M(Le.error);return}localStorage.setItem("palmier:lastAgent",y),l(Le.task_id,Le.run_id),u()}catch(we){M(we instanceof Error?we.message:String(we))}finally{H(null)}}return w.jsx("div",{className:"task-form-overlay",children:w.jsx("div",{className:"task-form",children:v?w.jsx(ik,{permissions:e==null?void 0:e.permissions}):w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"task-form-header",children:w.jsx("h2",{children:e?"Edit Task":"New Task"})}),B&&w.jsx("div",{className:"form-error",children:B}),w.jsx("textarea",{autoFocus:!e,className:"form-textarea",value:m,onChange:we=>d(we.target.value),placeholder:re?"If the input email contains an event, create a calendar entry for it.":"Research today's top AI news and write a summary.",rows:4,disabled:q}),w.jsxs("div",{className:"plan-actions",children:[b&&w.jsx("button",{className:"btn btn-link",onClick:()=>C(!0),children:"Granted Permissions"}),w.jsxs("div",{className:"agent-picker-section-inline",style:{marginLeft:"auto"},children:[w.jsx("span",{className:"agent-picker-label",children:"Run with"}),w.jsx("select",{className:"form-select form-select-sm",value:y,onChange:we=>g(we.target.value),children:n.map(we=>w.jsx("option",{value:we.key,children:we.label},we.key))})]})]}),w.jsxs("div",{className:"toggles-group",children:[w.jsxs("div",{className:`command-section${re?" command-section-active":""}`,children:[w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:re,onChange:we=>{ye(we.target.checked),we.target.checked?setTimeout(()=>{var Le;return(Le=U.current)==null?void 0:Le.focus()},0):R("")},disabled:q}),"Reactive"]}),re&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"command-help-text",children:"Runs a command and invokes the task for each line of output. Use “the input” in your task description to reference each line."}),w.jsx("input",{ref:U,className:"form-input form-input-mono",type:"text",value:Ee,onChange:we=>R(we.target.value),placeholder:"gws gmail +watch --project my-project",disabled:q})]})]}),r==="win32"&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:Z,onChange:we=>ge(we.target.checked),disabled:q}),"Run in the foreground (host must login to Windows)"]}),w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:N,onChange:we=>K(we.target.checked),disabled:q}),"Yolo mode"]}),N&&w.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."}),w.jsxs("div",{className:"triggers-section",children:[w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:j,onChange:we=>{we.target.checked?(Y(!0),F.length===0&&De()):(Y(!1),V(!1),G(Le=>{const $e=Le.filter(jt=>jt.schedule==="once"?jt.onceDate&&new Date(`${jt.onceDate}T${jt.onceTime}`)>new Date:!0);return $e.length===1&&$e[0].schedule==="daily"&&$e[0].time==="00:00"?[]:$e}))},disabled:q}),"Enable schedule"]}),w.jsxs("div",{className:`triggers-section-body${j?"":" disabled"}`,children:[F.length>0&&w.jsxs("select",{className:"form-select",value:se,disabled:!j,onChange:we=>Ce(we.target.value),children:[w.jsx("option",{value:"once",children:"Specific Time"}),w.jsx("option",{value:"hourly",children:"Hourly"}),w.jsx("option",{value:"daily",children:"Daily"}),w.jsx("option",{value:"weekly",children:"Weekly"}),w.jsx("option",{value:"monthly",children:"Monthly"})]}),se!=="hourly"&&F.map((we,Le)=>w.jsxs("div",{className:"trigger-row-card",children:[w.jsxs("div",{className:"trigger-row-content",children:[se==="daily"&&w.jsx("input",{className:"form-input",type:"time",value:we.time,disabled:!j,onChange:$e=>ve(Le,{time:$e.target.value})}),se==="weekly"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("select",{className:"form-select",value:we.dayOfWeek,disabled:!j,onChange:$e=>ve(Le,{dayOfWeek:$e.target.value}),children:ok.map(($e,jt)=>w.jsx("option",{value:String(jt),children:$e},jt))}),w.jsx("input",{className:"form-input",type:"time",value:we.time,disabled:!j,onChange:$e=>ve(Le,{time:$e.target.value})})]}),se==="monthly"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("select",{className:"form-select",value:we.dayOfMonth,disabled:!j,onChange:$e=>ve(Le,{dayOfMonth:$e.target.value}),children:Array.from({length:28},($e,jt)=>jt+1).map($e=>w.jsxs("option",{value:String($e),children:["Day ",$e]},$e))}),w.jsx("input",{className:"form-input",type:"time",value:we.time,disabled:!j,onChange:$e=>ve(Le,{time:$e.target.value})})]}),se==="once"&&w.jsxs("div",{className:"trigger-row-top",children:[w.jsx("input",{className:"form-input",type:"date",value:we.onceDate,min:new Date().toISOString().split("T")[0],disabled:!j,onChange:$e=>ve(Le,{onceDate:$e.target.value})}),w.jsx("input",{className:"form-input",type:"time",value:we.onceTime,min:we.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,disabled:!j,onChange:$e=>ve(Le,{onceTime:$e.target.value})})]})]}),F.length>1&&w.jsx("button",{className:"trigger-remove-btn",onClick:()=>je(Le),disabled:!j,title:"Remove trigger",children:"×"})]},Le)),F.length>0&&se!=="hourly"&&w.jsx("button",{className:"trigger-add-btn",onClick:De,disabled:!j,children:"+ Add"})]})]}),j&&F.length>0&&w.jsxs("label",{className:"toggle-label",children:[w.jsx("input",{type:"checkbox",checked:J,onChange:we=>V(we.target.checked),disabled:q}),"Confirm before each run"]})]}),!N&&(()=>{const we=n.find(Le=>Le.key===y);return(we==null?void 0:we.supportsPermissions)===!1&&w.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",we.label,". The task may fail if required permissions are not pre-configured."]})})(),w.jsxs("div",{className:"form-actions",children:[(()=>{const we=F.length>0,Le=!!m.trim()&&(!re||!!Ee.trim());return te?E?w.jsxs("button",{className:"btn btn-primary",onClick:()=>lt()&&Fe(),disabled:!pe||q,children:[he==="save"&&w.jsx("span",{className:"btn-spinner"}),"Save"]}):w.jsx("button",{className:"btn btn-primary",disabled:!0,children:"Save"}):we?w.jsxs("button",{className:"btn btn-primary",onClick:()=>lt()&&Fe(),disabled:!pe||q,children:[he==="save"&&w.jsx("span",{className:"btn-spinner"}),"Schedule"]}):w.jsxs(w.Fragment,{children:[w.jsxs("button",{className:"btn btn-primary",onClick:()=>lt()&&qe(),disabled:!Le||q,children:[he==="run"&&w.jsx("span",{className:"btn-spinner"}),"Run"]}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>lt()&&Fe(),disabled:!pe||q,children:"Save"})]})})(),w.jsx("button",{className:"btn btn-secondary",onClick:()=>{E&&m.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})})})}const dk="0.7.6";function mk(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 pk({connected:e,hostId:n,request:r,subscribeEvents:a,onViewRun:l,onUpdateRequired:u,onVersion:c,onCapabilityTokens:f}){const[m,d]=L.useState([]),[y,g]=L.useState(!1),[b,v]=L.useState(null),[C,z]=L.useState(new Map),[B,M]=L.useState(new Map),[F,G]=L.useState(new Map),[se,O]=L.useState(new Map),[j,Y]=L.useState(new Map),[J,V]=L.useState(!1),[N,K]=L.useState(void 0),[Z,ge]=L.useState([]),[he,H]=L.useState(),q=L.useCallback(()=>{V(!1),K(void 0)},[]),re=L.useCallback(async()=>{var E,ue;if(e){g(!0),v(null);try{const pe=await r("task.list"),ve=pe.tasks??[],je=new Map,De=new Map,Ce=new Map,ze=new Map,lt=new Map;for(const qe of ve)qe.status&&(je.set(qe.id,qe.status),(E=qe.status.pending_permission)!=null&&E.length&&Ce.set(qe.id,qe.status.pending_permission),(ue=qe.status.pending_input)!=null&&ue.length&&(ze.set(qe.id,{questions:qe.status.pending_input}),lt.set(qe.id,new Array(qe.status.pending_input.length).fill(""))));z(je),M(De),G(Ce),O(ze),Y(lt),d(ve),ge(pe.agents??[]),H(pe.host_platform),tk(pe.agents??[]);const Fe=pe.version??null;c==null||c(Fe),f==null||f(pe.capability_tokens??{}),u==null||u(!!Fe&&mk(Fe,dk))}catch(pe){const ve=pe instanceof Error?pe.message:String(pe);ve==="Not connected"||ve.includes("503")||ve.toLowerCase().includes("no responders")?v(null):v(ve),d([])}finally{g(!1)}}},[e,n,r]);L.useEffect(()=>{e?re():(d([]),g(!1))},[e,n,re]),L.useEffect(()=>{if(!e||!n)return;const E={decode:pe=>new TextDecoder().decode(pe)};return a(n,async pe=>{var lt;const ve=pe.subject.split(".");if(ve.length<3)return;const je=ve.slice(2).join(".");let De={};try{De=JSON.parse(E.decode(pe.data))}catch{return}const Ce=De.event_type,ze=De.session_id;if(Ce==="input-request"&&ze){const Fe=De.input_questions,qe=De.agent_name,Be=De.description;Fe!=null&&Fe.length&&(O(we=>{if(we.has(ze))return we;const Le=new Map(we);return Le.set(ze,{questions:Fe,description:Be,agentName:qe}),Le}),Y(we=>{if(we.has(ze))return we;const Le=new Map(we);return Le.set(ze,new Array(Fe.length).fill("")),Le}));return}if(Ce==="input-resolved"&&ze){O(Fe=>{if(!Fe.has(ze))return Fe;const qe=new Map(Fe);return qe.delete(ze),qe}),Y(Fe=>{const qe=new Map(Fe);return qe.delete(ze),qe});return}if(Ce==="confirm-request"&&ze){const Fe=De.description,qe=De.agent_name;Fe&&M(Be=>{if(Be.has(ze))return Be;const we=new Map(Be);return we.set(ze,{description:Fe,agentName:qe}),we});return}if(Ce==="confirm-resolved"&&ze){M(Fe=>{if(!Fe.has(ze))return Fe;const qe=new Map(Fe);return qe.delete(ze),qe});return}if(Ce==="permission-resolved"){G(Fe=>{if(!Fe.has(je))return Fe;const qe=new Map(Fe);return qe.delete(je),qe});return}try{const Fe=await r("task.status",{id:je},{timeout:5e3});if(Fe.error)return;z(qe=>{const Be=new Map(qe);return Be.set(je,Fe),Be}),(lt=Fe.pending_permission)!=null&<.length&&G(qe=>{if(qe.has(je))return qe;const Be=new Map(qe);return Be.set(je,Fe.pending_permission),Be})}catch{}})},[e,n,a,r]);async function ye(E,ue){try{await r("task.user_input",{id:E,value:[ue]})}catch(pe){console.error("[TaskListView] Failed to respond to confirmation:",pe)}}async function Ee(E,ue){try{await r("task.user_input",{id:E,value:[ue]})}catch(pe){console.error("[TaskListView] Failed to respond to permission request:",pe)}}async function R(E,ue){try{await r("task.user_input",{id:E,value:ue})}catch(pe){console.error("[TaskListView] Failed to respond to input request:",pe)}}function U(E){d(ue=>{const pe=ue.findIndex(ve=>ve.id===E.id);if(pe>=0){const ve=[...ue];return ve[pe]=E,ve}return[E,...ue]}),V(!1),K(void 0)}function te(E){d(ue=>ue.filter(pe=>pe.id!==E)),z(ue=>{const pe=new Map(ue);return pe.delete(E),pe}),O(ue=>{const pe=new Map(ue);return pe.delete(E),pe}),Y(ue=>{const pe=new Map(ue);return pe.delete(E),pe})}return w.jsxs(w.Fragment,{children:[b&&w.jsxs("div",{className:"form-error",children:[b,b.toLowerCase().includes("failed to fetch")&&w.jsxs(w.Fragment,{children:[" ",w.jsx("a",{href:"#",onClick:E=>{E.preventDefault(),window.location.reload()},children:"Reload"})]})]}),w.jsx("div",{className:"new-task-input-card",onClick:()=>{K(void 0),V(!0)},role:"button",tabIndex:0,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(K(void 0),V(!0))},children:w.jsx("span",{className:"new-task-placeholder",children:"Describe your new task..."})}),y&&!m.length?w.jsx("div",{className:"task-list",children:[0,1,2].map(E=>w.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[w.jsx("div",{className:"task-card-header",children:w.jsxs("div",{className:"task-card-title-row",children:[w.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),w.jsx("div",{className:"skeleton-line",style:{width:`${60+E*12}%`}})]})}),w.jsxs("div",{className:"task-card-meta",children:[w.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},E))}):w.jsx("div",{className:"task-list",children:m.map(E=>w.jsx(rk,{task:E,lastEvent:C.get(E.id),onEdit:async ue=>{try{const pe=await r("task.get",{id:ue.id});K(pe.error?ue:pe)}catch{K(ue)}V(!0)},onDelete:te,onViewRun:l},E.id))}),J&&w.jsx(hk,{initial:N,agents:Z,hostPlatform:he,onSaved:U,onRun:l,onCancel:q}),vu.createPortal(w.jsxs(w.Fragment,{children:[[...B.entries()].map(([E,{description:ue,agentName:pe}])=>{var je;const ve=pe||((je=m.find(De=>De.id===E))==null?void 0:je.name);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Confirmation Required"}),ve&&w.jsx("p",{className:"confirm-modal-subtitle",children:ve}),w.jsx("p",{className:"confirm-modal-message",children:ue}),w.jsxs("div",{className:"confirm-modal-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>ye(E,"confirmed"),children:"Confirm"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>ye(E,"aborted"),children:"Abort"})]})]})},E)}),[...F.entries()].map(([E,ue])=>{const pe=m.find(ve=>ve.id===E);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal permission-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),w.jsx("p",{className:"confirm-modal-message",children:w.jsx("strong",{children:(pe==null?void 0:pe.name)||(pe==null?void 0:pe.user_prompt)||E})}),w.jsx("div",{className:"permission-list",children:ue.map((ve,je)=>w.jsxs("div",{className:"permission-item",children:[w.jsx("span",{className:"permission-name",children:ve.name}),ve.description&&w.jsx("span",{className:"permission-desc",children:ve.description})]},je))}),w.jsxs("div",{className:"permission-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>Ee(E,"granted"),children:"Allow Once"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>Ee(E,"granted_all"),children:"Allow Always"})]}),w.jsx("button",{className:"permission-abort-link",onClick:()=>Ee(E,"aborted"),children:"Deny & Abort Task"})]})},E)}),[...se.entries()].map(([E,{questions:ue,description:pe,agentName:ve}])=>{var Ce;const je=j.get(E)??new Array(ue.length).fill(""),De=ve||((Ce=m.find(ze=>ze.id===E))==null?void 0:Ce.name);return w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal input-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),De&&w.jsx("p",{className:"confirm-modal-subtitle",children:De}),pe&&w.jsx("p",{className:"confirm-modal-message",children:pe}),w.jsx("div",{className:"input-list",children:ue.map((ze,lt)=>w.jsxs("div",{className:"input-item",children:[w.jsx("label",{className:"input-label",children:ze}),w.jsx("input",{type:"text",className:"input-field",value:je[lt]??"",onChange:Fe=>{Y(qe=>{const Be=new Map(qe),we=[...Be.get(E)??[]];return we[lt]=Fe.target.value,Be.set(E,we),Be})},autoFocus:lt===0})]},lt))}),w.jsx("div",{className:"input-actions",children:w.jsx("button",{className:"btn btn-primary",disabled:je.some(ze=>!ze.trim()),onClick:()=>R(E,je),children:"Submit"})}),w.jsx("button",{className:"permission-abort-link",onClick:()=>R(E,["aborted"]),children:"Cancel"})]})},E)})]}),document.body)]})}function gk(){const e=fa(),r=Tr().pathname.startsWith("/runs");return w.jsxs(w.Fragment,{children:[w.jsxs("button",{className:`tab-btn ${r?"":"tab-btn-active"}`,onClick:()=>e("/"),children:[w.jsxs("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),w.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]}),w.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>e("/runs"),children:[w.jsx("svg",{className:"tab-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Runs"]})]})}const yk="modulepreload",bk=function(e){return"/"+e},D0={},_x=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=bk(d),d in D0)return;D0[d]=!0;const y=d.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":yk,y||(b.as="script"),b.crossOrigin="",b.href=d,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((v,C)=>{b.addEventListener("load",v),b.addEventListener("error",()=>C(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)})},xk=ir("App",{web:()=>_x(()=>import("./web-CkWrlNwc.js"),[]).then(e=>new e.AppWeb)}),Zt=ir("Preferences",{web:()=>_x(()=>import("./web-lx34oBi7.js"),[]).then(e=>new e.PreferencesWeb)});function Ex(e){const[n,r]=L.useState(()=>window.matchMedia(e).matches);return L.useEffect(()=>{const a=window.matchMedia(e),l=u=>r(u.matches);return a.addEventListener("change",l),r(a.matches),()=>a.removeEventListener("change",l)},[e]),n}const ou=kn.isNativePlatform()?ir("LocationPermission"):null,Sh=kn.isNativePlatform()?ir("NotificationListener"):null,_h=kn.isNativePlatform()?ir("SmsPermission"):null,Eh=kn.isNativePlatform()?ir("ContactsPermission"):null,kh=kn.isNativePlatform()?ir("CalendarPermission"):null,Ch=kn.isNativePlatform()?ir("DndAccess"):null,Ah=kn.isNativePlatform()?ir("FullScreenIntent"):null,z0=!!window.__PALMIER_SERVE__,L0=kn.isNativePlatform();function U0({daemonVersion:e,capabilityTokens:n,activeClientToken:r,request:a,onCapabilityTokensChange:l}){var Dt;const{pairedHosts:u,activeHostId:c,setActiveHostId:f,removePairedHost:m,renamePairedHost:d}=Ul(),y=fa(),g=Ex("(min-width: 768px)"),[b,v]=L.useState(!1),[C,z]=L.useState(!1),[B,M]=L.useState(null),[F,G]=L.useState(""),[se,O]=L.useState(null),[j,Y]=L.useState(!1),[J,V]=L.useState(!1),[N,K]=L.useState(!1),[Z,ge]=L.useState(!1),[he,H]=L.useState(!1),[q,re]=L.useState(!1),[ye,Ee]=L.useState(!1),[R,U]=L.useState(!1),[te,E]=L.useState(!1);function ue(xe){return!!(r&&(n==null?void 0:n[xe])===r)}const pe=ue("location"),ve=ue("notifications"),je=ue("sms"),De=ue("contacts"),Ce=ue("calendar"),ze=ue("dnd"),lt=ue("alert"),Fe=ue("battery"),qe=ue("email");function Be(xe,Ve){const ot={};for(const[Fn,Bt]of Object.entries(n??{}))ot[Fn]=Bt??null;ot[xe]=Ve?r??null:null,l==null||l(ot)}L.useEffect(()=>{if(!L0||!ou||!a)return;function xe(){pe&&ou.check().then(({fine:ot})=>{ot||a("device.location.disable").then(()=>{Be("location",!1)}).catch(()=>{})})}xe();const Ve=xk.addListener("resume",()=>{xe()});return()=>{Ve.then(ot=>ot.remove())}},[pe,r]);async function we(){if(!(!Sh||!a)){V(!0);try{if(ve)await Zt.set({key:"notificationListenerEnabled",value:"false"}),await a("device.capability.disable",{capability:"notifications"}),Be("notifications",!1);else{const{enabled:xe}=await Sh.check();if(!xe&&!(await Sh.request()).enabled)return;const{value:Ve}=await Zt.get({key:"fcmToken"});if(!Ve){console.warn("No FCM token available");return}await Zt.set({key:"notificationListenerEnabled",value:"true"}),await a("device.capability.enable",{capability:"notifications",fcmToken:Ve}),Be("notifications",!0)}}catch(xe){console.error("Failed to toggle notification listener:",xe)}finally{V(!1)}}}async function Le(){if(!(!_h||!a)){K(!0);try{if(je)await Zt.set({key:"smsListenerEnabled",value:"false"}),await a("device.capability.disable",{capability:"sms"}),Be("sms",!1);else{const{granted:xe}=await _h.check();if(!xe&&!(await _h.request()).granted)return;const{value:Ve}=await Zt.get({key:"fcmToken"});if(!Ve){console.warn("No FCM token available");return}await Zt.set({key:"smsListenerEnabled",value:"true"}),await a("device.capability.enable",{capability:"sms",fcmToken:Ve}),Be("sms",!0)}}catch(xe){console.error("Failed to toggle SMS access:",xe)}finally{K(!1)}}}async function $e(){if(!(!Eh||!a)){ge(!0);try{if(De)await Zt.set({key:"contactsAccessEnabled",value:"false"}),await a("device.capability.disable",{capability:"contacts"}),Be("contacts",!1);else{const{granted:xe}=await Eh.check();if(!xe&&!(await Eh.request()).granted)return;const{value:Ve}=await Zt.get({key:"fcmToken"});if(!Ve){console.warn("No FCM token available");return}await Zt.set({key:"contactsAccessEnabled",value:"true"}),await a("device.capability.enable",{capability:"contacts",fcmToken:Ve}),Be("contacts",!0)}}catch(xe){console.error("Failed to toggle contacts access:",xe)}finally{ge(!1)}}}async function jt(){if(!(!kh||!a)){H(!0);try{if(Ce)await Zt.set({key:"calendarAccessEnabled",value:"false"}),await a("device.capability.disable",{capability:"calendar"}),Be("calendar",!1);else{const{granted:xe}=await kh.check();if(!xe&&!(await kh.request()).granted)return;const{value:Ve}=await Zt.get({key:"fcmToken"});if(!Ve){console.warn("No FCM token available");return}await Zt.set({key:"calendarAccessEnabled",value:"true"}),await a("device.capability.enable",{capability:"calendar",fcmToken:Ve}),Be("calendar",!0)}}catch(xe){console.error("Failed to toggle calendar access:",xe)}finally{H(!1)}}}async function gn(){if(!(!Ch||!a)){re(!0);try{if(ze)await a("device.capability.disable",{capability:"dnd"}),Be("dnd",!1);else{const{enabled:xe}=await Ch.check();if(!xe&&!(await Ch.request()).enabled)return;const{value:Ve}=await Zt.get({key:"fcmToken"});if(!Ve){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"dnd",fcmToken:Ve}),Be("dnd",!0)}}catch(xe){console.error("Failed to toggle DND access:",xe)}finally{re(!1)}}}async function ar(){if(!Ah)return!0;const{granted:xe}=await Ah.check();return xe?!0:(await Ah.request()).granted}async function An(){if(a){Ee(!0);try{if(lt)await a("device.capability.disable",{capability:"alert"}),Be("alert",!1);else{if(!await ar())return;const{value:xe}=await Zt.get({key:"fcmToken"});if(!xe){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"alert",fcmToken:xe}),Be("alert",!0)}}catch(xe){console.error("Failed to toggle alert access:",xe)}finally{Ee(!1)}}}async function ti(){if(a){E(!0);try{if(qe)await a("device.capability.disable",{capability:"email"}),Be("email",!1);else{if(!await ar())return;const{value:xe}=await Zt.get({key:"fcmToken"});if(!xe){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"email",fcmToken:xe}),Be("email",!0)}}catch(xe){console.error("Failed to toggle email access:",xe)}finally{E(!1)}}}async function gr(){if(a){U(!0);try{if(Fe)await a("device.capability.disable",{capability:"battery"}),Be("battery",!1);else{const{value:xe}=await Zt.get({key:"fcmToken"});if(!xe){console.warn("No FCM token available");return}await a("device.capability.enable",{capability:"battery",fcmToken:xe}),Be("battery",!0)}}catch(xe){console.error("Failed to toggle battery access:",xe)}finally{U(!1)}}}async function gt(){if(a){Y(!0);try{if(pe)await a("device.location.disable"),Be("location",!1);else{if(ou&&!(await ou.request()).fine)return;const{value:xe}=await Zt.get({key:"fcmToken"});if(!xe){console.warn("No FCM token available");return}await a("device.location.enable",{fcmToken:xe}),Be("location",!0)}}catch(xe){console.error("Failed to toggle location:",xe)}finally{Y(!1)}}}const ni=L.useRef(null),le=L.useRef(null),Se=L.useCallback(()=>{z(!0)},[]);function Pe(){C&&(v(!1),z(!1))}function Je(){z(!1),v(!0)}function it(xe,Ve){M(xe),G(Ve)}function Kt(){B&&F.trim()&&d(B,F.trim()),M(null),G("")}function yn(){M(null),G("")}L.useEffect(()=>{B&&le.current&&(le.current.focus(),le.current.select())},[B]),L.useEffect(()=>{if(!b||C)return;function xe(Ve){Ve.key==="Escape"&&Se()}return document.addEventListener("keydown",xe),()=>{document.removeEventListener("keydown",xe)}},[b,C,Se]);const It=w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"drawer-header",children:[w.jsx("span",{className:"drawer-title",children:"Palmier"}),!g&&w.jsx("button",{className:"drawer-close-btn",onClick:Se,"aria-label":"Close menu",children:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:w.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),!z0&&u.length>0&&w.jsxs("div",{className:"drawer-section",children:[w.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),w.jsx("div",{className:"host-picker-inline",children:w.jsx("div",{className:"host-picker-list",role:"listbox",children:u.map(xe=>{const Ve=xe.hostId===c,ot=B===xe.hostId,Fn=xe.name||xe.hostId.slice(0,8);return w.jsx("div",{className:"host-picker-item-wrapper",children:w.jsxs("div",{className:`host-picker-item ${Ve?"host-picker-item-active":""}`,onClick:()=>{ot||Ve||(f(xe.hostId),g||Se())},role:"option","aria-selected":Ve,children:[ot?w.jsx("input",{ref:le,className:"form-input host-picker-rename-input",type:"text",value:F,onChange:Bt=>G(Bt.target.value),onKeyDown:Bt=>{Bt.key==="Enter"&&Kt(),Bt.key==="Escape"&&yn()},onBlur:Kt,onClick:Bt=>Bt.stopPropagation()}):w.jsx("span",{className:"host-picker-item-name",children:Fn}),w.jsxs("div",{className:"host-picker-item-actions",children:[Ve&&!ot&&w.jsx("button",{className:"host-picker-edit-btn",onClick:Bt=>{Bt.stopPropagation(),it(xe.hostId,Fn)},"aria-label":"Rename host",children:w.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:w.jsx("path",{d:"M9.5 1.5L11.5 3.5M1.5 11.5L2 9L9 2L11 4L4 11L1.5 11.5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),!Ve&&w.jsx("button",{className:"host-picker-delete-btn",onClick:Bt=>{Bt.stopPropagation(),O(xe.hostId)},"aria-label":`Unpair ${Fn}`,children:w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:w.jsx("path",{d:"M4 5.5V11C4 11.2761 4.22386 11.5 4.5 11.5H9.5C9.77614 11.5 10 11.2761 10 11V5.5M3 4H11M5.5 4V3C5.5 2.72386 5.72386 2.5 6 2.5H8C8.27614 2.5 8.5 2.72386 8.5 3V4M6.5 6.5V9.5M7.5 6.5V9.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})},xe.hostId)})})})]}),!z0&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-divider"}),w.jsx("div",{className:"drawer-section",children:w.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{y("/pair"),g||Se()},children:"Pair New Host"})})]}),L0&&w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-divider"}),w.jsxs("div",{className:"drawer-section",children:[w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Location Access"}),w.jsx("button",{className:`toggle-switch ${pe?"toggle-switch-on":""}`,onClick:gt,disabled:j,role:"switch","aria-checked":pe,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Notification Access"}),w.jsx("button",{className:`toggle-switch ${ve?"toggle-switch-on":""}`,onClick:we,disabled:J,role:"switch","aria-checked":ve,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"SMS Access"}),w.jsx("button",{className:`toggle-switch ${je?"toggle-switch-on":""}`,onClick:Le,disabled:N,role:"switch","aria-checked":je,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Contacts Access"}),w.jsx("button",{className:`toggle-switch ${De?"toggle-switch-on":""}`,onClick:$e,disabled:Z,role:"switch","aria-checked":De,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Calendar Access"}),w.jsx("button",{className:`toggle-switch ${Ce?"toggle-switch-on":""}`,onClick:jt,disabled:he,role:"switch","aria-checked":Ce,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Do Not Disturb Control"}),w.jsx("button",{className:`toggle-switch ${ze?"toggle-switch-on":""}`,onClick:gn,disabled:q,role:"switch","aria-checked":ze,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Alert Access"}),w.jsx("button",{className:`toggle-switch ${lt?"toggle-switch-on":""}`,onClick:An,disabled:ye,role:"switch","aria-checked":lt,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Battery Access"}),w.jsx("button",{className:`toggle-switch ${Fe?"toggle-switch-on":""}`,onClick:gr,disabled:R,role:"switch","aria-checked":Fe,children:w.jsx("span",{className:"toggle-switch-thumb"})})]}),w.jsxs("label",{className:"drawer-toggle",children:[w.jsx("span",{className:"drawer-toggle-label",children:"Email Access"}),w.jsx("button",{className:`toggle-switch ${qe?"toggle-switch-on":""}`,onClick:ti,disabled:te,role:"switch","aria-checked":qe,children:w.jsx("span",{className:"toggle-switch-thumb"})})]})]})]}),w.jsxs("div",{className:"drawer-footer",children:[e&&w.jsxs("div",{className:"drawer-version",children:["Palmier v",e]}),w.jsxs("div",{className:"drawer-legal",children:[w.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),w.jsx("span",{className:"drawer-legal-sep",children:"·"}),w.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),ht=se&&vu.createPortal(w.jsx("div",{className:"confirm-modal-overlay",onClick:()=>O(null),children:w.jsxs("div",{className:"confirm-modal",onClick:xe=>xe.stopPropagation(),children:[w.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),w.jsxs("p",{className:"confirm-modal-message",children:['"',((Dt=u.find(xe=>xe.hostId===se))==null?void 0:Dt.name)||se.slice(0,8),'" will be unpaired from this device.']}),w.jsxs("div",{className:"confirm-modal-actions",children:[w.jsx("button",{className:"btn btn-secondary",onClick:()=>O(null),children:"Cancel"}),w.jsx("button",{className:"btn btn-danger",onClick:()=>{m(se),O(null)},children:"Delete"})]})]})}),document.body);return g?w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:ni,children:It}),ht]}):w.jsxs(w.Fragment,{children:[w.jsx("button",{className:"hamburger-btn",onClick:Je,"aria-label":"Open menu",children:w.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:w.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),b&&vu.createPortal(w.jsx("div",{className:`drawer-overlay ${C?"drawer-overlay-closing":""}`,onClick:Se,onAnimationEnd:Pe,children:w.jsx("div",{className:`drawer-panel ${C?"drawer-panel-closing":""}`,ref:ni,onClick:xe=>xe.stopPropagation(),children:It})}),document.body),ht]})}const vk=10;function wk({connected:e,hostId:n,request:r,subscribeEvents:a,filterTaskId:l,onClearFilter:u}){const[c,f]=L.useState([]),[m,d]=L.useState(0),[y,g]=L.useState(!1),[b,v]=L.useState(!1),C=fa(),z=L.useRef(null),B=L.useCallback(O=>{const j={offset:O,limit:vk};return l&&(j.task_id=l),j},[l]),M=L.useCallback(async(O,j)=>{if(e){j?v(!0):g(!0);try{const Y=await r("taskrun.list",B(O)),J=Y.entries??[];d(Y.total??0),f(j?V=>{const N=new Set(V.map(Z=>`${Z.task_id}:${Z.run_id}`)),K=J.filter(Z=>!N.has(`${Z.task_id}:${Z.run_id}`));return[...V,...K]}:J)}catch(Y){Y instanceof Error&&Y.message==="Not connected"||console.error("Failed to load runs:",Y)}finally{g(!1),v(!1)}}},[e,r,B]);L.useEffect(()=>{e?(f([]),d(0),M(0,!1)):(f([]),d(0))},[e,n,M,l]),L.useEffect(()=>!e||!n?void 0:a(n,async j=>{try{const Y=JSON.parse(new TextDecoder().decode(j.data));if(Y.event_type==="running-state"&&Y.running_state&&["monitoring","started","finished","failed","aborted"].includes(Y.running_state)){const J=await r("taskrun.list",B(0)),V=J.entries??[];d(J.total??0),f(N=>{const K=new Map(V.map(H=>[`${H.task_id}:${H.run_id}`,H])),Z=N.map(H=>{const q=`${H.task_id}:${H.run_id}`;return K.get(q)??H}),ge=new Set(Z.map(H=>`${H.task_id}:${H.run_id}`));return[...V.filter(H=>!ge.has(`${H.task_id}:${H.run_id}`)),...Z]})}}catch{}}),[e,n,a,r]),L.useEffect(()=>{const O=z.current;if(!O)return;const j=new IntersectionObserver(Y=>{Y[0].isIntersecting&&!b&&c.length<m&&M(c.length,!0)},{threshold:.1});return j.observe(O),()=>j.disconnect()},[c.length,m,b,M]);function F(O,j){if(!O||!j)return"";const Y=Math.round((j-O)/1e3);if(Y<60)return`${Y}s`;const J=Math.floor(Y/60),V=Y%60;return`${J}m ${V}s`}const G={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function se(O){if(O==="failed")return"var(--color-error)";if(O==="aborted")return"var(--color-warning, #d97706)"}return y&&c.length===0&&e?w.jsx("div",{className:"task-list",children:[0,1,2].map(O=>w.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[w.jsx("div",{className:"task-card-header",children:w.jsx("div",{className:"task-card-title-row",children:w.jsx("div",{className:"skeleton-line",style:{width:`${70+O*10}%`}})})}),w.jsx("div",{className:"task-card-meta",children:w.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},O))}):!e||y&&c.length===0?w.jsx("div",{className:"runs-view",children:w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"Runs"}),w.jsx("p",{className:"empty-state-hint",children:"Run history will appear here"})]})}):c.length===0?w.jsxs(w.Fragment,{children:[l&&u&&w.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:w.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",w.jsx("button",{onClick:u,"aria-label":"Clear filter",children:"×"})]})}),w.jsx("div",{className:"runs-view",children:w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{className:"empty-state-text",children:"No runs yet"}),w.jsx("p",{className:"empty-state-hint",children:l?"This task hasn't been executed yet. Run it from the task menu or wait for its next trigger.":"Run history will appear here."})]})})]}):w.jsxs(w.Fragment,{children:[l&&u&&w.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:w.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",w.jsx("button",{onClick:u,"aria-label":"Clear filter",children:"×"})]})}),w.jsxs("div",{className:"task-list",children:[c.map((O,j)=>w.jsxs("div",{className:"runs-card",onClick:()=>!O.error&&C(`/runs/${O.task_id}/${encodeURIComponent(O.run_id)}`),children:[w.jsxs("div",{className:"runs-card-body",children:[w.jsx("h3",{className:"runs-card-name",children:O.task_name||O.task_id}),w.jsxs("div",{className:"runs-card-meta",children:[w.jsx("span",{style:{color:se(O.running_state)},children:G[O.running_state??""]??O.running_state}),O.end_time&&w.jsx("span",{children:Ou(O.end_time)}),O.start_time&&O.end_time&&w.jsx("span",{style:{color:"var(--color-muted)"},children:F(O.start_time,O.end_time)}),O.error&&w.jsx("span",{style:{color:"var(--color-muted)"},children:O.error})]})]}),w.jsx("span",{className:"runs-card-chevron",children:"›"})]},`${O.task_id}-${O.run_id}-${j}`)),w.jsx("div",{ref:z,style:{height:1}}),b&&w.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:w.jsx("div",{className:"spinner"})})]})]})}function Sk(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const _k=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ek=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kk={};function B0(e,n){return(kk.jsx?Ek:_k).test(e)}const Ck=/[ \t\n\f\r]/g;function Ak(e){return typeof e=="object"?e.type==="text"?P0(e.value):!1:P0(e)}function P0(e){return e.replace(Ck,"")===""}class Hl{constructor(n,r,a){this.normal=r,this.property=n,a&&(this.space=a)}}Hl.prototype.normal={};Hl.prototype.property={};Hl.prototype.space=void 0;function kx(e,n){const r={},a={};for(const l of e)Object.assign(r,l.property),Object.assign(a,l.normal);return new Hl(r,a,n)}function ud(e){return e.toLowerCase()}class Cn{constructor(n,r){this.attribute=r,this.property=n}}Cn.prototype.attribute="";Cn.prototype.booleanish=!1;Cn.prototype.boolean=!1;Cn.prototype.commaOrSpaceSeparated=!1;Cn.prototype.commaSeparated=!1;Cn.prototype.defined=!1;Cn.prototype.mustUseProperty=!1;Cn.prototype.number=!1;Cn.prototype.overloadedBoolean=!1;Cn.prototype.property="";Cn.prototype.spaceSeparated=!1;Cn.prototype.space=void 0;let Tk=0;const Ke=ha(),Yt=ha(),cd=ha(),_e=ha(),kt=ha(),ls=ha(),Ln=ha();function ha(){return 2**++Tk}const fd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ke,booleanish:Yt,commaOrSpaceSeparated:Ln,commaSeparated:ls,number:_e,overloadedBoolean:cd,spaceSeparated:kt},Symbol.toStringTag,{value:"Module"})),Th=Object.keys(fd);class Bd extends Cn{constructor(n,r,a,l){let u=-1;if(super(n,r),H0(this,"space",l),typeof a=="number")for(;++u<Th.length;){const c=Th[u];H0(this,Th[u],(a&fd[c])===fd[c])}}}Bd.prototype.defined=!0;function H0(e,n,r){r&&(e[n]=r)}function gs(e){const n={},r={};for(const[a,l]of Object.entries(e.properties)){const u=new Bd(a,e.transform(e.attributes||{},a),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(u.mustUseProperty=!0),n[a]=u,r[ud(a)]=a,r[ud(u.attribute)]=a}return new Hl(n,r,e.space)}const Cx=gs({properties:{ariaActiveDescendant:null,ariaAtomic:Yt,ariaAutoComplete:null,ariaBusy:Yt,ariaChecked:Yt,ariaColCount:_e,ariaColIndex:_e,ariaColSpan:_e,ariaControls:kt,ariaCurrent:null,ariaDescribedBy:kt,ariaDetails:null,ariaDisabled:Yt,ariaDropEffect:kt,ariaErrorMessage:null,ariaExpanded:Yt,ariaFlowTo:kt,ariaGrabbed:Yt,ariaHasPopup:null,ariaHidden:Yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:kt,ariaLevel:_e,ariaLive:null,ariaModal:Yt,ariaMultiLine:Yt,ariaMultiSelectable:Yt,ariaOrientation:null,ariaOwns:kt,ariaPlaceholder:null,ariaPosInSet:_e,ariaPressed:Yt,ariaReadOnly:Yt,ariaRelevant:null,ariaRequired:Yt,ariaRoleDescription:kt,ariaRowCount:_e,ariaRowIndex:_e,ariaRowSpan:_e,ariaSelected:Yt,ariaSetSize:_e,ariaSort:null,ariaValueMax:_e,ariaValueMin:_e,ariaValueNow:_e,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Ax(e,n){return n in e?e[n]:n}function Tx(e,n){return Ax(e,n.toLowerCase())}const jk=gs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ls,acceptCharset:kt,accessKey:kt,action:null,allow:null,allowFullScreen:Ke,allowPaymentRequest:Ke,allowUserMedia:Ke,alt:null,as:null,async:Ke,autoCapitalize:null,autoComplete:kt,autoFocus:Ke,autoPlay:Ke,blocking:kt,capture:null,charSet:null,checked:Ke,cite:null,className:kt,cols:_e,colSpan:null,content:null,contentEditable:Yt,controls:Ke,controlsList:kt,coords:_e|ls,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ke,defer:Ke,dir:null,dirName:null,disabled:Ke,download:cd,draggable:Yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ke,formTarget:null,headers:kt,height:_e,hidden:cd,high:_e,href:null,hrefLang:null,htmlFor:kt,httpEquiv:kt,id:null,imageSizes:null,imageSrcSet:null,inert:Ke,inputMode:null,integrity:null,is:null,isMap:Ke,itemId:null,itemProp:kt,itemRef:kt,itemScope:Ke,itemType:kt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ke,low:_e,manifest:null,max:null,maxLength:_e,media:null,method:null,min:null,minLength:_e,multiple:Ke,muted:Ke,name:null,nonce:null,noModule:Ke,noValidate:Ke,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ke,optimum:_e,pattern:null,ping:kt,placeholder:null,playsInline:Ke,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ke,referrerPolicy:null,rel:kt,required:Ke,reversed:Ke,rows:_e,rowSpan:_e,sandbox:kt,scope:null,scoped:Ke,seamless:Ke,selected:Ke,shadowRootClonable:Ke,shadowRootDelegatesFocus:Ke,shadowRootMode:null,shape:null,size:_e,sizes:null,slot:null,span:_e,spellCheck:Yt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_e,step:null,style:null,tabIndex:_e,target:null,title:null,translate:null,type:null,typeMustMatch:Ke,useMap:null,value:Yt,width:_e,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:kt,axis:null,background:null,bgColor:null,border:_e,borderColor:null,bottomMargin:_e,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ke,declare:Ke,event:null,face:null,frame:null,frameBorder:null,hSpace:_e,leftMargin:_e,link:null,longDesc:null,lowSrc:null,marginHeight:_e,marginWidth:_e,noResize:Ke,noHref:Ke,noShade:Ke,noWrap:Ke,object:null,profile:null,prompt:null,rev:null,rightMargin:_e,rules:null,scheme:null,scrolling:Yt,standby:null,summary:null,text:null,topMargin:_e,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_e,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ke,disableRemotePlayback:Ke,prefix:null,property:null,results:_e,security:null,unselectable:null},space:"html",transform:Tx}),Nk=gs({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:Ln,accentHeight:_e,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_e,amplitude:_e,arabicForm:null,ascent:_e,attributeName:null,attributeType:null,azimuth:_e,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_e,by:null,calcMode:null,capHeight:_e,className:kt,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:_e,diffuseConstant:_e,direction:null,display:null,dur:null,divisor:_e,dominantBaseline:null,download:Ke,dx:null,dy:null,edgeMode:null,editable:null,elevation:_e,enableBackground:null,end:null,event:null,exponent:_e,externalResourcesRequired:null,fill:null,fillOpacity:_e,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:ls,g2:ls,glyphName:ls,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_e,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_e,horizOriginX:_e,horizOriginY:_e,id:null,ideographic:_e,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_e,k:_e,k1:_e,k2:_e,k3:_e,k4:_e,kernelMatrix:Ln,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_e,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:_e,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:_e,overlineThickness:_e,paintOrder:null,panose1:null,path:null,pathLength:_e,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:kt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_e,pointsAtY:_e,pointsAtZ:_e,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ln,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ln,rev:Ln,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ln,requiredFeatures:Ln,requiredFonts:Ln,requiredFormats:Ln,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:_e,specularExponent:_e,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_e,strikethroughThickness:_e,string:null,stroke:null,strokeDashArray:Ln,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_e,strokeOpacity:_e,strokeWidth:null,style:null,surfaceScale:_e,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ln,tabIndex:_e,tableValues:null,target:null,targetX:_e,targetY:_e,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ln,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:_e,underlineThickness:_e,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_e,values:null,vAlphabetic:_e,vMathematical:_e,vectorEffect:null,vHanging:_e,vIdeographic:_e,version:null,vertAdvY:_e,vertOriginX:_e,vertOriginY:_e,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_e,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ax}),jx=gs({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()}}),Nx=gs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Tx}),Ox=gs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),Ok={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"},Rk=/[A-Z]/g,q0=/-[a-z]/g,Mk=/^data[-\w.:]+$/i;function Dk(e,n){const r=ud(n);let a=n,l=Cn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&Mk.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(q0,Lk);a="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!q0.test(u)){let c=u.replace(Rk,zk);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=Bd}return new l(a,n)}function zk(e){return"-"+e.toLowerCase()}function Lk(e){return e.charAt(1).toUpperCase()}const Uk=kx([Cx,jk,jx,Nx,Ox],"html"),Pd=kx([Cx,Nk,jx,Nx,Ox],"svg");function Bk(e){return e.join(" ").trim()}var Xa={},jh,I0;function Pk(){if(I0)return jh;I0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
91
|
+
`,d="/",y="*",g="",b="comment",v="declaration";function C(B,M){if(typeof B!="string")throw new TypeError("First argument must be a string");if(!B)return[];M=M||{};var F=1,G=1;function se(he){var H=he.match(n);H&&(F+=H.length);var q=he.lastIndexOf(m);G=~q?he.length-q:G+he.length}function O(){var he={line:F,column:G};return function(H){return H.position=new j(he),V(),H}}function j(he){this.start=he,this.end={line:F,column:G},this.source=M.source}j.prototype.content=B;function Y(he){var H=new Error(M.source+":"+F+":"+G+": "+he);if(H.reason=he,H.filename=M.source,H.line=F,H.column=G,H.source=B,!M.silent)throw H}function J(he){var H=he.exec(B);if(H){var q=H[0];return se(q),B=B.slice(q.length),H}}function V(){J(r)}function N(he){var H;for(he=he||[];H=K();)H!==!1&&he.push(H);return he}function K(){var he=O();if(!(d!=B.charAt(0)||y!=B.charAt(1))){for(var H=2;g!=B.charAt(H)&&(y!=B.charAt(H)||d!=B.charAt(H+1));)++H;if(H+=2,g===B.charAt(H-1))return Y("End of comment missing");var q=B.slice(2,H-2);return G+=2,se(q),B=B.slice(H),G+=2,he({type:b,comment:q})}}function Z(){var he=O(),H=J(a);if(H){if(K(),!J(l))return Y("property missing ':'");var q=J(u),re=he({type:v,property:z(H[0].replace(e,g)),value:q?z(q[0].replace(e,g)):g});return J(c),re}}function ge(){var he=[];N(he);for(var H;H=Z();)H!==!1&&(he.push(H),N(he));return he}return V(),ge()}function z(B){return B?B.replace(f,g):g}return jh=C,jh}var F0;function Hk(){if(F0)return Xa;F0=1;var e=Xa&&Xa.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.default=r;const n=e(Pk());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 Xa}var dl={},$0;function qk(){if($0)return dl;$0=1,Object.defineProperty(dl,"__esModule",{value:!0}),dl.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 dl.camelCase=m,dl}var ml,G0;function Ik(){if(G0)return ml;G0=1;var e=ml&&ml.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=e(Hk()),r=qk();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,ml=a,ml}var Fk=Ik();const $k=Nb(Fk),Rx=Mx("end"),Hd=Mx("start");function Mx(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 Gk(e){const n=Hd(e),r=Rx(e);if(n&&r)return{start:n,end:r}}function El(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?V0(e.position):"start"in e||"end"in e?V0(e):"line"in e||"column"in e?hd(e):""}function hd(e){return Y0(e&&e.line)+":"+Y0(e&&e.column)}function V0(e){return hd(e&&e.start)+"-"+hd(e&&e.end)}function Y0(e){return e&&typeof e=="number"?e:1}class un 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=El(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}}un.prototype.file="";un.prototype.name="";un.prototype.reason="";un.prototype.message="";un.prototype.stack="";un.prototype.column=void 0;un.prototype.line=void 0;un.prototype.ancestors=void 0;un.prototype.cause=void 0;un.prototype.fatal=void 0;un.prototype.place=void 0;un.prototype.ruleId=void 0;un.prototype.source=void 0;const qd={}.hasOwnProperty,Vk=new Map,Yk=/[A-Z]/g,Jk=new Set(["table","tbody","thead","tfoot","tr"]),Xk=new Set(["td","th"]),Dx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Kk(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=iC(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=rC(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"?Pd:Uk,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=zx(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function zx(e,n,r){if(n.type==="element")return Qk(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Zk(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return eC(e,n,r);if(n.type==="mdxjsEsm")return Wk(e,n);if(n.type==="root")return tC(e,n,r);if(n.type==="text")return nC(e,n)}function Qk(e,n,r){const a=e.schema;let l=a;n.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=Pd,e.schema=l),e.ancestors.push(n);const u=Ux(e,n.tagName,!1),c=aC(e,n);let f=Fd(e,n);return Jk.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!Ak(m):!0})),Lx(e,c,u,n),Id(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function Zk(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)}Rl(e,n.position)}function Wk(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Rl(e,n.position)}function eC(e,n,r){const a=e.schema;let l=a;n.name==="svg"&&a.space==="html"&&(l=Pd,e.schema=l),e.ancestors.push(n);const u=n.name===null?e.Fragment:Ux(e,n.name,!0),c=sC(e,n),f=Fd(e,n);return Lx(e,c,u,n),Id(c,f),e.ancestors.pop(),e.schema=a,e.create(n,u,c,r)}function tC(e,n,r){const a={};return Id(a,Fd(e,n)),e.create(n,e.Fragment,a,r)}function nC(e,n){return n.value}function Lx(e,n,r,a){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=a)}function Id(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function rC(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 iC(e,n){return r;function r(a,l,u,c){const f=Array.isArray(u.children),m=Hd(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 aC(e,n){const r={};let a,l;for(l in n.properties)if(l!=="children"&&qd.call(n.properties,l)){const u=lC(e,l,n.properties[l]);if(u){const[c,f]=u;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&Xk.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 sC(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 Rl(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 Rl(e,n.position);else u=a.value===null?!0:a.value;r[l]=u}return r}function Fd(e,n){const r=[];let a=-1;const l=e.passKeys?new Map:Vk;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=zx(e,u,c);f!==void 0&&r.push(f)}return r}function lC(e,n,r){const a=Dk(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?Sk(r):Bk(r)),a.property==="style"){let l=typeof r=="object"?r:oC(e,String(r));return e.stylePropertyNameCase==="css"&&(l=uC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&a.space?Ok[a.property]||a.property:a.attribute,r]}}function oC(e,n){try{return $k(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,l=new un("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=Dx+"#cannot-parse-style-attribute",l}}function Ux(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=B0(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=B0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(a.type==="Literal"){const l=a.value;return qd.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(a);Rl(e)}function Rl(e,n){const r=new un("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=Dx+"#cannot-handle-mdx-estrees-without-createevaluater",r}function uC(e){const n={};let r;for(r in e)qd.call(e,r)&&(n[cC(r)]=e[r]);return n}function cC(e){let n=e.replace(Yk,fC);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function fC(e){return"-"+e.toLowerCase()}const Nh={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"]},hC={};function $d(e,n){const r=hC,a=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Bx(e,a,l)}function Bx(e,n,r){if(dC(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 J0(e.children,n,r)}return Array.isArray(e)?J0(e,n,r):""}function J0(e,n,r){const a=[];let l=-1;for(;++l<e.length;)a[l]=Bx(e[l],n,r);return a.join("")}function dC(e){return!!(e&&typeof e=="object")}const X0=document.createElement("i");function Gd(e){const n="&"+e+";";X0.innerHTML=n;const r=X0.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function qn(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 nr(e,n){return e.length>0?(qn(e,e.length,0,n),e):n}const K0={}.hasOwnProperty;function Px(e){const n={};let r=-1;for(;++r<e.length;)mC(n,e[r]);return n}function mC(e,n){let r;for(r in n){const l=(K0.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let c;if(u)for(c in u){K0.call(l,c)||(l[c]=[]);const f=u[c];pC(l[c],Array.isArray(f)?f:f?[f]:[])}}}function pC(e,n){let r=-1;const a=[];for(;++r<n.length;)(n[r].add==="after"?e:a).push(n[r]);qn(e,0,0,a)}function Hx(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 pr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const mn=Hi(/[A-Za-z]/),on=Hi(/[\dA-Za-z]/),gC=Hi(/[#-'*+\--9=?A-Z^-~]/);function Ru(e){return e!==null&&(e<32||e===127)}const dd=Hi(/\d/),yC=Hi(/[\dA-Fa-f]/),bC=Hi(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function Et(e){return e!==null&&(e<0||e===32)}function et(e){return e===-2||e===-1||e===32}const Fu=Hi(new RegExp("\\p{P}|\\p{S}","u")),ca=Hi(/\s/);function Hi(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ys(e){const n=[];let r=-1,a=0,l=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&on(e.charCodeAt(r+1))&&on(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 at(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 xC={tokenize:vC};function vC(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"),at(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 He(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),c)}}const wC={tokenize:SC},Q0={tokenize:_C};function SC(e){const n=this,r=[];let a=0,l,u,c;return f;function f(G){if(a<r.length){const se=r[a];return n.containerState=se[1],e.attempt(se[0].continuation,m,d)(G)}return d(G)}function m(G){if(a++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&F();const se=n.events.length;let O=se,j;for(;O--;)if(n.events[O][0]==="exit"&&n.events[O][1].type==="chunkFlow"){j=n.events[O][1].end;break}M(a);let Y=se;for(;Y<n.events.length;)n.events[Y][1].end={...j},Y++;return qn(n.events,O+1,0,n.events.slice(se)),n.events.length=Y,d(G)}return f(G)}function d(G){if(a===r.length){if(!l)return b(G);if(l.currentConstruct&&l.currentConstruct.concrete)return C(G);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(Q0,y,g)(G)}function y(G){return l&&F(),M(a),b(G)}function g(G){return n.parser.lazy[n.now().line]=a!==r.length,c=n.now().offset,C(G)}function b(G){return n.containerState={},e.attempt(Q0,v,C)(G)}function v(G){return a++,r.push([n.currentConstruct,n.containerState]),b(G)}function C(G){if(G===null){l&&F(),M(0),e.consume(G);return}return l=l||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),z(G)}function z(G){if(G===null){B(e.exit("chunkFlow"),!0),M(0),e.consume(G);return}return He(G)?(e.consume(G),B(e.exit("chunkFlow")),a=0,n.interrupt=void 0,f):(e.consume(G),z)}function B(G,se){const O=n.sliceStream(G);if(se&&O.push(null),G.previous=u,u&&(u.next=G),u=G,l.defineSkip(G.start),l.write(O),n.parser.lazy[G.start.line]){let j=l.events.length;for(;j--;)if(l.events[j][1].start.offset<c&&(!l.events[j][1].end||l.events[j][1].end.offset>c))return;const Y=n.events.length;let J=Y,V,N;for(;J--;)if(n.events[J][0]==="exit"&&n.events[J][1].type==="chunkFlow"){if(V){N=n.events[J][1].end;break}V=!0}for(M(a),j=Y;j<n.events.length;)n.events[j][1].end={...N},j++;qn(n.events,J+1,0,n.events.slice(Y)),n.events.length=j}}function M(G){let se=r.length;for(;se-- >G;){const O=r[se];n.containerState=O[1],O[0].exit.call(n,e)}r.length=G}function F(){l.write([null]),u=void 0,l=void 0,n.containerState._closeFlow=void 0}}function _C(e,n,r){return at(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function hs(e){if(e===null||Et(e)||ca(e))return 1;if(Fu(e))return 2}function $u(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 md={name:"attention",resolveAll:EC,tokenize:kC};function EC(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};Z0(g,-m),Z0(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=nr(d,[["enter",e[a][1],n],["exit",e[a][1],n]])),d=nr(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=nr(d,$u(n.parser.constructs.insideSpan.null,e.slice(a+1,r),n)),d=nr(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=nr(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):y=0,qn(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 kC(e,n){const r=this.parser.constructs.attentionMarkers.null,a=this.previous,l=hs(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=hs(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 Z0(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const CC={name:"autolink",tokenize:AC};function AC(e,n,r){let a=0;return l;function l(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(v){return mn(v)?(e.consume(v),c):v===64?r(v):d(v)}function c(v){return v===43||v===45||v===46||on(v)?(a=1,f(v)):d(v)}function f(v){return v===58?(e.consume(v),a=0,m):(v===43||v===45||v===46||on(v))&&a++<32?(e.consume(v),f):(a=0,d(v))}function m(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),n):v===null||v===32||v===60||Ru(v)?r(v):(e.consume(v),m)}function d(v){return v===64?(e.consume(v),y):gC(v)?(e.consume(v),d):r(v)}function y(v){return on(v)?g(v):r(v)}function g(v){return v===46?(e.consume(v),a=0,y):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),n):b(v)}function b(v){if((v===45||on(v))&&a++<63){const C=v===45?b:g;return e.consume(v),C}return r(v)}}const ql={partial:!0,tokenize:TC};function TC(e,n,r){return a;function a(u){return et(u)?at(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||He(u)?n(u):r(u)}}const qx={continuation:{tokenize:NC},exit:OC,name:"blockQuote",tokenize:jC};function jC(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 NC(e,n,r){const a=this;return l;function l(c){return et(c)?at(e,u,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(qx,n,r)(c)}}function OC(e){e.exit("blockQuote")}const Ix={name:"characterEscape",tokenize:RC};function RC(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 bC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const Fx={name:"characterReference",tokenize:MC};function MC(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=on,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=yC,y):(e.enter("characterReferenceValue"),u=7,c=dd,y(g))}function y(g){if(g===59&&l){const b=e.exit("characterReferenceValue");return c===on&&!Gd(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 W0={partial:!0,tokenize:zC},eb={concrete:!0,name:"codeFenced",tokenize:DC};function DC(e,n,r){const a=this,l={partial:!0,tokenize:O};let u=0,c=0,f;return m;function m(j){return d(j)}function d(j){const Y=a.events[a.events.length-1];return u=Y&&Y[1].type==="linePrefix"?Y[2].sliceSerialize(Y[1],!0).length:0,f=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(j)}function y(j){return j===f?(c++,e.consume(j),y):c<3?r(j):(e.exit("codeFencedFenceSequence"),et(j)?at(e,g,"whitespace")(j):g(j))}function g(j){return j===null||He(j)?(e.exit("codeFencedFence"),a.interrupt?n(j):e.check(W0,z,se)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(j))}function b(j){return j===null||He(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(j)):et(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),at(e,v,"whitespace")(j)):j===96&&j===f?r(j):(e.consume(j),b)}function v(j){return j===null||He(j)?g(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(j))}function C(j){return j===null||He(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(j)):j===96&&j===f?r(j):(e.consume(j),C)}function z(j){return e.attempt(l,se,B)(j)}function B(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),M}function M(j){return u>0&&et(j)?at(e,F,"linePrefix",u+1)(j):F(j)}function F(j){return j===null||He(j)?e.check(W0,z,se)(j):(e.enter("codeFlowValue"),G(j))}function G(j){return j===null||He(j)?(e.exit("codeFlowValue"),F(j)):(e.consume(j),G)}function se(j){return e.exit("codeFenced"),n(j)}function O(j,Y,J){let V=0;return N;function N(H){return j.enter("lineEnding"),j.consume(H),j.exit("lineEnding"),K}function K(H){return j.enter("codeFencedFence"),et(H)?at(j,Z,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):Z(H)}function Z(H){return H===f?(j.enter("codeFencedFenceSequence"),ge(H)):J(H)}function ge(H){return H===f?(V++,j.consume(H),ge):V>=c?(j.exit("codeFencedFenceSequence"),et(H)?at(j,he,"whitespace")(H):he(H)):J(H)}function he(H){return H===null||He(H)?(j.exit("codeFencedFence"),Y(H)):J(H)}}}function zC(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 Oh={name:"codeIndented",tokenize:UC},LC={partial:!0,tokenize:BC};function UC(e,n,r){const a=this;return l;function l(d){return e.enter("codeIndented"),at(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):He(d)?e.attempt(LC,c,m)(d):(e.enter("codeFlowValue"),f(d))}function f(d){return d===null||He(d)?(e.exit("codeFlowValue"),c(d)):(e.consume(d),f)}function m(d){return e.exit("codeIndented"),n(d)}}function BC(e,n,r){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?r(c):He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):at(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):He(c)?l(c):r(c)}}const PC={name:"codeText",previous:qC,resolve:HC,tokenize:IC};function HC(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 qC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function IC(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)):He(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||He(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 FC{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&&pl(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),pl(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),pl(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);pl(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);pl(this.left,r.reverse())}}}function pl(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 $x(e){const n={};let r=-1,a,l,u,c,f,m,d;const y=new FC(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,$C(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 qn(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function $C(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,v=r,C=0,z=0;const B=[z];for(;v;){for(;e.get(++l)[1]!==v;);u.push(l),v._tokenizer||(y=a.sliceStream(v),v.next||y.push(null),g&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(y),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=v,v=v.next}for(v=r;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(z=b+1,B.push(z),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):B.pop(),b=B.length;b--;){const M=f.slice(B[b],B[b+1]),F=u.pop();m.push([F,F+M.length-1]),e.splice(F,2,M)}for(m.reverse(),b=-1;++b<m.length;)d[C+m[b][0]]=C+m[b][1],C+=m[b][1]-m[b][0]-1;return d}const GC={resolve:YC,tokenize:JC},VC={partial:!0,tokenize:XC};function YC(e){return $x(e),e}function JC(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):He(f)?e.check(VC,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 XC(e,n,r){const a=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),at(e,u,"linePrefix")}function u(c){if(c===null||He(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 Gx(e,n,r,a,l,u,c,f,m){const d=m||Number.POSITIVE_INFINITY;let y=0;return g;function g(M){return M===60?(e.enter(a),e.enter(l),e.enter(u),e.consume(M),e.exit(u),b):M===null||M===32||M===41||Ru(M)?r(M):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),z(M))}function b(M){return M===62?(e.enter(u),e.consume(M),e.exit(u),e.exit(l),e.exit(a),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),v(M))}function v(M){return M===62?(e.exit("chunkString"),e.exit(f),b(M)):M===null||M===60||He(M)?r(M):(e.consume(M),M===92?C:v)}function C(M){return M===60||M===62||M===92?(e.consume(M),v):v(M)}function z(M){return!y&&(M===null||M===41||Et(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),n(M)):y<d&&M===40?(e.consume(M),y++,z):M===41?(e.consume(M),y--,z):M===null||M===32||M===40||Ru(M)?r(M):(e.consume(M),M===92?B:z)}function B(M){return M===40||M===41||M===92?(e.consume(M),z):z(M)}}function Vx(e,n,r,a,l,u){const c=this;let f=0,m;return d;function d(v){return e.enter(a),e.enter(l),e.consume(v),e.exit(l),e.enter(u),y}function y(v){return f>999||v===null||v===91||v===93&&!m||v===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?r(v):v===93?(e.exit(u),e.enter(l),e.consume(v),e.exit(l),e.exit(a),n):He(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||He(v)||f++>999?(e.exit("chunkString"),y(v)):(e.consume(v),m||(m=!et(v)),v===92?b:g)}function b(v){return v===91||v===92||v===93?(e.consume(v),f++,g):g(v)}}function Yx(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):He(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),at(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===c||b===null||He(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 kl(e,n){let r;return a;function a(l){return He(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),r=!0,a):et(l)?at(e,a,r?"linePrefix":"lineSuffix")(l):n(l)}}const KC={name:"definition",tokenize:ZC},QC={partial:!0,tokenize:WC};function ZC(e,n,r){const a=this;let l;return u;function u(v){return e.enter("definition"),c(v)}function c(v){return Vx.call(a,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return l=pr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),m):r(v)}function m(v){return Et(v)?kl(e,d)(v):d(v)}function d(v){return Gx(e,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function y(v){return e.attempt(QC,g,g)(v)}function g(v){return et(v)?at(e,b,"whitespace")(v):b(v)}function b(v){return v===null||He(v)?(e.exit("definition"),a.parser.defined.push(l),n(v)):r(v)}}function WC(e,n,r){return a;function a(f){return Et(f)?kl(e,l)(f):r(f)}function l(f){return Yx(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return et(f)?at(e,c,"whitespace")(f):c(f)}function c(f){return f===null||He(f)?n(f):r(f)}}const eA={name:"hardBreakEscape",tokenize:tA};function tA(e,n,r){return a;function a(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return He(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const nA={name:"headingAtx",resolve:rA,tokenize:iA};function rA(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"},qn(e,a,r-a+1,[["enter",l,n],["enter",u,n],["exit",u,n],["exit",l,n]])),e}function iA(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||Et(y)?(e.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(e.enter("atxHeadingSequence"),m(y)):y===null||He(y)?(e.exit("atxHeading"),n(y)):et(y)?at(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||Et(y)?(e.exit("atxHeadingText"),f(y)):(e.consume(y),d)}}const aA=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],tb=["pre","script","style","textarea"],sA={concrete:!0,name:"htmlFlow",resolveTo:uA,tokenize:cA},lA={partial:!0,tokenize:hA},oA={partial:!0,tokenize:fA};function uA(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 cA(e,n,r){const a=this;let l,u,c,f,m;return d;function d(E){return y(E)}function y(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),g}function g(E){return E===33?(e.consume(E),b):E===47?(e.consume(E),u=!0,z):E===63?(e.consume(E),l=3,a.interrupt?n:R):mn(E)?(e.consume(E),c=String.fromCharCode(E),B):r(E)}function b(E){return E===45?(e.consume(E),l=2,v):E===91?(e.consume(E),l=5,f=0,C):mn(E)?(e.consume(E),l=4,a.interrupt?n:R):r(E)}function v(E){return E===45?(e.consume(E),a.interrupt?n:R):r(E)}function C(E){const ue="CDATA[";return E===ue.charCodeAt(f++)?(e.consume(E),f===ue.length?a.interrupt?n:Z:C):r(E)}function z(E){return mn(E)?(e.consume(E),c=String.fromCharCode(E),B):r(E)}function B(E){if(E===null||E===47||E===62||Et(E)){const ue=E===47,pe=c.toLowerCase();return!ue&&!u&&tb.includes(pe)?(l=1,a.interrupt?n(E):Z(E)):aA.includes(c.toLowerCase())?(l=6,ue?(e.consume(E),M):a.interrupt?n(E):Z(E)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?r(E):u?F(E):G(E))}return E===45||on(E)?(e.consume(E),c+=String.fromCharCode(E),B):r(E)}function M(E){return E===62?(e.consume(E),a.interrupt?n:Z):r(E)}function F(E){return et(E)?(e.consume(E),F):N(E)}function G(E){return E===47?(e.consume(E),N):E===58||E===95||mn(E)?(e.consume(E),se):et(E)?(e.consume(E),G):N(E)}function se(E){return E===45||E===46||E===58||E===95||on(E)?(e.consume(E),se):O(E)}function O(E){return E===61?(e.consume(E),j):et(E)?(e.consume(E),O):G(E)}function j(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(e.consume(E),m=E,Y):et(E)?(e.consume(E),j):J(E)}function Y(E){return E===m?(e.consume(E),m=null,V):E===null||He(E)?r(E):(e.consume(E),Y)}function J(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||Et(E)?O(E):(e.consume(E),J)}function V(E){return E===47||E===62||et(E)?G(E):r(E)}function N(E){return E===62?(e.consume(E),K):r(E)}function K(E){return E===null||He(E)?Z(E):et(E)?(e.consume(E),K):r(E)}function Z(E){return E===45&&l===2?(e.consume(E),q):E===60&&l===1?(e.consume(E),re):E===62&&l===4?(e.consume(E),U):E===63&&l===3?(e.consume(E),R):E===93&&l===5?(e.consume(E),Ee):He(E)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(lA,te,ge)(E)):E===null||He(E)?(e.exit("htmlFlowData"),ge(E)):(e.consume(E),Z)}function ge(E){return e.check(oA,he,te)(E)}function he(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),H}function H(E){return E===null||He(E)?ge(E):(e.enter("htmlFlowData"),Z(E))}function q(E){return E===45?(e.consume(E),R):Z(E)}function re(E){return E===47?(e.consume(E),c="",ye):Z(E)}function ye(E){if(E===62){const ue=c.toLowerCase();return tb.includes(ue)?(e.consume(E),U):Z(E)}return mn(E)&&c.length<8?(e.consume(E),c+=String.fromCharCode(E),ye):Z(E)}function Ee(E){return E===93?(e.consume(E),R):Z(E)}function R(E){return E===62?(e.consume(E),U):E===45&&l===2?(e.consume(E),R):Z(E)}function U(E){return E===null||He(E)?(e.exit("htmlFlowData"),te(E)):(e.consume(E),U)}function te(E){return e.exit("htmlFlow"),n(E)}}function fA(e,n,r){const a=this;return l;function l(c){return He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}function hA(e,n,r){return a;function a(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(ql,n,r)}}const dA={name:"htmlText",tokenize:mA};function mA(e,n,r){const a=this;let l,u,c;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),m}function m(R){return R===33?(e.consume(R),d):R===47?(e.consume(R),O):R===63?(e.consume(R),G):mn(R)?(e.consume(R),J):r(R)}function d(R){return R===45?(e.consume(R),y):R===91?(e.consume(R),u=0,C):mn(R)?(e.consume(R),F):r(R)}function y(R){return R===45?(e.consume(R),v):r(R)}function g(R){return R===null?r(R):R===45?(e.consume(R),b):He(R)?(c=g,re(R)):(e.consume(R),g)}function b(R){return R===45?(e.consume(R),v):g(R)}function v(R){return R===62?q(R):R===45?b(R):g(R)}function C(R){const U="CDATA[";return R===U.charCodeAt(u++)?(e.consume(R),u===U.length?z:C):r(R)}function z(R){return R===null?r(R):R===93?(e.consume(R),B):He(R)?(c=z,re(R)):(e.consume(R),z)}function B(R){return R===93?(e.consume(R),M):z(R)}function M(R){return R===62?q(R):R===93?(e.consume(R),M):z(R)}function F(R){return R===null||R===62?q(R):He(R)?(c=F,re(R)):(e.consume(R),F)}function G(R){return R===null?r(R):R===63?(e.consume(R),se):He(R)?(c=G,re(R)):(e.consume(R),G)}function se(R){return R===62?q(R):G(R)}function O(R){return mn(R)?(e.consume(R),j):r(R)}function j(R){return R===45||on(R)?(e.consume(R),j):Y(R)}function Y(R){return He(R)?(c=Y,re(R)):et(R)?(e.consume(R),Y):q(R)}function J(R){return R===45||on(R)?(e.consume(R),J):R===47||R===62||Et(R)?V(R):r(R)}function V(R){return R===47?(e.consume(R),q):R===58||R===95||mn(R)?(e.consume(R),N):He(R)?(c=V,re(R)):et(R)?(e.consume(R),V):q(R)}function N(R){return R===45||R===46||R===58||R===95||on(R)?(e.consume(R),N):K(R)}function K(R){return R===61?(e.consume(R),Z):He(R)?(c=K,re(R)):et(R)?(e.consume(R),K):V(R)}function Z(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),l=R,ge):He(R)?(c=Z,re(R)):et(R)?(e.consume(R),Z):(e.consume(R),he)}function ge(R){return R===l?(e.consume(R),l=void 0,H):R===null?r(R):He(R)?(c=ge,re(R)):(e.consume(R),ge)}function he(R){return R===null||R===34||R===39||R===60||R===61||R===96?r(R):R===47||R===62||Et(R)?V(R):(e.consume(R),he)}function H(R){return R===47||R===62||Et(R)?V(R):r(R)}function q(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),n):r(R)}function re(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ye}function ye(R){return et(R)?at(e,Ee,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):Ee(R)}function Ee(R){return e.enter("htmlTextData"),c(R)}}const Vd={name:"labelEnd",resolveAll:bA,resolveTo:xA,tokenize:vA},pA={tokenize:wA},gA={tokenize:SA},yA={tokenize:_A};function bA(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&&qn(e,0,e.length,r),e}function xA(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=nr(f,e.slice(u+1,u+a+3)),f=nr(f,[["enter",y,n]]),f=nr(f,$u(n.parser.constructs.insideSpan.null,e.slice(u+a+4,c-3),n)),f=nr(f,[["exit",y,n],e[c-2],e[c-1],["exit",d,n]]),f=nr(f,e.slice(c+1)),f=nr(f,[["exit",m,n]]),qn(e,u,e.length,f),e}function vA(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(pr(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(pA,y,c?y:g)(b):b===91?e.attempt(gA,y,c?d:g)(b):c?y(b):g(b)}function d(b){return e.attempt(yA,y,g)(b)}function y(b){return n(b)}function g(b){return u._balanced=!0,r(b)}}function wA(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 Et(g)?kl(e,u)(g):u(g)}function u(g){return g===41?y(g):Gx(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Et(g)?kl(e,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?Yx(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return Et(g)?kl(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 SA(e,n,r){const a=this;return l;function l(f){return Vx.call(a,e,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return a.parser.defined.includes(pr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function c(f){return r(f)}}function _A(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 EA={name:"labelStartImage",resolveAll:Vd.resolveAll,tokenize:kA};function kA(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 CA={name:"labelStartLink",resolveAll:Vd.resolveAll,tokenize:AA};function AA(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 Rh={name:"lineEnding",tokenize:TA};function TA(e,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),at(e,n,"linePrefix")}}const bu={name:"thematicBreak",tokenize:jA};function jA(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||He(d))?(e.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(e.consume(d),a++,m):(e.exit("thematicBreakSequence"),et(d)?at(e,f,"whitespace")(d):f(d))}}const En={continuation:{tokenize:MA},exit:zA,name:"list",tokenize:RA},NA={partial:!0,tokenize:LA},OA={partial:!0,tokenize:DA};function RA(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(v){const C=a.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!a.containerState.marker||v===a.containerState.marker:dd(v)){if(a.containerState.type||(a.containerState.type=C,e.enter(C,{_container:!0})),C==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(bu,r,d)(v):d(v);if(!a.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(v)}return r(v)}function m(v){return dd(v)&&++c<10?(e.consume(v),m):(!a.interrupt||c<2)&&(a.containerState.marker?v===a.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),d(v)):r(v)}function d(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||v,e.check(ql,a.interrupt?r:y,e.attempt(NA,b,g))}function y(v){return a.containerState.initialBlankLine=!0,u++,b(v)}function g(v){return et(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),b):r(v)}function b(v){return a.containerState.size=u+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(v)}}function MA(e,n,r){const a=this;return a.containerState._closeFlow=void 0,e.check(ql,l,u);function l(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,at(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(OA,n,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,at(e,e.attempt(En,n,r),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function DA(e,n,r){const a=this;return at(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 zA(e){e.exit(this.containerState.type)}function LA(e,n,r){const a=this;return at(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 nb={name:"setextUnderline",resolveTo:UA,tokenize:BA};function UA(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 BA(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)?at(e,m,"lineSuffix")(d):m(d))}function m(d){return d===null||He(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const PA={tokenize:HA};function HA(e){const n=this,r=e.attempt(ql,a,e.attempt(this.parser.constructs.flowInitial,l,at(e,e.attempt(this.parser.constructs.flow,l,e.attempt(GC,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 qA={resolveAll:Xx()},IA=Jx("string"),FA=Jx("text");function Jx(e){return{resolveAll:Xx(e==="text"?$A: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 v=g[b];if(!v.previous||v.previous.call(a,a.previous))return!0}return!1}}}function Xx(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 $A(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 GA={42:En,43:En,45:En,48:En,49:En,50:En,51:En,52:En,53:En,54:En,55:En,56:En,57:En,62:qx},VA={91:KC},YA={[-2]:Oh,[-1]:Oh,32:Oh},JA={35:nA,42:bu,45:[nb,bu],60:sA,61:nb,95:bu,96:eb,126:eb},XA={38:Fx,92:Ix},KA={[-5]:Rh,[-4]:Rh,[-3]:Rh,33:EA,38:Fx,42:md,60:[CC,dA],91:CA,92:[eA,Ix],93:Vd,95:md,96:PC},QA={null:[md,qA]},ZA={null:[42,95]},WA={null:[]},eT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ZA,contentInitial:VA,disable:WA,document:GA,flow:JA,flowInitial:YA,insideSpan:QA,string:XA,text:KA},Symbol.toStringTag,{value:"Module"}));function tT(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:Y(O),check:Y(j),consume:F,enter:G,exit:se,interrupt:Y(j,{interrupt:!0})},d={code:null,containerState:{},defineSkip:z,events:[],now:C,parser:e,previous:null,sliceSerialize:b,sliceStream:v,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(K){return c=nr(c,K),B(),c[c.length-1]!==null?[]:(J(n,0),d.events=$u(u,d.events,d),d.events)}function b(K,Z){return rT(v(K),Z)}function v(K){return nT(c,K)}function C(){const{_bufferIndex:K,_index:Z,line:ge,column:he,offset:H}=a;return{_bufferIndex:K,_index:Z,line:ge,column:he,offset:H}}function z(K){l[K.line]=K.column,N()}function B(){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;)M(Z.charCodeAt(a._bufferIndex));else M(Z)}}function M(K){y=y(K)}function F(K){He(K)?(a.line++,a.column=1,a.offset+=K===-3?2:1,N()):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 G(K,Z){const ge=Z||{};return ge.type=K,ge.start=C(),d.events.push(["enter",ge,d]),f.push(ge),ge}function se(K){const Z=f.pop();return Z.end=C(),d.events.push(["exit",Z,d]),Z}function O(K,Z){J(K,Z.from)}function j(K,Z){Z.restore()}function Y(K,Z){return ge;function ge(he,H,q){let re,ye,Ee,R;return Array.isArray(he)?te(he):"tokenize"in he?te([he]):U(he);function U(ve){return je;function je(De){const Ce=De!==null&&ve[De],ze=De!==null&&ve.null,lt=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(ze)?ze:ze?[ze]:[]];return te(lt)(De)}}function te(ve){return re=ve,ye=0,ve.length===0?q:E(ve[ye])}function E(ve){return je;function je(De){return R=V(),Ee=ve,ve.partial||(d.currentConstruct=ve),ve.name&&d.parser.constructs.disable.null.includes(ve.name)?pe():ve.tokenize.call(Z?Object.assign(Object.create(d),Z):d,m,ue,pe)(De)}}function ue(ve){return K(Ee,R),H}function pe(ve){return R.restore(),++ye<re.length?E(re[ye]):q}}}function J(K,Z){K.resolveAll&&!u.includes(K)&&u.push(K),K.resolve&&qn(d.events,Z,d.events.length-Z,K.resolve(d.events.slice(Z),d)),K.resolveTo&&(d.events=K.resolveTo(d.events,d))}function V(){const K=C(),Z=d.previous,ge=d.currentConstruct,he=d.events.length,H=Array.from(f);return{from:he,restore:q};function q(){a=K,d.previous=Z,d.currentConstruct=ge,d.events.length=he,f=H,N()}}function N(){a.line in l&&a.column<2&&(a.column=l[a.line],a.offset+=l[a.line]-1)}}function nT(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 rT(e,n){let r=-1;const a=[];let l;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
|
|
92
|
+
`;break}case-3:{c=`\r
|
|
93
|
+
`;break}case-2:{c=n?" ":" ";break}case-1:{if(!n&&l)continue;c=" ";break}default:c=String.fromCharCode(u)}l=u===-2,a.push(c)}return a.join("")}function iT(e){const a={constructs:Px([eT,...(e||{}).extensions||[]]),content:l(xC),defined:[],document:l(wC),flow:l(PA),lazy:{},string:l(IA),text:l(FA)};return a;function l(u){return c;function c(f){return tT(a,u,f)}}}function aT(e){for(;!$x(e););return e}const rb=/[\0\t\n\r]/g;function sT(){let e=1,n="",r=!0,a;return l;function l(u,c,f){const m=[];let d,y,g,b,v;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(rb.lastIndex=g,d=rb.exec(u),b=d&&d.index!==void 0?d.index:u.length,v=u.charCodeAt(b),!d){n=u.slice(g);break}if(v===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),v){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 lT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function oT(e){return e.replace(lT,uT)}function uT(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return Hx(r.slice(u?2:1),u?16:10)}return Gd(r)||e}const Kx={}.hasOwnProperty;function cT(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),fT(r)(aT(iT(r).document().write(sT()(e,n,!0))))}function fT(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(gn),autolinkProtocol:V,autolinkEmail:V,atxHeading:u(we),blockQuote:u(ze),characterEscape:V,characterReference:V,codeFenced:u(lt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(lt,c),codeText:u(Fe,c),codeTextData:V,data:V,codeFlowValue:V,definition:u(qe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(Be),hardBreakEscape:u(Le),hardBreakTrailing:u(Le),htmlFlow:u($e,c),htmlFlowData:V,htmlText:u($e,c),htmlTextData:V,image:u(jt),label:c,link:u(gn),listItem:u(An),listItemValue:b,listOrdered:u(ar,g),listUnordered:u(ar),paragraph:u(ti),reference:E,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(we),strong:u(gr),thematicBreak:u(ni)},exit:{atxHeading:m(),atxHeadingSequence:O,autolink:m(),autolinkEmail:Ce,autolinkProtocol:De,blockQuote:m(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:ve,characterReference:je,codeFenced:m(B),codeFencedFence:z,codeFencedFenceInfo:v,codeFencedFenceMeta:C,codeFlowValue:N,codeIndented:m(M),codeText:m(H),codeTextData:N,data:N,definition:m(),definitionDestinationString:se,definitionLabelString:F,definitionTitleString:G,emphasis:m(),hardBreakEscape:m(Z),hardBreakTrailing:m(Z),htmlFlow:m(ge),htmlFlowData:N,htmlText:m(he),htmlTextData:N,image:m(re),label:Ee,labelText:ye,lineEnding:K,link:m(q),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:ue,resourceDestinationString:R,resourceTitleString:U,resource:te,setextHeading:m(J),setextHeadingLineSequence:Y,setextHeadingText:j,strong:m(),thematicBreak:m()}};Qx(n,(e||{}).mdastExtensions||[]);const r={};return a;function a(le){let Se={type:"root",children:[]};const Pe={stack:[Se],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},Je=[];let it=-1;for(;++it<le.length;)if(le[it][1].type==="listOrdered"||le[it][1].type==="listUnordered")if(le[it][0]==="enter")Je.push(it);else{const Kt=Je.pop();it=l(le,Kt,it)}for(it=-1;++it<le.length;){const Kt=n[le[it][0]];Kx.call(Kt,le[it][1].type)&&Kt[le[it][1].type].call(Object.assign({sliceSerialize:le[it][2].sliceSerialize},Pe),le[it][1])}if(Pe.tokenStack.length>0){const Kt=Pe.tokenStack[Pe.tokenStack.length-1];(Kt[1]||ib).call(Pe,void 0,Kt[0])}for(Se.position={start:Oi(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:Oi(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},it=-1;++it<n.transforms.length;)Se=n.transforms[it](Se)||Se;return Se}function l(le,Se,Pe){let Je=Se-1,it=-1,Kt=!1,yn,It,ht,Dt;for(;++Je<=Pe;){const xe=le[Je];switch(xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xe[0]==="enter"?it++:it--,Dt=void 0;break}case"lineEndingBlank":{xe[0]==="enter"&&(yn&&!Dt&&!it&&!ht&&(ht=Je),Dt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Dt=void 0}if(!it&&xe[0]==="enter"&&xe[1].type==="listItemPrefix"||it===-1&&xe[0]==="exit"&&(xe[1].type==="listUnordered"||xe[1].type==="listOrdered")){if(yn){let Ve=Je;for(It=void 0;Ve--;){const ot=le[Ve];if(ot[1].type==="lineEnding"||ot[1].type==="lineEndingBlank"){if(ot[0]==="exit")continue;It&&(le[It][1].type="lineEndingBlank",Kt=!0),ot[1].type="lineEnding",It=Ve}else if(!(ot[1].type==="linePrefix"||ot[1].type==="blockQuotePrefix"||ot[1].type==="blockQuotePrefixWhitespace"||ot[1].type==="blockQuoteMarker"||ot[1].type==="listItemIndent"))break}ht&&(!It||ht<It)&&(yn._spread=!0),yn.end=Object.assign({},It?le[It][1].start:xe[1].end),le.splice(It||Je,0,["exit",yn,xe[2]]),Je++,Pe++}if(xe[1].type==="listItemPrefix"){const Ve={type:"listItem",_spread:!1,start:Object.assign({},xe[1].start),end:void 0};yn=Ve,le.splice(Je,0,["enter",Ve,xe[2]]),Je++,Pe++,ht=void 0,Dt=!0}}}return le[Se][1]._spread=Kt,Pe}function u(le,Se){return Pe;function Pe(Je){f.call(this,le(Je),Je),Se&&Se.call(this,Je)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(le,Se,Pe){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([Se,Pe||void 0]),le.position={start:Oi(Se.start),end:void 0}}function m(le){return Se;function Se(Pe){le&&le.call(this,Pe),d.call(this,Pe)}}function d(le,Se){const Pe=this.stack.pop(),Je=this.tokenStack.pop();if(Je)Je[0].type!==le.type&&(Se?Se.call(this,le,Je[0]):(Je[1]||ib).call(this,le,Je[0]));else throw new Error("Cannot close `"+le.type+"` ("+El({start:le.start,end:le.end})+"): it’s not open");Pe.position.end=Oi(le.end)}function y(){return $d(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(le){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function v(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=le}function C(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=le}function z(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function B(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.value=le.replace(/(\r?\n|\r)$/g,"")}function F(le){const Se=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=Se,Pe.identifier=pr(this.sliceSerialize(le)).toLowerCase()}function G(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.title=le}function se(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.url=le}function O(le){const Se=this.stack[this.stack.length-1];if(!Se.depth){const Pe=this.sliceSerialize(le).length;Se.depth=Pe}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function Y(le){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function J(){this.data.setextHeadingSlurpLineEnding=void 0}function V(le){const Pe=this.stack[this.stack.length-1].children;let Je=Pe[Pe.length-1];(!Je||Je.type!=="text")&&(Je=gt(),Je.position={start:Oi(le.start),end:void 0},Pe.push(Je)),this.stack.push(Je)}function N(le){const Se=this.stack.pop();Se.value+=this.sliceSerialize(le),Se.position.end=Oi(le.end)}function K(le){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Pe=Se.children[Se.children.length-1];Pe.position.end=Oi(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(Se.type)&&(V.call(this,le),N.call(this,le))}function Z(){this.data.atHardBreak=!0}function ge(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.value=le}function he(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.value=le}function H(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.value=le}function q(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Se,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function re(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Se,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ye(le){const Se=this.sliceSerialize(le),Pe=this.stack[this.stack.length-2];Pe.label=oT(Se),Pe.identifier=pr(Se).toLowerCase()}function Ee(){const le=this.stack[this.stack.length-1],Se=this.resume(),Pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Pe.type==="link"){const Je=le.children;Pe.children=Je}else Pe.alt=Se}function R(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.url=le}function U(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.title=le}function te(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function ue(le){const Se=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=Se,Pe.identifier=pr(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function pe(le){this.data.characterReferenceType=le.type}function ve(le){const Se=this.sliceSerialize(le),Pe=this.data.characterReferenceType;let Je;Pe?(Je=Hx(Se,Pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Je=Gd(Se);const it=this.stack[this.stack.length-1];it.value+=Je}function je(le){const Se=this.stack.pop();Se.position.end=Oi(le.end)}function De(le){N.call(this,le);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(le)}function Ce(le){N.call(this,le);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(le)}function ze(){return{type:"blockquote",children:[]}}function lt(){return{type:"code",lang:null,meta:null,value:""}}function Fe(){return{type:"inlineCode",value:""}}function qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Be(){return{type:"emphasis",children:[]}}function we(){return{type:"heading",depth:0,children:[]}}function Le(){return{type:"break"}}function $e(){return{type:"html",value:""}}function jt(){return{type:"image",title:null,url:"",alt:null}}function gn(){return{type:"link",title:null,url:"",children:[]}}function ar(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function An(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function ti(){return{type:"paragraph",children:[]}}function gr(){return{type:"strong",children:[]}}function gt(){return{type:"text",value:""}}function ni(){return{type:"thematicBreak"}}}function Oi(e){return{line:e.line,column:e.column,offset:e.offset}}function Qx(e,n){let r=-1;for(;++r<n.length;){const a=n[r];Array.isArray(a)?Qx(e,a):hT(e,a)}}function hT(e,n){let r;for(r in n)if(Kx.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 ib(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+El({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+El({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+El({start:n.start,end:n.end})+") is still open")}function dT(e){const n=this;n.parser=r;function r(a){return cT(a,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function mT(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 pT(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
|
|
94
|
+
`}]}function gT(e,n){const r=n.value?n.value+`
|
|
95
|
+
`:"",a={},l=n.lang?n.lang.split(/\s+/):[];l.length>0&&(a.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:a,children:[{type:"text",value:r}]};return n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function yT(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function bT(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function xT(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(n.identifier).toUpperCase(),l=ys(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 vT(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 wT(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function Zx(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 ST(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return Zx(e,n);const l={src:ys(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 _T(e,n){const r={src:ys(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 ET(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 kT(e,n){const r=String(n.identifier).toUpperCase(),a=e.definitionById.get(r);if(!a)return Zx(e,n);const l={href:ys(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 CT(e,n){const r={href:ys(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 AT(e,n,r){const a=e.all(n),l=r?TT(r):Wx(n),u={},c=[];if(typeof n.checked=="boolean"){const y=a[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const y=a[f];(l||f!==0||y.type!=="element"||y.tagName!=="p")&&c.push({type:"text",value:`
|
|
96
|
+
`}),y.type==="element"&&y.tagName==="p"&&!l?c.push(...y.children):c.push(y)}const m=a[a.length-1];m&&(l||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
97
|
+
`});const d={type:"element",tagName:"li",properties:u,children:c};return e.patch(n,d),e.applyData(n,d)}function TT(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=Wx(r[a])}return n}function Wx(e){const n=e.spread;return n??e.children.length>1}function jT(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 NT(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function OT(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function RT(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function MT(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=Hd(n.children[1]),m=Rx(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 DT(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={},v=c?c[m]:void 0;v&&(b.align=v);let C={type:"element",tagName:u,properties:b,children:[]};g&&(C.children=e.all(g),e.patch(g,C),C=e.applyData(g,C)),d.push(C)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,y),e.applyData(n,y)}function zT(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const ab=9,sb=32;function LT(e){const n=String(e),r=/\r?\n|\r/g;let a=r.exec(n),l=0;const u=[];for(;a;)u.push(lb(n.slice(l,a.index),l>0,!0),a[0]),l=a.index+a[0].length,a=r.exec(n);return u.push(lb(n.slice(l),l>0,!1)),u.join("")}function lb(e,n,r){let a=0,l=e.length;if(n){let u=e.codePointAt(a);for(;u===ab||u===sb;)a++,u=e.codePointAt(a)}if(r){let u=e.codePointAt(l-1);for(;u===ab||u===sb;)l--,u=e.codePointAt(l-1)}return l>a?e.slice(a,l):""}function UT(e,n){const r={type:"text",value:LT(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function BT(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const PT={blockquote:mT,break:pT,code:gT,delete:yT,emphasis:bT,footnoteReference:xT,heading:vT,html:wT,imageReference:ST,image:_T,inlineCode:ET,linkReference:kT,link:CT,listItem:AT,list:jT,paragraph:NT,root:OT,strong:RT,table:MT,tableCell:zT,tableRow:DT,text:UT,thematicBreak:BT,toml:uu,yaml:uu,definition:uu,footnoteDefinition:uu};function uu(){}const e1=-1,Gu=0,Cl=1,Mu=2,Yd=3,Jd=4,Xd=5,Kd=6,t1=7,n1=8,ob=typeof self=="object"?self:globalThis,HT=(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 Gu:case e1:return r(c,l);case Cl:{const f=r([],l);for(const m of c)f.push(a(m));return f}case Mu:{const f=r({},l);for(const[m,d]of c)f[a(m)]=a(d);return f}case Yd:return r(new Date(c),l);case Jd:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case Xd:{const f=r(new Map,l);for(const[m,d]of c)f.set(a(m),a(d));return f}case Kd:{const f=r(new Set,l);for(const m of c)f.add(a(m));return f}case t1:{const{name:f,message:m}=c;return r(new ob[f](m),l)}case n1: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 ob[u](c),l)};return a},ub=e=>HT(new Map,e)(0),Ka="",{toString:qT}={},{keys:IT}=Object,gl=e=>{const n=typeof e;if(n!=="object"||!e)return[Gu,n];const r=qT.call(e).slice(8,-1);switch(r){case"Array":return[Cl,Ka];case"Object":return[Mu,Ka];case"Date":return[Yd,Ka];case"RegExp":return[Jd,Ka];case"Map":return[Xd,Ka];case"Set":return[Kd,Ka];case"DataView":return[Cl,r]}return r.includes("Array")?[Cl,r]:r.includes("Error")?[t1,r]:[Mu,r]},cu=([e,n])=>e===Gu&&(n==="function"||n==="symbol"),FT=(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]=gl(c);switch(f){case Gu:{let y=c;switch(m){case"bigint":f=n1,y=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([e1],c)}return l([f,y],c)}case Cl:{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 Mu:{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 IT(c))(e||!cu(gl(c[b])))&&y.push([u(b),u(c[b])]);return g}case Yd:return l([f,c.toISOString()],c);case Jd:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Xd:{const y=[],g=l([f,y],c);for(const[b,v]of c)(e||!(cu(gl(b))||cu(gl(v))))&&y.push([u(b),u(v)]);return g}case Kd:{const y=[],g=l([f,y],c);for(const b of c)(e||!cu(gl(b)))&&y.push(u(b));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},cb=(e,{json:n,lossy:r}={})=>{const a=[];return FT(!(n||r),!!n,new Map,a)(e),a},Du=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?ub(cb(e,n)):structuredClone(e):(e,n)=>ub(cb(e,n));function $T(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 GT(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function VT(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||$T,a=e.options.footnoteBackLabel||GT,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=ys(g.toLowerCase());let v=0;const C=[],z=e.footnoteCounts.get(g);for(;z!==void 0&&++v<=z;){C.length>0&&C.push({type:"text",value:" "});let F=typeof r=="string"?r:r(m,v);typeof F=="string"&&(F={type:"text",value:F}),C.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,v),className:["data-footnote-backref"]},children:Array.isArray(F)?F:[F]})}const B=y[y.length-1];if(B&&B.type==="element"&&B.tagName==="p"){const F=B.children[B.children.length-1];F&&F.type==="text"?F.value+=" ":B.children.push({type:"text",value:" "}),B.children.push(...C)}else y.push(...C);const M={type:"element",tagName:"li",properties:{id:n+"fn-"+b},children:e.wrap(y,!0)};e.patch(d,M),f.push(M)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Du(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
98
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
99
|
+
`}]}}const Vu=(function(e){if(e==null)return KT;if(typeof e=="function")return Yu(e);if(typeof e=="object")return Array.isArray(e)?YT(e):JT(e);if(typeof e=="string")return XT(e);throw new Error("Expected function, string, or object as test")});function YT(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Vu(e[r]);return Yu(a);function a(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function JT(e){const n=e;return Yu(r);function r(a){const l=a;let u;for(u in e)if(l[u]!==n[u])return!1;return!0}}function XT(e){return Yu(n);function n(r){return r&&r.type===e}}function Yu(e){return n;function n(r,a,l){return!!(QT(r)&&e.call(this,r,typeof a=="number"?a:void 0,l||void 0))}}function KT(){return!0}function QT(e){return e!==null&&typeof e=="object"&&"type"in e}const r1=[],ZT=!0,pd=!1,WT="skip";function i1(e,n,r,a){let l;typeof n=="function"&&typeof r!="function"?(a=r,r=n):l=n;const u=Vu(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 v=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(v?"<"+v+">":""))+")"})}return b;function b(){let v=r1,C,z,B;if((!n||u(m,d,y[y.length-1]||void 0))&&(v=e3(r(m,y)),v[0]===pd))return v;if("children"in m&&m.children){const M=m;if(M.children&&v[0]!==WT)for(z=(a?M.children.length:-1)+c,B=y.concat(M);z>-1&&z<M.children.length;){const F=M.children[z];if(C=f(F,z,B)(),C[0]===pd)return C;z=typeof C[1]=="number"?C[1]:z+c}}return v}}}function e3(e){return Array.isArray(e)?e:typeof e=="number"?[ZT,e]:e==null?r1:[e]}function Qd(e,n,r,a){let l,u,c;typeof n=="function"&&typeof r!="function"?(u=void 0,c=n,l=r):(u=n,c=r,l=a),i1(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 gd={}.hasOwnProperty,t3={};function n3(e,n){const r=n||t3,a=new Map,l=new Map,u=new Map,c={...PT,...r.handlers},f={all:d,applyData:i3,definitionById:a,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:r3,wrap:s3};return Qd(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?a:l,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),f;function m(y,g){const b=y.type,v=f.handlers[b];if(gd.call(f.handlers,b)&&v)return v(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in y){const{children:z,...B}=y,M=Du(B);return M.children=f.all(y),M}return Du(y)}return(f.options.unknownHandler||a3)(f,y,g)}function d(y){const g=[];if("children"in y){const b=y.children;let v=-1;for(;++v<b.length;){const C=f.one(b[v],y);if(C){if(v&&b[v-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=fb(C.value)),!Array.isArray(C)&&C.type==="element")){const z=C.children[0];z&&z.type==="text"&&(z.value=fb(z.value))}Array.isArray(C)?g.push(...C):g.push(C)}}}return g}}function r3(e,n){e.position&&(n.position=Gk(e))}function i3(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,Du(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function a3(e,n){const r=n.data||{},a="value"in n&&!(gd.call(r,"hProperties")||gd.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 s3(e,n){const r=[];let a=-1;for(n&&r.push({type:"text",value:`
|
|
100
|
+
`});++a<e.length;)a&&r.push({type:"text",value:`
|
|
101
|
+
`}),r.push(e[a]);return n&&e.length>0&&r.push({type:"text",value:`
|
|
102
|
+
`}),r}function fb(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function hb(e,n){const r=n3(e,n),a=r.one(e,void 0),l=VT(r),u=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
|
|
103
|
+
`},l),u}function l3(e,n){return e&&"run"in e?async function(r,a){const l=hb(r,{file:a,...n});await e.run(l,a)}:function(r,a){return hb(r,{file:a,...e||n})}}function db(e){if(e)throw e}var Mh,mb;function o3(){if(mb)return Mh;mb=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 Mh=function m(){var d,y,g,b,v,C,z=arguments[0],B=1,M=arguments.length,F=!1;for(typeof z=="boolean"&&(F=z,z=arguments[1]||{},B=2),(z==null||typeof z!="object"&&typeof z!="function")&&(z={});B<M;++B)if(d=arguments[B],d!=null)for(y in d)g=f(z,y),b=f(d,y),z!==b&&(F&&b&&(u(b)||(v=l(b)))?(v?(v=!1,C=g&&l(g)?g:[]):C=g&&u(g)?g:{},c(z,{name:y,newValue:m(F,C,b)})):typeof b<"u"&&c(z,{name:y,newValue:b}));return z},Mh}var u3=o3();const Dh=Nb(u3);function yd(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 c3(){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?f3(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 f3(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 Sr={basename:h3,dirname:d3,extname:m3,join:p3,sep:"/"};function h3(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Il(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 d3(e){if(Il(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 m3(e){Il(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 p3(...e){let n=-1,r;for(;++n<e.length;)Il(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":g3(r)}function g3(e){Il(e);const n=e.codePointAt(0)===47;let r=y3(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function y3(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 Il(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const b3={cwd:x3};function x3(){return"/"}function bd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function v3(e){if(typeof e=="string")e=new URL(e);else if(!bd(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 w3(e)}function w3(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 zh=["history","path","basename","stem","extname","dirname"];class a1{constructor(n){let r;n?bd(n)?r={path:n}:typeof n=="string"||S3(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":b3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<zh.length;){const u=zh[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)zh.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?Sr.basename(this.path):void 0}set basename(n){Uh(n,"basename"),Lh(n,"basename"),this.path=Sr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?Sr.dirname(this.path):void 0}set dirname(n){pb(this.basename,"dirname"),this.path=Sr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?Sr.extname(this.path):void 0}set extname(n){if(Lh(n,"extname"),pb(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=Sr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){bd(n)&&(n=v3(n)),Uh(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?Sr.basename(this.path,this.extname):void 0}set stem(n){Uh(n,"stem"),Lh(n,"stem"),this.path=Sr.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 un(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 Lh(e,n){if(e&&e.includes(Sr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+Sr.sep+"`")}function Uh(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function pb(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function S3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const _3=(function(e){const a=this.constructor.prototype,l=a[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,a),u}),E3={}.hasOwnProperty;class Zd extends _3{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=c3()}copy(){const n=new Zd;let r=-1;for(;++r<this.attachers.length;){const a=this.attachers[r];n.use(...a)}return n.data(Dh(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Hh("data",this.frozen),this.namespace[n]=r,this):E3.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Hh("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=fu(n),a=this.parser||this.Parser;return Bh("parse",a),a(String(r),r)}process(n,r){const a=this;return this.freeze(),Bh("process",this.parser||this.Parser),Ph("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=fu(n),m=a.parse(f);a.run(m,f,function(y,g,b){if(y||!g||!b)return d(y);const v=g,C=a.stringify(v,b);A3(C)?b.value=C:b.result=C,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(),Bh("processSync",this.parser||this.Parser),Ph("processSync",this.compiler||this.Compiler),this.process(n,l),yb("processSync","process",r),a;function l(u,c){r=!0,db(u),a=c}}run(n,r,a){gb(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=fu(r);l.run(n,m,d);function d(y,g,b){const v=g||n;y?f(y):c?c(v):a(void 0,v,b)}}}runSync(n,r){let a=!1,l;return this.run(n,r,u),yb("runSync","run",a),l;function u(c,f){db(c),l=f,a=!0}}stringify(n,r){this.freeze();const a=fu(r),l=this.compiler||this.Compiler;return Ph("stringify",l),gb(n),l(n,a)}use(n,...r){const a=this.attachers,l=this.namespace;if(Hh("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=Dh(!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[v,...C]=y;const z=a[b][1];yd(z)&&yd(v)&&(v=Dh(!0,z,v)),a[b]=[d,v,...C]}}}}const k3=new Zd().freeze();function Bh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ph(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Hh(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 gb(e){if(!yd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function yb(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function fu(e){return C3(e)?e:new a1(e)}function C3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function A3(e){return typeof e=="string"||T3(e)}function T3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const j3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bb=[],xb={allowDangerousHtml:!0},N3=/^(https?|ircs?|mailto|xmpp)$/i,O3=[{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 vb(e){const n=R3(e),r=M3(e);return D3(n.runSync(n.parse(r),r),e)}function R3(e){const n=e.rehypePlugins||bb,r=e.remarkPlugins||bb,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...xb}:xb;return k3().use(dT).use(r).use(l3,a).use(n)}function M3(e){const n=e.children||"",r=new a1;return typeof n=="string"&&(r.value=n),r}function D3(e,n){const r=n.allowedElements,a=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||z3;for(const y of O3)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+j3+y.id,void 0);return Qd(e,d),Kk(e,{Fragment:w.Fragment,components:l,ignoreInvalidStyle:!0,jsx:w.jsx,jsxs:w.jsxs,passKeys:!0,passNode:!0});function d(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return c?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let v;for(v in Nh)if(Object.hasOwn(Nh,v)&&Object.hasOwn(y.properties,v)){const C=y.properties[v],z=Nh[v];(z===null||z.includes(y.tagName))&&(y.properties[v]=m(String(C||""),v,y))}}if(y.type==="element"){let v=r?!r.includes(y.tagName):u?u.includes(y.tagName):!1;if(!v&&a&&typeof g=="number"&&(v=!a(y,g,b)),v&&b&&typeof g=="number")return f&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function z3(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||N3.test(e.slice(0,n))?e:""}function wb(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 L3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function s1(e,n,r){const l=Vu((r||{}).ignore||[]),u=U3(n);let c=-1;for(;++c<u.length;)i1(e,"text",f);function f(d,y){let g=-1,b;for(;++g<y.length;){const v=y[g],C=b?b.children:void 0;if(l(v,C?C.indexOf(v):void 0,b))return;b=v}if(b)return m(d,y)}function m(d,y){const g=y[y.length-1],b=u[c][0],v=u[c][1];let C=0;const B=g.children.indexOf(d);let M=!1,F=[];b.lastIndex=0;let G=b.exec(d.value);for(;G;){const se=G.index,O={index:G.index,input:G.input,stack:[...y,d]};let j=v(...G,O);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?b.lastIndex=se+1:(C!==se&&F.push({type:"text",value:d.value.slice(C,se)}),Array.isArray(j)?F.push(...j):j&&F.push(j),C=se+G[0].length,M=!0),!b.global)break;G=b.exec(d.value)}return M?(C<d.value.length&&F.push({type:"text",value:d.value.slice(C)}),g.children.splice(B,1,...F)):F=[d],B+F.length}}function U3(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([B3(l[0]),P3(l[1])])}return n}function B3(e){return typeof e=="string"?new RegExp(L3(e),"g"):e}function P3(e){return typeof e=="function"?e:function(){return e}}const qh="phrasing",Ih=["autolink","link","image","label"];function H3(){return{transforms:[Y3],enter:{literalAutolink:I3,literalAutolinkEmail:Fh,literalAutolinkHttp:Fh,literalAutolinkWww:Fh},exit:{literalAutolink:V3,literalAutolinkEmail:G3,literalAutolinkHttp:F3,literalAutolinkWww:$3}}}function q3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:qh,notInConstruct:Ih},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:qh,notInConstruct:Ih},{character:":",before:"[ps]",after:"\\/",inConstruct:qh,notInConstruct:Ih}]}}function I3(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Fh(e){this.config.enter.autolinkProtocol.call(this,e)}function F3(e){this.config.exit.autolinkProtocol.call(this,e)}function $3(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 G3(e){this.config.exit.autolinkEmail.call(this,e)}function V3(e){this.exit(e)}function Y3(e){s1(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,J3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),X3]],{ignore:["link","linkReference"]})}function J3(e,n,r,a,l){let u="";if(!l1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!K3(r)))return!1;const c=Q3(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 X3(e,n,r,a){return!l1(a,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function K3(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 Q3(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=wb(e,"(");let u=wb(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 l1(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||ca(r)||Fu(r))&&(!n||r!==47)}o1.peek=sj;function Z3(){this.buffer()}function W3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ej(){this.buffer()}function tj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function nj(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=pr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function rj(e){this.exit(e)}function ij(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=pr(this.sliceSerialize(e)).toLowerCase(),r.label=n}function aj(e){this.exit(e)}function sj(){return"["}function o1(e,n,r,a){const l=r.createTracker(a);let u=l.move("[^");const c=r.enter("footnoteReference"),f=r.enter("reference");return u+=l.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),c(),u+=l.move("]"),u}function lj(){return{enter:{gfmFootnoteCallString:Z3,gfmFootnoteCall:W3,gfmFootnoteDefinitionLabelString:ej,gfmFootnoteDefinition:tj},exit:{gfmFootnoteCallString:nj,gfmFootnoteCall:rj,gfmFootnoteDefinitionLabelString:ij,gfmFootnoteDefinition:aj}}}function oj(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:o1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(a,l,u,c){const f=u.createTracker(c);let m=f.move("[^");const d=u.enter("footnoteDefinition"),y=u.enter("label");return m+=f.move(u.safe(u.associationId(a),{before:m,after:"]"})),y(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((n?`
|
|
104
|
+
`:" ")+u.indentLines(u.containerFlow(a,f.current()),n?u1:uj))),d(),m}}function uj(e,n,r){return n===0?e:u1(e,n,r)}function u1(e,n,r){return(r?"":" ")+e}const cj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];c1.peek=pj;function fj(){return{canContainEols:["delete"],enter:{strikethrough:dj},exit:{strikethrough:mj}}}function hj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:cj}],handlers:{delete:c1}}}function dj(e){this.enter({type:"delete",children:[]},e)}function mj(e){this.exit(e)}function c1(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 pj(){return"~"}function gj(e){return e.length}function yj(e,n){const r=n||{},a=(r.align||[]).concat(),l=r.stringLength||gj,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<e.length;){const z=[],B=[];let M=-1;for(e[y].length>d&&(d=e[y].length);++M<e[y].length;){const F=bj(e[y][M]);if(r.alignDelimiters!==!1){const G=l(F);B[M]=G,(m[M]===void 0||G>m[M])&&(m[M]=G)}z.push(F)}c[y]=z,f[y]=B}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<d;)u[g]=Sb(a[g]);else{const z=Sb(a);for(;++g<d;)u[g]=z}g=-1;const b=[],v=[];for(;++g<d;){const z=u[g];let B="",M="";z===99?(B=":",M=":"):z===108?B=":":z===114&&(M=":");let F=r.alignDelimiters===!1?1:Math.max(1,m[g]-B.length-M.length);const G=B+"-".repeat(F)+M;r.alignDelimiters!==!1&&(F=B.length+F+M.length,F>m[g]&&(m[g]=F),v[g]=F),b[g]=G}c.splice(1,0,b),f.splice(1,0,v),y=-1;const C=[];for(;++y<c.length;){const z=c[y],B=f[y];g=-1;const M=[];for(;++g<d;){const F=z[g]||"";let G="",se="";if(r.alignDelimiters!==!1){const O=m[g]-(B[g]||0),j=u[g];j===114?G=" ".repeat(O):j===99?O%2?(G=" ".repeat(O/2+.5),se=" ".repeat(O/2-.5)):(G=" ".repeat(O/2),se=G):se=" ".repeat(O)}r.delimiterStart!==!1&&!g&&M.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&F==="")&&(r.delimiterStart!==!1||g)&&M.push(" "),r.alignDelimiters!==!1&&M.push(G),M.push(F),r.alignDelimiters!==!1&&M.push(se),r.padding!==!1&&M.push(" "),(r.delimiterEnd!==!1||g!==d-1)&&M.push("|")}C.push(r.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return C.join(`
|
|
105
|
+
`)}function bj(e){return e==null?"":String(e)}function Sb(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 xj(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()),vj);return l(),c}function vj(e,n,r){return">"+(r?"":" ")+e}function wj(e,n){return _b(e,n.inConstruct,!0)&&!_b(e,n.notInConstruct,!1)}function _b(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 Eb(e,n,r,a){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
|
|
106
|
+
`&&wj(r.stack,r.unsafe[l]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
107
|
+
`}function Sj(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 _j(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 Ej(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 kj(e,n,r,a){const l=Ej(r),u=e.value||"",c=l==="`"?"GraveAccent":"Tilde";if(_j(e,r)){const g=r.enter("codeIndented"),b=r.indentLines(u,Cj);return g(),b}const f=r.createTracker(a),m=l.repeat(Math.max(Sj(u,l)+1,3)),d=r.enter("codeFenced");let y=f.move(m);if(e.lang){const g=r.enter(`codeFencedLang${c}`);y+=f.move(r.safe(e.lang,{before:y,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${c}`);y+=f.move(" "),y+=f.move(r.safe(e.meta,{before:y,after:`
|
|
108
|
+
`,encode:["`"],...f.current()})),g()}return y+=f.move(`
|
|
109
|
+
`),u&&(y+=f.move(u+`
|
|
110
|
+
`)),y+=f.move(m),d(),y}function Cj(e,n,r){return(r?"":" ")+e}function Wd(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 Aj(e,n,r,a){const l=Wd(r),u=l==='"'?"Quote":"Apostrophe",c=r.enter("definition");let f=r.enter("label");const m=r.createTracker(a);let d=m.move("[");return d+=m.move(r.safe(r.associationId(e),{before:d,after:"]",...m.current()})),d+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(e.url,{before:d,after:e.title?" ":`
|
|
111
|
+
`,...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(e.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),c(),d}function Tj(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 Ml(e){return"&#x"+e.toString(16).toUpperCase()+";"}function zu(e,n,r){const a=hs(e),l=hs(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}}f1.peek=jj;function f1(e,n,r,a){const l=Tj(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=zu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=Ml(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=zu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Ml(g));const v=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+v}function jj(e,n,r){return r.options.emphasis||"*"}function Nj(e,n){let r=!1;return Qd(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return r=!0,pd}),!!((!e.depth||e.depth<3)&&$d(e)&&(n.options.setext||r))}function Oj(e,n,r,a){const l=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(a);if(Nj(e,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),b=r.containerPhrasing(e,{...u.current(),before:`
|
|
112
|
+
`,after:`
|
|
113
|
+
`});return g(),y(),b+`
|
|
114
|
+
`+(l===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
115
|
+
`))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),m=r.enter("phrasing");u.move(c+" ");let d=r.containerPhrasing(e,{before:"# ",after:`
|
|
116
|
+
`,...u.current()});return/^[\t ]/.test(d)&&(d=Ml(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}h1.peek=Rj;function h1(e){return e.value||""}function Rj(){return"<"}d1.peek=Mj;function d1(e,n,r,a){const l=Wd(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 Mj(){return"!"}m1.peek=Dj;function m1(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 Dj(){return"!"}p1.peek=zj;function p1(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 zj(){return"`"}function g1(e,n){const r=$d(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))}y1.peek=Lj;function y1(e,n,r,a){const l=Wd(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(a);let f,m;if(g1(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 Lj(e,n,r){return g1(e,r)?"<":"["}b1.peek=Uj;function b1(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 Uj(){return"["}function em(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 Bj(e){const n=em(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 Pj(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 x1(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 Hj(e,n,r,a){const l=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?Pj(r):em(r);const f=e.ordered?c==="."?")":".":Bj(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),x1(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 qj(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 Ij(e,n,r,a){const l=qj(r);let u=r.bulletCurrent||em(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,v){return b?(v?"":" ".repeat(c))+g:(v?u:u+" ".repeat(c-u.length))+g}}function Fj(e,n,r,a){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,a);return u(),l(),c}const $j=Vu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Gj(e,n,r,a){return(e.children.some(function(c){return $j(c)})?r.containerPhrasing:r.containerFlow).call(r,e,a)}function Vj(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}v1.peek=Yj;function v1(e,n,r,a){const l=Vj(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=zu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=Ml(d)+m.slice(1));const g=m.charCodeAt(m.length-1),b=zu(a.after.charCodeAt(0),g,l);b.inside&&(m=m.slice(0,-1)+Ml(g));const v=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},f+m+v}function Yj(e,n,r){return r.options.strong||"*"}function Jj(e,n,r,a){return r.safe(e.value,a)}function Xj(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 Kj(e,n,r){const a=(x1(r)+(r.options.ruleSpaces?" ":"")).repeat(Xj(r));return r.options.ruleSpaces?a.slice(0,-1):a}const w1={blockquote:xj,break:Eb,code:kj,definition:Aj,emphasis:f1,hardBreak:Eb,heading:Oj,html:h1,image:d1,imageReference:m1,inlineCode:p1,link:y1,linkReference:b1,list:Hj,listItem:Ij,paragraph:Fj,root:Gj,strong:v1,text:Jj,thematicBreak:Kj};function Qj(){return{enter:{table:Zj,tableData:kb,tableHeader:kb,tableRow:eN},exit:{codeText:tN,table:Wj,tableData:$h,tableHeader:$h,tableRow:$h}}}function Zj(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 Wj(e){this.exit(e),this.data.inTable=void 0}function eN(e){this.enter({type:"tableRow",children:[]},e)}function $h(e){this.exit(e)}function kb(e){this.enter({type:"tableCell",children:[]},e)}function tN(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,nN));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function nN(e,n){return n==="|"?n:e}function rN(e){const n=e||{},r=n.tableCellPadding,a=n.tablePipeAlign,l=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
117
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:m,tableRow:f}};function c(v,C,z,B){return d(y(v,z,B),v.align)}function f(v,C,z,B){const M=g(v,z,B),F=d([M]);return F.slice(0,F.indexOf(`
|
|
118
|
+
`))}function m(v,C,z,B){const M=z.enter("tableCell"),F=z.enter("phrasing"),G=z.containerPhrasing(v,{...B,before:u,after:u});return F(),M(),G}function d(v,C){return yj(v,{align:C,alignDelimiters:a,padding:r,stringLength:l})}function y(v,C,z){const B=v.children;let M=-1;const F=[],G=C.enter("table");for(;++M<B.length;)F[M]=g(B[M],C,z);return G(),F}function g(v,C,z){const B=v.children;let M=-1;const F=[],G=C.enter("tableRow");for(;++M<B.length;)F[M]=m(B[M],v,C,z);return G(),F}function b(v,C,z){let B=w1.inlineCode(v,C,z);return z.stack.includes("tableCell")&&(B=B.replace(/\|/g,"\\$&")),B}}function iN(){return{exit:{taskListCheckValueChecked:Cb,taskListCheckValueUnchecked:Cb,paragraph:sN}}}function aN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:lN}}}function Cb(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function sN(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const a=r.children[0];if(a&&a.type==="text"){const l=n.children;let u=-1,c;for(;++u<l.length;){const f=l[u];if(f.type==="paragraph"){c=f;break}}c===r&&(a.value=a.value.slice(1),a.value.length===0?r.children.shift():r.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,r.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function lN(e,n,r,a){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=r.createTracker(a);u&&f.move(c);let m=w1.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 oN(){return[H3(),lj(),fj(),Qj(),iN()]}function uN(e){return{extensions:[q3(),oj(e),hj(),rN(e),aN()]}}const cN={tokenize:gN,partial:!0},S1={tokenize:yN,partial:!0},_1={tokenize:bN,partial:!0},E1={tokenize:xN,partial:!0},fN={tokenize:vN,partial:!0},k1={name:"wwwAutolink",tokenize:mN,previous:A1},C1={name:"protocolAutolink",tokenize:pN,previous:T1},ei={name:"emailAutolink",tokenize:dN,previous:j1},jr={};function hN(){return{text:jr}}let oa=48;for(;oa<123;)jr[oa]=ei,oa++,oa===58?oa=65:oa===91&&(oa=97);jr[43]=ei;jr[45]=ei;jr[46]=ei;jr[95]=ei;jr[72]=[ei,C1];jr[104]=[ei,C1];jr[87]=[ei,k1];jr[119]=[ei,k1];function dN(e,n,r){const a=this;let l,u;return c;function c(g){return!xd(g)||!j1.call(a,a.previous)||tm(a.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return xd(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(fN,y,d)(g):g===45||g===95||on(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&&mn(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function mN(e,n,r){const a=this;return l;function l(c){return c!==87&&c!==119||!A1.call(a,a.previous)||tm(a.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(cN,e.attempt(S1,e.attempt(_1,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function pN(e,n,r){const a=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&T1.call(a,a.previous)&&!tm(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(mn(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||Ru(g)||Et(g)||ca(g)||Fu(g)?r(g):e.attempt(S1,e.attempt(_1,y),r)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function gN(e,n,r){let a=0;return l;function l(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),l):c===46&&a===3?(e.consume(c),u):r(c)}function u(c){return c===null?r(c):n(c)}}function yN(e,n,r){let a,l,u;return c;function c(d){return d===46||d===95?e.check(E1,m,f)(d):d===null||Et(d)||ca(d)||d!==45&&Fu(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 bN(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(E1,n,u)(c):c===null||Et(c)||ca(c)?n(c):(e.consume(c),l)}function u(c){return c===41&&a++,e.consume(c),l}}function xN(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||Et(f)||ca(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||Et(f)||ca(f)?n(f):a(f)}function u(f){return mn(f)?c(f):r(f)}function c(f){return f===59?(e.consume(f),a):mn(f)?(e.consume(f),c):r(f)}}function vN(e,n,r){return a;function a(u){return e.consume(u),l}function l(u){return on(u)?r(u):n(u)}}function A1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Et(e)}function T1(e){return!mn(e)}function j1(e){return!(e===47||xd(e))}function xd(e){return e===43||e===45||e===46||e===95||on(e)}function tm(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 wN={tokenize:jN,partial:!0};function SN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:CN,continuation:{tokenize:AN},exit:TN}},text:{91:{name:"gfmFootnoteCall",tokenize:kN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:_N,resolveTo:EN}}}}function _N(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=pr(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 EN(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 kN(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||Et(g))return r(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return l.includes(pr(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(g)}return Et(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 CN(e,n,r){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(C){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(C),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(C){return C===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(C),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):r(C)}function y(C){if(c>999||C===93&&!f||C===null||C===91||Et(C))return r(C);if(C===93){e.exit("chunkString");const z=e.exit("gfmFootnoteDefinitionLabelString");return u=pr(a.sliceSerialize(z)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(C),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Et(C)||(f=!0),c++,e.consume(C),C===92?g:y}function g(C){return C===91||C===92||C===93?(e.consume(C),c++,y):y(C)}function b(C){return C===58?(e.enter("definitionMarker"),e.consume(C),e.exit("definitionMarker"),l.includes(u)||l.push(u),at(e,v,"gfmFootnoteDefinitionWhitespace")):r(C)}function v(C){return n(C)}}function AN(e,n,r){return e.check(ql,n,e.attempt(wN,n,r))}function TN(e){e.exit("gfmFootnoteDefinition")}function jN(e,n,r){const a=this;return at(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 NN(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]],v=f.parser.constructs.insideSpan.null;v&&qn(b,b.length,0,$u(v,c.slice(d+1,m),f)),qn(b,b.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),qn(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(C){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(C):(c.enter("strikethroughSequenceTemporary"),v(C))}function v(C){const z=hs(d);if(C===126)return g>1?m(C):(c.consume(C),g++,v);if(g<2&&!r)return m(C);const B=c.exit("strikethroughSequenceTemporary"),M=hs(C);return B._open=!M||M===2&&!!z,B._close=!z||z===2&&!!M,f(C)}}}class ON{constructor(){this.map=[]}add(n,r,a){RN(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 RN(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 MN(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 DN(){return{flow:{null:{name:"table",tokenize:zN,resolveAll:LN}}}}function zN(e,n,r){const a=this;let l=0,u=0,c;return f;function f(N){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,ge=Z==="tableHead"||Z==="tableRow"?j:m;return ge===j&&a.parser.lazy[a.now().line]?r(N):ge(N)}function m(N){return e.enter("tableHead"),e.enter("tableRow"),d(N)}function d(N){return N===124||(c=!0,u+=1),y(N)}function y(N){return N===null?r(N):He(N)?u>1?(u=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),v):r(N):et(N)?at(e,y,"whitespace")(N):(u+=1,c&&(c=!1,l+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(N)))}function g(N){return N===null||N===124||Et(N)?(e.exit("data"),y(N)):(e.consume(N),N===92?b:g)}function b(N){return N===92||N===124?(e.consume(N),g):g(N)}function v(N){return a.interrupt=!1,a.parser.lazy[a.now().line]?r(N):(e.enter("tableDelimiterRow"),c=!1,et(N)?at(e,C,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):C(N))}function C(N){return N===45||N===58?B(N):N===124?(c=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),z):O(N)}function z(N){return et(N)?at(e,B,"whitespace")(N):B(N)}function B(N){return N===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),M):N===45?(u+=1,M(N)):N===null||He(N)?se(N):O(N)}function M(N){return N===45?(e.enter("tableDelimiterFiller"),F(N)):O(N)}function F(N){return N===45?(e.consume(N),F):N===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),G):(e.exit("tableDelimiterFiller"),G(N))}function G(N){return et(N)?at(e,se,"whitespace")(N):se(N)}function se(N){return N===124?C(N):N===null||He(N)?!c||l!==u?O(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(N)):O(N)}function O(N){return r(N)}function j(N){return e.enter("tableRow"),Y(N)}function Y(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),Y):N===null||He(N)?(e.exit("tableRow"),n(N)):et(N)?at(e,Y,"whitespace")(N):(e.enter("data"),J(N))}function J(N){return N===null||N===124||Et(N)?(e.exit("data"),Y(N)):(e.consume(N),N===92?V:J)}function V(N){return N===92||N===124?(e.consume(N),J):J(N)}}function LN(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 ON;for(;++r<e.length;){const v=e[r],C=v[1];v[0]==="enter"?C.type==="tableHead"?(f=!1,m!==0&&(Ab(b,n,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},C.start),end:Object.assign({},C.end)},b.add(r,0,[["enter",d,n]])):C.type==="tableRow"||C.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({},C.start),end:Object.assign({},C.end)},b.add(r,0,[["enter",y,n]])),l=C.type==="tableDelimiterRow"?2:y?3:1):l&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=hu(b,n,u,l,void 0,g),u=[0,0,0,0]),c[2]=r)):C.type==="tableCellDivider"&&(a?a=!1:(u[1]!==0&&(c[0]=c[1],g=hu(b,n,u,l,void 0,g)),u=c,c=[u[1],r,0,0])):C.type==="tableHead"?(f=!0,m=r):C.type==="tableRow"||C.type==="tableDelimiterRow"?(m=r,u[1]!==0?(c[0]=c[1],g=hu(b,n,u,l,r,g)):c[1]!==0&&(g=hu(b,n,c,l,r,g)),l=0):l&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&Ab(b,n,m,d,y),b.consume(n.events),r=-1;++r<n.events.length;){const v=n.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=MN(n.events,r))}return e}function hu(e,n,r,a,l,u){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},Wa(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=Wa(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=Wa(n.events,r[2]),y=Wa(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]],v=n.events[r[3]];if(b[1].end=Object.assign({},v[1].end),b[1].type="chunkText",b[1].contentType="text",r[3]>r[2]+1){const C=r[2]+1,z=r[3]-r[2]-1;e.add(C,z,[])}}e.add(r[3]+1,0,[["exit",g,n]])}return l!==void 0&&(u.end=Object.assign({},Wa(n.events,l)),e.add(l,0,[["exit",u,n]]),u=void 0),u}function Ab(e,n,r,a,l){const u=[],c=Wa(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 Wa(e,n){const r=e[n],a=r[0]==="enter"?"start":"end";return r[1][a]}const UN={name:"tasklistCheck",tokenize:PN};function BN(){return{text:{91:UN}}}function PN(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 Et(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 He(m)?n(m):et(m)?e.check({tokenize:HN},n,r)(m):r(m)}}function HN(e,n,r){return at(e,a,"whitespace");function a(l){return l===null?r(l):n(l)}}function qN(e){return Px([hN(),SN(),NN(e),DN(),BN()])}const IN={};function Tb(e){const n=this,r=e||IN,a=n.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),u=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(qN(r)),u.push(oN()),c.push(uN(r))}function FN(e){s1(e,[/\r?\n|\r/g,$N])}function $N(){return{type:"break"}}function jb(){return function(e){FN(e)}}function GN({connected:e,hostId:n,request:r,subscribeEvents:a,taskId:l,runId:u}){const c=fa(),[f,m]=L.useState(!0),[d,y]=L.useState([]),[g,b]=L.useState(),[v,C]=L.useState(),z=g==="started"||g==="monitoring",B=g==="followup",M=g==="started"||g==="followup",[F,G]=L.useState(null),[se,O]=L.useState(!1),[j,Y]=L.useState(""),[J,V]=L.useState(!1),N=L.useRef(null);async function K(){try{const H=await r("task.result",{id:l,run_id:u});if(H.error){console.error("No result:",H.error),c("/runs",{replace:!0});return}y(H.messages??[]),b(H.running_state),C(H.agent)}catch(H){console.error("Failed to load result:",H),c("/runs",{replace:!0})}finally{m(!1)}}async function Z(H){var q;try{const ye=(q=(await r("task.reports",{id:l,run_id:u,report_files:[H]})).reports)==null?void 0:q[0];ye!=null&&ye.data_url?G({file:H,data_url:ye.data_url}):G({file:H,content:(ye==null?void 0:ye.content)??"Report not found."})}catch{G({file:H,content:"Failed to load report."})}}L.useEffect(()=>{e&&(m(!0),K())},[e,l,u]),L.useEffect(()=>!e||!n?void 0:a(n,async q=>{try{const re=JSON.parse(new TextDecoder().decode(q.data));if(re.event_type!=="running-state"&&re.event_type!=="result-updated"||q.subject.split(".").pop()!==l||re.event_type==="result-updated"&&re.run_id&&re.run_id!==u)return;K()}catch{}}),[e,n,l,a,r]),L.useEffect(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)},[d]);function ge(H){if(H==="input")return"User Input";if(H==="permission")return"Permission";if(H==="confirmation")return"Confirmation"}function he(H){return H==="started"?"Task started":H==="finished"?"Task finished":H==="failed"?"Task failed":H==="error"?"Command failed":H==="aborted"?"Task aborted":H==="confirmation"?"Task confirmed":H==="stopped"?"Follow-up stopped":H??""}return w.jsxs("div",{className:"run-detail",children:[w.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),f?w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[w.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),w.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"chat-thread",ref:N,children:[d.map((H,q)=>{const re=M&&H.role==="assistant"&&!d.slice(q+1).some(ye=>ye.role==="assistant"||ye.role==="user");return H.role==="status"&&H.type==="monitoring"?null:H.role==="status"?w.jsxs("div",{className:`chat-status${H.type==="error"?" chat-status--error":""}`,children:[w.jsxs("div",{children:[he(H.type),H.time>0&&w.jsx("span",{className:"chat-status-time",children:Ou(H.time)})]}),H.content&&w.jsx("pre",{className:"chat-status-detail",children:H.content})]},q):w.jsxs("div",{className:`chat-message chat-message--${H.role}`,children:[H.role==="assistant"&&v&&w.jsx("div",{className:"chat-message-agent",children:od(v)}),w.jsxs("div",{className:"chat-message-content",children:[w.jsx(vb,{remarkPlugins:[Tb,jb],children:H.content}),re&&w.jsxs("div",{className:"chat-typing-indicator",children:[w.jsx("span",{}),w.jsx("span",{}),w.jsx("span",{})]})]}),H.attachments&&H.attachments.length>0&&w.jsx("div",{className:"chat-message-attachments",children:H.attachments.map(ye=>w.jsx("button",{className:"chat-attachment-chip",onClick:()=>Z(ye),children:ye},ye))}),w.jsxs("div",{className:"chat-message-meta",children:[ge(H.type)&&w.jsx("span",{className:"chat-message-type",children:ge(H.type)}),H.time>0&&w.jsx("span",{children:Ou(H.time)})]})]},q)}),M&&(()=>{const H=d.filter(q=>q.role!=="status");return H.length===0||H[H.length-1].role!=="assistant"})()&&w.jsxs("div",{className:"chat-message chat-message--assistant",children:[v&&w.jsx("div",{className:"chat-message-agent",children:od(v)}),w.jsxs("div",{className:"chat-typing-indicator",children:[w.jsx("span",{}),w.jsx("span",{}),w.jsx("span",{})]})]}),g==="monitoring"&&w.jsxs("div",{className:"chat-monitoring-indicator",children:[w.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),z?w.jsx("div",{className:"chat-abort-bar",children:w.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:se,onClick:async()=>{if(confirm("Abort this task?")){O(!0);try{await r("task.abort",{id:l})}catch(H){console.error("Abort failed:",H)}finally{O(!1)}}},children:se?"Aborting...":"Abort Task"})}):B?w.jsx("div",{className:"chat-input-bar",children:w.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:se,onClick:async()=>{O(!0);try{await r("task.stop_followup",{id:l,run_id:u})}catch(H){console.error("Stop failed:",H)}finally{O(!1)}},children:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:w.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):w.jsxs("form",{className:"chat-input-bar",onSubmit:async H=>{H.preventDefault();const q=j.trim();if(!(!q||J)){V(!0);try{await r("task.followup",{id:l,run_id:u,message:q}),Y("")}catch(re){console.error("Follow-up failed:",re)}finally{V(!1)}}},children:[w.jsx("input",{className:"chat-input",type:"text",placeholder:"Follow-up message",value:j,onChange:H=>Y(H.target.value),disabled:J}),w.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!j.trim()||J,children:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),w.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),F&&w.jsx("div",{className:"report-dialog-overlay",onClick:()=>G(null),children:w.jsxs("div",{className:"report-dialog",onClick:H=>H.stopPropagation(),children:[w.jsxs("div",{className:"report-dialog-header",children:[w.jsx("span",{className:"report-dialog-title",children:F.file}),w.jsx("button",{className:"report-dialog-close",onClick:()=>G(null),"aria-label":"Close",children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),w.jsx("div",{className:"report-dialog-body",children:F.data_url?w.jsx("img",{src:F.data_url,alt:F.file,style:{maxWidth:"100%",height:"auto"}}):w.jsx(vb,{remarkPlugins:[Tb,jb],components:{a:({...H})=>w.jsx("a",{...H,target:"_blank",rel:"noopener noreferrer"})},children:F.content??""})})]})})]})}function VN(){const{getActiveHost:e}=Ul(),n=e(),r=L.useRef(null);L.useEffect(()=>{if(kn.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 ZE("/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 QE("/api/push/subscribe",{hostId:n.hostId,endpoint:f.endpoint,keys:{p256dh:f.keys.p256dh,auth:f.keys.auth}}),r.current=n.hostId}catch(u){console.error("[Push] Subscription failed:",u)}}a()},[n])}function du(){var ye;const{pairedHosts:e,activeHostId:n,removePairedHost:r}=Ul(),{connected:a,request:l,subscribeEvents:u,unauthorized:c}=Ud(),f=fa(),m=Tr(),d=NS(),y=Ex("(min-width: 768px)"),g=m.pathname.startsWith("/runs"),b=d.runId?void 0:d.taskId,[v,C]=L.useState(null),z=d.runId,B=z==="latest";L.useEffect(()=>{if(!B||!d.taskId||!a){C(null);return}l("taskrun.list",{task_id:d.taskId,limit:1}).then(Ee=>{var U,te;const R=(te=(U=Ee.entries)==null?void 0:U[0])==null?void 0:te.run_id;C(R??null)}).catch(()=>C(null))},[B,d.taskId,a]);const M=B?v:z,F=!!(d.taskId&&M&&M!=="latest"),[G,se]=L.useState(!1),[O,j]=L.useState(!1),[Y,J]=L.useState(null),[V,N]=L.useState(null),[K,Z]=L.useState({});VN(),L.useEffect(()=>{window.scrollTo(0,0)},[n]);function ge(Ee,R){f(R?`/runs/${encodeURIComponent(Ee)}/${encodeURIComponent(R)}`:`/runs/${encodeURIComponent(Ee)}`)}async function he(){j(!0),J(null);try{const Ee=await l("host.update");if(Ee.error){J(Ee.error),j(!1);return}}catch{}setTimeout(()=>window.location.reload(),1e4)}const H=e.length>0,q=H&&a&&n&&!c,re=((ye=e.find(Ee=>Ee.hostId===n))==null?void 0:ye.clientToken)??null;return w.jsxs("div",{className:"dashboard",children:[y&&w.jsx(U0,{daemonVersion:V,capabilityTokens:K,activeClientToken:re,request:l,onCapabilityTokensChange:Z}),w.jsxs("div",{className:"dashboard-content",children:[w.jsxs("div",{className:"tab-bar",children:[!y&&w.jsx(U0,{daemonVersion:V,capabilityTokens:K,activeClientToken:re,request:l,onCapabilityTokensChange:Z}),w.jsx(gk,{})]}),w.jsx("main",{className:"dashboard-main",children:c?w.jsxs("div",{className:"revoked-state",children:[w.jsx("div",{className:"revoked-icon",children:w.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),w.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),w.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),w.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),w.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),w.jsx("div",{className:"revoked-command",children:w.jsx("code",{children:"palmier pair"})}),w.jsxs("div",{className:"revoked-actions",children:[w.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Re-pair Device"}),w.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):q?w.jsxs(w.Fragment,{children:[w.jsx("div",{style:{display:g?"none":"contents"},children:w.jsx(pk,{connected:a,hostId:n,request:l,subscribeEvents:u,onViewRun:ge,onUpdateRequired:se,onVersion:N,onCapabilityTokens:Z})}),F?w.jsx(GN,{connected:a,hostId:n,request:l,subscribeEvents:u,taskId:d.taskId,runId:decodeURIComponent(M)}):g?w.jsx(wk,{connected:a,hostId:n,request:l,subscribeEvents:u,filterTaskId:b,onClearFilter:()=>f("/runs")}):null]}):w.jsxs("div",{className:"empty-state",children:[w.jsx("p",{children:H?"Connecting to host...":"No hosts paired yet."}),!H&&w.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Pair Host"})]})}),G&&!O&&!Y&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),w.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",V?` (v${V})`:""," is too old for this version of the app. Please update to continue."]}),w.jsx("div",{className:"confirm-modal-actions",children:w.jsx("button",{className:"btn btn-primary",onClick:he,children:"Update Now"})})]})}),O&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),w.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),Y&&w.jsx("div",{className:"confirm-modal-overlay",children:w.jsxs("div",{className:"confirm-modal",children:[w.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),w.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:Y}),w.jsx("div",{className:"confirm-modal-actions",children:w.jsx("button",{className:"btn btn-secondary",onClick:()=>{J(null)},children:"Retry"})})]})})]})]})}const yl=!!window.__PALMIER_SERVE__;function YN(){const[e,n]=L.useState(""),[r,a]=L.useState(!1),[l,u]=L.useState(null),{addPairedHost:c}=Ul(),f=fa();async function m(){const d=e.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}a(!0),u(null);try{let y;if(yl){const b=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,label:navigator.userAgent})});if(!b.ok){const v=await b.json().catch(()=>({error:"Connection failed"}));throw new Error(v.error||`HTTP ${b.status}`)}y=await b.json()}else{const b=await fetch(`${Ld}/api/config`);if(!b.ok)throw new Error("Failed to fetch server config");const v=await b.json();if(!v.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const C=await xx({servers:v.natsWsUrl,authenticator:cx(v.natsJwt,new TextEncoder().encode(v.natsNkeySeed))}),z=Eu(),B=`pair.${d}`,M=await C.request(B,z.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(z.decode(M.data)),await C.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:yl?window.location.origin:void 0};c(g),kn.isNativePlatform()&&await Zt.set({key:"hostId",value:y.hostId}),f("/")}catch(y){const g=y instanceof Error?y.message:String(y);g.includes("timeout")||g.includes("TIMEOUT")||g.includes("503")||g.toLowerCase().includes("no responders")?u("Code not found or expired. Check the code and try again."):u(g)}finally{a(!1)}}return w.jsx("div",{className:"pair-page",children:w.jsxs("div",{className:"pair-card",children:[w.jsxs("div",{className:"pair-header",children:[w.jsx("h1",{className:"pair-title",children:yl?"Pair":"Pair with Host"}),w.jsx("p",{className:"pair-subtitle",children:yl?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!yl&&w.jsxs("div",{className:"pair-instructions",children:[w.jsxs("div",{className:"pair-instruction-block",children:[w.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),w.jsxs("ol",{className:"pair-steps",children:[w.jsxs("li",{children:["Install at least one agent CLI (e.g., ",w.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),w.jsxs("li",{children:["Install Palmier on your host machine:",w.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),w.jsxs("li",{children:["Run the setup wizard:",w.jsx("code",{className:"pair-command",children:"palmier init"})]}),w.jsx("li",{children:"A pairing code will display automatically"})]})]}),w.jsx("div",{className:"pair-instruction-divider"}),w.jsxs("div",{className:"pair-instruction-block",children:[w.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),w.jsxs("ol",{className:"pair-steps",children:[w.jsxs("li",{children:["Run ",w.jsx("code",{children:"palmier pair"})," on the host machine"]}),w.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),w.jsxs("div",{className:"pair-form",children:[w.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",w.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:e,onChange:d=>n(d.target.value.toUpperCase()),placeholder:"A7K9M2",className:"form-input form-input-mono pair-code-input",autoFocus:!0,autoComplete:"off",disabled:r})]}),l&&w.jsx("p",{className:"pair-error",children:l}),w.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!e.trim(),children:[r&&w.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),w.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),w.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",w.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",w.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function JN(){return w.jsx(j_,{children:w.jsx(ek,{children:w.jsxs(GS,{children:[w.jsx(Qa,{path:"/",element:w.jsx(du,{})}),w.jsx(Qa,{path:"/runs",element:w.jsx(du,{})}),w.jsx(Qa,{path:"/runs/:taskId",element:w.jsx(du,{})}),w.jsx(Qa,{path:"/runs/:taskId/:runId",element:w.jsx(du,{})}),w.jsx(Qa,{path:"/pair",element:w.jsx(YN,{})})]})})})}Yw.createRoot(document.getElementById("root")).render(w.jsx(L.StrictMode,{children:w.jsx(p_,{children:w.jsx(JN,{})})}));export{zd as W};
|