palmier 0.6.0 → 0.6.1
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/.github/workflows/publish.yml +15 -2
- package/CLAUDE.md +2 -2
- package/DISCLAIMER.md +36 -0
- package/README.md +76 -87
- package/dist/commands/pair.d.ts +1 -1
- package/dist/commands/pair.js +1 -1
- package/dist/pwa/apple-touch-icon.png +0 -0
- package/dist/pwa/assets/index-C7Ib48wG.js +118 -0
- package/dist/pwa/assets/index-_AmC1Rkn.css +1 -0
- package/dist/pwa/assets/plus-jakarta-sans-latin-ext-wght-normal-DmpS2jIq.woff2 +0 -0
- package/dist/pwa/assets/plus-jakarta-sans-latin-wght-normal-eXO_dkmS.woff2 +0 -0
- package/dist/pwa/assets/plus-jakarta-sans-vietnamese-wght-normal-qRpaaN48.woff2 +0 -0
- package/dist/pwa/favicon.ico +0 -0
- package/dist/pwa/index.html +17 -0
- package/dist/pwa/manifest.webmanifest +1 -0
- package/dist/pwa/pwa-192x192.png +0 -0
- package/dist/pwa/pwa-512x512.png +0 -0
- package/dist/pwa/registerSW.js +1 -0
- package/dist/pwa/service-worker.js +2 -0
- package/dist/rpc-handler.d.ts +4 -0
- package/dist/rpc-handler.js +1 -1
- package/dist/transports/http-transport.js +26 -40
- package/package.json +2 -2
- package/palmier-server/.github/workflows/ci.yml +21 -0
- package/palmier-server/.github/workflows/deploy.yml +38 -0
- package/palmier-server/CLAUDE.md +13 -0
- package/palmier-server/PRODUCTION.md +355 -0
- package/palmier-server/README.md +187 -0
- package/palmier-server/nats.conf +15 -0
- package/palmier-server/package.json +8 -0
- package/palmier-server/pnpm-lock.yaml +6597 -0
- package/palmier-server/pnpm-workspace.yaml +3 -0
- package/palmier-server/pwa/index.html +16 -0
- package/palmier-server/pwa/logo/logo-prompt.md +28 -0
- package/palmier-server/pwa/logo/logo_20260330.png +0 -0
- package/palmier-server/pwa/package.json +30 -0
- package/palmier-server/pwa/public/apple-touch-icon.png +0 -0
- package/palmier-server/pwa/public/favicon.ico +0 -0
- package/palmier-server/pwa/public/pwa-192x192.png +0 -0
- package/palmier-server/pwa/public/pwa-512x512.png +0 -0
- package/palmier-server/pwa/src/App.css +2387 -0
- package/palmier-server/pwa/src/App.tsx +21 -0
- package/palmier-server/pwa/src/agentLabels.ts +11 -0
- package/palmier-server/pwa/src/api.ts +61 -0
- package/palmier-server/pwa/src/components/HostMenu.tsx +289 -0
- package/palmier-server/pwa/src/components/PlanDialog.tsx +41 -0
- package/palmier-server/pwa/src/components/RunDetailView.tsx +293 -0
- package/palmier-server/pwa/src/components/RunsView.tsx +254 -0
- package/palmier-server/pwa/src/components/TabBar.tsx +31 -0
- package/palmier-server/pwa/src/components/TaskCard.tsx +213 -0
- package/palmier-server/pwa/src/components/TaskForm.tsx +580 -0
- package/palmier-server/pwa/src/components/TaskListView.tsx +415 -0
- package/palmier-server/pwa/src/constants.ts +2 -0
- package/palmier-server/pwa/src/contexts/HostConnectionContext.tsx +313 -0
- package/palmier-server/pwa/src/contexts/HostStoreContext.tsx +135 -0
- package/palmier-server/pwa/src/formatTime.ts +10 -0
- package/palmier-server/pwa/src/hooks/useBackClose.ts +75 -0
- package/palmier-server/pwa/src/hooks/useMediaQuery.ts +17 -0
- package/palmier-server/pwa/src/hooks/usePushSubscription.ts +75 -0
- package/palmier-server/pwa/src/main.tsx +14 -0
- package/palmier-server/pwa/src/pages/Dashboard.tsx +223 -0
- package/palmier-server/pwa/src/pages/PairHost.tsx +178 -0
- package/palmier-server/pwa/src/service-worker.ts +139 -0
- package/palmier-server/pwa/src/types.ts +79 -0
- package/palmier-server/pwa/src/vite-env.d.ts +11 -0
- package/palmier-server/pwa/tsconfig.json +21 -0
- package/palmier-server/pwa/tsconfig.node.json +19 -0
- package/palmier-server/pwa/vite.config.ts +47 -0
- package/palmier-server/server/.env.example +16 -0
- package/palmier-server/server/package.json +33 -0
- package/palmier-server/server/src/db.ts +34 -0
- package/palmier-server/server/src/index.ts +217 -0
- package/palmier-server/server/src/nats.ts +25 -0
- package/palmier-server/server/src/push.ts +68 -0
- package/palmier-server/server/src/routes/hosts.ts +45 -0
- package/palmier-server/server/src/routes/push.ts +100 -0
- package/palmier-server/server/tsconfig.json +20 -0
- package/palmier-server/spec.md +415 -0
- package/src/commands/pair.ts +1 -1
- package/src/rpc-handler.ts +1 -1
- package/src/transports/http-transport.ts +28 -41
- package/test/result-state.test.ts +110 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var iS=Object.defineProperty;var aS=(t,n,r)=>n in t?iS(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r;var sS=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports);var k=(t,n,r)=>aS(t,typeof n!="symbol"?n+"":n,r);var Vj=sS((Xj,Ki)=>{(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 tb(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $f={exports:{}},Ws={};/**
|
|
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 Sy;function lS(){if(Sy)return Ws;Sy=1;var t=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:t,type:a,key:c,ref:l!==void 0?l:null,props:u}}return Ws.Fragment=n,Ws.jsx=r,Ws.jsxs=r,Ws}var _y;function oS(){return _y||(_y=1,$f.exports=lS()),$f.exports}var S=oS(),Gf={exports:{}},Ie={};/**
|
|
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 wy;function uS(){if(wy)return Ie;wy=1;var t=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"),x=Symbol.iterator;function v(L){return L===null||typeof L!="object"?null:(L=x&&L[x]||L["@@iterator"],typeof L=="function"?L:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,q={};function M(L,Y,E){this.props=L,this.context=Y,this.refs=q,this.updater=E||C}M.prototype.isReactComponent={},M.prototype.setState=function(L,Y){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,Y,"setState")},M.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function G(){}G.prototype=M.prototype;function V(L,Y,E){this.props=L,this.context=Y,this.refs=q,this.updater=E||C}var le=V.prototype=new G;le.constructor=V,D(le,M.prototype),le.isPureReactComponent=!0;var j=Array.isArray;function O(){}var J={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function X(L,Y,E){var se=E.ref;return{$$typeof:t,type:L,key:Y,ref:se!==void 0?se:null,props:E}}function z(L,Y){return X(L.type,Y,L.props)}function ie(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function K(L){var Y={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(E){return Y[E]})}var ge=/\/+/g;function he(L,Y){return typeof L=="object"&&L!==null&&L.key!=null?K(""+L.key):Y.toString(36)}function I(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(O,O):(L.status="pending",L.then(function(Y){L.status==="pending"&&(L.status="fulfilled",L.value=Y)},function(Y){L.status==="pending"&&(L.status="rejected",L.reason=Y)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function H(L,Y,E,se,we){var xe=typeof L;(xe==="undefined"||xe==="boolean")&&(L=null);var Oe=!1;if(L===null)Oe=!0;else switch(xe){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(L.$$typeof){case t:case n:Oe=!0;break;case y:return Oe=L._init,H(Oe(L._payload),Y,E,se,we)}}if(Oe)return we=we(L),Oe=se===""?"."+he(L,0):se,j(we)?(E="",Oe!=null&&(E=Oe.replace(ge,"$&/")+"/"),H(we,Y,E,"",function(Me){return Me})):we!=null&&(ie(we)&&(we=z(we,E+(we.key==null||L&&L.key===we.key?"":(""+we.key).replace(ge,"$&/")+"/")+Oe)),Y.push(we)),1;Oe=0;var ze=se===""?".":se+":";if(j(L))for(var Ce=0;Ce<L.length;Ce++)se=L[Ce],xe=ze+he(se,Ce),Oe+=H(se,Y,E,xe,we);else if(Ce=v(L),typeof Ce=="function")for(L=Ce.call(L),Ce=0;!(se=L.next()).done;)se=se.value,xe=ze+he(se,Ce++),Oe+=H(se,Y,E,xe,we);else if(xe==="object"){if(typeof L.then=="function")return H(I(L),Y,E,se,we);throw Y=String(L),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return Oe}function te(L,Y,E){if(L==null)return L;var se=[],we=0;return H(L,se,"","",function(xe){return Y.call(E,xe,we++)}),se}function me(L){if(L._status===-1){var Y=L._result;Y=Y(),Y.then(function(E){(L._status===0||L._status===-1)&&(L._status=1,L._result=E)},function(E){(L._status===0||L._status===-1)&&(L._status=2,L._result=E)}),L._status===-1&&(L._status=0,L._result=Y)}if(L._status===1)return L._result.default;throw L._result}var Ae=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},N={map:te,forEach:function(L,Y,E){te(L,function(){Y.apply(this,arguments)},E)},count:function(L){var Y=0;return te(L,function(){Y++}),Y},toArray:function(L){return te(L,function(Y){return Y})||[]},only:function(L){if(!ie(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Ie.Activity=g,Ie.Children=N,Ie.Component=M,Ie.Fragment=r,Ie.Profiler=l,Ie.PureComponent=V,Ie.StrictMode=a,Ie.Suspense=m,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=J,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(L){return J.H.useMemoCache(L)}},Ie.cache=function(L){return function(){return L.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(L,Y,E){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var se=D({},L.props),we=L.key;if(Y!=null)for(xe in Y.key!==void 0&&(we=""+Y.key),Y)!F.call(Y,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&Y.ref===void 0||(se[xe]=Y[xe]);var xe=arguments.length-2;if(xe===1)se.children=E;else if(1<xe){for(var Oe=Array(xe),ze=0;ze<xe;ze++)Oe[ze]=arguments[ze+2];se.children=Oe}return X(L.type,we,se)},Ie.createContext=function(L){return L={$$typeof:c,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:u,_context:L},L},Ie.createElement=function(L,Y,E){var se,we={},xe=null;if(Y!=null)for(se in Y.key!==void 0&&(xe=""+Y.key),Y)F.call(Y,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(we[se]=Y[se]);var Oe=arguments.length-2;if(Oe===1)we.children=E;else if(1<Oe){for(var ze=Array(Oe),Ce=0;Ce<Oe;Ce++)ze[Ce]=arguments[Ce+2];we.children=ze}if(L&&L.defaultProps)for(se in Oe=L.defaultProps,Oe)we[se]===void 0&&(we[se]=Oe[se]);return X(L,xe,we)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(L){return{$$typeof:f,render:L}},Ie.isValidElement=ie,Ie.lazy=function(L){return{$$typeof:y,_payload:{_status:-1,_result:L},_init:me}},Ie.memo=function(L,Y){return{$$typeof:d,type:L,compare:Y===void 0?null:Y}},Ie.startTransition=function(L){var Y=J.T,E={};J.T=E;try{var se=L(),we=J.S;we!==null&&we(E,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(O,Ae)}catch(xe){Ae(xe)}finally{Y!==null&&E.types!==null&&(Y.types=E.types),J.T=Y}},Ie.unstable_useCacheRefresh=function(){return J.H.useCacheRefresh()},Ie.use=function(L){return J.H.use(L)},Ie.useActionState=function(L,Y,E){return J.H.useActionState(L,Y,E)},Ie.useCallback=function(L,Y){return J.H.useCallback(L,Y)},Ie.useContext=function(L){return J.H.useContext(L)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(L,Y){return J.H.useDeferredValue(L,Y)},Ie.useEffect=function(L,Y){return J.H.useEffect(L,Y)},Ie.useEffectEvent=function(L){return J.H.useEffectEvent(L)},Ie.useId=function(){return J.H.useId()},Ie.useImperativeHandle=function(L,Y,E){return J.H.useImperativeHandle(L,Y,E)},Ie.useInsertionEffect=function(L,Y){return J.H.useInsertionEffect(L,Y)},Ie.useLayoutEffect=function(L,Y){return J.H.useLayoutEffect(L,Y)},Ie.useMemo=function(L,Y){return J.H.useMemo(L,Y)},Ie.useOptimistic=function(L,Y){return J.H.useOptimistic(L,Y)},Ie.useReducer=function(L,Y,E){return J.H.useReducer(L,Y,E)},Ie.useRef=function(L){return J.H.useRef(L)},Ie.useState=function(L){return J.H.useState(L)},Ie.useSyncExternalStore=function(L,Y,E){return J.H.useSyncExternalStore(L,Y,E)},Ie.useTransition=function(){return J.H.useTransition()},Ie.version="19.2.4",Ie}var Ey;function nd(){return Ey||(Ey=1,Gf.exports=uS()),Gf.exports}var U=nd(),Yf={exports:{}},el={},Vf={exports:{}},Jf={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var ky;function cS(){return ky||(ky=1,(function(t){function n(H,te){var me=H.length;H.push(te);e:for(;0<me;){var Ae=me-1>>>1,N=H[Ae];if(0<l(N,te))H[Ae]=te,H[me]=N,me=Ae;else break e}}function r(H){return H.length===0?null:H[0]}function a(H){if(H.length===0)return null;var te=H[0],me=H.pop();if(me!==te){H[0]=me;e:for(var Ae=0,N=H.length,L=N>>>1;Ae<L;){var Y=2*(Ae+1)-1,E=H[Y],se=Y+1,we=H[se];if(0>l(E,me))se<N&&0>l(we,E)?(H[Ae]=we,H[se]=me,Ae=se):(H[Ae]=E,H[Y]=me,Ae=Y);else if(se<N&&0>l(we,me))H[Ae]=we,H[se]=me,Ae=se;else break e}}return te}function l(H,te){var me=H.sortIndex-te.sortIndex;return me!==0?me:H.id-te.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();t.unstable_now=function(){return c.now()-f}}var m=[],d=[],y=1,g=null,x=3,v=!1,C=!1,D=!1,q=!1,M=typeof setTimeout=="function"?setTimeout:null,G=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function le(H){for(var te=r(d);te!==null;){if(te.callback===null)a(d);else if(te.startTime<=H)a(d),te.sortIndex=te.expirationTime,n(m,te);else break;te=r(d)}}function j(H){if(D=!1,le(H),!C)if(r(m)!==null)C=!0,O||(O=!0,K());else{var te=r(d);te!==null&&I(j,te.startTime-H)}}var O=!1,J=-1,F=5,X=-1;function z(){return q?!0:!(t.unstable_now()-X<F)}function ie(){if(q=!1,O){var H=t.unstable_now();X=H;var te=!0;try{e:{C=!1,D&&(D=!1,G(J),J=-1),v=!0;var me=x;try{t:{for(le(H),g=r(m);g!==null&&!(g.expirationTime>H&&z());){var Ae=g.callback;if(typeof Ae=="function"){g.callback=null,x=g.priorityLevel;var N=Ae(g.expirationTime<=H);if(H=t.unstable_now(),typeof N=="function"){g.callback=N,le(H),te=!0;break t}g===r(m)&&a(m),le(H)}else a(m);g=r(m)}if(g!==null)te=!0;else{var L=r(d);L!==null&&I(j,L.startTime-H),te=!1}}break e}finally{g=null,x=me,v=!1}te=void 0}}finally{te?K():O=!1}}}var K;if(typeof V=="function")K=function(){V(ie)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,he=ge.port2;ge.port1.onmessage=ie,K=function(){he.postMessage(null)}}else K=function(){M(ie,0)};function I(H,te){J=M(function(){H(t.unstable_now())},te)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(H){H.callback=null},t.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<H?Math.floor(1e3/H):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(H){switch(x){case 1:case 2:case 3:var te=3;break;default:te=x}var me=x;x=te;try{return H()}finally{x=me}},t.unstable_requestPaint=function(){q=!0},t.unstable_runWithPriority=function(H,te){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var me=x;x=H;try{return te()}finally{x=me}},t.unstable_scheduleCallback=function(H,te,me){var Ae=t.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?Ae+me:Ae):me=Ae,H){case 1:var N=-1;break;case 2:N=250;break;case 5:N=1073741823;break;case 4:N=1e4;break;default:N=5e3}return N=me+N,H={id:y++,callback:te,priorityLevel:H,startTime:me,expirationTime:N,sortIndex:-1},me>Ae?(H.sortIndex=me,n(d,H),r(m)===null&&H===r(d)&&(D?(G(J),J=-1):D=!0,I(j,me-Ae))):(H.sortIndex=N,n(m,H),C||v||(C=!0,O||(O=!0,K()))),H},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(H){var te=x;return function(){var me=x;x=te;try{return H.apply(this,arguments)}finally{x=me}}}})(Jf)),Jf}var Cy;function fS(){return Cy||(Cy=1,Vf.exports=cS()),Vf.exports}var Xf={exports:{}},Zt={};/**
|
|
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 Ay;function hS(){if(Ay)return Zt;Ay=1;var t=nd();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=t.__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 Zt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Zt.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)},Zt.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()}},Zt.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))},Zt.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Zt.preinit=function(m,d){if(typeof m=="string"&&d&&typeof d.as=="string"){var y=d.as,g=f(y,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,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:x,fetchPriority:v}):y==="script"&&a.d.X(m,{crossOrigin:g,integrity:x,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Zt.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)},Zt.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})}},Zt.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)},Zt.requestFormReset=function(m){a.d.r(m)},Zt.unstable_batchedUpdates=function(m,d){return m(d)},Zt.useFormState=function(m,d,y){return c.H.useFormState(m,d,y)},Zt.useFormStatus=function(){return c.H.useHostTransitionStatus()},Zt.version="19.2.4",Zt}var Ty;function nb(){if(Ty)return Xf.exports;Ty=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(n){console.error(n)}}return t(),Xf.exports=hS(),Xf.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 Oy;function dS(){if(Oy)return el;Oy=1;var t=fS(),n=nd(),r=nb();function a(e){var i="https://react.dev/errors/"+e;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 #"+e+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var i=e,s=e;if(e.alternate)for(;i.return;)i=i.return;else{e=i;do i=e,(i.flags&4098)!==0&&(s=i.return),e=i.return;while(e)}return i.tag===3?s:null}function c(e){if(e.tag===13){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function f(e){if(e.tag===31){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function m(e){if(u(e)!==e)throw Error(a(188))}function d(e){var i=e.alternate;if(!i){if(i=u(e),i===null)throw Error(a(188));return i!==e?null:e}for(var s=e,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),e;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 b=!1,_=h.child;_;){if(_===s){b=!0,s=h,o=p;break}if(_===o){b=!0,o=h,s=p;break}_=_.sibling}if(!b){for(_=p.child;_;){if(_===s){b=!0,s=p,o=h;break}if(_===o){b=!0,o=p,s=h;break}_=_.sibling}if(!b)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?e:i}function y(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e;for(e=e.child;e!==null;){if(i=y(e),i!==null)return i;e=e.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),V=Symbol.for("react.context"),le=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),ie=Symbol.iterator;function K(e){return e===null||typeof e!="object"?null:(e=ie&&e[ie]||e["@@iterator"],typeof e=="function"?e:null)}var ge=Symbol.for("react.client.reference");function he(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case M:return"Profiler";case q:return"StrictMode";case j:return"Suspense";case O:return"SuspenseList";case X:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case V:return e.displayName||"Context";case G:return(e._context.displayName||"Context")+".Consumer";case le:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case J:return i=e.displayName||null,i!==null?i:he(e.type)||"Memo";case F:i=e._payload,e=e._init;try{return he(e(i))}catch{}}return null}var I=Array.isArray,H=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},Ae=[],N=-1;function L(e){return{current:e}}function Y(e){0>N||(e.current=Ae[N],Ae[N]=null,N--)}function E(e,i){N++,Ae[N]=e.current,e.current=i}var se=L(null),we=L(null),xe=L(null),Oe=L(null);function ze(e,i){switch(E(xe,i),E(we,e),E(se,null),i.nodeType){case 9:case 11:e=(e=i.documentElement)&&(e=e.namespaceURI)?$g(e):0;break;default:if(e=i.tagName,i=i.namespaceURI)i=$g(i),e=Gg(i,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(se),E(se,e)}function Ce(){Y(se),Y(we),Y(xe)}function Me(e){e.memoizedState!==null&&E(Oe,e);var i=se.current,s=Gg(i,e.type);i!==s&&(E(we,e),E(se,s))}function Le(e){we.current===e&&(Y(se),Y(we)),Oe.current===e&&(Y(Oe),Xs._currentValue=me)}var Fe,gn;function Xt(e){if(Fe===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);Fe=i&&i[1]||"",gn=-1<s.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Fe+e+gn}var Rn=!1;function ve(e,i){if(!e||Rn)return"";Rn=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(i){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(ae){var ne=ae}Reflect.construct(e,[],pe)}else{try{pe.call()}catch(ae){ne=ae}e.call(pe.prototype)}}else{try{throw Error()}catch(ae){ne=ae}(pe=e())&&typeof pe.catch=="function"&&pe.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(),b=p[0],_=p[1];if(b&&_){var B=b.split(`
|
|
44
|
+
`),ee=_.split(`
|
|
45
|
+
`);for(h=o=0;o<B.length&&!B[o].includes("DetermineComponentFrameRoot");)o++;for(;h<ee.length&&!ee[h].includes("DetermineComponentFrameRoot");)h++;if(o===B.length||h===ee.length)for(o=B.length-1,h=ee.length-1;1<=o&&0<=h&&B[o]!==ee[h];)h--;for(;1<=o&&0<=h;o--,h--)if(B[o]!==ee[h]){if(o!==1||h!==1)do if(o--,h--,0>h||B[o]!==ee[h]){var oe=`
|
|
46
|
+
`+B[o].replace(" at new "," at ");return e.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",e.displayName)),oe}while(1<=o&&0<=h);break}}}finally{Rn=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?Xt(s):""}function Pe(e,i){switch(e.tag){case 26:case 27:case 5:return Xt(e.type);case 16:return Xt("Lazy");case 13:return e.child!==i&&i!==null?Xt("Suspense Fallback"):Xt("Suspense");case 19:return Xt("SuspenseList");case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return Xt("Activity");default:return""}}function He(e){try{var i="",s=null;do i+=Pe(e,s),s=e,e=e.return;while(e);return i}catch(o){return`
|
|
47
|
+
Error generating stack: `+o.message+`
|
|
48
|
+
`+o.stack}}var _t=Object.prototype.hasOwnProperty,Mn=t.unstable_scheduleCallback,Qn=t.unstable_cancelCallback,ra=t.unstable_shouldYield,Gr=t.unstable_requestPaint,yt=t.unstable_now,os=t.unstable_getCurrentPriorityLevel,ue=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,qe=t.unstable_NormalPriority,Ve=t.unstable_LowPriority,rt=t.unstable_IdlePriority,en=t.log,Dn=t.unstable_setDisableYieldValue,$t=null,dt=null;function Bt(e){if(typeof en=="function"&&Dn(e),dt&&typeof dt.setStrictMode=="function")try{dt.setStrictMode($t,e)}catch{}}var lt=Math.clz32?Math.clz32:ia,zn=Math.log,tn=Math.LN2;function ia(e){return e>>>=0,e===0?32:31-(zn(e)/tn|0)|0}var Yr=256,vr=262144,Vr=4194304;function Zn(e){var i=e&42;if(i!==0)return i;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ti(e,i,s){var o=e.pendingLanes;if(o===0)return 0;var h=0,p=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var _=o&134217727;return _!==0?(o=_&~p,o!==0?h=Zn(o):(b&=_,b!==0?h=Zn(b):s||(s=_&~e,s!==0&&(h=Zn(s))))):(_=o&~p,_!==0?h=Zn(_):b!==0?h=Zn(b):s||(s=o&~e,s!==0&&(h=Zn(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 Oi(e,i){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&i)===0}function us(e,i){switch(e){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 aa(){var e=Vr;return Vr<<=1,(Vr&62914560)===0&&(Vr=4194304),e}function Jr(e){for(var i=[],s=0;31>s;s++)i.push(e);return i}function Kn(e,i){e.pendingLanes|=i,i!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xr(e,i,s,o,h,p){var b=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var _=e.entanglements,B=e.expirationTimes,ee=e.hiddenUpdates;for(s=b&~s;0<s;){var oe=31-lt(s),pe=1<<oe;_[oe]=0,B[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&=~pe}o!==0&&Qr(e,o,0),p!==0&&h===0&&e.tag!==0&&(e.suspendedLanes|=p&~(b&~i))}function Qr(e,i,s){e.pendingLanes|=i,e.suspendedLanes&=~i;var o=31-lt(i);e.entangledLanes|=i,e.entanglements[o]=e.entanglements[o]|1073741824|s&261930}function ji(e,i){var s=e.entangledLanes|=i;for(e=e.entanglements;s;){var o=31-lt(s),h=1<<o;h&i|e[o]&i&&(e[o]|=i),s&=~h}}function Zr(e,i){var s=i&-i;return s=(s&42)!==0?1:Sr(s),(s&(e.suspendedLanes|i))!==0?0:s}function Sr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ni(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function cs(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:my(e.type))}function Dl(e,i){var s=te.p;try{return te.p=e,i()}finally{te.p=s}}var lr=Math.random().toString(36).slice(2),mt="__reactFiber$"+lr,At="__reactProps$"+lr,yn="__reactContainer$"+lr,Ri="__reactEvents$"+lr,fs="__reactListeners$"+lr,zl="__reactHandles$"+lr,Ll="__reactResources$"+lr,qt="__reactMarker$"+lr;function sa(e){delete e[mt],delete e[At],delete e[Ri],delete e[fs],delete e[zl]}function w(e){var i=e[mt];if(i)return i;for(var s=e.parentNode;s;){if(i=s[yn]||s[mt]){if(s=i.alternate,i.child!==null||s!==null&&s.child!==null)for(e=Kg(e);e!==null;){if(s=e[mt])return s;e=Kg(e)}return i}e=s,s=e.parentNode}return null}function T(e){if(e=e[mt]||e[yn]){var i=e.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return e}return null}function A(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e.stateNode;throw Error(a(33))}function R(e){var i=e[Ll];return i||(i=e[Ll]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function P(e){e[qt]=!0}var Z=new Set,de={};function ye(e,i){re(e,i),re(e+"Capture",i)}function re(e,i){for(de[e]=i,e=0;e<i.length;e++)Z.add(i[e])}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]*$"),je={},Je={};function xt(e){return _t.call(Je,e)?!0:_t.call(je,e)?!1:fe.test(e)?Je[e]=!0:(je[e]=!0,!1)}function Qt(e,i,s){if(xt(i))if(s===null)e.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(i);return;case"boolean":var o=i.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(i);return}}e.setAttribute(i,""+s)}}function Wn(e,i,s){if(s===null)e.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttribute(i,""+s)}}function _r(e,i,s,o){if(o===null)e.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(i,s,""+o)}}function Ln(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ld(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Z1(e,i,s){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,i);if(!e.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var h=o.get,p=o.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return h.call(this)},set:function(b){s=""+b,p.call(this,b)}}),Object.defineProperty(e,i,{enumerable:o.enumerable}),{getValue:function(){return s},setValue:function(b){s=""+b},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function Lu(e){if(!e._valueTracker){var i=Ld(e)?"checked":"value";e._valueTracker=Z1(e,i,""+e[i])}}function Ud(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var s=i.getValue(),o="";return e&&(o=Ld(e)?e.checked?"true":"false":e.value),e=o,e!==s?(i.setValue(e),!0):!1}function Ul(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var K1=/[\n"\\]/g;function Un(e){return e.replace(K1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Uu(e,i,s,o,h,p,b,_){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),i!=null?b==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+Ln(i)):e.value!==""+Ln(i)&&(e.value=""+Ln(i)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),i!=null?Bu(e,b,Ln(i)):s!=null?Bu(e,b,Ln(s)):o!=null&&e.removeAttribute("value"),h==null&&p!=null&&(e.defaultChecked=!!p),h!=null&&(e.checked=h&&typeof h!="function"&&typeof h!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.name=""+Ln(_):e.removeAttribute("name")}function Bd(e,i,s,o,h,p,b,_){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),i!=null||s!=null){if(!(p!=="submit"&&p!=="reset"||i!=null)){Lu(e);return}s=s!=null?""+Ln(s):"",i=i!=null?""+Ln(i):s,_||i===e.value||(e.value=i),e.defaultValue=i}o=o??h,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=_?e.checked:!!o,e.defaultChecked=!!o,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),Lu(e)}function Bu(e,i,s){i==="number"&&Ul(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function la(e,i,s,o){if(e=e.options,i){i={};for(var h=0;h<s.length;h++)i["$"+s[h]]=!0;for(s=0;s<e.length;s++)h=i.hasOwnProperty("$"+e[s].value),e[s].selected!==h&&(e[s].selected=h),h&&o&&(e[s].defaultSelected=!0)}else{for(s=""+Ln(s),i=null,h=0;h<e.length;h++){if(e[h].value===s){e[h].selected=!0,o&&(e[h].defaultSelected=!0);return}i!==null||e[h].disabled||(i=e[h])}i!==null&&(i.selected=!0)}}function qd(e,i,s){if(i!=null&&(i=""+Ln(i),i!==e.value&&(e.value=i),s==null)){e.defaultValue!==i&&(e.defaultValue=i);return}e.defaultValue=s!=null?""+Ln(s):""}function Hd(e,i,s,o){if(i==null){if(o!=null){if(s!=null)throw Error(a(92));if(I(o)){if(1<o.length)throw Error(a(93));o=o[0]}s=o}s==null&&(s=""),i=s}s=Ln(i),e.defaultValue=s,o=e.textContent,o===s&&o!==""&&o!==null&&(e.value=o),Lu(e)}function oa(e,i){if(i){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=i;return}}e.textContent=i}var W1=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 Pd(e,i,s){var o=i.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?o?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="":o?e.setProperty(i,s):typeof s!="number"||s===0||W1.has(i)?i==="float"?e.cssFloat=s:e[i]=(""+s).trim():e[i]=s+"px"}function Id(e,i,s){if(i!=null&&typeof i!="object")throw Error(a(62));if(e=e.style,s!=null){for(var o in s)!s.hasOwnProperty(o)||i!=null&&i.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var h in i)o=i[h],i.hasOwnProperty(h)&&s[h]!==o&&Pd(e,h,o)}else for(var p in i)i.hasOwnProperty(p)&&Pd(e,p,i[p])}function qu(e){if(e.indexOf("-")===-1)return!1;switch(e){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 ex=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"]]),tx=/^[\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 Bl(e){return tx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function wr(){}var Hu=null;function Pu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ua=null,ca=null;function Fd(e){var i=T(e);if(i&&(e=i.stateNode)){var s=e[At]||null;e:switch(e=i.stateNode,i.type){case"input":if(Uu(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),i=s.name,s.type==="radio"&&i!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Un(""+i)+'"][type="radio"]'),i=0;i<s.length;i++){var o=s[i];if(o!==e&&o.form===e.form){var h=o[At]||null;if(!h)throw Error(a(90));Uu(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===e.form&&Ud(o)}break e;case"textarea":qd(e,s.value,s.defaultValue);break e;case"select":i=s.value,i!=null&&la(e,!!s.multiple,i,!1)}}}var Iu=!1;function $d(e,i,s){if(Iu)return e(i,s);Iu=!0;try{var o=e(i);return o}finally{if(Iu=!1,(ua!==null||ca!==null)&&(Co(),ua&&(i=ua,e=ca,ca=ua=null,Fd(i),e)))for(i=0;i<e.length;i++)Fd(e[i])}}function hs(e,i){var s=e.stateNode;if(s===null)return null;var o=s[At]||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)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(a(231,i,typeof s));return s}var Er=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fu=!1;if(Er)try{var ds={};Object.defineProperty(ds,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",ds,ds),window.removeEventListener("test",ds,ds)}catch{Fu=!1}var Kr=null,$u=null,ql=null;function Gd(){if(ql)return ql;var e,i=$u,s=i.length,o,h="value"in Kr?Kr.value:Kr.textContent,p=h.length;for(e=0;e<s&&i[e]===h[e];e++);var b=s-e;for(o=1;o<=b&&i[s-o]===h[p-o];o++);return ql=h.slice(e,1<o?1-o:void 0)}function Hl(e){var i=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&i===13&&(e=13)):e=i,e===10&&(e=13),32<=e||e===13?e:0}function Pl(){return!0}function Yd(){return!1}function on(e){function i(s,o,h,p,b){this._reactName=s,this._targetInst=h,this.type=o,this.nativeEvent=p,this.target=b,this.currentTarget=null;for(var _ in e)e.hasOwnProperty(_)&&(s=e[_],this[_]=s?s(p):p[_]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Pl:Yd,this.isPropagationStopped=Yd,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=Pl)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Pl)},persist:function(){},isPersistent:Pl}),i}var Mi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Il=on(Mi),ms=g({},Mi,{view:0,detail:0}),nx=on(ms),Gu,Yu,ps,Fl=g({},ms,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ju,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ps&&(ps&&e.type==="mousemove"?(Gu=e.screenX-ps.screenX,Yu=e.screenY-ps.screenY):Yu=Gu=0,ps=e),Gu)},movementY:function(e){return"movementY"in e?e.movementY:Yu}}),Vd=on(Fl),rx=g({},Fl,{dataTransfer:0}),ix=on(rx),ax=g({},ms,{relatedTarget:0}),Vu=on(ax),sx=g({},Mi,{animationName:0,elapsedTime:0,pseudoElement:0}),lx=on(sx),ox=g({},Mi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ux=on(ox),cx=g({},Mi,{data:0}),Jd=on(cx),fx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hx={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"},dx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mx(e){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(e):(e=dx[e])?!!i[e]:!1}function Ju(){return mx}var px=g({},ms,{key:function(e){if(e.key){var i=fx[e.key]||e.key;if(i!=="Unidentified")return i}return e.type==="keypress"?(e=Hl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?hx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ju,charCode:function(e){return e.type==="keypress"?Hl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Hl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),gx=on(px),yx=g({},Fl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xd=on(yx),bx=g({},ms,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ju}),xx=on(bx),vx=g({},Mi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Sx=on(vx),_x=g({},Fl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),wx=on(_x),Ex=g({},Mi,{newState:0,oldState:0}),kx=on(Ex),Cx=[9,13,27,32],Xu=Er&&"CompositionEvent"in window,gs=null;Er&&"documentMode"in document&&(gs=document.documentMode);var Ax=Er&&"TextEvent"in window&&!gs,Qd=Er&&(!Xu||gs&&8<gs&&11>=gs),Zd=" ",Kd=!1;function Wd(e,i){switch(e){case"keyup":return Cx.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function em(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var fa=!1;function Tx(e,i){switch(e){case"compositionend":return em(i);case"keypress":return i.which!==32?null:(Kd=!0,Zd);case"textInput":return e=i.data,e===Zd&&Kd?null:e;default:return null}}function Ox(e,i){if(fa)return e==="compositionend"||!Xu&&Wd(e,i)?(e=Gd(),ql=$u=Kr=null,fa=!1,e):null;switch(e){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 Qd&&i.locale!=="ko"?null:i.data;default:return null}}var jx={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 tm(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i==="input"?!!jx[e.type]:i==="textarea"}function nm(e,i,s,o){ua?ca?ca.push(o):ca=[o]:ua=o,i=Mo(i,"onChange"),0<i.length&&(s=new Il("onChange","change",null,s,o),e.push({event:s,listeners:i}))}var ys=null,bs=null;function Nx(e){Bg(e,0)}function $l(e){var i=A(e);if(Ud(i))return e}function rm(e,i){if(e==="change")return i}var im=!1;if(Er){var Qu;if(Er){var Zu="oninput"in document;if(!Zu){var am=document.createElement("div");am.setAttribute("oninput","return;"),Zu=typeof am.oninput=="function"}Qu=Zu}else Qu=!1;im=Qu&&(!document.documentMode||9<document.documentMode)}function sm(){ys&&(ys.detachEvent("onpropertychange",lm),bs=ys=null)}function lm(e){if(e.propertyName==="value"&&$l(bs)){var i=[];nm(i,bs,e,Pu(e)),$d(Nx,i)}}function Rx(e,i,s){e==="focusin"?(sm(),ys=i,bs=s,ys.attachEvent("onpropertychange",lm)):e==="focusout"&&sm()}function Mx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $l(bs)}function Dx(e,i){if(e==="click")return $l(i)}function zx(e,i){if(e==="input"||e==="change")return $l(i)}function Lx(e,i){return e===i&&(e!==0||1/e===1/i)||e!==e&&i!==i}var bn=typeof Object.is=="function"?Object.is:Lx;function xs(e,i){if(bn(e,i))return!0;if(typeof e!="object"||e===null||typeof i!="object"||i===null)return!1;var s=Object.keys(e),o=Object.keys(i);if(s.length!==o.length)return!1;for(o=0;o<s.length;o++){var h=s[o];if(!_t.call(i,h)||!bn(e[h],i[h]))return!1}return!0}function om(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function um(e,i){var s=om(e);e=0;for(var o;s;){if(s.nodeType===3){if(o=e+s.textContent.length,e<=i&&o>=i)return{node:s,offset:i-e};e=o}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=om(s)}}function cm(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?cm(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function fm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var i=Ul(e.document);i instanceof e.HTMLIFrameElement;){try{var s=typeof i.contentWindow.location.href=="string"}catch{s=!1}if(s)e=i.contentWindow;else break;i=Ul(e.document)}return i}function Ku(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i&&(i==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||i==="textarea"||e.contentEditable==="true")}var Ux=Er&&"documentMode"in document&&11>=document.documentMode,ha=null,Wu=null,vs=null,ec=!1;function hm(e,i,s){var o=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;ec||ha==null||ha!==Ul(o)||(o=ha,"selectionStart"in o&&Ku(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}),vs&&xs(vs,o)||(vs=o,o=Mo(Wu,"onSelect"),0<o.length&&(i=new Il("onSelect","select",null,i,s),e.push({event:i,listeners:o}),i.target=ha)))}function Di(e,i){var s={};return s[e.toLowerCase()]=i.toLowerCase(),s["Webkit"+e]="webkit"+i,s["Moz"+e]="moz"+i,s}var da={animationend:Di("Animation","AnimationEnd"),animationiteration:Di("Animation","AnimationIteration"),animationstart:Di("Animation","AnimationStart"),transitionrun:Di("Transition","TransitionRun"),transitionstart:Di("Transition","TransitionStart"),transitioncancel:Di("Transition","TransitionCancel"),transitionend:Di("Transition","TransitionEnd")},tc={},dm={};Er&&(dm=document.createElement("div").style,"AnimationEvent"in window||(delete da.animationend.animation,delete da.animationiteration.animation,delete da.animationstart.animation),"TransitionEvent"in window||delete da.transitionend.transition);function zi(e){if(tc[e])return tc[e];if(!da[e])return e;var i=da[e],s;for(s in i)if(i.hasOwnProperty(s)&&s in dm)return tc[e]=i[s];return e}var mm=zi("animationend"),pm=zi("animationiteration"),gm=zi("animationstart"),Bx=zi("transitionrun"),qx=zi("transitionstart"),Hx=zi("transitioncancel"),ym=zi("transitionend"),bm=new Map,nc="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(" ");nc.push("scrollEnd");function er(e,i){bm.set(e,i),ye(i,[e])}var Gl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Bn=[],ma=0,rc=0;function Yl(){for(var e=ma,i=rc=ma=0;i<e;){var s=Bn[i];Bn[i++]=null;var o=Bn[i];Bn[i++]=null;var h=Bn[i];Bn[i++]=null;var p=Bn[i];if(Bn[i++]=null,o!==null&&h!==null){var b=o.pending;b===null?h.next=h:(h.next=b.next,b.next=h),o.pending=h}p!==0&&xm(s,h,p)}}function Vl(e,i,s,o){Bn[ma++]=e,Bn[ma++]=i,Bn[ma++]=s,Bn[ma++]=o,rc|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function ic(e,i,s,o){return Vl(e,i,s,o),Jl(e)}function Li(e,i){return Vl(e,null,null,i),Jl(e)}function xm(e,i,s){e.lanes|=s;var o=e.alternate;o!==null&&(o.lanes|=s);for(var h=!1,p=e.return;p!==null;)p.childLanes|=s,o=p.alternate,o!==null&&(o.childLanes|=s),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(h=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,h&&i!==null&&(h=31-lt(s),e=p.hiddenUpdates,o=e[h],o===null?e[h]=[i]:o.push(i),i.lane=s|536870912),p):null}function Jl(e){if(50<Is)throw Is=0,mf=null,Error(a(185));for(var i=e.return;i!==null;)e=i,i=e.return;return e.tag===3?e.stateNode:null}var pa={};function Px(e,i,s,o){this.tag=e,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 xn(e,i,s,o){return new Px(e,i,s,o)}function ac(e){return e=e.prototype,!(!e||!e.isReactComponent)}function kr(e,i){var s=e.alternate;return s===null?(s=xn(e.tag,i,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=i,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,i=e.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function vm(e,i){e.flags&=65011714;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=i,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,i=s.dependencies,e.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),e}function Xl(e,i,s,o,h,p){var b=0;if(o=e,typeof e=="function")ac(e)&&(b=1);else if(typeof e=="string")b=Yv(e,s,se.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case X:return e=xn(31,s,i,h),e.elementType=X,e.lanes=p,e;case D:return Ui(s.children,h,p,i);case q:b=8,h|=24;break;case M:return e=xn(12,s,i,h|2),e.elementType=M,e.lanes=p,e;case j:return e=xn(13,s,i,h),e.elementType=j,e.lanes=p,e;case O:return e=xn(19,s,i,h),e.elementType=O,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case V:b=10;break e;case G:b=9;break e;case le:b=11;break e;case J:b=14;break e;case F:b=16,o=null;break e}b=29,s=Error(a(130,e===null?"null":typeof e,"")),o=null}return i=xn(b,s,i,h),i.elementType=e,i.type=o,i.lanes=p,i}function Ui(e,i,s,o){return e=xn(7,e,o,i),e.lanes=s,e}function sc(e,i,s){return e=xn(6,e,null,i),e.lanes=s,e}function Sm(e){var i=xn(18,null,null,0);return i.stateNode=e,i}function lc(e,i,s){return i=xn(4,e.children!==null?e.children:[],e.key,i),i.lanes=s,i.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},i}var _m=new WeakMap;function qn(e,i){if(typeof e=="object"&&e!==null){var s=_m.get(e);return s!==void 0?s:(i={value:e,source:i,stack:He(i)},_m.set(e,i),i)}return{value:e,source:i,stack:He(i)}}var ga=[],ya=0,Ql=null,Ss=0,Hn=[],Pn=0,Wr=null,or=1,ur="";function Cr(e,i){ga[ya++]=Ss,ga[ya++]=Ql,Ql=e,Ss=i}function wm(e,i,s){Hn[Pn++]=or,Hn[Pn++]=ur,Hn[Pn++]=Wr,Wr=e;var o=or;e=ur;var h=32-lt(o)-1;o&=~(1<<h),s+=1;var p=32-lt(i)+h;if(30<p){var b=h-h%5;p=(o&(1<<b)-1).toString(32),o>>=b,h-=b,or=1<<32-lt(i)+h|s<<h|o,ur=p+e}else or=1<<p|s<<h|o,ur=e}function oc(e){e.return!==null&&(Cr(e,1),wm(e,1,0))}function uc(e){for(;e===Ql;)Ql=ga[--ya],ga[ya]=null,Ss=ga[--ya],ga[ya]=null;for(;e===Wr;)Wr=Hn[--Pn],Hn[Pn]=null,ur=Hn[--Pn],Hn[Pn]=null,or=Hn[--Pn],Hn[Pn]=null}function Em(e,i){Hn[Pn++]=or,Hn[Pn++]=ur,Hn[Pn++]=Wr,or=i.id,ur=i.overflow,Wr=e}var Gt=null,vt=null,et=!1,ei=null,In=!1,cc=Error(a(519));function ti(e){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _s(qn(i,e)),cc}function km(e){var i=e.stateNode,s=e.type,o=e.memoizedProps;switch(i[mt]=e,i[At]=o,s){case"dialog":Qe("cancel",i),Qe("close",i);break;case"iframe":case"object":case"embed":Qe("load",i);break;case"video":case"audio":for(s=0;s<$s.length;s++)Qe($s[s],i);break;case"source":Qe("error",i);break;case"img":case"image":case"link":Qe("error",i),Qe("load",i);break;case"details":Qe("toggle",i);break;case"input":Qe("invalid",i),Bd(i,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Qe("invalid",i);break;case"textarea":Qe("invalid",i),Hd(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||Ig(i.textContent,s)?(o.popover!=null&&(Qe("beforetoggle",i),Qe("toggle",i)),o.onScroll!=null&&Qe("scroll",i),o.onScrollEnd!=null&&Qe("scrollend",i),o.onClick!=null&&(i.onclick=wr),i=!0):i=!1,i||ti(e,!0)}function Cm(e){for(Gt=e.return;Gt;)switch(Gt.tag){case 5:case 31:case 13:In=!1;return;case 27:case 3:In=!0;return;default:Gt=Gt.return}}function ba(e){if(e!==Gt)return!1;if(!et)return Cm(e),et=!0,!1;var i=e.tag,s;if((s=i!==3&&i!==27)&&((s=i===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Of(e.type,e.memoizedProps)),s=!s),s&&vt&&ti(e),Cm(e),i===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));vt=Zg(e)}else if(i===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));vt=Zg(e)}else i===27?(i=vt,pi(e.type)?(e=Df,Df=null,vt=e):vt=i):vt=Gt?$n(e.stateNode.nextSibling):null;return!0}function Bi(){vt=Gt=null,et=!1}function fc(){var e=ei;return e!==null&&(hn===null?hn=e:hn.push.apply(hn,e),ei=null),e}function _s(e){ei===null?ei=[e]:ei.push(e)}var hc=L(null),qi=null,Ar=null;function ni(e,i,s){E(hc,i._currentValue),i._currentValue=s}function Tr(e){e._currentValue=hc.current,Y(hc)}function dc(e,i,s){for(;e!==null;){var o=e.alternate;if((e.childLanes&i)!==i?(e.childLanes|=i,o!==null&&(o.childLanes|=i)):o!==null&&(o.childLanes&i)!==i&&(o.childLanes|=i),e===s)break;e=e.return}}function mc(e,i,s,o){var h=e.child;for(h!==null&&(h.return=e);h!==null;){var p=h.dependencies;if(p!==null){var b=h.child;p=p.firstContext;e:for(;p!==null;){var _=p;p=h;for(var B=0;B<i.length;B++)if(_.context===i[B]){p.lanes|=s,_=p.alternate,_!==null&&(_.lanes|=s),dc(p.return,s,e),o||(b=null);break e}p=_.next}}else if(h.tag===18){if(b=h.return,b===null)throw Error(a(341));b.lanes|=s,p=b.alternate,p!==null&&(p.lanes|=s),dc(b,s,e),b=null}else b=h.child;if(b!==null)b.return=h;else for(b=h;b!==null;){if(b===e){b=null;break}if(h=b.sibling,h!==null){h.return=b.return,b=h;break}b=b.return}h=b}}function xa(e,i,s,o){e=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 b=h.alternate;if(b===null)throw Error(a(387));if(b=b.memoizedProps,b!==null){var _=h.type;bn(h.pendingProps.value,b.value)||(e!==null?e.push(_):e=[_])}}else if(h===Oe.current){if(b=h.alternate,b===null)throw Error(a(387));b.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(e!==null?e.push(Xs):e=[Xs])}h=h.return}e!==null&&mc(i,e,s,o),i.flags|=262144}function Zl(e){for(e=e.firstContext;e!==null;){if(!bn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Hi(e){qi=e,Ar=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return Am(qi,e)}function Kl(e,i){return qi===null&&Hi(e),Am(e,i)}function Am(e,i){var s=i._currentValue;if(i={context:i,memoizedValue:s,next:null},Ar===null){if(e===null)throw Error(a(308));Ar=i,e.dependencies={lanes:0,firstContext:i},e.flags|=524288}else Ar=Ar.next=i;return s}var Ix=typeof AbortController<"u"?AbortController:function(){var e=[],i=this.signal={aborted:!1,addEventListener:function(s,o){e.push(o)}};this.abort=function(){i.aborted=!0,e.forEach(function(s){return s()})}},Fx=t.unstable_scheduleCallback,$x=t.unstable_NormalPriority,Mt={$$typeof:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pc(){return{controller:new Ix,data:new Map,refCount:0}}function ws(e){e.refCount--,e.refCount===0&&Fx($x,function(){e.controller.abort()})}var Es=null,gc=0,va=0,Sa=null;function Gx(e,i){if(Es===null){var s=Es=[];gc=0,va=vf(),Sa={status:"pending",value:void 0,then:function(o){s.push(o)}}}return gc++,i.then(Tm,Tm),i}function Tm(){if(--gc===0&&Es!==null){Sa!==null&&(Sa.status="fulfilled");var e=Es;Es=null,va=0,Sa=null;for(var i=0;i<e.length;i++)(0,e[i])()}}function Yx(e,i){var s=[],o={status:"pending",value:null,reason:null,then:function(h){s.push(h)}};return e.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 Om=H.S;H.S=function(e,i){hg=yt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Gx(e,i),Om!==null&&Om(e,i)};var Pi=L(null);function yc(){var e=Pi.current;return e!==null?e:pt.pooledCache}function Wl(e,i){i===null?E(Pi,Pi.current):E(Pi,i.pool)}function jm(){var e=yc();return e===null?null:{parent:Mt._currentValue,pool:e}}var _a=Error(a(460)),bc=Error(a(474)),eo=Error(a(542)),to={then:function(){}};function Nm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Rm(e,i,s){switch(s=e[s],s===void 0?e.push(i):s!==i&&(i.then(wr,wr),i=s),i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,Dm(e),e;default:if(typeof i.status=="string")i.then(wr,wr);else{if(e=pt,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=i,e.status="pending",e.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 e=i.reason,Dm(e),e}throw Fi=i,_a}}function Ii(e){try{var i=e._init;return i(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Fi=s,_a):s}}var Fi=null;function Mm(){if(Fi===null)throw Error(a(459));var e=Fi;return Fi=null,e}function Dm(e){if(e===_a||e===eo)throw Error(a(483))}var wa=null,ks=0;function no(e){var i=ks;return ks+=1,wa===null&&(wa=[]),Rm(wa,e,i)}function Cs(e,i){i=i.props.ref,e.ref=i!==void 0?i:null}function ro(e,i){throw i.$$typeof===x?Error(a(525)):(e=Object.prototype.toString.call(i),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":e)))}function zm(e){function i(Q,$){if(e){var W=Q.deletions;W===null?(Q.deletions=[$],Q.flags|=16):W.push($)}}function s(Q,$){if(!e)return null;for(;$!==null;)i(Q,$),$=$.sibling;return null}function o(Q){for(var $=new Map;Q!==null;)Q.key!==null?$.set(Q.key,Q):$.set(Q.index,Q),Q=Q.sibling;return $}function h(Q,$){return Q=kr(Q,$),Q.index=0,Q.sibling=null,Q}function p(Q,$,W){return Q.index=W,e?(W=Q.alternate,W!==null?(W=W.index,W<$?(Q.flags|=67108866,$):W):(Q.flags|=67108866,$)):(Q.flags|=1048576,$)}function b(Q){return e&&Q.alternate===null&&(Q.flags|=67108866),Q}function _(Q,$,W,ce){return $===null||$.tag!==6?($=sc(W,Q.mode,ce),$.return=Q,$):($=h($,W),$.return=Q,$)}function B(Q,$,W,ce){var De=W.type;return De===D?oe(Q,$,W.props.children,ce,W.key):$!==null&&($.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===F&&Ii(De)===$.type)?($=h($,W.props),Cs($,W),$.return=Q,$):($=Xl(W.type,W.key,W.props,null,Q.mode,ce),Cs($,W),$.return=Q,$)}function ee(Q,$,W,ce){return $===null||$.tag!==4||$.stateNode.containerInfo!==W.containerInfo||$.stateNode.implementation!==W.implementation?($=lc(W,Q.mode,ce),$.return=Q,$):($=h($,W.children||[]),$.return=Q,$)}function oe(Q,$,W,ce,De){return $===null||$.tag!==7?($=Ui(W,Q.mode,ce,De),$.return=Q,$):($=h($,W),$.return=Q,$)}function pe(Q,$,W){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=sc(""+$,Q.mode,W),$.return=Q,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case v:return W=Xl($.type,$.key,$.props,null,Q.mode,W),Cs(W,$),W.return=Q,W;case C:return $=lc($,Q.mode,W),$.return=Q,$;case F:return $=Ii($),pe(Q,$,W)}if(I($)||K($))return $=Ui($,Q.mode,W,null),$.return=Q,$;if(typeof $.then=="function")return pe(Q,no($),W);if($.$$typeof===V)return pe(Q,Kl(Q,$),W);ro(Q,$)}return null}function ne(Q,$,W,ce){var De=$!==null?$.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return De!==null?null:_(Q,$,""+W,ce);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case v:return W.key===De?B(Q,$,W,ce):null;case C:return W.key===De?ee(Q,$,W,ce):null;case F:return W=Ii(W),ne(Q,$,W,ce)}if(I(W)||K(W))return De!==null?null:oe(Q,$,W,ce,null);if(typeof W.then=="function")return ne(Q,$,no(W),ce);if(W.$$typeof===V)return ne(Q,$,Kl(Q,W),ce);ro(Q,W)}return null}function ae(Q,$,W,ce,De){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return Q=Q.get(W)||null,_($,Q,""+ce,De);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return Q=Q.get(ce.key===null?W:ce.key)||null,B($,Q,ce,De);case C:return Q=Q.get(ce.key===null?W:ce.key)||null,ee($,Q,ce,De);case F:return ce=Ii(ce),ae(Q,$,W,ce,De)}if(I(ce)||K(ce))return Q=Q.get(W)||null,oe($,Q,ce,De,null);if(typeof ce.then=="function")return ae(Q,$,W,no(ce),De);if(ce.$$typeof===V)return ae(Q,$,W,Kl($,ce),De);ro($,ce)}return null}function Ne(Q,$,W,ce){for(var De=null,it=null,Re=$,Ge=$=0,We=null;Re!==null&&Ge<W.length;Ge++){Re.index>Ge?(We=Re,Re=null):We=Re.sibling;var at=ne(Q,Re,W[Ge],ce);if(at===null){Re===null&&(Re=We);break}e&&Re&&at.alternate===null&&i(Q,Re),$=p(at,$,Ge),it===null?De=at:it.sibling=at,it=at,Re=We}if(Ge===W.length)return s(Q,Re),et&&Cr(Q,Ge),De;if(Re===null){for(;Ge<W.length;Ge++)Re=pe(Q,W[Ge],ce),Re!==null&&($=p(Re,$,Ge),it===null?De=Re:it.sibling=Re,it=Re);return et&&Cr(Q,Ge),De}for(Re=o(Re);Ge<W.length;Ge++)We=ae(Re,Q,Ge,W[Ge],ce),We!==null&&(e&&We.alternate!==null&&Re.delete(We.key===null?Ge:We.key),$=p(We,$,Ge),it===null?De=We:it.sibling=We,it=We);return e&&Re.forEach(function(vi){return i(Q,vi)}),et&&Cr(Q,Ge),De}function Be(Q,$,W,ce){if(W==null)throw Error(a(151));for(var De=null,it=null,Re=$,Ge=$=0,We=null,at=W.next();Re!==null&&!at.done;Ge++,at=W.next()){Re.index>Ge?(We=Re,Re=null):We=Re.sibling;var vi=ne(Q,Re,at.value,ce);if(vi===null){Re===null&&(Re=We);break}e&&Re&&vi.alternate===null&&i(Q,Re),$=p(vi,$,Ge),it===null?De=vi:it.sibling=vi,it=vi,Re=We}if(at.done)return s(Q,Re),et&&Cr(Q,Ge),De;if(Re===null){for(;!at.done;Ge++,at=W.next())at=pe(Q,at.value,ce),at!==null&&($=p(at,$,Ge),it===null?De=at:it.sibling=at,it=at);return et&&Cr(Q,Ge),De}for(Re=o(Re);!at.done;Ge++,at=W.next())at=ae(Re,Q,Ge,at.value,ce),at!==null&&(e&&at.alternate!==null&&Re.delete(at.key===null?Ge:at.key),$=p(at,$,Ge),it===null?De=at:it.sibling=at,it=at);return e&&Re.forEach(function(rS){return i(Q,rS)}),et&&Cr(Q,Ge),De}function ht(Q,$,W,ce){if(typeof W=="object"&&W!==null&&W.type===D&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case v:e:{for(var De=W.key;$!==null;){if($.key===De){if(De=W.type,De===D){if($.tag===7){s(Q,$.sibling),ce=h($,W.props.children),ce.return=Q,Q=ce;break e}}else if($.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===F&&Ii(De)===$.type){s(Q,$.sibling),ce=h($,W.props),Cs(ce,W),ce.return=Q,Q=ce;break e}s(Q,$);break}else i(Q,$);$=$.sibling}W.type===D?(ce=Ui(W.props.children,Q.mode,ce,W.key),ce.return=Q,Q=ce):(ce=Xl(W.type,W.key,W.props,null,Q.mode,ce),Cs(ce,W),ce.return=Q,Q=ce)}return b(Q);case C:e:{for(De=W.key;$!==null;){if($.key===De)if($.tag===4&&$.stateNode.containerInfo===W.containerInfo&&$.stateNode.implementation===W.implementation){s(Q,$.sibling),ce=h($,W.children||[]),ce.return=Q,Q=ce;break e}else{s(Q,$);break}else i(Q,$);$=$.sibling}ce=lc(W,Q.mode,ce),ce.return=Q,Q=ce}return b(Q);case F:return W=Ii(W),ht(Q,$,W,ce)}if(I(W))return Ne(Q,$,W,ce);if(K(W)){if(De=K(W),typeof De!="function")throw Error(a(150));return W=De.call(W),Be(Q,$,W,ce)}if(typeof W.then=="function")return ht(Q,$,no(W),ce);if(W.$$typeof===V)return ht(Q,$,Kl(Q,W),ce);ro(Q,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,$!==null&&$.tag===6?(s(Q,$.sibling),ce=h($,W),ce.return=Q,Q=ce):(s(Q,$),ce=sc(W,Q.mode,ce),ce.return=Q,Q=ce),b(Q)):s(Q,$)}return function(Q,$,W,ce){try{ks=0;var De=ht(Q,$,W,ce);return wa=null,De}catch(Re){if(Re===_a||Re===eo)throw Re;var it=xn(29,Re,null,Q.mode);return it.lanes=ce,it.return=Q,it}finally{}}}var $i=zm(!0),Lm=zm(!1),ri=!1;function xc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vc(e,i){e=e.updateQueue,i.updateQueue===e&&(i.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ii(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ai(e,i,s){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(st&2)!==0){var h=o.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),o.pending=i,i=Jl(e),xm(e,null,s),i}return Vl(e,o,i,s),Jl(e)}function As(e,i,s){if(i=i.updateQueue,i!==null&&(i=i.shared,(s&4194048)!==0)){var o=i.lanes;o&=e.pendingLanes,s|=o,i.lanes=s,ji(e,s)}}function Sc(e,i){var s=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,s===o)){var h=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var b={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};p===null?h=p=b:p=p.next=b,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},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=i:e.next=i,s.lastBaseUpdate=i}var _c=!1;function Ts(){if(_c){var e=Sa;if(e!==null)throw e}}function Os(e,i,s,o){_c=!1;var h=e.updateQueue;ri=!1;var p=h.firstBaseUpdate,b=h.lastBaseUpdate,_=h.shared.pending;if(_!==null){h.shared.pending=null;var B=_,ee=B.next;B.next=null,b===null?p=ee:b.next=ee,b=B;var oe=e.alternate;oe!==null&&(oe=oe.updateQueue,_=oe.lastBaseUpdate,_!==b&&(_===null?oe.firstBaseUpdate=ee:_.next=ee,oe.lastBaseUpdate=B))}if(p!==null){var pe=h.baseState;b=0,oe=ee=B=null,_=p;do{var ne=_.lane&-536870913,ae=ne!==_.lane;if(ae?(Ke&ne)===ne:(o&ne)===ne){ne!==0&&ne===va&&(_c=!0),oe!==null&&(oe=oe.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Ne=e,Be=_;ne=i;var ht=s;switch(Be.tag){case 1:if(Ne=Be.payload,typeof Ne=="function"){pe=Ne.call(ht,pe,ne);break e}pe=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Be.payload,ne=typeof Ne=="function"?Ne.call(ht,pe,ne):Ne,ne==null)break e;pe=g({},pe,ne);break e;case 2:ri=!0}}ne=_.callback,ne!==null&&(e.flags|=64,ae&&(e.flags|=8192),ae=h.callbacks,ae===null?h.callbacks=[ne]:ae.push(ne))}else ae={lane:ne,tag:_.tag,payload:_.payload,callback:_.callback,next:null},oe===null?(ee=oe=ae,B=pe):oe=oe.next=ae,b|=ne;if(_=_.next,_===null){if(_=h.shared.pending,_===null)break;ae=_,_=ae.next,ae.next=null,h.lastBaseUpdate=ae,h.shared.pending=null}}while(!0);oe===null&&(B=pe),h.baseState=B,h.firstBaseUpdate=ee,h.lastBaseUpdate=oe,p===null&&(h.shared.lanes=0),ci|=b,e.lanes=b,e.memoizedState=pe}}function Um(e,i){if(typeof e!="function")throw Error(a(191,e));e.call(i)}function Bm(e,i){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Um(s[e],i)}var Ea=L(null),io=L(0);function qm(e,i){e=Ur,E(io,e),E(Ea,i),Ur=e|i.baseLanes}function wc(){E(io,Ur),E(Ea,Ea.current)}function Ec(){Ur=io.current,Y(Ea),Y(io)}var vn=L(null),Fn=null;function si(e){var i=e.alternate;E(jt,jt.current&1),E(vn,e),Fn===null&&(i===null||Ea.current!==null||i.memoizedState!==null)&&(Fn=e)}function kc(e){E(jt,jt.current),E(vn,e),Fn===null&&(Fn=e)}function Hm(e){e.tag===22?(E(jt,jt.current),E(vn,e),Fn===null&&(Fn=e)):li()}function li(){E(jt,jt.current),E(vn,vn.current)}function Sn(e){Y(vn),Fn===e&&(Fn=null),Y(jt)}var jt=L(0);function ao(e){for(var i=e;i!==null;){if(i.tag===13){var s=i.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Rf(s)||Mf(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===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Or=0,$e=null,ct=null,Dt=null,so=!1,ka=!1,Gi=!1,lo=0,js=0,Ca=null,Vx=0;function Tt(){throw Error(a(321))}function Cc(e,i){if(i===null)return!1;for(var s=0;s<i.length&&s<e.length;s++)if(!bn(e[s],i[s]))return!1;return!0}function Ac(e,i,s,o,h,p){return Or=p,$e=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,H.H=e===null||e.memoizedState===null?wp:Ic,Gi=!1,p=s(o,h),Gi=!1,ka&&(p=Im(i,s,o,h)),Pm(e),p}function Pm(e){H.H=Ms;var i=ct!==null&&ct.next!==null;if(Or=0,Dt=ct=$e=null,so=!1,js=0,Ca=null,i)throw Error(a(300));e===null||zt||(e=e.dependencies,e!==null&&Zl(e)&&(zt=!0))}function Im(e,i,s,o){$e=e;var h=0;do{if(ka&&(Ca=null),js=0,ka=!1,25<=h)throw Error(a(301));if(h+=1,Dt=ct=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}H.H=Ep,p=i(s,o)}while(ka);return p}function Jx(){var e=H.H,i=e.useState()[0];return i=typeof i.then=="function"?Ns(i):i,e=e.useState()[0],(ct!==null?ct.memoizedState:null)!==e&&($e.flags|=1024),i}function Tc(){var e=lo!==0;return lo=0,e}function Oc(e,i,s){i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~s}function jc(e){if(so){for(e=e.memoizedState;e!==null;){var i=e.queue;i!==null&&(i.pending=null),e=e.next}so=!1}Or=0,Dt=ct=$e=null,ka=!1,js=lo=0,Ca=null}function nn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dt===null?$e.memoizedState=Dt=e:Dt=Dt.next=e,Dt}function Nt(){if(ct===null){var e=$e.alternate;e=e!==null?e.memoizedState:null}else e=ct.next;var i=Dt===null?$e.memoizedState:Dt.next;if(i!==null)Dt=i,ct=e;else{if(e===null)throw $e.alternate===null?Error(a(467)):Error(a(310));ct=e,e={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},Dt===null?$e.memoizedState=Dt=e:Dt=Dt.next=e}return Dt}function oo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ns(e){var i=js;return js+=1,Ca===null&&(Ca=[]),e=Rm(Ca,e,i),i=$e,(Dt===null?i.memoizedState:Dt.next)===null&&(i=i.alternate,H.H=i===null||i.memoizedState===null?wp:Ic),e}function uo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ns(e);if(e.$$typeof===V)return Yt(e)}throw Error(a(438,String(e)))}function Nc(e){var i=null,s=$e.updateQueue;if(s!==null&&(i=s.memoCache),i==null){var o=$e.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=oo(),$e.updateQueue=s),s.memoCache=i,s=i.data[i.index],s===void 0)for(s=i.data[i.index]=Array(e),o=0;o<e;o++)s[o]=z;return i.index++,s}function jr(e,i){return typeof i=="function"?i(e):i}function co(e){var i=Nt();return Rc(i,ct,e)}function Rc(e,i,s){var o=e.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=s;var h=e.baseQueue,p=o.pending;if(p!==null){if(h!==null){var b=h.next;h.next=p.next,p.next=b}i.baseQueue=h=p,o.pending=null}if(p=e.baseState,h===null)e.memoizedState=p;else{i=h.next;var _=b=null,B=null,ee=i,oe=!1;do{var pe=ee.lane&-536870913;if(pe!==ee.lane?(Ke&pe)===pe:(Or&pe)===pe){var ne=ee.revertLane;if(ne===0)B!==null&&(B=B.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),pe===va&&(oe=!0);else if((Or&ne)===ne){ee=ee.next,ne===va&&(oe=!0);continue}else pe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},B===null?(_=B=pe,b=p):B=B.next=pe,$e.lanes|=ne,ci|=ne;pe=ee.action,Gi&&s(p,pe),p=ee.hasEagerState?ee.eagerState:s(p,pe)}else ne={lane:pe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},B===null?(_=B=ne,b=p):B=B.next=ne,$e.lanes|=pe,ci|=pe;ee=ee.next}while(ee!==null&&ee!==i);if(B===null?b=p:B.next=_,!bn(p,e.memoizedState)&&(zt=!0,oe&&(s=Sa,s!==null)))throw s;e.memoizedState=p,e.baseState=b,e.baseQueue=B,o.lastRenderedState=p}return h===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Mc(e){var i=Nt(),s=i.queue;if(s===null)throw Error(a(311));s.lastRenderedReducer=e;var o=s.dispatch,h=s.pending,p=i.memoizedState;if(h!==null){s.pending=null;var b=h=h.next;do p=e(p,b.action),b=b.next;while(b!==h);bn(p,i.memoizedState)||(zt=!0),i.memoizedState=p,i.baseQueue===null&&(i.baseState=p),s.lastRenderedState=p}return[p,o]}function Fm(e,i,s){var o=$e,h=Nt(),p=et;if(p){if(s===void 0)throw Error(a(407));s=s()}else s=i();var b=!bn((ct||h).memoizedState,s);if(b&&(h.memoizedState=s,zt=!0),h=h.queue,Lc(Ym.bind(null,o,h,e),[e]),h.getSnapshot!==i||b||Dt!==null&&Dt.memoizedState.tag&1){if(o.flags|=2048,Aa(9,{destroy:void 0},Gm.bind(null,o,h,s,i),null),pt===null)throw Error(a(349));p||(Or&127)!==0||$m(o,i,s)}return s}function $m(e,i,s){e.flags|=16384,e={getSnapshot:i,value:s},i=$e.updateQueue,i===null?(i=oo(),$e.updateQueue=i,i.stores=[e]):(s=i.stores,s===null?i.stores=[e]:s.push(e))}function Gm(e,i,s,o){i.value=s,i.getSnapshot=o,Vm(i)&&Jm(e)}function Ym(e,i,s){return s(function(){Vm(i)&&Jm(e)})}function Vm(e){var i=e.getSnapshot;e=e.value;try{var s=i();return!bn(e,s)}catch{return!0}}function Jm(e){var i=Li(e,2);i!==null&&dn(i,e,2)}function Dc(e){var i=nn();if(typeof e=="function"){var s=e;if(e=s(),Gi){Bt(!0);try{s()}finally{Bt(!1)}}}return i.memoizedState=i.baseState=e,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:e},i}function Xm(e,i,s,o){return e.baseState=s,Rc(e,ct,typeof o=="function"?o:jr)}function Xx(e,i,s,o,h){if(mo(e))throw Error(a(485));if(e=i.action,e!==null){var p={payload:h,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){p.listeners.push(b)}};H.T!==null?s(!0):p.isTransition=!1,o(p),s=i.pending,s===null?(p.next=i.pending=p,Qm(i,p)):(p.next=s.next,i.pending=s.next=p)}}function Qm(e,i){var s=i.action,o=i.payload,h=e.state;if(i.isTransition){var p=H.T,b={};H.T=b;try{var _=s(h,o),B=H.S;B!==null&&B(b,_),Zm(e,i,_)}catch(ee){zc(e,i,ee)}finally{p!==null&&b.types!==null&&(p.types=b.types),H.T=p}}else try{p=s(h,o),Zm(e,i,p)}catch(ee){zc(e,i,ee)}}function Zm(e,i,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(o){Km(e,i,o)},function(o){return zc(e,i,o)}):Km(e,i,s)}function Km(e,i,s){i.status="fulfilled",i.value=s,Wm(i),e.state=s,i=e.pending,i!==null&&(s=i.next,s===i?e.pending=null:(s=s.next,i.next=s,Qm(e,s)))}function zc(e,i,s){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do i.status="rejected",i.reason=s,Wm(i),i=i.next;while(i!==o)}e.action=null}function Wm(e){e=e.listeners;for(var i=0;i<e.length;i++)(0,e[i])()}function ep(e,i){return i}function tp(e,i){if(et){var s=pt.formState;if(s!==null){e:{var o=$e;if(et){if(vt){t:{for(var h=vt,p=In;h.nodeType!==8;){if(!p){h=null;break t}if(h=$n(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){vt=$n(h.nextSibling),o=h.data==="F!";break e}}ti(o)}o=!1}o&&(i=s[0])}}return s=nn(),s.memoizedState=s.baseState=i,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ep,lastRenderedState:i},s.queue=o,s=vp.bind(null,$e,o),o.dispatch=s,o=Dc(!1),p=Pc.bind(null,$e,!1,o.queue),o=nn(),h={state:i,dispatch:null,action:e,pending:null},o.queue=h,s=Xx.bind(null,$e,h,p,s),h.dispatch=s,o.memoizedState=e,[i,s,!1]}function np(e){var i=Nt();return rp(i,ct,e)}function rp(e,i,s){if(i=Rc(e,i,ep)[0],e=co(jr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var o=Ns(i)}catch(b){throw b===_a?eo:b}else o=i;i=Nt();var h=i.queue,p=h.dispatch;return s!==i.memoizedState&&($e.flags|=2048,Aa(9,{destroy:void 0},Qx.bind(null,h,s),null)),[o,p,e]}function Qx(e,i){e.action=i}function ip(e){var i=Nt(),s=ct;if(s!==null)return rp(i,s,e);Nt(),i=i.memoizedState,s=Nt();var o=s.queue.dispatch;return s.memoizedState=e,[i,o,!1]}function Aa(e,i,s,o){return e={tag:e,create:s,deps:o,inst:i,next:null},i=$e.updateQueue,i===null&&(i=oo(),$e.updateQueue=i),s=i.lastEffect,s===null?i.lastEffect=e.next=e:(o=s.next,s.next=e,e.next=o,i.lastEffect=e),e}function ap(){return Nt().memoizedState}function fo(e,i,s,o){var h=nn();$e.flags|=e,h.memoizedState=Aa(1|i,{destroy:void 0},s,o===void 0?null:o)}function ho(e,i,s,o){var h=Nt();o=o===void 0?null:o;var p=h.memoizedState.inst;ct!==null&&o!==null&&Cc(o,ct.memoizedState.deps)?h.memoizedState=Aa(i,p,s,o):($e.flags|=e,h.memoizedState=Aa(1|i,p,s,o))}function sp(e,i){fo(8390656,8,e,i)}function Lc(e,i){ho(2048,8,e,i)}function Zx(e){$e.flags|=4;var i=$e.updateQueue;if(i===null)i=oo(),$e.updateQueue=i,i.events=[e];else{var s=i.events;s===null?i.events=[e]:s.push(e)}}function lp(e){var i=Nt().memoizedState;return Zx({ref:i,nextImpl:e}),function(){if((st&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function op(e,i){return ho(4,2,e,i)}function up(e,i){return ho(4,4,e,i)}function cp(e,i){if(typeof i=="function"){e=e();var s=i(e);return function(){typeof s=="function"?s():i(null)}}if(i!=null)return e=e(),i.current=e,function(){i.current=null}}function fp(e,i,s){s=s!=null?s.concat([e]):null,ho(4,4,cp.bind(null,i,e),s)}function Uc(){}function hp(e,i){var s=Nt();i=i===void 0?null:i;var o=s.memoizedState;return i!==null&&Cc(i,o[1])?o[0]:(s.memoizedState=[e,i],e)}function dp(e,i){var s=Nt();i=i===void 0?null:i;var o=s.memoizedState;if(i!==null&&Cc(i,o[1]))return o[0];if(o=e(),Gi){Bt(!0);try{e()}finally{Bt(!1)}}return s.memoizedState=[o,i],o}function Bc(e,i,s){return s===void 0||(Or&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=i:(e.memoizedState=s,e=mg(),$e.lanes|=e,ci|=e,s)}function mp(e,i,s,o){return bn(s,i)?s:Ea.current!==null?(e=Bc(e,s,o),bn(e,i)||(zt=!0),e):(Or&42)===0||(Or&1073741824)!==0&&(Ke&261930)===0?(zt=!0,e.memoizedState=s):(e=mg(),$e.lanes|=e,ci|=e,i)}function pp(e,i,s,o,h){var p=te.p;te.p=p!==0&&8>p?p:8;var b=H.T,_={};H.T=_,Pc(e,!1,i,s);try{var B=h(),ee=H.S;if(ee!==null&&ee(_,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var oe=Yx(B,o);Rs(e,i,oe,En(e))}else Rs(e,i,o,En(e))}catch(pe){Rs(e,i,{then:function(){},status:"rejected",reason:pe},En())}finally{te.p=p,b!==null&&_.types!==null&&(b.types=_.types),H.T=b}}function Kx(){}function qc(e,i,s,o){if(e.tag!==5)throw Error(a(476));var h=gp(e).queue;pp(e,h,i,me,s===null?Kx:function(){return yp(e),s(o)})}function gp(e){var i=e.memoizedState;if(i!==null)return i;i={memoizedState:me,baseState:me,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:me},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jr,lastRenderedState:s},next:null},e.memoizedState=i,e=e.alternate,e!==null&&(e.memoizedState=i),i}function yp(e){var i=gp(e);i.next===null&&(i=e.alternate.memoizedState),Rs(e,i.next.queue,{},En())}function Hc(){return Yt(Xs)}function bp(){return Nt().memoizedState}function xp(){return Nt().memoizedState}function Wx(e){for(var i=e.return;i!==null;){switch(i.tag){case 24:case 3:var s=En();e=ii(s);var o=ai(i,e,s);o!==null&&(dn(o,i,s),As(o,i,s)),i={cache:pc()},e.payload=i;return}i=i.return}}function ev(e,i,s){var o=En();s={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},mo(e)?Sp(i,s):(s=ic(e,i,s,o),s!==null&&(dn(s,e,o),_p(s,i,o)))}function vp(e,i,s){var o=En();Rs(e,i,s,o)}function Rs(e,i,s,o){var h={lane:o,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(mo(e))Sp(i,h);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var b=i.lastRenderedState,_=p(b,s);if(h.hasEagerState=!0,h.eagerState=_,bn(_,b))return Vl(e,i,h,0),pt===null&&Yl(),!1}catch{}finally{}if(s=ic(e,i,h,o),s!==null)return dn(s,e,o),_p(s,i,o),!0}return!1}function Pc(e,i,s,o){if(o={lane:2,revertLane:vf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},mo(e)){if(i)throw Error(a(479))}else i=ic(e,s,o,2),i!==null&&dn(i,e,2)}function mo(e){var i=e.alternate;return e===$e||i!==null&&i===$e}function Sp(e,i){ka=so=!0;var s=e.pending;s===null?i.next=i:(i.next=s.next,s.next=i),e.pending=i}function _p(e,i,s){if((s&4194048)!==0){var o=i.lanes;o&=e.pendingLanes,s|=o,i.lanes=s,ji(e,s)}}var Ms={readContext:Yt,use:uo,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};Ms.useEffectEvent=Tt;var wp={readContext:Yt,use:uo,useCallback:function(e,i){return nn().memoizedState=[e,i===void 0?null:i],e},useContext:Yt,useEffect:sp,useImperativeHandle:function(e,i,s){s=s!=null?s.concat([e]):null,fo(4194308,4,cp.bind(null,i,e),s)},useLayoutEffect:function(e,i){return fo(4194308,4,e,i)},useInsertionEffect:function(e,i){fo(4,2,e,i)},useMemo:function(e,i){var s=nn();i=i===void 0?null:i;var o=e();if(Gi){Bt(!0);try{e()}finally{Bt(!1)}}return s.memoizedState=[o,i],o},useReducer:function(e,i,s){var o=nn();if(s!==void 0){var h=s(i);if(Gi){Bt(!0);try{s(i)}finally{Bt(!1)}}}else h=i;return o.memoizedState=o.baseState=h,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:h},o.queue=e,e=e.dispatch=ev.bind(null,$e,e),[o.memoizedState,e]},useRef:function(e){var i=nn();return e={current:e},i.memoizedState=e},useState:function(e){e=Dc(e);var i=e.queue,s=vp.bind(null,$e,i);return i.dispatch=s,[e.memoizedState,s]},useDebugValue:Uc,useDeferredValue:function(e,i){var s=nn();return Bc(s,e,i)},useTransition:function(){var e=Dc(!1);return e=pp.bind(null,$e,e.queue,!0,!1),nn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,i,s){var o=$e,h=nn();if(et){if(s===void 0)throw Error(a(407));s=s()}else{if(s=i(),pt===null)throw Error(a(349));(Ke&127)!==0||$m(o,i,s)}h.memoizedState=s;var p={value:s,getSnapshot:i};return h.queue=p,sp(Ym.bind(null,o,p,e),[e]),o.flags|=2048,Aa(9,{destroy:void 0},Gm.bind(null,o,p,s,i),null),s},useId:function(){var e=nn(),i=pt.identifierPrefix;if(et){var s=ur,o=or;s=(o&~(1<<32-lt(o)-1)).toString(32)+s,i="_"+i+"R_"+s,s=lo++,0<s&&(i+="H"+s.toString(32)),i+="_"}else s=Vx++,i="_"+i+"r_"+s.toString(32)+"_";return e.memoizedState=i},useHostTransitionStatus:Hc,useFormState:tp,useActionState:tp,useOptimistic:function(e){var i=nn();i.memoizedState=i.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=s,i=Pc.bind(null,$e,!0,s),s.dispatch=i,[e,i]},useMemoCache:Nc,useCacheRefresh:function(){return nn().memoizedState=Wx.bind(null,$e)},useEffectEvent:function(e){var i=nn(),s={impl:e};return i.memoizedState=s,function(){if((st&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}},Ic={readContext:Yt,use:uo,useCallback:hp,useContext:Yt,useEffect:Lc,useImperativeHandle:fp,useInsertionEffect:op,useLayoutEffect:up,useMemo:dp,useReducer:co,useRef:ap,useState:function(){return co(jr)},useDebugValue:Uc,useDeferredValue:function(e,i){var s=Nt();return mp(s,ct.memoizedState,e,i)},useTransition:function(){var e=co(jr)[0],i=Nt().memoizedState;return[typeof e=="boolean"?e:Ns(e),i]},useSyncExternalStore:Fm,useId:bp,useHostTransitionStatus:Hc,useFormState:np,useActionState:np,useOptimistic:function(e,i){var s=Nt();return Xm(s,ct,e,i)},useMemoCache:Nc,useCacheRefresh:xp};Ic.useEffectEvent=lp;var Ep={readContext:Yt,use:uo,useCallback:hp,useContext:Yt,useEffect:Lc,useImperativeHandle:fp,useInsertionEffect:op,useLayoutEffect:up,useMemo:dp,useReducer:Mc,useRef:ap,useState:function(){return Mc(jr)},useDebugValue:Uc,useDeferredValue:function(e,i){var s=Nt();return ct===null?Bc(s,e,i):mp(s,ct.memoizedState,e,i)},useTransition:function(){var e=Mc(jr)[0],i=Nt().memoizedState;return[typeof e=="boolean"?e:Ns(e),i]},useSyncExternalStore:Fm,useId:bp,useHostTransitionStatus:Hc,useFormState:ip,useActionState:ip,useOptimistic:function(e,i){var s=Nt();return ct!==null?Xm(s,ct,e,i):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Nc,useCacheRefresh:xp};Ep.useEffectEvent=lp;function Fc(e,i,s,o){i=e.memoizedState,s=s(o,i),s=s==null?i:g({},i,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var $c={enqueueSetState:function(e,i,s){e=e._reactInternals;var o=En(),h=ii(o);h.payload=i,s!=null&&(h.callback=s),i=ai(e,h,o),i!==null&&(dn(i,e,o),As(i,e,o))},enqueueReplaceState:function(e,i,s){e=e._reactInternals;var o=En(),h=ii(o);h.tag=1,h.payload=i,s!=null&&(h.callback=s),i=ai(e,h,o),i!==null&&(dn(i,e,o),As(i,e,o))},enqueueForceUpdate:function(e,i){e=e._reactInternals;var s=En(),o=ii(s);o.tag=2,i!=null&&(o.callback=i),i=ai(e,o,s),i!==null&&(dn(i,e,s),As(i,e,s))}};function kp(e,i,s,o,h,p,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,p,b):i.prototype&&i.prototype.isPureReactComponent?!xs(s,o)||!xs(h,p):!0}function Cp(e,i,s,o){e=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(s,o),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(s,o),i.state!==e&&$c.enqueueReplaceState(i,i.state,null)}function Yi(e,i){var s=i;if("ref"in i){s={};for(var o in i)o!=="ref"&&(s[o]=i[o])}if(e=e.defaultProps){s===i&&(s=g({},s));for(var h in e)s[h]===void 0&&(s[h]=e[h])}return s}function Ap(e){Gl(e)}function Tp(e){console.error(e)}function Op(e){Gl(e)}function po(e,i){try{var s=e.onUncaughtError;s(i.value,{componentStack:i.stack})}catch(o){setTimeout(function(){throw o})}}function jp(e,i,s){try{var o=e.onCaughtError;o(s.value,{componentStack:s.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Gc(e,i,s){return s=ii(s),s.tag=3,s.payload={element:null},s.callback=function(){po(e,i)},s}function Np(e){return e=ii(e),e.tag=3,e}function Rp(e,i,s,o){var h=s.type.getDerivedStateFromError;if(typeof h=="function"){var p=o.value;e.payload=function(){return h(p)},e.callback=function(){jp(i,s,o)}}var b=s.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){jp(i,s,o),typeof h!="function"&&(fi===null?fi=new Set([this]):fi.add(this));var _=o.stack;this.componentDidCatch(o.value,{componentStack:_!==null?_:""})})}function tv(e,i,s,o,h){if(s.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(i=s.alternate,i!==null&&xa(i,s,h,!0),s=vn.current,s!==null){switch(s.tag){case 31:case 13:return Fn===null?Ao():s.alternate===null&&Ot===0&&(Ot=3),s.flags&=-257,s.flags|=65536,s.lanes=h,o===to?s.flags|=16384:(i=s.updateQueue,i===null?s.updateQueue=new Set([o]):i.add(o),yf(e,o,h)),!1;case 22:return s.flags|=65536,o===to?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)),yf(e,o,h)),!1}throw Error(a(435,s.tag))}return yf(e,o,h),Ao(),!1}if(et)return i=vn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,o!==cc&&(e=Error(a(422),{cause:o}),_s(qn(e,s)))):(o!==cc&&(i=Error(a(423),{cause:o}),_s(qn(i,s))),e=e.current.alternate,e.flags|=65536,h&=-h,e.lanes|=h,o=qn(o,s),h=Gc(e.stateNode,o,h),Sc(e,h),Ot!==4&&(Ot=2)),!1;var p=Error(a(520),{cause:o});if(p=qn(p,s),Ps===null?Ps=[p]:Ps.push(p),Ot!==4&&(Ot=2),i===null)return!0;o=qn(o,s),s=i;do{switch(s.tag){case 3:return s.flags|=65536,e=h&-h,s.lanes|=e,e=Gc(s.stateNode,o,e),Sc(s,e),!1;case 1:if(i=s.type,p=s.stateNode,(s.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(fi===null||!fi.has(p))))return s.flags|=65536,h&=-h,s.lanes|=h,h=Np(h),Rp(h,e,s,o),Sc(s,h),!1}s=s.return}while(s!==null);return!1}var Yc=Error(a(461)),zt=!1;function Vt(e,i,s,o){i.child=e===null?Lm(i,null,s,o):$i(i,e.child,s,o)}function Mp(e,i,s,o,h){s=s.render;var p=i.ref;if("ref"in o){var b={};for(var _ in o)_!=="ref"&&(b[_]=o[_])}else b=o;return Hi(i),o=Ac(e,i,s,b,p,h),_=Tc(),e!==null&&!zt?(Oc(e,i,h),Nr(e,i,h)):(et&&_&&oc(i),i.flags|=1,Vt(e,i,o,h),i.child)}function Dp(e,i,s,o,h){if(e===null){var p=s.type;return typeof p=="function"&&!ac(p)&&p.defaultProps===void 0&&s.compare===null?(i.tag=15,i.type=p,zp(e,i,p,o,h)):(e=Xl(s.type,null,o,i,i.mode,h),e.ref=i.ref,e.return=i,i.child=e)}if(p=e.child,!ef(e,h)){var b=p.memoizedProps;if(s=s.compare,s=s!==null?s:xs,s(b,o)&&e.ref===i.ref)return Nr(e,i,h)}return i.flags|=1,e=kr(p,o),e.ref=i.ref,e.return=i,i.child=e}function zp(e,i,s,o,h){if(e!==null){var p=e.memoizedProps;if(xs(p,o)&&e.ref===i.ref)if(zt=!1,i.pendingProps=o=p,ef(e,h))(e.flags&131072)!==0&&(zt=!0);else return i.lanes=e.lanes,Nr(e,i,h)}return Vc(e,i,s,o,h)}function Lp(e,i,s,o){var h=o.children,p=e!==null?e.memoizedState:null;if(e===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,e!==null){for(o=i.child=e.child,h=0;o!==null;)h=h|o.lanes|o.childLanes,o=o.sibling;o=h&~p}else o=0,i.child=null;return Up(e,i,p,s,o)}if((s&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},e!==null&&Wl(i,p!==null?p.cachePool:null),p!==null?qm(i,p):wc(),Hm(i);else return o=i.lanes=536870912,Up(e,i,p!==null?p.baseLanes|s:s,s,o)}else p!==null?(Wl(i,p.cachePool),qm(i,p),li(),i.memoizedState=null):(e!==null&&Wl(i,null),wc(),li());return Vt(e,i,h,s),i.child}function Ds(e,i){return e!==null&&e.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Up(e,i,s,o,h){var p=yc();return p=p===null?null:{parent:Mt._currentValue,pool:p},i.memoizedState={baseLanes:s,cachePool:p},e!==null&&Wl(i,null),wc(),Hm(i),e!==null&&xa(e,i,o,!0),i.childLanes=h,null}function go(e,i){return i=bo({mode:i.mode,children:i.children},e.mode),i.ref=e.ref,e.child=i,i.return=e,i}function Bp(e,i,s){return $i(i,e.child,null,s),e=go(i,i.pendingProps),e.flags|=2,Sn(i),i.memoizedState=null,e}function nv(e,i,s){var o=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,e===null){if(et){if(o.mode==="hidden")return e=go(i,o),i.lanes=536870912,Ds(null,e);if(kc(i),(e=vt)?(e=Qg(e,In),e=e!==null&&e.data==="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:Wr!==null?{id:or,overflow:ur}:null,retryLane:536870912,hydrationErrors:null},s=Sm(e),s.return=i,i.child=s,Gt=i,vt=null)):e=null,e===null)throw ti(i);return i.lanes=536870912,null}return go(i,o)}var p=e.memoizedState;if(p!==null){var b=p.dehydrated;if(kc(i),h)if(i.flags&256)i.flags&=-257,i=Bp(e,i,s);else if(i.memoizedState!==null)i.child=e.child,i.flags|=128,i=null;else throw Error(a(558));else if(zt||xa(e,i,s,!1),h=(s&e.childLanes)!==0,zt||h){if(o=pt,o!==null&&(b=Zr(o,s),b!==0&&b!==p.retryLane))throw p.retryLane=b,Li(e,b),dn(o,e,b),Yc;Ao(),i=Bp(e,i,s)}else e=p.treeContext,vt=$n(b.nextSibling),Gt=i,et=!0,ei=null,In=!1,e!==null&&Em(i,e),i=go(i,o),i.flags|=4096;return i}return e=kr(e.child,{mode:o.mode,children:o.children}),e.ref=i.ref,i.child=e,e.return=i,e}function yo(e,i){var s=i.ref;if(s===null)e!==null&&e.ref!==null&&(i.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(a(284));(e===null||e.ref!==s)&&(i.flags|=4194816)}}function Vc(e,i,s,o,h){return Hi(i),s=Ac(e,i,s,o,void 0,h),o=Tc(),e!==null&&!zt?(Oc(e,i,h),Nr(e,i,h)):(et&&o&&oc(i),i.flags|=1,Vt(e,i,s,h),i.child)}function qp(e,i,s,o,h,p){return Hi(i),i.updateQueue=null,s=Im(i,o,s,h),Pm(e),o=Tc(),e!==null&&!zt?(Oc(e,i,p),Nr(e,i,p)):(et&&o&&oc(i),i.flags|=1,Vt(e,i,s,p),i.child)}function Hp(e,i,s,o,h){if(Hi(i),i.stateNode===null){var p=pa,b=s.contextType;typeof b=="object"&&b!==null&&(p=Yt(b)),p=new s(o,p),i.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=$c,i.stateNode=p,p._reactInternals=i,p=i.stateNode,p.props=o,p.state=i.memoizedState,p.refs={},xc(i),b=s.contextType,p.context=typeof b=="object"&&b!==null?Yt(b):pa,p.state=i.memoizedState,b=s.getDerivedStateFromProps,typeof b=="function"&&(Fc(i,s,b,o),p.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(b=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),b!==p.state&&$c.enqueueReplaceState(p,p.state,null),Os(i,o,p,h),Ts(),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!0}else if(e===null){p=i.stateNode;var _=i.memoizedProps,B=Yi(s,_);p.props=B;var ee=p.context,oe=s.contextType;b=pa,typeof oe=="object"&&oe!==null&&(b=Yt(oe));var pe=s.getDerivedStateFromProps;oe=typeof pe=="function"||typeof p.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,oe||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(_||ee!==b)&&Cp(i,p,o,b),ri=!1;var ne=i.memoizedState;p.state=ne,Os(i,o,p,h),Ts(),ee=i.memoizedState,_||ne!==ee||ri?(typeof pe=="function"&&(Fc(i,s,pe,o),ee=i.memoizedState),(B=ri||kp(i,s,B,o,ne,ee,b))?(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=b,o=B):(typeof p.componentDidMount=="function"&&(i.flags|=4194308),o=!1)}else{p=i.stateNode,vc(e,i),b=i.memoizedProps,oe=Yi(s,b),p.props=oe,pe=i.pendingProps,ne=p.context,ee=s.contextType,B=pa,typeof ee=="object"&&ee!==null&&(B=Yt(ee)),_=s.getDerivedStateFromProps,(ee=typeof _=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(b!==pe||ne!==B)&&Cp(i,p,o,B),ri=!1,ne=i.memoizedState,p.state=ne,Os(i,o,p,h),Ts();var ae=i.memoizedState;b!==pe||ne!==ae||ri||e!==null&&e.dependencies!==null&&Zl(e.dependencies)?(typeof _=="function"&&(Fc(i,s,_,o),ae=i.memoizedState),(oe=ri||kp(i,s,oe,o,ne,ae,B)||e!==null&&e.dependencies!==null&&Zl(e.dependencies))?(ee||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,ae,B),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,ae,B)),typeof p.componentDidUpdate=="function"&&(i.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof p.componentDidUpdate!="function"||b===e.memoizedProps&&ne===e.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&ne===e.memoizedState||(i.flags|=1024),i.memoizedProps=o,i.memoizedState=ae),p.props=o,p.state=ae,p.context=B,o=oe):(typeof p.componentDidUpdate!="function"||b===e.memoizedProps&&ne===e.memoizedState||(i.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&ne===e.memoizedState||(i.flags|=1024),o=!1)}return p=o,yo(e,i),o=(i.flags&128)!==0,p||o?(p=i.stateNode,s=o&&typeof s.getDerivedStateFromError!="function"?null:p.render(),i.flags|=1,e!==null&&o?(i.child=$i(i,e.child,null,h),i.child=$i(i,null,s,h)):Vt(e,i,s,h),i.memoizedState=p.state,e=i.child):e=Nr(e,i,h),e}function Pp(e,i,s,o){return Bi(),i.flags|=256,Vt(e,i,s,o),i.child}var Jc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xc(e){return{baseLanes:e,cachePool:jm()}}function Qc(e,i,s){return e=e!==null?e.childLanes&~s:0,i&&(e|=wn),e}function Ip(e,i,s){var o=i.pendingProps,h=!1,p=(i.flags&128)!==0,b;if((b=p)||(b=e!==null&&e.memoizedState===null?!1:(jt.current&2)!==0),b&&(h=!0,i.flags&=-129),b=(i.flags&32)!==0,i.flags&=-33,e===null){if(et){if(h?si(i):li(),(e=vt)?(e=Qg(e,In),e=e!==null&&e.data!=="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:Wr!==null?{id:or,overflow:ur}:null,retryLane:536870912,hydrationErrors:null},s=Sm(e),s.return=i,i.child=s,Gt=i,vt=null)):e=null,e===null)throw ti(i);return Mf(e)?i.lanes=32:i.lanes=536870912,null}var _=o.children;return o=o.fallback,h?(li(),h=i.mode,_=bo({mode:"hidden",children:_},h),o=Ui(o,h,s,null),_.return=i,o.return=i,_.sibling=o,i.child=_,o=i.child,o.memoizedState=Xc(s),o.childLanes=Qc(e,b,s),i.memoizedState=Jc,Ds(null,o)):(si(i),Zc(i,_))}var B=e.memoizedState;if(B!==null&&(_=B.dehydrated,_!==null)){if(p)i.flags&256?(si(i),i.flags&=-257,i=Kc(e,i,s)):i.memoizedState!==null?(li(),i.child=e.child,i.flags|=128,i=null):(li(),_=o.fallback,h=i.mode,o=bo({mode:"visible",children:o.children},h),_=Ui(_,h,s,null),_.flags|=2,o.return=i,_.return=i,o.sibling=_,i.child=o,$i(i,e.child,null,s),o=i.child,o.memoizedState=Xc(s),o.childLanes=Qc(e,b,s),i.memoizedState=Jc,i=Ds(null,o));else if(si(i),Mf(_)){if(b=_.nextSibling&&_.nextSibling.dataset,b)var ee=b.dgst;b=ee,o=Error(a(419)),o.stack="",o.digest=b,_s({value:o,source:null,stack:null}),i=Kc(e,i,s)}else if(zt||xa(e,i,s,!1),b=(s&e.childLanes)!==0,zt||b){if(b=pt,b!==null&&(o=Zr(b,s),o!==0&&o!==B.retryLane))throw B.retryLane=o,Li(e,o),dn(b,e,o),Yc;Rf(_)||Ao(),i=Kc(e,i,s)}else Rf(_)?(i.flags|=192,i.child=e.child,i=null):(e=B.treeContext,vt=$n(_.nextSibling),Gt=i,et=!0,ei=null,In=!1,e!==null&&Em(i,e),i=Zc(i,o.children),i.flags|=4096);return i}return h?(li(),_=o.fallback,h=i.mode,B=e.child,ee=B.sibling,o=kr(B,{mode:"hidden",children:o.children}),o.subtreeFlags=B.subtreeFlags&65011712,ee!==null?_=kr(ee,_):(_=Ui(_,h,s,null),_.flags|=2),_.return=i,o.return=i,o.sibling=_,i.child=o,Ds(null,o),o=i.child,_=e.child.memoizedState,_===null?_=Xc(s):(h=_.cachePool,h!==null?(B=Mt._currentValue,h=h.parent!==B?{parent:B,pool:B}:h):h=jm(),_={baseLanes:_.baseLanes|s,cachePool:h}),o.memoizedState=_,o.childLanes=Qc(e,b,s),i.memoizedState=Jc,Ds(e.child,o)):(si(i),s=e.child,e=s.sibling,s=kr(s,{mode:"visible",children:o.children}),s.return=i,s.sibling=null,e!==null&&(b=i.deletions,b===null?(i.deletions=[e],i.flags|=16):b.push(e)),i.child=s,i.memoizedState=null,s)}function Zc(e,i){return i=bo({mode:"visible",children:i},e.mode),i.return=e,e.child=i}function bo(e,i){return e=xn(22,e,null,i),e.lanes=0,e}function Kc(e,i,s){return $i(i,e.child,null,s),e=Zc(i,i.pendingProps.children),e.flags|=2,i.memoizedState=null,e}function Fp(e,i,s){e.lanes|=i;var o=e.alternate;o!==null&&(o.lanes|=i),dc(e.return,i,s)}function Wc(e,i,s,o,h,p){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:o,tail:s,tailMode:h,treeForkCount:p}:(b.isBackwards=i,b.rendering=null,b.renderingStartTime=0,b.last=o,b.tail=s,b.tailMode=h,b.treeForkCount=p)}function $p(e,i,s){var o=i.pendingProps,h=o.revealOrder,p=o.tail;o=o.children;var b=jt.current,_=(b&2)!==0;if(_?(b=b&1|2,i.flags|=128):b&=1,E(jt,b),Vt(e,i,o,s),o=et?Ss:0,!_&&e!==null&&(e.flags&128)!==0)e:for(e=i.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Fp(e,s,i);else if(e.tag===19)Fp(e,s,i);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break e;for(;e.sibling===null;){if(e.return===null||e.return===i)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(h){case"forwards":for(s=i.child,h=null;s!==null;)e=s.alternate,e!==null&&ao(e)===null&&(h=s),s=s.sibling;s=h,s===null?(h=i.child,i.child=null):(h=s.sibling,s.sibling=null),Wc(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(e=h.alternate,e!==null&&ao(e)===null){i.child=h;break}e=h.sibling,h.sibling=s,s=h,h=e}Wc(i,!0,s,null,p,o);break;case"together":Wc(i,!1,null,null,void 0,o);break;default:i.memoizedState=null}return i.child}function Nr(e,i,s){if(e!==null&&(i.dependencies=e.dependencies),ci|=i.lanes,(s&i.childLanes)===0)if(e!==null){if(xa(e,i,s,!1),(s&i.childLanes)===0)return null}else return null;if(e!==null&&i.child!==e.child)throw Error(a(153));if(i.child!==null){for(e=i.child,s=kr(e,e.pendingProps),i.child=s,s.return=i;e.sibling!==null;)e=e.sibling,s=s.sibling=kr(e,e.pendingProps),s.return=i;s.sibling=null}return i.child}function ef(e,i){return(e.lanes&i)!==0?!0:(e=e.dependencies,!!(e!==null&&Zl(e)))}function rv(e,i,s){switch(i.tag){case 3:ze(i,i.stateNode.containerInfo),ni(i,Mt,e.memoizedState.cache),Bi();break;case 27:case 5:Me(i);break;case 4:ze(i,i.stateNode.containerInfo);break;case 10:ni(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,kc(i),null;break;case 13:var o=i.memoizedState;if(o!==null)return o.dehydrated!==null?(si(i),i.flags|=128,null):(s&i.child.childLanes)!==0?Ip(e,i,s):(si(i),e=Nr(e,i,s),e!==null?e.sibling:null);si(i);break;case 19:var h=(e.flags&128)!==0;if(o=(s&i.childLanes)!==0,o||(xa(e,i,s,!1),o=(s&i.childLanes)!==0),h){if(o)return $p(e,i,s);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),E(jt,jt.current),o)break;return null;case 22:return i.lanes=0,Lp(e,i,s,i.pendingProps);case 24:ni(i,Mt,e.memoizedState.cache)}return Nr(e,i,s)}function Gp(e,i,s){if(e!==null)if(e.memoizedProps!==i.pendingProps)zt=!0;else{if(!ef(e,s)&&(i.flags&128)===0)return zt=!1,rv(e,i,s);zt=(e.flags&131072)!==0}else zt=!1,et&&(i.flags&1048576)!==0&&wm(i,Ss,i.index);switch(i.lanes=0,i.tag){case 16:e:{var o=i.pendingProps;if(e=Ii(i.elementType),i.type=e,typeof e=="function")ac(e)?(o=Yi(e,o),i.tag=1,i=Hp(null,i,e,o,s)):(i.tag=0,i=Vc(null,i,e,o,s));else{if(e!=null){var h=e.$$typeof;if(h===le){i.tag=11,i=Mp(null,i,e,o,s);break e}else if(h===J){i.tag=14,i=Dp(null,i,e,o,s);break e}}throw i=he(e)||e,Error(a(306,i,""))}}return i;case 0:return Vc(e,i,i.type,i.pendingProps,s);case 1:return o=i.type,h=Yi(o,i.pendingProps),Hp(e,i,o,h,s);case 3:e:{if(ze(i,i.stateNode.containerInfo),e===null)throw Error(a(387));o=i.pendingProps;var p=i.memoizedState;h=p.element,vc(e,i),Os(i,o,null,s);var b=i.memoizedState;if(o=b.cache,ni(i,Mt,o),o!==p.cache&&mc(i,[Mt],s,!0),Ts(),o=b.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:b.cache},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){i=Pp(e,i,o,s);break e}else if(o!==h){h=qn(Error(a(424)),i),_s(h),i=Pp(e,i,o,s);break e}else{switch(e=i.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(vt=$n(e.firstChild),Gt=i,et=!0,ei=null,In=!0,s=Lm(i,null,o,s),i.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(Bi(),o===h){i=Nr(e,i,s);break e}Vt(e,i,o,s)}i=i.child}return i;case 26:return yo(e,i),e===null?(s=ny(i.type,null,i.pendingProps,null))?i.memoizedState=s:et||(s=i.type,e=i.pendingProps,o=Do(xe.current).createElement(s),o[mt]=i,o[At]=e,Jt(o,s,e),P(o),i.stateNode=o):i.memoizedState=ny(i.type,e.memoizedProps,i.pendingProps,e.memoizedState),null;case 27:return Me(i),e===null&&et&&(o=i.stateNode=Wg(i.type,i.pendingProps,xe.current),Gt=i,In=!0,h=vt,pi(i.type)?(Df=h,vt=$n(o.firstChild)):vt=h),Vt(e,i,i.pendingProps.children,s),yo(e,i),e===null&&(i.flags|=4194304),i.child;case 5:return e===null&&et&&((h=o=vt)&&(o=Mv(o,i.type,i.pendingProps,In),o!==null?(i.stateNode=o,Gt=i,vt=$n(o.firstChild),In=!1,h=!0):h=!1),h||ti(i)),Me(i),h=i.type,p=i.pendingProps,b=e!==null?e.memoizedProps:null,o=p.children,Of(h,p)?o=null:b!==null&&Of(h,b)&&(i.flags|=32),i.memoizedState!==null&&(h=Ac(e,i,Jx,null,null,s),Xs._currentValue=h),yo(e,i),Vt(e,i,o,s),i.child;case 6:return e===null&&et&&((e=s=vt)&&(s=Dv(s,i.pendingProps,In),s!==null?(i.stateNode=s,Gt=i,vt=null,e=!0):e=!1),e||ti(i)),null;case 13:return Ip(e,i,s);case 4:return ze(i,i.stateNode.containerInfo),o=i.pendingProps,e===null?i.child=$i(i,null,o,s):Vt(e,i,o,s),i.child;case 11:return Mp(e,i,i.type,i.pendingProps,s);case 7:return Vt(e,i,i.pendingProps,s),i.child;case 8:return Vt(e,i,i.pendingProps.children,s),i.child;case 12:return Vt(e,i,i.pendingProps.children,s),i.child;case 10:return o=i.pendingProps,ni(i,i.type,o.value),Vt(e,i,o.children,s),i.child;case 9:return h=i.type._context,o=i.pendingProps.children,Hi(i),h=Yt(h),o=o(h),i.flags|=1,Vt(e,i,o,s),i.child;case 14:return Dp(e,i,i.type,i.pendingProps,s);case 15:return zp(e,i,i.type,i.pendingProps,s);case 19:return $p(e,i,s);case 31:return nv(e,i,s);case 22:return Lp(e,i,s,i.pendingProps);case 24:return Hi(i),o=Yt(Mt),e===null?(h=yc(),h===null&&(h=pt,p=pc(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=s),h=p),i.memoizedState={parent:o,cache:h},xc(i),ni(i,Mt,h)):((e.lanes&s)!==0&&(vc(e,i),Os(i,null,null,s),Ts()),h=e.memoizedState,p=i.memoizedState,h.parent!==o?(h={parent:o,cache:o},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),ni(i,Mt,o)):(o=p.cache,ni(i,Mt,o),o!==h.cache&&mc(i,[Mt],s,!0))),Vt(e,i,i.pendingProps.children,s),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Rr(e){e.flags|=4}function tf(e,i,s,o,h){if((i=(e.mode&32)!==0)&&(i=!1),i){if(e.flags|=16777216,(h&335544128)===h)if(e.stateNode.complete)e.flags|=8192;else if(bg())e.flags|=8192;else throw Fi=to,bc}else e.flags&=-16777217}function Yp(e,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ly(i))if(bg())e.flags|=8192;else throw Fi=to,bc}function xo(e,i){i!==null&&(e.flags|=4),e.flags&16384&&(i=e.tag!==22?aa():536870912,e.lanes|=i,Na|=i)}function zs(e,i){if(!et)switch(e.tailMode){case"hidden":i=e.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?i||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function St(e){var i=e.alternate!==null&&e.alternate.child===e.child,s=0,o=0;if(i)for(var h=e.child;h!==null;)s|=h.lanes|h.childLanes,o|=h.subtreeFlags&65011712,o|=h.flags&65011712,h.return=e,h=h.sibling;else for(h=e.child;h!==null;)s|=h.lanes|h.childLanes,o|=h.subtreeFlags,o|=h.flags,h.return=e,h=h.sibling;return e.subtreeFlags|=o,e.childLanes=s,i}function iv(e,i,s){var o=i.pendingProps;switch(uc(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return St(i),null;case 1:return St(i),null;case 3:return s=i.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),Tr(Mt),Ce(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(ba(i)?Rr(i):e===null||e.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,fc())),St(i),null;case 26:var h=i.type,p=i.memoizedState;return e===null?(Rr(i),p!==null?(St(i),Yp(i,p)):(St(i),tf(i,h,null,o,s))):p?p!==e.memoizedState?(Rr(i),St(i),Yp(i,p)):(St(i),i.flags&=-16777217):(e=e.memoizedProps,e!==o&&Rr(i),St(i),tf(i,h,e,o,s)),null;case 27:if(Le(i),s=xe.current,h=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==o&&Rr(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return St(i),null}e=se.current,ba(i)?km(i):(e=Wg(h,o,s),i.stateNode=e,Rr(i))}return St(i),null;case 5:if(Le(i),h=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==o&&Rr(i);else{if(!o){if(i.stateNode===null)throw Error(a(166));return St(i),null}if(p=se.current,ba(i))km(i);else{var b=Do(xe.current);switch(p){case 1:p=b.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=b.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=b.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=b.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=b.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?b.createElement(h,{is:o.is}):b.createElement(h)}}p[mt]=i,p[At]=o;e:for(b=i.child;b!==null;){if(b.tag===5||b.tag===6)p.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===i)break e;for(;b.sibling===null;){if(b.return===null||b.return===i)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}i.stateNode=p;e:switch(Jt(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&&Rr(i)}}return St(i),tf(i,i.type,e===null?null:e.memoizedProps,i.pendingProps,s),null;case 6:if(e&&i.stateNode!=null)e.memoizedProps!==o&&Rr(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(a(166));if(e=xe.current,ba(i)){if(e=i.stateNode,s=i.memoizedProps,o=null,h=Gt,h!==null)switch(h.tag){case 27:case 5:o=h.memoizedProps}e[mt]=i,e=!!(e.nodeValue===s||o!==null&&o.suppressHydrationWarning===!0||Ig(e.nodeValue,s)),e||ti(i,!0)}else e=Do(e).createTextNode(o),e[mt]=i,i.stateNode=e}return St(i),null;case 31:if(s=i.memoizedState,e===null||e.memoizedState!==null){if(o=ba(i),s!==null){if(e===null){if(!o)throw Error(a(318));if(e=i.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[mt]=i}else Bi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;St(i),e=!1}else s=fc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return i.flags&256?(Sn(i),i):(Sn(i),null);if((i.flags&128)!==0)throw Error(a(558))}return St(i),null;case 13:if(o=i.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(h=ba(i),o!==null&&o.dehydrated!==null){if(e===null){if(!h)throw Error(a(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[mt]=i}else Bi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;St(i),h=!1}else h=fc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Sn(i),i):(Sn(i),null)}return Sn(i),(i.flags&128)!==0?(i.lanes=s,i):(s=o!==null,e=e!==null&&e.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!==e&&s&&(i.child.flags|=8192),xo(i,i.updateQueue),St(i),null);case 4:return Ce(),e===null&&Ef(i.stateNode.containerInfo),St(i),null;case 10:return Tr(i.type),St(i),null;case 19:if(Y(jt),o=i.memoizedState,o===null)return St(i),null;if(h=(i.flags&128)!==0,p=o.rendering,p===null)if(h)zs(o,!1);else{if(Ot!==0||e!==null&&(e.flags&128)!==0)for(e=i.child;e!==null;){if(p=ao(e),p!==null){for(i.flags|=128,zs(o,!1),e=p.updateQueue,i.updateQueue=e,xo(i,e),i.subtreeFlags=0,e=s,s=i.child;s!==null;)vm(s,e),s=s.sibling;return E(jt,jt.current&1|2),et&&Cr(i,o.treeForkCount),i.child}e=e.sibling}o.tail!==null&&yt()>Eo&&(i.flags|=128,h=!0,zs(o,!1),i.lanes=4194304)}else{if(!h)if(e=ao(p),e!==null){if(i.flags|=128,h=!0,e=e.updateQueue,i.updateQueue=e,xo(i,e),zs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!p.alternate&&!et)return St(i),null}else 2*yt()-o.renderingStartTime>Eo&&s!==536870912&&(i.flags|=128,h=!0,zs(o,!1),i.lanes=4194304);o.isBackwards?(p.sibling=i.child,i.child=p):(e=o.last,e!==null?e.sibling=p:i.child=p,o.last=p)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=yt(),e.sibling=null,s=jt.current,E(jt,h?s&1|2:s&1),et&&Cr(i,o.treeForkCount),e):(St(i),null);case 22:case 23:return Sn(i),Ec(),o=i.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(s&536870912)!==0&&(i.flags&128)===0&&(St(i),i.subtreeFlags&6&&(i.flags|=8192)):St(i),s=i.updateQueue,s!==null&&xo(i,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==s&&(i.flags|=2048),e!==null&&Y(Pi),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),Tr(Mt),St(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function av(e,i){switch(uc(i),i.tag){case 1:return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return Tr(Mt),Ce(),e=i.flags,(e&65536)!==0&&(e&128)===0?(i.flags=e&-65537|128,i):null;case 26:case 27:case 5:return Le(i),null;case 31:if(i.memoizedState!==null){if(Sn(i),i.alternate===null)throw Error(a(340));Bi()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 13:if(Sn(i),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Bi()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return Y(jt),null;case 4:return Ce(),null;case 10:return Tr(i.type),null;case 22:case 23:return Sn(i),Ec(),e!==null&&Y(Pi),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 24:return Tr(Mt),null;case 25:return null;default:return null}}function Vp(e,i){switch(uc(i),i.tag){case 3:Tr(Mt),Ce();break;case 26:case 27:case 5:Le(i);break;case 4:Ce();break;case 31:i.memoizedState!==null&&Sn(i);break;case 13:Sn(i);break;case 19:Y(jt);break;case 10:Tr(i.type);break;case 22:case 23:Sn(i),Ec(),e!==null&&Y(Pi);break;case 24:Tr(Mt)}}function Ls(e,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&e)===e){o=void 0;var p=s.create,b=s.inst;o=p(),b.destroy=o}s=s.next}while(s!==h)}}catch(_){ut(i,i.return,_)}}function oi(e,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&e)===e){var b=o.inst,_=b.destroy;if(_!==void 0){b.destroy=void 0,h=i;var B=s,ee=_;try{ee()}catch(oe){ut(h,B,oe)}}}o=o.next}while(o!==p)}}catch(oe){ut(i,i.return,oe)}}function Jp(e){var i=e.updateQueue;if(i!==null){var s=e.stateNode;try{Bm(i,s)}catch(o){ut(e,e.return,o)}}}function Xp(e,i,s){s.props=Yi(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(o){ut(e,i,o)}}function Us(e,i){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof s=="function"?e.refCleanup=s(o):s.current=o}}catch(h){ut(e,i,h)}}function cr(e,i){var s=e.ref,o=e.refCleanup;if(s!==null)if(typeof o=="function")try{o()}catch(h){ut(e,i,h)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){ut(e,i,h)}else s.current=null}function Qp(e){var i=e.type,s=e.memoizedProps,o=e.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){ut(e,e.return,h)}}function nf(e,i,s){try{var o=e.stateNode;Av(o,e.type,s,i),o[At]=i}catch(h){ut(e,e.return,h)}}function Zp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&pi(e.type)||e.tag===4}function rf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Zp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&pi(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function af(e,i,s){var o=e.tag;if(o===5||o===6)e=e.stateNode,i?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,i):(i=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,i.appendChild(e),s=s._reactRootContainer,s!=null||i.onclick!==null||(i.onclick=wr));else if(o!==4&&(o===27&&pi(e.type)&&(s=e.stateNode,i=null),e=e.child,e!==null))for(af(e,i,s),e=e.sibling;e!==null;)af(e,i,s),e=e.sibling}function vo(e,i,s){var o=e.tag;if(o===5||o===6)e=e.stateNode,i?s.insertBefore(e,i):s.appendChild(e);else if(o!==4&&(o===27&&pi(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(vo(e,i,s),e=e.sibling;e!==null;)vo(e,i,s),e=e.sibling}function Kp(e){var i=e.stateNode,s=e.memoizedProps;try{for(var o=e.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);Jt(i,o,s),i[mt]=e,i[At]=s}catch(p){ut(e,e.return,p)}}var Mr=!1,Lt=!1,sf=!1,Wp=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function sv(e,i){if(e=e.containerInfo,Af=Po,e=fm(e),Ku(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.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 b=0,_=-1,B=-1,ee=0,oe=0,pe=e,ne=null;t:for(;;){for(var ae;pe!==s||h!==0&&pe.nodeType!==3||(_=b+h),pe!==p||o!==0&&pe.nodeType!==3||(B=b+o),pe.nodeType===3&&(b+=pe.nodeValue.length),(ae=pe.firstChild)!==null;)ne=pe,pe=ae;for(;;){if(pe===e)break t;if(ne===s&&++ee===h&&(_=b),ne===p&&++oe===o&&(B=b),(ae=pe.nextSibling)!==null)break;pe=ne,ne=pe.parentNode}pe=ae}s=_===-1||B===-1?null:{start:_,end:B}}else s=null}s=s||{start:0,end:0}}else s=null;for(Tf={focusedElem:e,selectionRange:s},Po=!1,Pt=i;Pt!==null;)if(i=Pt,e=i.child,(i.subtreeFlags&1028)!==0&&e!==null)e.return=i,Pt=e;else for(;Pt!==null;){switch(i=Pt,p=i.alternate,e=i.flags,i.tag){case 0:if((e&4)!==0&&(e=i.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)h=e[s],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,s=i,h=p.memoizedProps,p=p.memoizedState,o=s.stateNode;try{var Ne=Yi(s.type,h);e=o.getSnapshotBeforeUpdate(Ne,p),o.__reactInternalSnapshotBeforeUpdate=e}catch(Be){ut(s,s.return,Be)}}break;case 3:if((e&1024)!==0){if(e=i.stateNode.containerInfo,s=e.nodeType,s===9)Nf(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Nf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=i.sibling,e!==null){e.return=i.return,Pt=e;break}Pt=i.return}}function eg(e,i,s){var o=s.flags;switch(s.tag){case 0:case 11:case 15:zr(e,s),o&4&&Ls(5,s);break;case 1:if(zr(e,s),o&4)if(e=s.stateNode,i===null)try{e.componentDidMount()}catch(b){ut(s,s.return,b)}else{var h=Yi(s.type,i.memoizedProps);i=i.memoizedState;try{e.componentDidUpdate(h,i,e.__reactInternalSnapshotBeforeUpdate)}catch(b){ut(s,s.return,b)}}o&64&&Jp(s),o&512&&Us(s,s.return);break;case 3:if(zr(e,s),o&64&&(e=s.updateQueue,e!==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{Bm(e,i)}catch(b){ut(s,s.return,b)}}break;case 27:i===null&&o&4&&Kp(s);case 26:case 5:zr(e,s),i===null&&o&4&&Qp(s),o&512&&Us(s,s.return);break;case 12:zr(e,s);break;case 31:zr(e,s),o&4&&rg(e,s);break;case 13:zr(e,s),o&4&&ig(e,s),o&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=pv.bind(null,s),zv(e,s))));break;case 22:if(o=s.memoizedState!==null||Mr,!o){i=i!==null&&i.memoizedState!==null||Lt,h=Mr;var p=Lt;Mr=o,(Lt=i)&&!p?Lr(e,s,(s.subtreeFlags&8772)!==0):zr(e,s),Mr=h,Lt=p}break;case 30:break;default:zr(e,s)}}function tg(e){var i=e.alternate;i!==null&&(e.alternate=null,tg(i)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(i=e.stateNode,i!==null&&sa(i)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var wt=null,un=!1;function Dr(e,i,s){for(s=s.child;s!==null;)ng(e,i,s),s=s.sibling}function ng(e,i,s){if(dt&&typeof dt.onCommitFiberUnmount=="function")try{dt.onCommitFiberUnmount($t,s)}catch{}switch(s.tag){case 26:Lt||cr(s,i),Dr(e,i,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Lt||cr(s,i);var o=wt,h=un;pi(s.type)&&(wt=s.stateNode,un=!1),Dr(e,i,s),Ys(s.stateNode),wt=o,un=h;break;case 5:Lt||cr(s,i);case 6:if(o=wt,h=un,wt=null,Dr(e,i,s),wt=o,un=h,wt!==null)if(un)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(s.stateNode)}catch(p){ut(s,i,p)}else try{wt.removeChild(s.stateNode)}catch(p){ut(s,i,p)}break;case 18:wt!==null&&(un?(e=wt,Jg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),qa(e)):Jg(wt,s.stateNode));break;case 4:o=wt,h=un,wt=s.stateNode.containerInfo,un=!0,Dr(e,i,s),wt=o,un=h;break;case 0:case 11:case 14:case 15:oi(2,s,i),Lt||oi(4,s,i),Dr(e,i,s);break;case 1:Lt||(cr(s,i),o=s.stateNode,typeof o.componentWillUnmount=="function"&&Xp(s,i,o)),Dr(e,i,s);break;case 21:Dr(e,i,s);break;case 22:Lt=(o=Lt)||s.memoizedState!==null,Dr(e,i,s),Lt=o;break;default:Dr(e,i,s)}}function rg(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{qa(e)}catch(s){ut(i,i.return,s)}}}function ig(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{qa(e)}catch(s){ut(i,i.return,s)}}function lv(e){switch(e.tag){case 31:case 13:case 19:var i=e.stateNode;return i===null&&(i=e.stateNode=new Wp),i;case 22:return e=e.stateNode,i=e._retryCache,i===null&&(i=e._retryCache=new Wp),i;default:throw Error(a(435,e.tag))}}function So(e,i){var s=lv(e);i.forEach(function(o){if(!s.has(o)){s.add(o);var h=gv.bind(null,e,o);o.then(h,h)}})}function cn(e,i){var s=i.deletions;if(s!==null)for(var o=0;o<s.length;o++){var h=s[o],p=e,b=i,_=b;e:for(;_!==null;){switch(_.tag){case 27:if(pi(_.type)){wt=_.stateNode,un=!1;break e}break;case 5:wt=_.stateNode,un=!1;break e;case 3:case 4:wt=_.stateNode.containerInfo,un=!0;break e}_=_.return}if(wt===null)throw Error(a(160));ng(p,b,h),wt=null,un=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)ag(i,e),i=i.sibling}var tr=null;function ag(e,i){var s=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:cn(i,e),fn(e),o&4&&(oi(3,e,e.return),Ls(3,e),oi(5,e,e.return));break;case 1:cn(i,e),fn(e),o&512&&(Lt||s===null||cr(s,s.return)),o&64&&Mr&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?o:s.concat(o))));break;case 26:var h=tr;if(cn(i,e),fn(e),o&512&&(Lt||s===null||cr(s,s.return)),o&4){var p=s!==null?s.memoizedState:null;if(o=e.memoizedState,s===null)if(o===null)if(e.stateNode===null){e:{o=e.type,s=e.memoizedProps,h=h.ownerDocument||h;t:switch(o){case"title":p=h.getElementsByTagName("title")[0],(!p||p[qt]||p[mt]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(o),h.head.insertBefore(p,h.querySelector("head > title"))),Jt(p,o,s),p[mt]=e,P(p),o=p;break e;case"link":var b=ay("link","href",h).get(o+(s.href||""));if(b){for(var _=0;_<b.length;_++)if(p=b[_],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)){b.splice(_,1);break t}}p=h.createElement(o),Jt(p,o,s),h.head.appendChild(p);break;case"meta":if(b=ay("meta","content",h).get(o+(s.content||""))){for(_=0;_<b.length;_++)if(p=b[_],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)){b.splice(_,1);break t}}p=h.createElement(o),Jt(p,o,s),h.head.appendChild(p);break;default:throw Error(a(468,o))}p[mt]=e,P(p),o=p}e.stateNode=o}else sy(h,e.type,e.stateNode);else e.stateNode=iy(h,o,e.memoizedProps);else p!==o?(p===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):p.count--,o===null?sy(h,e.type,e.stateNode):iy(h,o,e.memoizedProps)):o===null&&e.stateNode!==null&&nf(e,e.memoizedProps,s.memoizedProps)}break;case 27:cn(i,e),fn(e),o&512&&(Lt||s===null||cr(s,s.return)),s!==null&&o&4&&nf(e,e.memoizedProps,s.memoizedProps);break;case 5:if(cn(i,e),fn(e),o&512&&(Lt||s===null||cr(s,s.return)),e.flags&32){h=e.stateNode;try{oa(h,"")}catch(Ne){ut(e,e.return,Ne)}}o&4&&e.stateNode!=null&&(h=e.memoizedProps,nf(e,h,s!==null?s.memoizedProps:h)),o&1024&&(sf=!0);break;case 6:if(cn(i,e),fn(e),o&4){if(e.stateNode===null)throw Error(a(162));o=e.memoizedProps,s=e.stateNode;try{s.nodeValue=o}catch(Ne){ut(e,e.return,Ne)}}break;case 3:if(Uo=null,h=tr,tr=zo(i.containerInfo),cn(i,e),tr=h,fn(e),o&4&&s!==null&&s.memoizedState.isDehydrated)try{qa(i.containerInfo)}catch(Ne){ut(e,e.return,Ne)}sf&&(sf=!1,sg(e));break;case 4:o=tr,tr=zo(e.stateNode.containerInfo),cn(i,e),fn(e),tr=o;break;case 12:cn(i,e),fn(e);break;case 31:cn(i,e),fn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,So(e,o)));break;case 13:cn(i,e),fn(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(wo=yt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,So(e,o)));break;case 22:h=e.memoizedState!==null;var B=s!==null&&s.memoizedState!==null,ee=Mr,oe=Lt;if(Mr=ee||h,Lt=oe||B,cn(i,e),Lt=oe,Mr=ee,fn(e),o&8192)e:for(i=e.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(s===null||B||Mr||Lt||Vi(e)),s=null,i=e;;){if(i.tag===5||i.tag===26){if(s===null){B=s=i;try{if(p=B.stateNode,h)b=p.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{_=B.stateNode;var pe=B.memoizedProps.style,ne=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;_.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ne){ut(B,B.return,Ne)}}}else if(i.tag===6){if(s===null){B=i;try{B.stateNode.nodeValue=h?"":B.memoizedProps}catch(Ne){ut(B,B.return,Ne)}}}else if(i.tag===18){if(s===null){B=i;try{var ae=B.stateNode;h?Xg(ae,!0):Xg(B.stateNode,!1)}catch(Ne){ut(B,B.return,Ne)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===e)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break e;for(;i.sibling===null;){if(i.return===null||i.return===e)break e;s===i&&(s=null),i=i.return}s===i&&(s=null),i.sibling.return=i.return,i=i.sibling}o&4&&(o=e.updateQueue,o!==null&&(s=o.retryQueue,s!==null&&(o.retryQueue=null,So(e,s))));break;case 19:cn(i,e),fn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,So(e,o)));break;case 30:break;case 21:break;default:cn(i,e),fn(e)}}function fn(e){var i=e.flags;if(i&2){try{for(var s,o=e.return;o!==null;){if(Zp(o)){s=o;break}o=o.return}if(s==null)throw Error(a(160));switch(s.tag){case 27:var h=s.stateNode,p=rf(e);vo(e,p,h);break;case 5:var b=s.stateNode;s.flags&32&&(oa(b,""),s.flags&=-33);var _=rf(e);vo(e,_,b);break;case 3:case 4:var B=s.stateNode.containerInfo,ee=rf(e);af(e,ee,B);break;default:throw Error(a(161))}}catch(oe){ut(e,e.return,oe)}e.flags&=-3}i&4096&&(e.flags&=-4097)}function sg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var i=e;sg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),e=e.sibling}}function zr(e,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)eg(e,i.alternate,i),i=i.sibling}function Vi(e){for(e=e.child;e!==null;){var i=e;switch(i.tag){case 0:case 11:case 14:case 15:oi(4,i,i.return),Vi(i);break;case 1:cr(i,i.return);var s=i.stateNode;typeof s.componentWillUnmount=="function"&&Xp(i,i.return,s),Vi(i);break;case 27:Ys(i.stateNode);case 26:case 5:cr(i,i.return),Vi(i);break;case 22:i.memoizedState===null&&Vi(i);break;case 30:Vi(i);break;default:Vi(i)}e=e.sibling}}function Lr(e,i,s){for(s=s&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var o=i.alternate,h=e,p=i,b=p.flags;switch(p.tag){case 0:case 11:case 15:Lr(h,p,s),Ls(4,p);break;case 1:if(Lr(h,p,s),o=p,h=o.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(ee){ut(o,o.return,ee)}if(o=p,h=o.updateQueue,h!==null){var _=o.stateNode;try{var B=h.shared.hiddenCallbacks;if(B!==null)for(h.shared.hiddenCallbacks=null,h=0;h<B.length;h++)Um(B[h],_)}catch(ee){ut(o,o.return,ee)}}s&&b&64&&Jp(p),Us(p,p.return);break;case 27:Kp(p);case 26:case 5:Lr(h,p,s),s&&o===null&&b&4&&Qp(p),Us(p,p.return);break;case 12:Lr(h,p,s);break;case 31:Lr(h,p,s),s&&b&4&&rg(h,p);break;case 13:Lr(h,p,s),s&&b&4&&ig(h,p);break;case 22:p.memoizedState===null&&Lr(h,p,s),Us(p,p.return);break;case 30:break;default:Lr(h,p,s)}i=i.sibling}}function lf(e,i){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&ws(s))}function of(e,i){e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&ws(e))}function nr(e,i,s,o){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)lg(e,i,s,o),i=i.sibling}function lg(e,i,s,o){var h=i.flags;switch(i.tag){case 0:case 11:case 15:nr(e,i,s,o),h&2048&&Ls(9,i);break;case 1:nr(e,i,s,o);break;case 3:nr(e,i,s,o),h&2048&&(e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&ws(e)));break;case 12:if(h&2048){nr(e,i,s,o),e=i.stateNode;try{var p=i.memoizedProps,b=p.id,_=p.onPostCommit;typeof _=="function"&&_(b,i.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(B){ut(i,i.return,B)}}else nr(e,i,s,o);break;case 31:nr(e,i,s,o);break;case 13:nr(e,i,s,o);break;case 23:break;case 22:p=i.stateNode,b=i.alternate,i.memoizedState!==null?p._visibility&2?nr(e,i,s,o):Bs(e,i):p._visibility&2?nr(e,i,s,o):(p._visibility|=2,Ta(e,i,s,o,(i.subtreeFlags&10256)!==0||!1)),h&2048&&lf(b,i);break;case 24:nr(e,i,s,o),h&2048&&of(i.alternate,i);break;default:nr(e,i,s,o)}}function Ta(e,i,s,o,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var p=e,b=i,_=s,B=o,ee=b.flags;switch(b.tag){case 0:case 11:case 15:Ta(p,b,_,B,h),Ls(8,b);break;case 23:break;case 22:var oe=b.stateNode;b.memoizedState!==null?oe._visibility&2?Ta(p,b,_,B,h):Bs(p,b):(oe._visibility|=2,Ta(p,b,_,B,h)),h&&ee&2048&&lf(b.alternate,b);break;case 24:Ta(p,b,_,B,h),h&&ee&2048&&of(b.alternate,b);break;default:Ta(p,b,_,B,h)}i=i.sibling}}function Bs(e,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var s=e,o=i,h=o.flags;switch(o.tag){case 22:Bs(s,o),h&2048&&lf(o.alternate,o);break;case 24:Bs(s,o),h&2048&&of(o.alternate,o);break;default:Bs(s,o)}i=i.sibling}}var qs=8192;function Oa(e,i,s){if(e.subtreeFlags&qs)for(e=e.child;e!==null;)og(e,i,s),e=e.sibling}function og(e,i,s){switch(e.tag){case 26:Oa(e,i,s),e.flags&qs&&e.memoizedState!==null&&Vv(s,tr,e.memoizedState,e.memoizedProps);break;case 5:Oa(e,i,s);break;case 3:case 4:var o=tr;tr=zo(e.stateNode.containerInfo),Oa(e,i,s),tr=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=qs,qs=16777216,Oa(e,i,s),qs=o):Oa(e,i,s));break;default:Oa(e,i,s)}}function ug(e){var i=e.alternate;if(i!==null&&(e=i.child,e!==null)){i.child=null;do i=e.sibling,e.sibling=null,e=i;while(e!==null)}}function Hs(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];Pt=o,fg(o,e)}ug(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)cg(e),e=e.sibling}function cg(e){switch(e.tag){case 0:case 11:case 15:Hs(e),e.flags&2048&&oi(9,e,e.return);break;case 3:Hs(e);break;case 12:Hs(e);break;case 22:var i=e.stateNode;e.memoizedState!==null&&i._visibility&2&&(e.return===null||e.return.tag!==13)?(i._visibility&=-3,_o(e)):Hs(e);break;default:Hs(e)}}function _o(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var o=i[s];Pt=o,fg(o,e)}ug(e)}for(e=e.child;e!==null;){switch(i=e,i.tag){case 0:case 11:case 15:oi(8,i,i.return),_o(i);break;case 22:s=i.stateNode,s._visibility&2&&(s._visibility&=-3,_o(i));break;default:_o(i)}e=e.sibling}}function fg(e,i){for(;Pt!==null;){var s=Pt;switch(s.tag){case 0:case 11:case 15:oi(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:ws(s.memoizedState.cache)}if(o=s.child,o!==null)o.return=s,Pt=o;else e:for(s=e;Pt!==null;){o=Pt;var h=o.sibling,p=o.return;if(tg(o),o===s){Pt=null;break e}if(h!==null){h.return=p,Pt=h;break e}Pt=p}}}var ov={getCacheForType:function(e){var i=Yt(Mt),s=i.data.get(e);return s===void 0&&(s=e(),i.data.set(e,s)),s},cacheSignal:function(){return Yt(Mt).controller.signal}},uv=typeof WeakMap=="function"?WeakMap:Map,st=0,pt=null,Xe=null,Ke=0,ot=0,_n=null,ui=!1,ja=!1,uf=!1,Ur=0,Ot=0,ci=0,Ji=0,cf=0,wn=0,Na=0,Ps=null,hn=null,ff=!1,wo=0,hg=0,Eo=1/0,ko=null,fi=null,Ht=0,hi=null,Ra=null,Br=0,hf=0,df=null,dg=null,Is=0,mf=null;function En(){return(st&2)!==0&&Ke!==0?Ke&-Ke:H.T!==null?vf():cs()}function mg(){if(wn===0)if((Ke&536870912)===0||et){var e=vr;vr<<=1,(vr&3932160)===0&&(vr=262144),wn=e}else wn=536870912;return e=vn.current,e!==null&&(e.flags|=32),wn}function dn(e,i,s){(e===pt&&(ot===2||ot===9)||e.cancelPendingCommit!==null)&&(Ma(e,0),di(e,Ke,wn,!1)),Kn(e,s),((st&2)===0||e!==pt)&&(e===pt&&((st&2)===0&&(Ji|=s),Ot===4&&di(e,Ke,wn,!1)),fr(e))}function pg(e,i,s){if((st&6)!==0)throw Error(a(327));var o=!s&&(i&127)===0&&(i&e.expiredLanes)===0||Oi(e,i),h=o?hv(e,i):gf(e,i,!0),p=o;do{if(h===0){ja&&!o&&di(e,i,0,!1);break}else{if(s=e.current.alternate,p&&!cv(s)){h=gf(e,i,!1),p=!1;continue}if(h===2){if(p=i,e.errorRecoveryDisabledLanes&p)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){i=b;e:{var _=e;h=Ps;var B=_.current.memoizedState.isDehydrated;if(B&&(Ma(_,b).flags|=256),b=gf(_,b,!1),b!==2){if(uf&&!B){_.errorRecoveryDisabledLanes|=p,Ji|=p,h=4;break e}p=hn,hn=h,p!==null&&(hn===null?hn=p:hn.push.apply(hn,p))}h=b}if(p=!1,h!==2)continue}}if(h===1){Ma(e,0),di(e,i,0,!0);break}e:{switch(o=e,p=h,p){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:di(o,i,wn,!ui);break e;case 2:hn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(h=wo+300-yt(),10<h)){if(di(o,i,wn,!ui),Ti(o,0,!0)!==0)break e;Br=i,o.timeoutHandle=Yg(gg.bind(null,o,s,hn,ko,ff,i,wn,Ji,Na,ui,p,"Throttled",-0,0),h);break e}gg(o,s,hn,ko,ff,i,wn,Ji,Na,ui,p,null,-0,0)}}break}while(!0);fr(e)}function gg(e,i,s,o,h,p,b,_,B,ee,oe,pe,ne,ae){if(e.timeoutHandle=-1,pe=i.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wr},og(i,p,pe);var Ne=(p&62914560)===p?wo-yt():(p&4194048)===p?hg-yt():0;if(Ne=Jv(pe,Ne),Ne!==null){Br=p,e.cancelPendingCommit=Ne(Eg.bind(null,e,i,p,s,o,h,b,_,B,oe,pe,null,ne,ae)),di(e,p,b,!ee);return}}Eg(e,i,p,s,o,h,b,_,B)}function cv(e){for(var i=e;;){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(!bn(p(),h))return!1}catch{return!1}}if(s=i.child,i.subtreeFlags&16384&&s!==null)s.return=i,i=s;else{if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function di(e,i,s,o){i&=~cf,i&=~Ji,e.suspendedLanes|=i,e.pingedLanes&=~i,o&&(e.warmLanes|=i),o=e.expirationTimes;for(var h=i;0<h;){var p=31-lt(h),b=1<<p;o[p]=-1,h&=~b}s!==0&&Qr(e,s,i)}function Co(){return(st&6)===0?(Fs(0),!1):!0}function pf(){if(Xe!==null){if(ot===0)var e=Xe.return;else e=Xe,Ar=qi=null,jc(e),wa=null,ks=0,e=Xe;for(;e!==null;)Vp(e.alternate,e),e=e.return;Xe=null}}function Ma(e,i){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,jv(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Br=0,pf(),pt=e,Xe=s=kr(e.current,null),Ke=i,ot=0,_n=null,ui=!1,ja=Oi(e,i),uf=!1,Na=wn=cf=Ji=ci=Ot=0,hn=Ps=null,ff=!1,(i&8)!==0&&(i|=i&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=i;0<o;){var h=31-lt(o),p=1<<h;i|=e[h],o&=~p}return Ur=i,Yl(),s}function yg(e,i){$e=null,H.H=Ms,i===_a||i===eo?(i=Mm(),ot=3):i===bc?(i=Mm(),ot=4):ot=i===Yc?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,_n=i,Xe===null&&(Ot=1,po(e,qn(i,e.current)))}function bg(){var e=vn.current;return e===null?!0:(Ke&4194048)===Ke?Fn===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Fn:!1}function xg(){var e=H.H;return H.H=Ms,e===null?Ms:e}function vg(){var e=H.A;return H.A=ov,e}function Ao(){Ot=4,ui||(Ke&4194048)!==Ke&&vn.current!==null||(ja=!0),(ci&134217727)===0&&(Ji&134217727)===0||pt===null||di(pt,Ke,wn,!1)}function gf(e,i,s){var o=st;st|=2;var h=xg(),p=vg();(pt!==e||Ke!==i)&&(ko=null,Ma(e,i)),i=!1;var b=Ot;e:do try{if(ot!==0&&Xe!==null){var _=Xe,B=_n;switch(ot){case 8:pf(),b=6;break e;case 3:case 2:case 9:case 6:vn.current===null&&(i=!0);var ee=ot;if(ot=0,_n=null,Da(e,_,B,ee),s&&ja){b=0;break e}break;default:ee=ot,ot=0,_n=null,Da(e,_,B,ee)}}fv(),b=Ot;break}catch(oe){yg(e,oe)}while(!0);return i&&e.shellSuspendCounter++,Ar=qi=null,st=o,H.H=h,H.A=p,Xe===null&&(pt=null,Ke=0,Yl()),b}function fv(){for(;Xe!==null;)Sg(Xe)}function hv(e,i){var s=st;st|=2;var o=xg(),h=vg();pt!==e||Ke!==i?(ko=null,Eo=yt()+500,Ma(e,i)):ja=Oi(e,i);e:do try{if(ot!==0&&Xe!==null){i=Xe;var p=_n;t:switch(ot){case 1:ot=0,_n=null,Da(e,i,p,1);break;case 2:case 9:if(Nm(p)){ot=0,_n=null,_g(i);break}i=function(){ot!==2&&ot!==9||pt!==e||(ot=7),fr(e)},p.then(i,i);break e;case 3:ot=7;break e;case 4:ot=5;break e;case 7:Nm(p)?(ot=0,_n=null,_g(i)):(ot=0,_n=null,Da(e,i,p,7));break;case 5:var b=null;switch(Xe.tag){case 26:b=Xe.memoizedState;case 5:case 27:var _=Xe;if(b?ly(b):_.stateNode.complete){ot=0,_n=null;var B=_.sibling;if(B!==null)Xe=B;else{var ee=_.return;ee!==null?(Xe=ee,To(ee)):Xe=null}break t}}ot=0,_n=null,Da(e,i,p,5);break;case 6:ot=0,_n=null,Da(e,i,p,6);break;case 8:pf(),Ot=6;break e;default:throw Error(a(462))}}dv();break}catch(oe){yg(e,oe)}while(!0);return Ar=qi=null,H.H=o,H.A=h,st=s,Xe!==null?0:(pt=null,Ke=0,Yl(),Ot)}function dv(){for(;Xe!==null&&!ra();)Sg(Xe)}function Sg(e){var i=Gp(e.alternate,e,Ur);e.memoizedProps=e.pendingProps,i===null?To(e):Xe=i}function _g(e){var i=e,s=i.alternate;switch(i.tag){case 15:case 0:i=qp(s,i,i.pendingProps,i.type,void 0,Ke);break;case 11:i=qp(s,i,i.pendingProps,i.type.render,i.ref,Ke);break;case 5:jc(i);default:Vp(s,i),i=Xe=vm(i,Ur),i=Gp(s,i,Ur)}e.memoizedProps=e.pendingProps,i===null?To(e):Xe=i}function Da(e,i,s,o){Ar=qi=null,jc(i),wa=null,ks=0;var h=i.return;try{if(tv(e,h,i,s,Ke)){Ot=1,po(e,qn(s,e.current)),Xe=null;return}}catch(p){if(h!==null)throw Xe=h,p;Ot=1,po(e,qn(s,e.current)),Xe=null;return}i.flags&32768?(et||o===1?e=!0:ja||(Ke&536870912)!==0?e=!1:(ui=e=!0,(o===2||o===9||o===3||o===6)&&(o=vn.current,o!==null&&o.tag===13&&(o.flags|=16384))),wg(i,e)):To(i)}function To(e){var i=e;do{if((i.flags&32768)!==0){wg(i,ui);return}e=i.return;var s=iv(i.alternate,i,Ur);if(s!==null){Xe=s;return}if(i=i.sibling,i!==null){Xe=i;return}Xe=i=e}while(i!==null);Ot===0&&(Ot=5)}function wg(e,i){do{var s=av(e.alternate,e);if(s!==null){s.flags&=32767,Xe=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!i&&(e=e.sibling,e!==null)){Xe=e;return}Xe=e=s}while(e!==null);Ot=6,Xe=null}function Eg(e,i,s,o,h,p,b,_,B){e.cancelPendingCommit=null;do Oo();while(Ht!==0);if((st&6)!==0)throw Error(a(327));if(i!==null){if(i===e.current)throw Error(a(177));if(p=i.lanes|i.childLanes,p|=rc,Xr(e,s,p,b,_,B),e===pt&&(Xe=pt=null,Ke=0),Ra=i,hi=e,Br=s,hf=p,df=h,dg=o,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,yv(qe,function(){return Og(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||o){o=H.T,H.T=null,h=te.p,te.p=2,b=st,st|=4;try{sv(e,i,s)}finally{st=b,te.p=h,H.T=o}}Ht=1,kg(),Cg(),Ag()}}function kg(){if(Ht===1){Ht=0;var e=hi,i=Ra,s=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||s){s=H.T,H.T=null;var o=te.p;te.p=2;var h=st;st|=4;try{ag(i,e);var p=Tf,b=fm(e.containerInfo),_=p.focusedElem,B=p.selectionRange;if(b!==_&&_&&_.ownerDocument&&cm(_.ownerDocument.documentElement,_)){if(B!==null&&Ku(_)){var ee=B.start,oe=B.end;if(oe===void 0&&(oe=ee),"selectionStart"in _)_.selectionStart=ee,_.selectionEnd=Math.min(oe,_.value.length);else{var pe=_.ownerDocument||document,ne=pe&&pe.defaultView||window;if(ne.getSelection){var ae=ne.getSelection(),Ne=_.textContent.length,Be=Math.min(B.start,Ne),ht=B.end===void 0?Be:Math.min(B.end,Ne);!ae.extend&&Be>ht&&(b=ht,ht=Be,Be=b);var Q=um(_,Be),$=um(_,ht);if(Q&&$&&(ae.rangeCount!==1||ae.anchorNode!==Q.node||ae.anchorOffset!==Q.offset||ae.focusNode!==$.node||ae.focusOffset!==$.offset)){var W=pe.createRange();W.setStart(Q.node,Q.offset),ae.removeAllRanges(),Be>ht?(ae.addRange(W),ae.extend($.node,$.offset)):(W.setEnd($.node,$.offset),ae.addRange(W))}}}}for(pe=[],ae=_;ae=ae.parentNode;)ae.nodeType===1&&pe.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<pe.length;_++){var ce=pe[_];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Po=!!Af,Tf=Af=null}finally{st=h,te.p=o,H.T=s}}e.current=i,Ht=2}}function Cg(){if(Ht===2){Ht=0;var e=hi,i=Ra,s=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||s){s=H.T,H.T=null;var o=te.p;te.p=2;var h=st;st|=4;try{eg(e,i.alternate,i)}finally{st=h,te.p=o,H.T=s}}Ht=3}}function Ag(){if(Ht===4||Ht===3){Ht=0,Gr();var e=hi,i=Ra,s=Br,o=dg;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Ht=5:(Ht=0,Ra=hi=null,Tg(e,e.pendingLanes));var h=e.pendingLanes;if(h===0&&(fi=null),Ni(s),i=i.stateNode,dt&&typeof dt.onCommitFiberRoot=="function")try{dt.onCommitFiberRoot($t,i,void 0,(i.current.flags&128)===128)}catch{}if(o!==null){i=H.T,h=te.p,te.p=2,H.T=null;try{for(var p=e.onRecoverableError,b=0;b<o.length;b++){var _=o[b];p(_.value,{componentStack:_.stack})}}finally{H.T=i,te.p=h}}(Br&3)!==0&&Oo(),fr(e),h=e.pendingLanes,(s&261930)!==0&&(h&42)!==0?e===mf?Is++:(Is=0,mf=e):Is=0,Fs(0)}}function Tg(e,i){(e.pooledCacheLanes&=i)===0&&(i=e.pooledCache,i!=null&&(e.pooledCache=null,ws(i)))}function Oo(){return kg(),Cg(),Ag(),Og()}function Og(){if(Ht!==5)return!1;var e=hi,i=hf;hf=0;var s=Ni(Br),o=H.T,h=te.p;try{te.p=32>s?32:s,H.T=null,s=df,df=null;var p=hi,b=Br;if(Ht=0,Ra=hi=null,Br=0,(st&6)!==0)throw Error(a(331));var _=st;if(st|=4,cg(p.current),lg(p,p.current,b,s),st=_,Fs(0,!1),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot($t,p)}catch{}return!0}finally{te.p=h,H.T=o,Tg(e,i)}}function jg(e,i,s){i=qn(s,i),i=Gc(e.stateNode,i,2),e=ai(e,i,2),e!==null&&(Kn(e,2),fr(e))}function ut(e,i,s){if(e.tag===3)jg(e,e,s);else for(;i!==null;){if(i.tag===3){jg(i,e,s);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(fi===null||!fi.has(o))){e=qn(s,e),s=Np(2),o=ai(i,s,2),o!==null&&(Rp(s,o,i,e),Kn(o,2),fr(o));break}}i=i.return}}function yf(e,i,s){var o=e.pingCache;if(o===null){o=e.pingCache=new uv;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)||(uf=!0,h.add(s),e=mv.bind(null,e,i,s),i.then(e,e))}function mv(e,i,s){var o=e.pingCache;o!==null&&o.delete(i),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,pt===e&&(Ke&s)===s&&(Ot===4||Ot===3&&(Ke&62914560)===Ke&&300>yt()-wo?(st&2)===0&&Ma(e,0):cf|=s,Na===Ke&&(Na=0)),fr(e)}function Ng(e,i){i===0&&(i=aa()),e=Li(e,i),e!==null&&(Kn(e,i),fr(e))}function pv(e){var i=e.memoizedState,s=0;i!==null&&(s=i.retryLane),Ng(e,s)}function gv(e,i){var s=0;switch(e.tag){case 31:case 13:var o=e.stateNode,h=e.memoizedState;h!==null&&(s=h.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(a(314))}o!==null&&o.delete(i),Ng(e,s)}function yv(e,i){return Mn(e,i)}var jo=null,za=null,bf=!1,No=!1,xf=!1,mi=0;function fr(e){e!==za&&e.next===null&&(za===null?jo=za=e:za=za.next=e),No=!0,bf||(bf=!0,xv())}function Fs(e,i){if(!xf&&No){xf=!0;do for(var s=!1,o=jo;o!==null;){if(e!==0){var h=o.pendingLanes;if(h===0)var p=0;else{var b=o.suspendedLanes,_=o.pingedLanes;p=(1<<31-lt(42|e)+1)-1,p&=h&~(b&~_),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(s=!0,zg(o,p))}else p=Ke,p=Ti(o,o===pt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Oi(o,p)||(s=!0,zg(o,p));o=o.next}while(s);xf=!1}}function bv(){Rg()}function Rg(){No=bf=!1;var e=0;mi!==0&&Ov()&&(e=mi);for(var i=yt(),s=null,o=jo;o!==null;){var h=o.next,p=Mg(o,i);p===0?(o.next=null,s===null?jo=h:s.next=h,h===null&&(za=s)):(s=o,(e!==0||(p&3)!==0)&&(No=!0)),o=h}Ht!==0&&Ht!==5||Fs(e),mi!==0&&(mi=0)}function Mg(e,i){for(var s=e.suspendedLanes,o=e.pingedLanes,h=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var b=31-lt(p),_=1<<b,B=h[b];B===-1?((_&s)===0||(_&o)!==0)&&(h[b]=us(_,i)):B<=i&&(e.expiredLanes|=_),p&=~_}if(i=pt,s=Ke,s=Ti(e,e===i?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,s===0||e===i&&(ot===2||ot===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&Qn(o),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||Oi(e,s)){if(i=s&-s,i===e.callbackPriority)return i;switch(o!==null&&Qn(o),Ni(s)){case 2:case 8:s=Se;break;case 32:s=qe;break;case 268435456:s=rt;break;default:s=qe}return o=Dg.bind(null,e),s=Mn(s,o),e.callbackPriority=i,e.callbackNode=s,i}return o!==null&&o!==null&&Qn(o),e.callbackPriority=2,e.callbackNode=null,2}function Dg(e,i){if(Ht!==0&&Ht!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Oo()&&e.callbackNode!==s)return null;var o=Ke;return o=Ti(e,e===pt?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(pg(e,o,i),Mg(e,yt()),e.callbackNode!=null&&e.callbackNode===s?Dg.bind(null,e):null)}function zg(e,i){if(Oo())return null;pg(e,i,!0)}function xv(){Nv(function(){(st&6)!==0?Mn(ue,bv):Rg()})}function vf(){if(mi===0){var e=va;e===0&&(e=Yr,Yr<<=1,(Yr&261888)===0&&(Yr=256)),mi=e}return mi}function Lg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Bl(""+e)}function Ug(e,i){var s=i.ownerDocument.createElement("input");return s.name=i.name,s.value=i.value,e.id&&s.setAttribute("form",e.id),i.parentNode.insertBefore(s,i),e=new FormData(e),s.parentNode.removeChild(s),e}function vv(e,i,s,o,h){if(i==="submit"&&s&&s.stateNode===h){var p=Lg((h[At]||null).action),b=o.submitter;b&&(i=(i=b[At]||null)?Lg(i.formAction):b.getAttribute("formAction"),i!==null&&(p=i,b=null));var _=new Il("action","action",null,o,h);e.push({event:_,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(mi!==0){var B=b?Ug(h,b):new FormData(h);qc(s,{pending:!0,data:B,method:h.method,action:p},null,B)}}else typeof p=="function"&&(_.preventDefault(),B=b?Ug(h,b):new FormData(h),qc(s,{pending:!0,data:B,method:h.method,action:p},p,B))},currentTarget:h}]})}}for(var Sf=0;Sf<nc.length;Sf++){var _f=nc[Sf],Sv=_f.toLowerCase(),_v=_f[0].toUpperCase()+_f.slice(1);er(Sv,"on"+_v)}er(mm,"onAnimationEnd"),er(pm,"onAnimationIteration"),er(gm,"onAnimationStart"),er("dblclick","onDoubleClick"),er("focusin","onFocus"),er("focusout","onBlur"),er(Bx,"onTransitionRun"),er(qx,"onTransitionStart"),er(Hx,"onTransitionCancel"),er(ym,"onTransitionEnd"),re("onMouseEnter",["mouseout","mouseover"]),re("onMouseLeave",["mouseout","mouseover"]),re("onPointerEnter",["pointerout","pointerover"]),re("onPointerLeave",["pointerout","pointerover"]),ye("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ye("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ye("onBeforeInput",["compositionend","keypress","textInput","paste"]),ye("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ye("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $s="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(" "),wv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat($s));function Bg(e,i){i=(i&4)!==0;for(var s=0;s<e.length;s++){var o=e[s],h=o.event;o=o.listeners;e:{var p=void 0;if(i)for(var b=o.length-1;0<=b;b--){var _=o[b],B=_.instance,ee=_.currentTarget;if(_=_.listener,B!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=ee;try{p(h)}catch(oe){Gl(oe)}h.currentTarget=null,p=B}else for(b=0;b<o.length;b++){if(_=o[b],B=_.instance,ee=_.currentTarget,_=_.listener,B!==p&&h.isPropagationStopped())break e;p=_,h.currentTarget=ee;try{p(h)}catch(oe){Gl(oe)}h.currentTarget=null,p=B}}}}function Qe(e,i){var s=i[Ri];s===void 0&&(s=i[Ri]=new Set);var o=e+"__bubble";s.has(o)||(qg(i,e,2,!1),s.add(o))}function wf(e,i,s){var o=0;i&&(o|=4),qg(s,e,o,i)}var Ro="_reactListening"+Math.random().toString(36).slice(2);function Ef(e){if(!e[Ro]){e[Ro]=!0,Z.forEach(function(s){s!=="selectionchange"&&(wv.has(s)||wf(s,!1,e),wf(s,!0,e))});var i=e.nodeType===9?e:e.ownerDocument;i===null||i[Ro]||(i[Ro]=!0,wf("selectionchange",!1,i))}}function qg(e,i,s,o){switch(my(i)){case 2:var h=Zv;break;case 8:h=Kv;break;default:h=qf}s=h.bind(null,i,s,e),h=void 0,!Fu||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),o?h!==void 0?e.addEventListener(i,s,{capture:!0,passive:h}):e.addEventListener(i,s,!0):h!==void 0?e.addEventListener(i,s,{passive:h}):e.addEventListener(i,s,!1)}function kf(e,i,s,o,h){var p=o;if((i&1)===0&&(i&2)===0&&o!==null)e:for(;;){if(o===null)return;var b=o.tag;if(b===3||b===4){var _=o.stateNode.containerInfo;if(_===h)break;if(b===4)for(b=o.return;b!==null;){var B=b.tag;if((B===3||B===4)&&b.stateNode.containerInfo===h)return;b=b.return}for(;_!==null;){if(b=w(_),b===null)return;if(B=b.tag,B===5||B===6||B===26||B===27){o=p=b;continue e}_=_.parentNode}}o=o.return}$d(function(){var ee=p,oe=Pu(s),pe=[];e:{var ne=bm.get(e);if(ne!==void 0){var ae=Il,Ne=e;switch(e){case"keypress":if(Hl(s)===0)break e;case"keydown":case"keyup":ae=gx;break;case"focusin":Ne="focus",ae=Vu;break;case"focusout":Ne="blur",ae=Vu;break;case"beforeblur":case"afterblur":ae=Vu;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=Vd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=ix;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=xx;break;case mm:case pm:case gm:ae=lx;break;case ym:ae=Sx;break;case"scroll":case"scrollend":ae=nx;break;case"wheel":ae=wx;break;case"copy":case"cut":case"paste":ae=ux;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Xd;break;case"toggle":case"beforetoggle":ae=kx}var Be=(i&4)!==0,ht=!Be&&(e==="scroll"||e==="scrollend"),Q=Be?ne!==null?ne+"Capture":null:ne;Be=[];for(var $=ee,W;$!==null;){var ce=$;if(W=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||W===null||Q===null||(ce=hs($,Q),ce!=null&&Be.push(Gs($,ce,W))),ht)break;$=$.return}0<Be.length&&(ne=new ae(ne,Ne,null,s,oe),pe.push({event:ne,listeners:Be}))}}if((i&7)===0){e:{if(ne=e==="mouseover"||e==="pointerover",ae=e==="mouseout"||e==="pointerout",ne&&s!==Hu&&(Ne=s.relatedTarget||s.fromElement)&&(w(Ne)||Ne[yn]))break e;if((ae||ne)&&(ne=oe.window===oe?oe:(ne=oe.ownerDocument)?ne.defaultView||ne.parentWindow:window,ae?(Ne=s.relatedTarget||s.toElement,ae=ee,Ne=Ne?w(Ne):null,Ne!==null&&(ht=u(Ne),Be=Ne.tag,Ne!==ht||Be!==5&&Be!==27&&Be!==6)&&(Ne=null)):(ae=null,Ne=ee),ae!==Ne)){if(Be=Vd,ce="onMouseLeave",Q="onMouseEnter",$="mouse",(e==="pointerout"||e==="pointerover")&&(Be=Xd,ce="onPointerLeave",Q="onPointerEnter",$="pointer"),ht=ae==null?ne:A(ae),W=Ne==null?ne:A(Ne),ne=new Be(ce,$+"leave",ae,s,oe),ne.target=ht,ne.relatedTarget=W,ce=null,w(oe)===ee&&(Be=new Be(Q,$+"enter",Ne,s,oe),Be.target=W,Be.relatedTarget=ht,ce=Be),ht=ce,ae&&Ne)t:{for(Be=Ev,Q=ae,$=Ne,W=0,ce=Q;ce;ce=Be(ce))W++;ce=0;for(var De=$;De;De=Be(De))ce++;for(;0<W-ce;)Q=Be(Q),W--;for(;0<ce-W;)$=Be($),ce--;for(;W--;){if(Q===$||$!==null&&Q===$.alternate){Be=Q;break t}Q=Be(Q),$=Be($)}Be=null}else Be=null;ae!==null&&Hg(pe,ne,ae,Be,!1),Ne!==null&&ht!==null&&Hg(pe,ht,Ne,Be,!0)}}e:{if(ne=ee?A(ee):window,ae=ne.nodeName&&ne.nodeName.toLowerCase(),ae==="select"||ae==="input"&&ne.type==="file")var it=rm;else if(tm(ne))if(im)it=zx;else{it=Mx;var Re=Rx}else ae=ne.nodeName,!ae||ae.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&qu(ee.elementType)&&(it=rm):it=Dx;if(it&&(it=it(e,ee))){nm(pe,it,s,oe);break e}Re&&Re(e,ne,ee),e==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&Bu(ne,"number",ne.value)}switch(Re=ee?A(ee):window,e){case"focusin":(tm(Re)||Re.contentEditable==="true")&&(ha=Re,Wu=ee,vs=null);break;case"focusout":vs=Wu=ha=null;break;case"mousedown":ec=!0;break;case"contextmenu":case"mouseup":case"dragend":ec=!1,hm(pe,s,oe);break;case"selectionchange":if(Ux)break;case"keydown":case"keyup":hm(pe,s,oe)}var Ge;if(Xu)e:{switch(e){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else fa?Wd(e,s)&&(We="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(We="onCompositionStart");We&&(Qd&&s.locale!=="ko"&&(fa||We!=="onCompositionStart"?We==="onCompositionEnd"&&fa&&(Ge=Gd()):(Kr=oe,$u="value"in Kr?Kr.value:Kr.textContent,fa=!0)),Re=Mo(ee,We),0<Re.length&&(We=new Jd(We,e,null,s,oe),pe.push({event:We,listeners:Re}),Ge?We.data=Ge:(Ge=em(s),Ge!==null&&(We.data=Ge)))),(Ge=Ax?Tx(e,s):Ox(e,s))&&(We=Mo(ee,"onBeforeInput"),0<We.length&&(Re=new Jd("onBeforeInput","beforeinput",null,s,oe),pe.push({event:Re,listeners:We}),Re.data=Ge)),vv(pe,e,ee,s,oe)}Bg(pe,i)})}function Gs(e,i,s){return{instance:e,listener:i,currentTarget:s}}function Mo(e,i){for(var s=i+"Capture",o=[];e!==null;){var h=e,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=hs(e,s),h!=null&&o.unshift(Gs(e,h,p)),h=hs(e,i),h!=null&&o.push(Gs(e,h,p))),e.tag===3)return o;e=e.return}return[]}function Ev(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Hg(e,i,s,o,h){for(var p=i._reactName,b=[];s!==null&&s!==o;){var _=s,B=_.alternate,ee=_.stateNode;if(_=_.tag,B!==null&&B===o)break;_!==5&&_!==26&&_!==27||ee===null||(B=ee,h?(ee=hs(s,p),ee!=null&&b.unshift(Gs(s,ee,B))):h||(ee=hs(s,p),ee!=null&&b.push(Gs(s,ee,B)))),s=s.return}b.length!==0&&e.push({event:i,listeners:b})}var kv=/\r\n?/g,Cv=/\u0000|\uFFFD/g;function Pg(e){return(typeof e=="string"?e:""+e).replace(kv,`
|
|
49
|
+
`).replace(Cv,"")}function Ig(e,i){return i=Pg(i),Pg(e)===i}function ft(e,i,s,o,h,p){switch(s){case"children":typeof o=="string"?i==="body"||i==="textarea"&&o===""||oa(e,o):(typeof o=="number"||typeof o=="bigint")&&i!=="body"&&oa(e,""+o);break;case"className":Wn(e,"class",o);break;case"tabIndex":Wn(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Wn(e,s,o);break;case"style":Id(e,o,p);break;case"data":if(i!=="object"){Wn(e,"data",o);break}case"src":case"href":if(o===""&&(i!=="a"||s!=="href")){e.removeAttribute(s);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(s);break}o=Bl(""+o),e.setAttribute(s,o);break;case"action":case"formAction":if(typeof o=="function"){e.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"&&ft(e,i,"name",h.name,h,null),ft(e,i,"formEncType",h.formEncType,h,null),ft(e,i,"formMethod",h.formMethod,h,null),ft(e,i,"formTarget",h.formTarget,h,null)):(ft(e,i,"encType",h.encType,h,null),ft(e,i,"method",h.method,h,null),ft(e,i,"target",h.target,h,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(s);break}o=Bl(""+o),e.setAttribute(s,o);break;case"onClick":o!=null&&(e.onclick=wr);break;case"onScroll":o!=null&&Qe("scroll",e);break;case"onScrollEnd":o!=null&&Qe("scrollend",e);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));e.innerHTML=s}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.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"){e.removeAttribute("xlink:href");break}s=Bl(""+o),e.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"?e.setAttribute(s,""+o):e.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"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":o===!0?e.setAttribute(s,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(s,o):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(s,o):e.removeAttribute(s);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(s):e.setAttribute(s,o);break;case"popover":Qe("beforetoggle",e),Qe("toggle",e),Qt(e,"popover",o);break;case"xlinkActuate":_r(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":_r(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":_r(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":_r(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":_r(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":_r(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":_r(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":_r(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":_r(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Qt(e,"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=ex.get(s)||s,Qt(e,s,o))}}function Cf(e,i,s,o,h,p){switch(s){case"style":Id(e,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));e.innerHTML=s}}break;case"children":typeof o=="string"?oa(e,o):(typeof o=="number"||typeof o=="bigint")&&oa(e,""+o);break;case"onScroll":o!=null&&Qe("scroll",e);break;case"onScrollEnd":o!=null&&Qe("scrollend",e);break;case"onClick":o!=null&&(e.onclick=wr);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=e[At]||null,p=p!=null?p[s]:null,typeof p=="function"&&e.removeEventListener(i,p,h),typeof o=="function")){typeof p!="function"&&p!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(i,o,h);break e}s in e?e[s]=o:o===!0?e.setAttribute(s,""):Qt(e,s,o)}}}function Jt(e,i,s){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",e),Qe("load",e);var o=!1,h=!1,p;for(p in s)if(s.hasOwnProperty(p)){var b=s[p];if(b!=null)switch(p){case"src":o=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:ft(e,i,p,b,s,null)}}h&&ft(e,i,"srcSet",s.srcSet,s,null),o&&ft(e,i,"src",s.src,s,null);return;case"input":Qe("invalid",e);var _=p=b=h=null,B=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":b=oe;break;case"checked":B=oe;break;case"defaultChecked":ee=oe;break;case"value":p=oe;break;case"defaultValue":_=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,i));break;default:ft(e,i,o,oe,s,null)}}Bd(e,p,_,B,ee,b,h,!1);return;case"select":Qe("invalid",e),o=b=p=null;for(h in s)if(s.hasOwnProperty(h)&&(_=s[h],_!=null))switch(h){case"value":p=_;break;case"defaultValue":b=_;break;case"multiple":o=_;default:ft(e,i,h,_,s,null)}i=p,s=b,e.multiple=!!o,i!=null?la(e,!!o,i,!1):s!=null&&la(e,!!o,s,!0);return;case"textarea":Qe("invalid",e),p=h=o=null;for(b in s)if(s.hasOwnProperty(b)&&(_=s[b],_!=null))switch(b){case"value":o=_;break;case"defaultValue":h=_;break;case"children":p=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(a(91));break;default:ft(e,i,b,_,s,null)}Hd(e,o,h,p);return;case"option":for(B in s)if(s.hasOwnProperty(B)&&(o=s[B],o!=null))switch(B){case"selected":e.selected=o&&typeof o!="function"&&typeof o!="symbol";break;default:ft(e,i,B,o,s,null)}return;case"dialog":Qe("beforetoggle",e),Qe("toggle",e),Qe("cancel",e),Qe("close",e);break;case"iframe":case"object":Qe("load",e);break;case"video":case"audio":for(o=0;o<$s.length;o++)Qe($s[o],e);break;case"image":Qe("error",e),Qe("load",e);break;case"details":Qe("toggle",e);break;case"embed":case"source":case"link":Qe("error",e),Qe("load",e);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:ft(e,i,ee,o,s,null)}return;default:if(qu(i)){for(oe in s)s.hasOwnProperty(oe)&&(o=s[oe],o!==void 0&&Cf(e,i,oe,o,s,void 0));return}}for(_ in s)s.hasOwnProperty(_)&&(o=s[_],o!=null&&ft(e,i,_,o,s,null))}function Av(e,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,b=null,_=null,B=null,ee=null,oe=null;for(ae in s){var pe=s[ae];if(s.hasOwnProperty(ae)&&pe!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":B=pe;default:o.hasOwnProperty(ae)||ft(e,i,ae,null,o,pe)}}for(var ne in o){var ae=o[ne];if(pe=s[ne],o.hasOwnProperty(ne)&&(ae!=null||pe!=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":b=ae;break;case"defaultValue":_=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,i));break;default:ae!==pe&&ft(e,i,ne,ae,o,pe)}}Uu(e,b,_,B,ee,oe,p,h);return;case"select":ae=b=_=ne=null;for(p in s)if(B=s[p],s.hasOwnProperty(p)&&B!=null)switch(p){case"value":break;case"multiple":ae=B;default:o.hasOwnProperty(p)||ft(e,i,p,null,o,B)}for(h in o)if(p=o[h],B=s[h],o.hasOwnProperty(h)&&(p!=null||B!=null))switch(h){case"value":ne=p;break;case"defaultValue":_=p;break;case"multiple":b=p;default:p!==B&&ft(e,i,h,p,o,B)}i=_,s=b,o=ae,ne!=null?la(e,!!s,ne,!1):!!o!=!!s&&(i!=null?la(e,!!s,i,!0):la(e,!!s,s?[]:"",!1));return;case"textarea":ae=ne=null;for(_ in s)if(h=s[_],s.hasOwnProperty(_)&&h!=null&&!o.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:ft(e,i,_,null,o,h)}for(b in o)if(h=o[b],p=s[b],o.hasOwnProperty(b)&&(h!=null||p!=null))switch(b){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&&ft(e,i,b,h,o,p)}qd(e,ne,ae);return;case"option":for(var Ne in s)if(ne=s[Ne],s.hasOwnProperty(Ne)&&ne!=null&&!o.hasOwnProperty(Ne))switch(Ne){case"selected":e.selected=!1;break;default:ft(e,i,Ne,null,o,ne)}for(B in o)if(ne=o[B],ae=s[B],o.hasOwnProperty(B)&&ne!==ae&&(ne!=null||ae!=null))switch(B){case"selected":e.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:ft(e,i,B,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 Be in s)ne=s[Be],s.hasOwnProperty(Be)&&ne!=null&&!o.hasOwnProperty(Be)&&ft(e,i,Be,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:ft(e,i,ee,ne,o,ae)}return;default:if(qu(i)){for(var ht in s)ne=s[ht],s.hasOwnProperty(ht)&&ne!==void 0&&!o.hasOwnProperty(ht)&&Cf(e,i,ht,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||Cf(e,i,oe,ne,o,ae);return}}for(var Q in s)ne=s[Q],s.hasOwnProperty(Q)&&ne!=null&&!o.hasOwnProperty(Q)&&ft(e,i,Q,null,o,ne);for(pe in o)ne=o[pe],ae=s[pe],!o.hasOwnProperty(pe)||ne===ae||ne==null&&ae==null||ft(e,i,pe,ne,o,ae)}function Fg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Tv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,i=0,s=performance.getEntriesByType("resource"),o=0;o<s.length;o++){var h=s[o],p=h.transferSize,b=h.initiatorType,_=h.duration;if(p&&_&&Fg(b)){for(b=0,_=h.responseEnd,o+=1;o<s.length;o++){var B=s[o],ee=B.startTime;if(ee>_)break;var oe=B.transferSize,pe=B.initiatorType;oe&&Fg(pe)&&(B=B.responseEnd,b+=oe*(B<_?1:(_-ee)/(B-ee)))}if(--o,i+=8*(p+b)/(h.duration/1e3),e++,10<e)break}}if(0<e)return i/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Af=null,Tf=null;function Do(e){return e.nodeType===9?e:e.ownerDocument}function $g(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Gg(e,i){if(e===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&i==="foreignObject"?0:e}function Of(e,i){return e==="textarea"||e==="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 jf=null;function Ov(){var e=window.event;return e&&e.type==="popstate"?e===jf?!1:(jf=e,!0):(jf=null,!1)}var Yg=typeof setTimeout=="function"?setTimeout:void 0,jv=typeof clearTimeout=="function"?clearTimeout:void 0,Vg=typeof Promise=="function"?Promise:void 0,Nv=typeof queueMicrotask=="function"?queueMicrotask:typeof Vg<"u"?function(e){return Vg.resolve(null).then(e).catch(Rv)}:Yg;function Rv(e){setTimeout(function(){throw e})}function pi(e){return e==="head"}function Jg(e,i){var s=i,o=0;do{var h=s.nextSibling;if(e.removeChild(s),h&&h.nodeType===8)if(s=h.data,s==="/$"||s==="/&"){if(o===0){e.removeChild(h),qa(i);return}o--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")o++;else if(s==="html")Ys(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,Ys(s);for(var p=s.firstChild;p;){var b=p.nextSibling,_=p.nodeName;p[qt]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&p.rel.toLowerCase()==="stylesheet"||s.removeChild(p),p=b}}else s==="body"&&Ys(e.ownerDocument.body);s=h}while(s);qa(i)}function Xg(e,i){var s=e;e=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(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=o}while(s)}function Nf(e){var i=e.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":Nf(s),sa(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function Mv(e,i,s,o){for(;e.nodeType===1;){var h=s;if(e.nodeName.toLowerCase()!==i.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[qt])switch(i){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==h.rel||e.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||e.getAttribute("title")!==(h.title==null?null:h.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(h.src==null?null:h.src)||e.getAttribute("type")!==(h.type==null?null:h.type)||e.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(i==="input"&&e.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=$n(e.nextSibling),e===null)break}return null}function Dv(e,i,s){if(i==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=$n(e.nextSibling),e===null))return null;return e}function Qg(e,i){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=$n(e.nextSibling),e===null))return null;return e}function Rf(e){return e.data==="$?"||e.data==="$~"}function Mf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function zv(e,i){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=i;else if(e.data!=="$?"||s.readyState!=="loading")i();else{var o=function(){i(),s.removeEventListener("DOMContentLoaded",o)};s.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function $n(e){for(;e!=null;e=e.nextSibling){var i=e.nodeType;if(i===1||i===3)break;if(i===8){if(i=e.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return e}var Df=null;function Zg(e){e=e.nextSibling;for(var i=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(i===0)return $n(e.nextSibling);i--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||i++}e=e.nextSibling}return null}function Kg(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(i===0)return e;i--}else s!=="/$"&&s!=="/&"||i++}e=e.previousSibling}return null}function Wg(e,i,s){switch(i=Do(s),e){case"html":if(e=i.documentElement,!e)throw Error(a(452));return e;case"head":if(e=i.head,!e)throw Error(a(453));return e;case"body":if(e=i.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function Ys(e){for(var i=e.attributes;i.length;)e.removeAttributeNode(i[0]);sa(e)}var Gn=new Map,ey=new Set;function zo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var qr=te.d;te.d={f:Lv,r:Uv,D:Bv,C:qv,L:Hv,m:Pv,X:Fv,S:Iv,M:$v};function Lv(){var e=qr.f(),i=Co();return e||i}function Uv(e){var i=T(e);i!==null&&i.tag===5&&i.type==="form"?yp(i):qr.r(e)}var La=typeof document>"u"?null:document;function ty(e,i,s){var o=La;if(o&&typeof i=="string"&&i){var h=Un(i);h='link[rel="'+e+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),ey.has(h)||(ey.add(h),e={rel:e,crossOrigin:s,href:i},o.querySelector(h)===null&&(i=o.createElement("link"),Jt(i,"link",e),P(i),o.head.appendChild(i)))}}function Bv(e){qr.D(e),ty("dns-prefetch",e,null)}function qv(e,i){qr.C(e,i),ty("preconnect",e,i)}function Hv(e,i,s){qr.L(e,i,s);var o=La;if(o&&e&&i){var h='link[rel="preload"][as="'+Un(i)+'"]';i==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+Un(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+Un(s.imageSizes)+'"]')):h+='[href="'+Un(e)+'"]';var p=h;switch(i){case"style":p=Ua(e);break;case"script":p=Ba(e)}Gn.has(p)||(e=g({rel:"preload",href:i==="image"&&s&&s.imageSrcSet?void 0:e,as:i},s),Gn.set(p,e),o.querySelector(h)!==null||i==="style"&&o.querySelector(Vs(p))||i==="script"&&o.querySelector(Js(p))||(i=o.createElement("link"),Jt(i,"link",e),P(i),o.head.appendChild(i)))}}function Pv(e,i){qr.m(e,i);var s=La;if(s&&e){var o=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Un(o)+'"][href="'+Un(e)+'"]',p=h;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Ba(e)}if(!Gn.has(p)&&(e=g({rel:"modulepreload",href:e},i),Gn.set(p,e),s.querySelector(h)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Js(p)))return}o=s.createElement("link"),Jt(o,"link",e),P(o),s.head.appendChild(o)}}}function Iv(e,i,s){qr.S(e,i,s);var o=La;if(o&&e){var h=R(o).hoistableStyles,p=Ua(e);i=i||"default";var b=h.get(p);if(!b){var _={loading:0,preload:null};if(b=o.querySelector(Vs(p)))_.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":i},s),(s=Gn.get(p))&&zf(e,s);var B=b=o.createElement("link");P(B),Jt(B,"link",e),B._p=new Promise(function(ee,oe){B.onload=ee,B.onerror=oe}),B.addEventListener("load",function(){_.loading|=1}),B.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Lo(b,i,o)}b={type:"stylesheet",instance:b,count:1,state:_},h.set(p,b)}}}function Fv(e,i){qr.X(e,i);var s=La;if(s&&e){var o=R(s).hoistableScripts,h=Ba(e),p=o.get(h);p||(p=s.querySelector(Js(h)),p||(e=g({src:e,async:!0},i),(i=Gn.get(h))&&Lf(e,i),p=s.createElement("script"),P(p),Jt(p,"link",e),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function $v(e,i){qr.M(e,i);var s=La;if(s&&e){var o=R(s).hoistableScripts,h=Ba(e),p=o.get(h);p||(p=s.querySelector(Js(h)),p||(e=g({src:e,async:!0,type:"module"},i),(i=Gn.get(h))&&Lf(e,i),p=s.createElement("script"),P(p),Jt(p,"link",e),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(h,p))}}function ny(e,i,s,o){var h=(h=xe.current)?zo(h):null;if(!h)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(i=Ua(s.href),s=R(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"){e=Ua(s.href);var p=R(h).hoistableStyles,b=p.get(e);if(b||(h=h.ownerDocument||h,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,b),(p=h.querySelector(Vs(e)))&&!p._p&&(b.instance=p,b.state.loading=5),Gn.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Gn.set(e,s),p||Gv(h,e,s,b.state))),i&&o===null)throw Error(a(528,""));return b}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=Ba(s),s=R(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,e))}}function Ua(e){return'href="'+Un(e)+'"'}function Vs(e){return'link[rel="stylesheet"]['+e+"]"}function ry(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function Gv(e,i,s,o){e.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=e.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),Jt(i,"link",s),P(i),e.head.appendChild(i))}function Ba(e){return'[src="'+Un(e)+'"]'}function Js(e){return"script[async]"+e}function iy(e,i,s){if(i.count++,i.instance===null)switch(i.type){case"style":var o=e.querySelector('style[data-href~="'+Un(s.href)+'"]');if(o)return i.instance=o,P(o),o;var h=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),P(o),Jt(o,"style",h),Lo(o,s.precedence,e),i.instance=o;case"stylesheet":h=Ua(s.href);var p=e.querySelector(Vs(h));if(p)return i.state.loading|=4,i.instance=p,P(p),p;o=ry(s),(h=Gn.get(h))&&zf(o,h),p=(e.ownerDocument||e).createElement("link"),P(p);var b=p;return b._p=new Promise(function(_,B){b.onload=_,b.onerror=B}),Jt(p,"link",o),i.state.loading|=4,Lo(p,s.precedence,e),i.instance=p;case"script":return p=Ba(s.src),(h=e.querySelector(Js(p)))?(i.instance=h,P(h),h):(o=s,(h=Gn.get(p))&&(o=g({},s),Lf(o,h)),e=e.ownerDocument||e,h=e.createElement("script"),P(h),Jt(h,"link",o),e.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,Lo(o,s.precedence,e));return i.instance}function Lo(e,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,b=0;b<o.length;b++){var _=o[b];if(_.dataset.precedence===i)p=_;else if(p!==h)break}p?p.parentNode.insertBefore(e,p.nextSibling):(i=s.nodeType===9?s.head:s,i.insertBefore(e,i.firstChild))}function zf(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.title==null&&(e.title=i.title)}function Lf(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.integrity==null&&(e.integrity=i.integrity)}var Uo=null;function ay(e,i,s){if(Uo===null){var o=new Map,h=Uo=new Map;h.set(s,o)}else h=Uo,o=h.get(s),o||(o=new Map,h.set(s,o));if(o.has(e))return o;for(o.set(e,null),s=s.getElementsByTagName(e),h=0;h<s.length;h++){var p=s[h];if(!(p[qt]||p[mt]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var b=p.getAttribute(i)||"";b=e+b;var _=o.get(b);_?_.push(p):o.set(b,[p])}}return o}function sy(e,i,s){e=e.ownerDocument||e,e.head.insertBefore(s,i==="title"?e.querySelector("head > title"):null)}function Yv(e,i,s){if(s===1||i.itemProp!=null)return!1;switch(e){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 e=i.disabled,typeof i.precedence=="string"&&e==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 ly(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Vv(e,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=Ua(o.href),p=i.querySelector(Vs(h));if(p){i=p._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(e.count++,e=Bo.bind(e),i.then(e,e)),s.state.loading|=4,s.instance=p,P(p);return}p=i.ownerDocument||i,o=ry(o),(h=Gn.get(h))&&zf(o,h),p=p.createElement("link"),P(p);var b=p;b._p=new Promise(function(_,B){b.onload=_,b.onerror=B}),Jt(p,"link",o),s.instance=p}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=Bo.bind(e),i.addEventListener("load",s),i.addEventListener("error",s))}}var Uf=0;function Jv(e,i){return e.stylesheets&&e.count===0&&Ho(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var o=setTimeout(function(){if(e.stylesheets&&Ho(e,e.stylesheets),e.unsuspend){var p=e.unsuspend;e.unsuspend=null,p()}},6e4+i);0<e.imgBytes&&Uf===0&&(Uf=62500*Tv());var h=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ho(e,e.stylesheets),e.unsuspend)){var p=e.unsuspend;e.unsuspend=null,p()}},(e.imgBytes>Uf?50:800)+i);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(h)}}:null}function Bo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ho(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var qo=null;function Ho(e,i){e.stylesheets=null,e.unsuspend!==null&&(e.count++,qo=new Map,i.forEach(Xv,e),qo=null,Bo.call(e))}function Xv(e,i){if(!(i.state.loading&4)){var s=qo.get(e);if(s)var o=s.get(null);else{s=new Map,qo.set(e,s);for(var h=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var b=h[p];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(s.set(b.dataset.precedence,b),o=b)}o&&s.set(null,o)}h=i.instance,b=h.getAttribute("data-precedence"),p=s.get(b)||o,p===o&&s.set(null,h),s.set(b,h),this.count++,o=Bo.bind(this),h.addEventListener("load",o),h.addEventListener("error",o),p?p.parentNode.insertBefore(h,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(h,e.firstChild)),i.state.loading|=4}}var Xs={$$typeof:V,Provider:null,Consumer:null,_currentValue:me,_currentValue2:me,_threadCount:0};function Qv(e,i,s,o,h,p,b,_,B){this.tag=1,this.containerInfo=e,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=Jr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jr(0),this.hiddenUpdates=Jr(null),this.identifierPrefix=o,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=B,this.incompleteTransitions=new Map}function oy(e,i,s,o,h,p,b,_,B,ee,oe,pe){return e=new Qv(e,i,s,b,B,ee,oe,pe,_),i=1,p===!0&&(i|=24),p=xn(3,null,null,i),e.current=p,p.stateNode=e,i=pc(),i.refCount++,e.pooledCache=i,i.refCount++,p.memoizedState={element:o,isDehydrated:s,cache:i},xc(p),e}function uy(e){return e?(e=pa,e):pa}function cy(e,i,s,o,h,p){h=uy(h),o.context===null?o.context=h:o.pendingContext=h,o=ii(i),o.payload={element:s},p=p===void 0?null:p,p!==null&&(o.callback=p),s=ai(e,o,i),s!==null&&(dn(s,e,i),As(s,e,i))}function fy(e,i){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<i?s:i}}function Bf(e,i){fy(e,i),(e=e.alternate)&&fy(e,i)}function hy(e){if(e.tag===13||e.tag===31){var i=Li(e,67108864);i!==null&&dn(i,e,67108864),Bf(e,67108864)}}function dy(e){if(e.tag===13||e.tag===31){var i=En();i=Sr(i);var s=Li(e,i);s!==null&&dn(s,e,i),Bf(e,i)}}var Po=!0;function Zv(e,i,s,o){var h=H.T;H.T=null;var p=te.p;try{te.p=2,qf(e,i,s,o)}finally{te.p=p,H.T=h}}function Kv(e,i,s,o){var h=H.T;H.T=null;var p=te.p;try{te.p=8,qf(e,i,s,o)}finally{te.p=p,H.T=h}}function qf(e,i,s,o){if(Po){var h=Hf(o);if(h===null)kf(e,i,o,Io,s),py(e,o);else if(eS(h,e,i,s,o))o.stopPropagation();else if(py(e,o),i&4&&-1<Wv.indexOf(e)){for(;h!==null;){var p=T(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var b=Zn(p.pendingLanes);if(b!==0){var _=p;for(_.pendingLanes|=2,_.entangledLanes|=2;b;){var B=1<<31-lt(b);_.entanglements[1]|=B,b&=~B}fr(p),(st&6)===0&&(Eo=yt()+500,Fs(0))}}break;case 31:case 13:_=Li(p,2),_!==null&&dn(_,p,2),Co(),Bf(p,2)}if(p=Hf(o),p===null&&kf(e,i,o,Io,s),p===h)break;h=p}h!==null&&o.stopPropagation()}else kf(e,i,o,null,s)}}function Hf(e){return e=Pu(e),Pf(e)}var Io=null;function Pf(e){if(Io=null,e=w(e),e!==null){var i=u(e);if(i===null)e=null;else{var s=i.tag;if(s===13){if(e=c(i),e!==null)return e;e=null}else if(s===31){if(e=f(i),e!==null)return e;e=null}else if(s===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;e=null}else i!==e&&(e=null)}}return Io=e,null}function my(e){switch(e){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(os()){case ue:return 2;case Se:return 8;case qe:case Ve:return 32;case rt:return 268435456;default:return 32}default:return 32}}var If=!1,gi=null,yi=null,bi=null,Qs=new Map,Zs=new Map,xi=[],Wv="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 py(e,i){switch(e){case"focusin":case"focusout":gi=null;break;case"dragenter":case"dragleave":yi=null;break;case"mouseover":case"mouseout":bi=null;break;case"pointerover":case"pointerout":Qs.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zs.delete(i.pointerId)}}function Ks(e,i,s,o,h,p){return e===null||e.nativeEvent!==p?(e={blockedOn:i,domEventName:s,eventSystemFlags:o,nativeEvent:p,targetContainers:[h]},i!==null&&(i=T(i),i!==null&&hy(i)),e):(e.eventSystemFlags|=o,i=e.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),e)}function eS(e,i,s,o,h){switch(i){case"focusin":return gi=Ks(gi,e,i,s,o,h),!0;case"dragenter":return yi=Ks(yi,e,i,s,o,h),!0;case"mouseover":return bi=Ks(bi,e,i,s,o,h),!0;case"pointerover":var p=h.pointerId;return Qs.set(p,Ks(Qs.get(p)||null,e,i,s,o,h)),!0;case"gotpointercapture":return p=h.pointerId,Zs.set(p,Ks(Zs.get(p)||null,e,i,s,o,h)),!0}return!1}function gy(e){var i=w(e.target);if(i!==null){var s=u(i);if(s!==null){if(i=s.tag,i===13){if(i=c(s),i!==null){e.blockedOn=i,Dl(e.priority,function(){dy(s)});return}}else if(i===31){if(i=f(s),i!==null){e.blockedOn=i,Dl(e.priority,function(){dy(s)});return}}else if(i===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Fo(e){if(e.blockedOn!==null)return!1;for(var i=e.targetContainers;0<i.length;){var s=Hf(e.nativeEvent);if(s===null){s=e.nativeEvent;var o=new s.constructor(s.type,s);Hu=o,s.target.dispatchEvent(o),Hu=null}else return i=T(s),i!==null&&hy(i),e.blockedOn=s,!1;i.shift()}return!0}function yy(e,i,s){Fo(e)&&s.delete(i)}function tS(){If=!1,gi!==null&&Fo(gi)&&(gi=null),yi!==null&&Fo(yi)&&(yi=null),bi!==null&&Fo(bi)&&(bi=null),Qs.forEach(yy),Zs.forEach(yy)}function $o(e,i){e.blockedOn===i&&(e.blockedOn=null,If||(If=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,tS)))}var Go=null;function by(e){Go!==e&&(Go=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Go===e&&(Go=null);for(var i=0;i<e.length;i+=3){var s=e[i],o=e[i+1],h=e[i+2];if(typeof o!="function"){if(Pf(o||s)===null)continue;break}var p=T(s);p!==null&&(e.splice(i,3),i-=3,qc(p,{pending:!0,data:h,method:s.method,action:o},o,h))}}))}function qa(e){function i(B){return $o(B,e)}gi!==null&&$o(gi,e),yi!==null&&$o(yi,e),bi!==null&&$o(bi,e),Qs.forEach(i),Zs.forEach(i);for(var s=0;s<xi.length;s++){var o=xi[s];o.blockedOn===e&&(o.blockedOn=null)}for(;0<xi.length&&(s=xi[0],s.blockedOn===null);)gy(s),s.blockedOn===null&&xi.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(o=0;o<s.length;o+=3){var h=s[o],p=s[o+1],b=h[At]||null;if(typeof p=="function")b||by(s);else if(b){var _=null;if(p&&p.hasAttribute("formAction")){if(h=p,b=p[At]||null)_=b.formAction;else if(Pf(h)!==null)continue}else _=b.action;typeof _=="function"?s[o+1]=_:(s.splice(o,3),o-=3),by(s)}}}function xy(){function e(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(b){return h=b})},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",e),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(s,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function Ff(e){this._internalRoot=e}Yo.prototype.render=Ff.prototype.render=function(e){var i=this._internalRoot;if(i===null)throw Error(a(409));var s=i.current,o=En();cy(s,o,e,i,null,null)},Yo.prototype.unmount=Ff.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var i=e.containerInfo;cy(e.current,2,null,e,null,null),Co(),i[yn]=null}};function Yo(e){this._internalRoot=e}Yo.prototype.unstable_scheduleHydration=function(e){if(e){var i=cs();e={blockedOn:null,target:e,priority:i};for(var s=0;s<xi.length&&i!==0&&i<xi[s].priority;s++);xi.splice(s,0,e),s===0&&gy(e)}};var vy=n.version;if(vy!=="19.2.4")throw Error(a(527,vy,"19.2.4"));te.findDOMNode=function(e){var i=e._reactInternals;if(i===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=d(i),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var nS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vo.isDisabled&&Vo.supportsFiber)try{$t=Vo.inject(nS),dt=Vo}catch{}}return el.createRoot=function(e,i){if(!l(e))throw Error(a(299));var s=!1,o="",h=Ap,p=Tp,b=Op;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&&(b=i.onRecoverableError)),i=oy(e,1,!1,null,null,s,o,null,h,p,b,xy),e[yn]=i.current,Ef(e),new Ff(i)},el.hydrateRoot=function(e,i,s){if(!l(e))throw Error(a(299));var o=!1,h="",p=Ap,b=Tp,_=Op,B=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&&(b=s.onCaughtError),s.onRecoverableError!==void 0&&(_=s.onRecoverableError),s.formState!==void 0&&(B=s.formState)),i=oy(e,1,!0,i,s??null,o,h,B,p,b,_,xy),i.context=uy(null),s=i.current,o=En(),o=Sr(o),h=ii(o),h.callback=null,ai(s,h,o),s=o,i.current.lanes=s,Kn(i,s),fr(i),e[yn]=i.current,Ef(e),new Yo(i)},el.version="19.2.4",el}var jy;function mS(){if(jy)return Yf.exports;jy=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(n){console.error(n)}}return t(),Yf.exports=dS(),Yf.exports}var pS=mS();/**
|
|
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 Ny="popstate";function Ry(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function gS(t={}){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 kh("",{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:bl(l)}return bS(n,r,null,t)}function Ct(t,n){if(t===!1||t===null||typeof t>"u")throw new Error(n)}function gr(t,n){if(!t){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function yS(){return Math.random().toString(36).substring(2,10)}function My(t,n){return{usr:t.state,key:t.key,idx:n,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function kh(t,n,r=null,a,l){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof n=="string"?rs(n):n,state:r,key:n&&n.key||a||yS(),unstable_mask:l}}function bl({pathname:t="/",search:n="",hash:r=""}){return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function rs(t){let n={};if(t){let r=t.indexOf("#");r>=0&&(n.hash=t.substring(r),t=t.substring(0,r));let a=t.indexOf("?");a>=0&&(n.search=t.substring(a),t=t.substring(0,a)),t&&(n.pathname=t)}return n}function bS(t,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 q=y(),M=q==null?null:q-d;d=q,m&&m({action:f,location:D.location,delta:M})}function x(q,M){f="PUSH";let G=Ry(q)?q:kh(D.location,q,M);d=y()+1;let V=My(G,d),le=D.createHref(G.unstable_mask||G);try{c.pushState(V,"",le)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;l.location.assign(le)}u&&m&&m({action:f,location:D.location,delta:1})}function v(q,M){f="REPLACE";let G=Ry(q)?q:kh(D.location,q,M);d=y();let V=My(G,d),le=D.createHref(G.unstable_mask||G);c.replaceState(V,"",le),u&&m&&m({action:f,location:D.location,delta:0})}function C(q){return xS(q)}let D={get action(){return f},get location(){return t(l,c)},listen(q){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(Ny,g),m=q,()=>{l.removeEventListener(Ny,g),m=null}},createHref(q){return n(l,q)},createURL:C,encodeLocation(q){let M=C(q);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:x,replace:v,go(q){return c.go(q)}};return D}function xS(t,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Ct(r,"No window.location.(origin|href) available to create URL");let a=typeof t=="string"?t:bl(t);return a=a.replace(/ $/,"%20"),!n&&a.startsWith("//")&&(a=r+a),new URL(a,r)}function rb(t,n,r="/"){return vS(t,n,r,!1)}function vS(t,n,r,a){let l=typeof n=="string"?rs(n):n,u=Ir(l.pathname||"/",r);if(u==null)return null;let c=ib(t);SS(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let d=RS(u);f=jS(c[m],d,a)}return f}function ib(t,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;Ct(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=pr([a,y.relativePath]),x=r.concat(y);c.children&&c.children.length>0&&(Ct(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),ib(c.children,n,x,g,m)),!(c.path==null&&!c.index)&&n.push({path:g,score:TS(g,c.index),routesMeta:x})};return t.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))u(c,f);else for(let d of ab(c.path))u(c,f,!0,d)}),n}function ab(t){let n=t.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=ab(a.join("/")),f=[];return f.push(...c.map(m=>m===""?u:[u,m].join("/"))),l&&f.push(...c),f.map(m=>t.startsWith("/")&&m===""?"/":m)}function SS(t){t.sort((n,r)=>n.score!==r.score?r.score-n.score:OS(n.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var _S=/^:[\w-]+$/,wS=3,ES=2,kS=1,CS=10,AS=-2,Dy=t=>t==="*";function TS(t,n){let r=t.split("/"),a=r.length;return r.some(Dy)&&(a+=AS),n&&(a+=ES),r.filter(l=>!Dy(l)).reduce((l,u)=>l+(_S.test(u)?wS:u===""?kS:CS),a)}function OS(t,n){return t.length===n.length&&t.slice(0,-1).every((a,l)=>a===n[l])?t[t.length-1]-n[n.length-1]:0}function jS(t,n,r=!1){let{routesMeta:a}=t,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=uu({path:m.relativePath,caseSensitive:m.caseSensitive,end:d},y),x=m.route;if(!g&&d&&r&&!a[a.length-1].route.index&&(g=uu({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!g)return null;Object.assign(l,g.params),c.push({params:l,pathname:pr([u,g.pathname]),pathnameBase:LS(pr([u,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(u=pr([u,g.pathnameBase]))}return c}function uu(t,n){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,a]=NS(t.path,t.caseSensitive,t.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},x)=>{if(y==="*"){let C=f[x]||"";c=u.slice(0,u.length-C.length).replace(/(.)\/+$/,"$1")}const v=f[x];return g&&!v?d[y]=void 0:d[y]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:u,pathnameBase:c,pattern:t}}function NS(t,n=!1,r=!0){gr(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let a=[],l="^"+t.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 t.endsWith("*")?(a.push({paramName:"*"}),l+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":t!==""&&t!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),a]}function RS(t){try{return t.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return gr(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),t}}function Ir(t,n){if(n==="/")return t;if(!t.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,a=t.charAt(r);return a&&a!=="/"?null:t.slice(r)||"/"}var MS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function DS(t,n="/"){let{pathname:r,search:a="",hash:l=""}=typeof t=="string"?rs(t):t,u;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?u=zy(r.substring(1),"/"):u=zy(r,n)):u=n,{pathname:u,search:US(a),hash:BS(l)}}function zy(t,n){let r=n.replace(/\/+$/,"").split("/");return t.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function Qf(t,n,r,a){return`Cannot include a '${t}' 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 zS(t){return t.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function sb(t){let n=zS(t);return n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase)}function rd(t,n,r,a=!1){let l;typeof t=="string"?l=rs(t):(l={...t},Ct(!l.pathname||!l.pathname.includes("?"),Qf("?","pathname","search",l)),Ct(!l.pathname||!l.pathname.includes("#"),Qf("#","pathname","hash",l)),Ct(!l.search||!l.search.includes("#"),Qf("#","search","hash",l)));let u=t===""||l.pathname==="",c=u?"/":l.pathname,f;if(c==null)f=r;else{let g=n.length-1;if(!a&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;l.pathname=x.join("/")}f=g>=0?n[g]:"/"}let m=DS(l,f),d=c&&c!=="/"&&c.endsWith("/"),y=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(d||y)&&(m.pathname+="/"),m}var pr=t=>t.join("/").replace(/\/\/+/g,"/"),LS=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),US=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,BS=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,qS=class{constructor(t,n,r,a=!1){this.status=t,this.statusText=n||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function HS(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function PS(t){return t.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 ob(t,n){let r=t;if(typeof r!="string"||!MS.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=Ir(c.pathname,n);c.origin===u.origin&&f!=null?r=f+c.search+c.hash:l=!0}catch{gr(!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 ub=["POST","PUT","PATCH","DELETE"];new Set(ub);var IS=["GET",...ub];new Set(IS);var is=U.createContext(null);is.displayName="DataRouter";var ku=U.createContext(null);ku.displayName="DataRouterState";var FS=U.createContext(!1),cb=U.createContext({isTransitioning:!1});cb.displayName="ViewTransition";var $S=U.createContext(new Map);$S.displayName="Fetchers";var GS=U.createContext(null);GS.displayName="Await";var Xn=U.createContext(null);Xn.displayName="Navigation";var kl=U.createContext(null);kl.displayName="Location";var yr=U.createContext({outlet:null,matches:[],isDataRoute:!1});yr.displayName="Route";var id=U.createContext(null);id.displayName="RouteError";var fb="REACT_ROUTER_ERROR",YS="REDIRECT",VS="ROUTE_ERROR_RESPONSE";function JS(t){if(t.startsWith(`${fb}:${YS}:{`))try{let n=JSON.parse(t.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 XS(t){if(t.startsWith(`${fb}:${VS}:{`))try{let n=JSON.parse(t.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new qS(n.status,n.statusText,n.data)}catch{}}function QS(t,{relative:n}={}){Ct(Cl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=U.useContext(Xn),{hash:l,pathname:u,search:c}=Al(t,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:pr([r,u])),a.createHref({pathname:f,search:c,hash:l})}function Cl(){return U.useContext(kl)!=null}function br(){return Ct(Cl(),"useLocation() may be used only in the context of a <Router> component."),U.useContext(kl).location}var hb="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function db(t){U.useContext(Xn).static||U.useLayoutEffect(t)}function ea(){let{isDataRoute:t}=U.useContext(yr);return t?c_():ZS()}function ZS(){Ct(Cl(),"useNavigate() may be used only in the context of a <Router> component.");let t=U.useContext(is),{basename:n,navigator:r}=U.useContext(Xn),{matches:a}=U.useContext(yr),{pathname:l}=br(),u=JSON.stringify(sb(a)),c=U.useRef(!1);return db(()=>{c.current=!0}),U.useCallback((m,d={})=>{if(gr(c.current,hb),!c.current)return;if(typeof m=="number"){r.go(m);return}let y=rd(m,JSON.parse(u),l,d.relative==="path");t==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:pr([n,y.pathname])),(d.replace?r.replace:r.push)(y,d.state,d)},[n,r,u,l,t])}U.createContext(null);function KS(){let{matches:t}=U.useContext(yr),n=t[t.length-1];return n?n.params:{}}function Al(t,{relative:n}={}){let{matches:r}=U.useContext(yr),{pathname:a}=br(),l=JSON.stringify(sb(r));return U.useMemo(()=>rd(t,JSON.parse(l),a,n==="path"),[t,l,a,n])}function WS(t,n){return mb(t,n)}function mb(t,n,r){var q;Ct(Cl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=U.useContext(Xn),{matches:l}=U.useContext(yr),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=br(),g;if(n){let M=typeof n=="string"?rs(n):n;Ct(m==="/"||((q=M.pathname)==null?void 0:q.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 x=g.pathname||"/",v=x;if(m!=="/"){let M=m.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(M.length).join("/")}let C=rb(t,{pathname:v});gr(d||C!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),gr(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 D=i_(C&&C.map(M=>Object.assign({},M,{params:Object.assign({},c,M.params),pathname:pr([m,a.encodeLocation?a.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?m:pr([m,a.encodeLocation?a.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),l,r);return n&&D?U.createElement(kl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},D):D}function e_(){let t=u_(),n=HS(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.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:",t),c=U.createElement(U.Fragment,null,U.createElement("p",null,"💿 Hey developer 👋"),U.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",U.createElement("code",{style:u},"ErrorBoundary")," or"," ",U.createElement("code",{style:u},"errorElement")," prop on your route.")),U.createElement(U.Fragment,null,U.createElement("h2",null,"Unexpected Application Error!"),U.createElement("h3",{style:{fontStyle:"italic"}},n),r?U.createElement("pre",{style:l},r):null,c)}var t_=U.createElement(e_,null),pb=class extends U.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){this.props.onError?this.props.onError(t,n):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const r=XS(t.digest);r&&(t=r)}let n=t!==void 0?U.createElement(yr.Provider,{value:this.props.routeContext},U.createElement(id.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?U.createElement(n_,{error:t},n):n}};pb.contextType=FS;var Zf=new WeakMap;function n_({children:t,error:n}){let{basename:r}=U.useContext(Xn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let a=JS(n.digest);if(a){let l=Zf.get(n);if(l)throw l;let u=ob(a.location,r);if(lb&&!Zf.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 Zf.set(n,c),c}return U.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return t}function r_({routeContext:t,match:n,children:r}){let a=U.useContext(is);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),U.createElement(yr.Provider,{value:t},r)}function i_(t,n=[],r){let a=r==null?void 0:r.state;if(t==null){if(!a)return null;if(a.errors)t=a.matches;else if(n.length===0&&!a.initialized&&a.matches.length>0)t=a.matches;else return null}let l=t,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);Ct(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:x,errors:v}=a,C=g.route.loader&&!x.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 x,v;m(y,{location:a.location,params:((v=(x=a.matches)==null?void 0:x[0])==null?void 0:v.params)??{},unstable_pattern:PS(a.matches),errorInfo:g})}:void 0;return l.reduceRight((y,g,x)=>{let v,C=!1,D=null,q=null;a&&(v=u&&g.route.id?u[g.route.id]:void 0,D=g.route.errorElement||t_,c&&(f<0&&x===0?(gb("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,q=null):f===x&&(C=!0,q=g.route.hydrateFallbackElement||null)));let M=n.concat(l.slice(0,x+1)),G=()=>{let V;return v?V=D:C?V=q:g.route.Component?V=U.createElement(g.route.Component,null):g.route.element?V=g.route.element:V=y,U.createElement(r_,{match:g,routeContext:{outlet:y,matches:M,isDataRoute:a!=null},children:V})};return a&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?U.createElement(pb,{location:a.location,revalidation:a.revalidation,component:D,error:v,children:G(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:d}):G()},null)}function ad(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function a_(t){let n=U.useContext(is);return Ct(n,ad(t)),n}function s_(t){let n=U.useContext(ku);return Ct(n,ad(t)),n}function l_(t){let n=U.useContext(yr);return Ct(n,ad(t)),n}function sd(t){let n=l_(t),r=n.matches[n.matches.length-1];return Ct(r.route.id,`${t} can only be used on routes that contain a unique "id"`),r.route.id}function o_(){return sd("useRouteId")}function u_(){var a;let t=U.useContext(id),n=s_("useRouteError"),r=sd("useRouteError");return t!==void 0?t:(a=n.errors)==null?void 0:a[r]}function c_(){let{router:t}=a_("useNavigate"),n=sd("useNavigate"),r=U.useRef(!1);return db(()=>{r.current=!0}),U.useCallback(async(l,u={})=>{gr(r.current,hb),r.current&&(typeof l=="number"?await t.navigate(l):await t.navigate(l,{fromRouteId:n,...u}))},[t,n])}var Ly={};function gb(t,n,r){!n&&!Ly[t]&&(Ly[t]=!0,gr(!1,r))}U.memo(f_);function f_({routes:t,future:n,state:r,isStatic:a,onError:l}){return mb(t,void 0,{state:r,isStatic:a,onError:l})}function Fa(t){Ct(!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 h_({basename:t="/",children:n=null,location:r,navigationType:a="POP",navigator:l,static:u=!1,unstable_useTransitions:c}){Ct(!Cl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=t.replace(/^\/*/,"/"),m=U.useMemo(()=>({basename:f,navigator:l,static:u,unstable_useTransitions:c,future:{}}),[f,l,u,c]);typeof r=="string"&&(r=rs(r));let{pathname:d="/",search:y="",hash:g="",state:x=null,key:v="default",unstable_mask:C}=r,D=U.useMemo(()=>{let q=Ir(d,f);return q==null?null:{location:{pathname:q,search:y,hash:g,state:x,key:v,unstable_mask:C},navigationType:a}},[f,d,y,g,x,v,a,C]);return gr(D!=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.`),D==null?null:U.createElement(Xn.Provider,{value:m},U.createElement(kl.Provider,{children:n,value:D}))}function d_({children:t,location:n}){return WS(Ch(t),n)}function Ch(t,n=[]){let r=[];return U.Children.forEach(t,(a,l)=>{if(!U.isValidElement(a))return;let u=[...n,l];if(a.type===U.Fragment){r.push.apply(r,Ch(a.props.children,u));return}Ct(a.type===Fa,`[${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>`),Ct(!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=Ch(a.props.children,u)),r.push(c)}),r}var iu="get",au="application/x-www-form-urlencoded";function Cu(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function m_(t){return Cu(t)&&t.tagName.toLowerCase()==="button"}function p_(t){return Cu(t)&&t.tagName.toLowerCase()==="form"}function g_(t){return Cu(t)&&t.tagName.toLowerCase()==="input"}function y_(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function b_(t,n){return t.button===0&&(!n||n==="_self")&&!y_(t)}var Jo=null;function x_(){if(Jo===null)try{new FormData(document.createElement("form"),0),Jo=!1}catch{Jo=!0}return Jo}var v_=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Kf(t){return t!=null&&!v_.has(t)?(gr(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${au}"`),null):t}function S_(t,n){let r,a,l,u,c;if(p_(t)){let f=t.getAttribute("action");a=f?Ir(f,n):null,r=t.getAttribute("method")||iu,l=Kf(t.getAttribute("enctype"))||au,u=new FormData(t)}else if(m_(t)||g_(t)&&(t.type==="submit"||t.type==="image")){let f=t.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||f.getAttribute("action");if(a=m?Ir(m,n):null,r=t.getAttribute("formmethod")||f.getAttribute("method")||iu,l=Kf(t.getAttribute("formenctype"))||Kf(f.getAttribute("enctype"))||au,u=new FormData(f,t),!x_()){let{name:d,type:y,value:g}=t;if(y==="image"){let x=d?`${d}.`:"";u.append(`${x}x`,"0"),u.append(`${x}y`,"0")}else d&&u.append(d,g)}}else{if(Cu(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=iu,a=null,l=au,c=t}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 ld(t,n){if(t===!1||t===null||typeof t>"u")throw new Error(n)}function __(t,n,r,a){let l=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${a}`:l.pathname=`${l.pathname}.${a}`:l.pathname==="/"?l.pathname=`_root.${a}`:n&&Ir(l.pathname,n)==="/"?l.pathname=`${n.replace(/\/$/,"")}/_root.${a}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${a}`,l}async function w_(t,n){if(t.id in n)return n[t.id];try{let r=await import(t.module);return n[t.id]=r,r}catch(r){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function E_(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function k_(t,n,r){let a=await Promise.all(t.map(async l=>{let u=n.routes[l.route.id];if(u){let c=await w_(u,r);return c.links?c.links():[]}return[]}));return O_(a.flat(1).filter(E_).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function Uy(t,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 x=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function C_(t,n,{includeHydrateFallback:r}={}){return A_(t.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_(t){return[...new Set(t)]}function T_(t){let n={},r=Object.keys(t).sort();for(let a of r)n[a]=t[a];return n}function O_(t,n){let r=new Set;return new Set(n),t.reduce((a,l)=>{let u=JSON.stringify(T_(l));return r.has(u)||(r.add(u),a.push({key:u,link:l})),a},[])}function yb(){let t=U.useContext(is);return ld(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function j_(){let t=U.useContext(ku);return ld(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var od=U.createContext(void 0);od.displayName="FrameworkContext";function bb(){let t=U.useContext(od);return ld(t,"You must render this element inside a <HydratedRouter> element"),t}function N_(t,n){let r=U.useContext(od),[a,l]=U.useState(!1),[u,c]=U.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:y,onTouchStart:g}=n,x=U.useRef(null);U.useEffect(()=>{if(t==="render"&&c(!0),t==="viewport"){let D=M=>{M.forEach(G=>{c(G.isIntersecting)})},q=new IntersectionObserver(D,{threshold:.5});return x.current&&q.observe(x.current),()=>{q.disconnect()}}},[t]),U.useEffect(()=>{if(a){let D=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(D)}}},[a]);let v=()=>{l(!0)},C=()=>{l(!1),c(!1)};return r?t!=="intent"?[u,x,{}]:[u,x,{onFocus:tl(f,v),onBlur:tl(m,C),onMouseEnter:tl(d,v),onMouseLeave:tl(y,C),onTouchStart:tl(g,v)}]:[!1,x,{}]}function tl(t,n){return r=>{t&&t(r),r.defaultPrevented||n(r)}}function R_({page:t,...n}){let{router:r}=yb(),a=U.useMemo(()=>rb(r.routes,t,r.basename),[r.routes,t,r.basename]);return a?U.createElement(D_,{page:t,matches:a,...n}):null}function M_(t){let{manifest:n,routeModules:r}=bb(),[a,l]=U.useState([]);return U.useEffect(()=>{let u=!1;return k_(t,n,r).then(c=>{u||l(c)}),()=>{u=!0}},[t,n,r]),a}function D_({page:t,matches:n,...r}){let a=br(),{future:l,manifest:u,routeModules:c}=bb(),{basename:f}=yb(),{loaderData:m,matches:d}=j_(),y=U.useMemo(()=>Uy(t,n,d,u,a,"data"),[t,n,d,u,a]),g=U.useMemo(()=>Uy(t,n,d,u,a,"assets"),[t,n,d,u,a]),x=U.useMemo(()=>{if(t===a.pathname+a.search+a.hash)return[];let D=new Set,q=!1;if(n.forEach(G=>{var le;let V=u.routes[G.route.id];!V||!V.hasLoader||(!y.some(j=>j.route.id===G.route.id)&&G.route.id in m&&((le=c[G.route.id])!=null&&le.shouldRevalidate)||V.hasClientLoader?q=!0:D.add(G.route.id))}),D.size===0)return[];let M=__(t,f,l.unstable_trailingSlashAwareDataRequests,"data");return q&&D.size>0&&M.searchParams.set("_routes",n.filter(G=>D.has(G.route.id)).map(G=>G.route.id).join(",")),[M.pathname+M.search]},[f,l.unstable_trailingSlashAwareDataRequests,m,a,u,y,n,t,c]),v=U.useMemo(()=>C_(g,u),[g,u]),C=M_(g);return U.createElement(U.Fragment,null,x.map(D=>U.createElement("link",{key:D,rel:"prefetch",as:"fetch",href:D,...r})),v.map(D=>U.createElement("link",{key:D,rel:"modulepreload",href:D,...r})),C.map(({key:D,link:q})=>U.createElement("link",{key:D,nonce:r.nonce,...q,crossOrigin:q.crossOrigin??r.crossOrigin})))}function z_(...t){return n=>{t.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var L_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{L_&&(window.__reactRouterVersion="7.13.1")}catch{}function U_({basename:t,children:n,unstable_useTransitions:r,window:a}){let l=U.useRef();l.current==null&&(l.current=gS({window:a,v5Compat:!0}));let u=l.current,[c,f]=U.useState({action:u.action,location:u.location}),m=U.useCallback(d=>{r===!1?f(d):U.startTransition(()=>f(d))},[r]);return U.useLayoutEffect(()=>u.listen(m),[u,m]),U.createElement(h_,{basename:t,children:n,location:c.location,navigationType:c.action,navigator:u,unstable_useTransitions:r})}var xb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vb=U.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:x,unstable_defaultShouldRevalidate:v,...C},D){let{basename:q,navigator:M,unstable_useTransitions:G}=U.useContext(Xn),V=typeof y=="string"&&xb.test(y),le=ob(y,q);y=le.to;let j=QS(y,{relative:l}),O=br(),J=null;if(f){let I=rd(f,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);q!=="/"&&(I.pathname=I.pathname==="/"?q:pr([q,I.pathname])),J=M.createHref(I)}let[F,X,z]=N_(a,C),ie=P_(y,{replace:c,unstable_mask:f,state:m,target:d,preventScrollReset:g,relative:l,viewTransition:x,unstable_defaultShouldRevalidate:v,unstable_useTransitions:G});function K(I){n&&n(I),I.defaultPrevented||ie(I)}let ge=!(le.isExternal||u),he=U.createElement("a",{...C,...z,href:(ge?J:void 0)||le.absoluteURL||j,onClick:ge?K:n,ref:z_(D,X),target:d,"data-discover":!V&&r==="render"?"true":void 0});return F&&!V?U.createElement(U.Fragment,null,he,U.createElement(R_,{page:j})):he});vb.displayName="Link";var B_=U.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=Al(c,{relative:d.relative}),x=br(),v=U.useContext(ku),{navigator:C,basename:D}=U.useContext(Xn),q=v!=null&&Y_(g)&&f===!0,M=C.encodeLocation?C.encodeLocation(g).pathname:g.pathname,G=x.pathname,V=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(G=G.toLowerCase(),V=V?V.toLowerCase():null,M=M.toLowerCase()),V&&D&&(V=Ir(V,D)||V);const le=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let j=G===M||!l&&G.startsWith(M)&&G.charAt(le)==="/",O=V!=null&&(V===M||!l&&V.startsWith(M)&&V.charAt(M.length)==="/"),J={isActive:j,isPending:O,isTransitioning:q},F=j?n:void 0,X;typeof a=="function"?X=a(J):X=[a,j?"active":null,O?"pending":null,q?"transitioning":null].filter(Boolean).join(" ");let z=typeof u=="function"?u(J):u;return U.createElement(vb,{...d,"aria-current":F,className:X,ref:y,style:z,to:c,viewTransition:f},typeof m=="function"?m(J):m)});B_.displayName="NavLink";var q_=U.forwardRef(({discover:t="render",fetcherKey:n,navigate:r,reloadDocument:a,replace:l,state:u,method:c=iu,action:f,onSubmit:m,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x,...v},C)=>{let{unstable_useTransitions:D}=U.useContext(Xn),q=$_(),M=G_(f,{relative:d}),G=c.toLowerCase()==="get"?"get":"post",V=typeof f=="string"&&xb.test(f),le=j=>{if(m&&m(j),j.defaultPrevented)return;j.preventDefault();let O=j.nativeEvent.submitter,J=(O==null?void 0:O.getAttribute("formmethod"))||c,F=()=>q(O||j.currentTarget,{fetcherKey:n,method:J,navigate:r,replace:l,state:u,relative:d,preventScrollReset:y,viewTransition:g,unstable_defaultShouldRevalidate:x});D&&r!==!1?U.startTransition(()=>F()):F()};return U.createElement("form",{ref:C,method:G,action:M,onSubmit:a?m:le,...v,"data-discover":!V&&t==="render"?"true":void 0})});q_.displayName="Form";function H_(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sb(t){let n=U.useContext(is);return Ct(n,H_(t)),n}function P_(t,{target:n,replace:r,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:d}={}){let y=ea(),g=br(),x=Al(t,{relative:c});return U.useCallback(v=>{if(b_(v,n)){v.preventDefault();let C=r!==void 0?r:bl(g)===bl(x),D=()=>y(t,{replace:C,unstable_mask:a,state:l,preventScrollReset:u,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});d?U.startTransition(()=>D()):D()}},[g,y,x,r,a,l,n,t,u,c,f,m,d])}var I_=0,F_=()=>`__${String(++I_)}__`;function $_(){let{router:t}=Sb("useSubmit"),{basename:n}=U.useContext(Xn),r=o_(),a=t.fetch,l=t.navigate;return U.useCallback(async(u,c={})=>{let{action:f,method:m,encType:d,formData:y,body:g}=S_(u,n);if(c.navigate===!1){let x=c.fetcherKey||F_();await a(x,r,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,flushSync:c.flushSync})}else await l(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:y,body:g,formMethod:c.method||m,formEncType:c.encType||d,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,l,n,r])}function G_(t,{relative:n}={}){let{basename:r}=U.useContext(Xn),a=U.useContext(yr);Ct(a,"useFormAction must be used inside a RouteContext");let[l]=a.matches.slice(-1),u={...Al(t||".",{relative:n})},c=br();if(t==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(!t||t===".")&&l.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:pr([r,u.pathname])),bl(u)}function Y_(t,{relative:n}={}){let r=U.useContext(cb);Ct(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Sb("useViewTransitionState"),l=Al(t,{relative:n});if(!r.isTransitioning)return!1;let u=Ir(r.currentLocation.pathname,a)||r.currentLocation.pathname,c=Ir(r.nextLocation.pathname,a)||r.nextLocation.pathname;return uu(l.pathname,c)!=null||uu(l.pathname,u)!=null}var cu=nb();const _b=U.createContext(null),wb="palmier_paired_hosts",Ah="palmier_active_host";function Wf(){try{const t=localStorage.getItem(wb);if(t)return JSON.parse(t)}catch{}return[]}function V_(t){localStorage.setItem(wb,JSON.stringify(t))}function J_(){return localStorage.getItem(Ah)}function X_(t){t?localStorage.setItem(Ah,t):localStorage.removeItem(Ah)}const Q_=!!window.__PALMIER_SERVE__&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Z_({children:t}){const[n,r]=U.useState(Wf),[a,l]=U.useState(()=>{const y=J_(),g=Wf();return y&&g.some(x=>x.hostId===y)?y:g.length>0?g[0].hostId:null});U.useEffect(()=>{if(!Q_)return;const y="local";if(!Wf().find(x=>x.hostId===y)){const x={hostId:y,clientToken:"",directUrl:window.location.origin};r(v=>[...v.filter(C=>C.hostId!==y),x]),l(y)}},[]),U.useEffect(()=>{V_(n)},[n]),U.useEffect(()=>{X_(a)},[a]);const u=U.useCallback(y=>{r(g=>[...g.filter(v=>v.hostId!==y.hostId),y]),l(y.hostId)},[]),c=U.useCallback(y=>{r(g=>{const x=g.filter(v=>v.hostId!==y);return x.length>0?l(x[0].hostId):l(null),x})},[]),f=U.useCallback((y,g)=>{r(x=>x.map(v=>v.hostId===y?{...v,name:g}:v))},[]),m=U.useCallback(y=>{l(y)},[]),d=U.useCallback(()=>n.find(y=>y.hostId===a)??null,[n,a]);return S.jsx(_b.Provider,{value:{pairedHosts:n,activeHostId:a,addPairedHost:u,removePairedHost:c,renamePairedHost:f,setActiveHostId:m,getActiveHost:d},children:t})}function Tl(){const t=U.useContext(_b);if(!t)throw new Error("useHostStore must be used within HostStoreProvider");return t}const Nn=new Uint8Array(0),ta=new TextEncoder,Tn=new TextDecoder;function K_(...t){let n=0;for(let l=0;l<t.length;l++)n+=t[l].length;const r=new Uint8Array(n);let a=0;for(let l=0;l<t.length;l++)r.set(t[l],a),a+=t[l].length;return r}function fl(...t){const n=[];for(let r=0;r<t.length;r++)n.push(ta.encode(t[r]));return n.length===0?Nn:n.length===1?n[0]:K_(...n)}function By(t){return!t||t.length===0?"":Tn.decode(t)}const qy="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",Hy=36,W_=0xcfd41b9100000,Py=33,ew=333,Iy=22;function tw(t){for(let n=0;n<t.length;n++)t[n]=Math.floor(Math.random()*255)}function nw(t){var n;(n=globalThis==null?void 0:globalThis.crypto)!=null&&n.getRandomValues?globalThis.crypto.getRandomValues(t):tw(t)}class rw{constructor(){k(this,"buf");k(this,"seq");k(this,"inc");k(this,"inited");this.buf=new Uint8Array(Iy),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){this.seq=Math.floor(Math.random()*W_),this.inc=Math.floor(Math.random()*(ew-Py)+Py)}setPre(){const n=new Uint8Array(12);nw(n);for(let r=0;r<12;r++){const a=n[r]%36;this.buf[r]=qy.charCodeAt(a)}}fillSeq(){let n=this.seq;for(let r=Iy-1;r>=12;r--)this.buf[r]=qy.charCodeAt(n%Hy),n=Math.floor(n/Hy)}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 ki=new rw;var Hr;(function(t){t.Disconnect="disconnect",t.Reconnect="reconnect",t.Update="update",t.LDM="ldm",t.Error="error"})(Hr||(Hr={}));var Va;(function(t){t.Reconnecting="reconnecting",t.PingTimer="pingTimer",t.StaleConnection="staleConnection",t.ClientInitiatedReconnect="client initiated reconnect"})(Va||(Va={}));var _e;(function(t){t.ApiError="BAD API",t.BadAuthentication="BAD_AUTHENTICATION",t.BadCreds="BAD_CREDS",t.BadHeader="BAD_HEADER",t.BadJson="BAD_JSON",t.BadPayload="BAD_PAYLOAD",t.BadSubject="BAD_SUBJECT",t.Cancelled="CANCELLED",t.ConnectionClosed="CONNECTION_CLOSED",t.ConnectionDraining="CONNECTION_DRAINING",t.ConnectionRefused="CONNECTION_REFUSED",t.ConnectionTimeout="CONNECTION_TIMEOUT",t.Disconnect="DISCONNECT",t.InvalidOption="INVALID_OPTION",t.InvalidPayload="INVALID_PAYLOAD",t.MaxPayloadExceeded="MAX_PAYLOAD_EXCEEDED",t.NoResponders="503",t.NotFunction="NOT_FUNC",t.RequestError="REQUEST_ERROR",t.ServerOptionNotAvailable="SERVER_OPT_NA",t.SubClosed="SUB_CLOSED",t.SubDraining="SUB_DRAINING",t.Timeout="TIMEOUT",t.Tls="TLS",t.Unknown="UNKNOWN_ERROR",t.WssRequired="WSS_REQUIRED",t.JetStreamInvalidAck="JESTREAM_INVALID_ACK",t.JetStream404NoMessages="404",t.JetStream408RequestTimeout="408",t.JetStream409MaxAckPendingExceeded="409",t.JetStream409="409",t.JetStreamNotEnabled="503",t.JetStreamIdleHeartBeat="IDLE_HEARTBEAT",t.AuthorizationViolation="AUTHORIZATION_VIOLATION",t.AuthenticationExpired="AUTHENTICATION_EXPIRED",t.ProtocolError="NATS_PROTOCOL_ERR",t.PermissionsViolation="PERMISSIONS_VIOLATION",t.AuthenticationTimeout="AUTHENTICATION_TIMEOUT",t.AccountExpired="ACCOUNT_EXPIRED"})(_e||(_e={}));function iw(t){return typeof t.code=="string"}class Eb{constructor(){k(this,"messages");this.messages=new Map,this.messages.set(_e.InvalidPayload,"Invalid payload type - payloads can be 'binary', 'string', or 'json'"),this.messages.set(_e.BadJson,"Bad JSON"),this.messages.set(_e.WssRequired,"TLS is required, therefore a secure websocket connection is also required")}static getMessage(n){return aw.getMessage(n)}getMessage(n){return this.messages.get(n)||n}}const aw=new Eb;class Te 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=Eb.getMessage(r);return new Te(l,r,a)}isAuthError(){return this.code===_e.AuthenticationExpired||this.code===_e.AuthorizationViolation||this.code===_e.AccountExpired}isAuthTimeout(){return this.code===_e.AuthenticationTimeout}isPermissionError(){return this.code===_e.PermissionsViolation}isProtocolError(){return this.code===_e.ProtocolError}isJetStreamError(){return this.api_error!==void 0}jsError(){return this.api_error?this.api_error:null}}var Cn;(function(t){t[t.Exact=0]="Exact",t[t.CanonicalMIME=1]="CanonicalMIME",t[t.IgnoreCase=2]="IgnoreCase"})(Cn||(Cn={}));var ir;(function(t){t.Timer="timer",t.Count="count",t.JitterTimer="jitterTimer",t.SentinelMsg="sentinelMsg"})(ir||(ir={}));var hl;(function(t){t.STATS="io.nats.micro.v1.stats_response",t.INFO="io.nats.micro.v1.info_response",t.PING="io.nats.micro.v1.ping_response"})(hl||(hl={}));const fu="Nats-Service-Error",hu="Nats-Service-Error-Code";class du extends Error{constructor(r,a){super(a);k(this,"code");this.code=r}static isServiceError(r){return du.toServiceError(r)!==null}static toServiceError(r){var l,u;const a=((l=r==null?void 0:r.headers)==null?void 0:l.get(hu))||"";if(a!==""){const c=parseInt(a)||400,f=((u=r==null?void 0:r.headers)==null?void 0:u.get(fu))||"";return new du(c,f.length?f:a)}return null}}function Pr(t=""){if(t=t||"_INBOX",typeof t!="string")throw new Error("prefix must be a string");return t.split(".").forEach(n=>{if(n==="*"||n===">")throw new Error(`inbox prefixes cannot have wildcards '${t}'`)}),`${t}.${ki.next()}`}const Th="127.0.0.1";var _i;(function(t){t.PING="PING",t.STATS="STATS",t.INFO="INFO"})(_i||(_i={}));function Au(t,...n){for(let r=0;r<n.length;r++){const a=n[r];Object.keys(a).forEach(function(l){t[l]=a[l]})}return t}function Xo(t){return Tn.decode(t).replace(/\n/g,"␊").replace(/\r/g,"␍")}function Wa(t,n=!0){const r=n?Te.errorForCode(_e.Timeout):null;let a,l;const u=new Promise((c,f)=>{a={cancel:()=>{l&&clearTimeout(l)}},l=setTimeout(()=>{f(r===null?Te.errorForCode(_e.Timeout):r)},t)});return Object.assign(u,a)}function as(t=0){let n;const r=new Promise(a=>{const l=setTimeout(()=>{a()},t);n={cancel:()=>{l&&clearTimeout(l)}}});return Object.assign(r,n)}function kt(){let t={};const n=new Promise((r,a)=>{t={resolve:r,reject:a}});return Object.assign(n,t)}function kb(t){for(let n=t.length-1;n>0;n--){const r=Math.floor(Math.random()*(n+1));[t[n],t[r]]=[t[r],t[n]]}return t}function sw(t){return t===0?0:Math.floor(t/2+Math.random()*t)}function ud(t=[0,250,250,500,500,3e3,5e3]){Array.isArray(t)||(t=[0,250,250,500,500,3e3,5e3]);const n=t.length-1;return{backoff(r){return sw(r>n?t[n]:t[r])}}}function Et(t){return t*1e6}function cd(t){return Math.floor(t/1e6)}function Fy(t){let a=!0;const l=new Array(t.length);for(let u=0;u<t.length;u++){let c=t.charCodeAt(u);if(c===58||c<33||c>126)throw new Te(`'${t[u]}' is not a valid character for a header key`,_e.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 Fr(t=0,n=""){if(t===0&&n!==""||t>0&&n==="")throw new Error("setting status requires both code and description");return new wi(t,n)}const eh="NATS/1.0";class wi{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 wi,l=Tn.decode(n).split(`\r
|
|
61
|
+
`),u=l[0];if(u!==eh){let c=u.replace(eh,"").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=eh;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 ta.encode(this.toString())}static validHeaderValue(n){if(/[\r\n]/.test(n))throw new Te("invalid header value - \\r and \\n are not allowed.",_e.BadHeader);return n.trim()}keys(){const n=[];for(const r of this.headers.keys())n.push(r);return n}findKeys(n,r=Cn.Exact){const a=this.keys();switch(r){case Cn.Exact:return a.filter(l=>l===n);case Cn.CanonicalMIME:return n=Fy(n),a.filter(l=>l===n);default:{const l=n.toLowerCase();return a.filter(u=>l===u.toLowerCase())}}}get(n,r=Cn.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=Cn.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=Cn.Exact){return this.findKeys(n,r).length>0}set(n,r,a=Cn.Exact){this.delete(n,a),this.append(n,r,a)}append(n,r,a=Cn.Exact){const l=Fy(n);a===Cn.CanonicalMIME&&(n=l);const u=this.findKeys(n,a);n=u.length>0?u[0]:n;const c=wi.validHeaderValue(r);let f=this.headers.get(n);f||(f=[],this.headers.set(n,f)),f.push(c)}values(n,r=Cn.Exact){const a=[];return this.findKeys(n,r).forEach(u=>{const c=this.headers.get(u);c&&a.push(...c)}),a}delete(n,r=Cn.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 wi;for(const a in n)r.headers.set(a,n[a]);return r}}function mu(){return{encode(t){return ta.encode(t)},decode(t){return Tn.decode(t)}}}function ar(t){return{encode(n){try{return n===void 0&&(n=null),ta.encode(JSON.stringify(n))}catch(r){throw Te.errorForCode(_e.BadJson,r)}},decode(n){try{return JSON.parse(Tn.decode(n),t)}catch(r){throw Te.errorForCode(_e.BadJson,r)}}}}function Cb(t){var n;return t&&t.data.length===0&&((n=t.headers)==null?void 0:n.code)===503?Te.errorForCode(_e.NoResponders):null}class fd{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=Tn.decode(this._msg.subject),this._subject)}get reply(){return this._reply?this._reply:(this._reply=Tn.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=wi.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=Nn,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 ar(n).decode(this.data)}string(){return Tn.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(fd,"jc");function Ja(t){return Tu("durable",t)}function rn(t){return Tu("stream",t)}function Tu(t,n=""){if(n==="")throw Error(`${t} 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 ${t} name - ${t} name cannot contain '${a}'`)}}),""}function ul(t,n=""){if(n==="")throw Error(`${t} name required`);const r=lw(n);if(r.length)throw new Error(`invalid ${t} name - ${t} name ${r}`)}function lw(t=""){if(t==="")throw Error("name required");const n=/^[-\w]+$/g;if(t.match(n)===null){for(const a of t.split(""))if(a.match(n)===null)return`cannot contain '${a}'`}return""}function Oh(t){if(t.data.length>0)return!1;const n=t.headers;return n?n.code>=100&&n.code<200:!1}function jh(t){var n;return Oh(t)&&((n=t.headers)==null?void 0:n.description)==="Idle Heartbeat"}function ow(t,n,r){const a=Fr(t,n),l={hdr:1,sid:0,size:0},u=new fd(l,Nn,{});return u._headers=a,u._subject=r,u}function Xa(t){if(t.data.length!==0)return null;const n=t.headers;return n?Ab(n.code,n.description):null}var Vn;(function(t){t.MaxBatchExceeded="exceeded maxrequestbatch of",t.MaxExpiresExceeded="exceeded maxrequestexpires of",t.MaxBytesExceeded="exceeded maxrequestmaxbytes of",t.MaxMessageSizeExceeded="message size exceeds maxbytes",t.PushConsumer="consumer is push based",t.MaxWaitingExceeded="exceeded maxwaiting",t.IdleHeartbeatMissed="idle heartbeats missed",t.ConsumerDeleted="consumer deleted"})(Vn||(Vn={}));function uw(t){return t.code!==_e.JetStream409?!1:[Vn.MaxBatchExceeded,Vn.MaxExpiresExceeded,Vn.MaxBytesExceeded,Vn.MaxMessageSizeExceeded,Vn.PushConsumer,Vn.IdleHeartbeatMissed,Vn.ConsumerDeleted].find(r=>t.message.indexOf(r)!==-1)!==void 0}function Ab(t,n=""){if(t<300)return null;switch(n=n.toLowerCase(),t){case 404:return new Te(n,_e.JetStream404NoMessages);case 408:return new Te(n,_e.JetStream408RequestTimeout);case 409:{const r=n.startsWith(Vn.IdleHeartbeatMissed)?_e.JetStreamIdleHeartBeat:_e.JetStream409;return new Te(n,r)}case 503:return Te.errorForCode(_e.JetStreamNotEnabled,new Error(n));default:return n===""&&(n=_e.Unknown),new Te(n,`${t}`)}}class Ft{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=kt(),this.yields=[],this.iterClosed=kt(),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 Te("unsupported iterator",_e.ApiError);if(this.yielding)throw new Te("already yielding",_e.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=kt())}}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 hd{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 Nh;(function(t){t.Limits="limits",t.Interest="interest",t.Workqueue="workqueue"})(Nh||(Nh={}));var xl;(function(t){t.Old="old",t.New="new"})(xl||(xl={}));var Rh;(function(t){t.File="file",t.Memory="memory"})(Rh||(Rh={}));var Rt;(function(t){t.All="all",t.Last="last",t.New="new",t.StartSequence="by_start_sequence",t.StartTime="by_start_time",t.LastPerSubject="last_per_subject"})(Rt||(Rt={}));var It;(function(t){t.None="none",t.All="all",t.Explicit="explicit",t.NotSet=""})(It||(It={}));var es;(function(t){t.Instant="instant",t.Original="original"})(es||(es={}));var Ci;(function(t){t.None="none",t.S2="s2"})(Ci||(Ci={}));var pu;(function(t){t.CreateOrUpdate="",t.Update="update",t.Create="create"})(pu||(pu={}));function cw(t,n={}){return Object.assign({name:t,deliver_policy:Rt.All,ack_policy:It.Explicit,ack_wait:Et(30*1e3),replay_policy:es.Instant},n)}var $y;(function(t){t.API="api_audit",t.StreamAction="stream_action",t.ConsumerAction="consumer_action",t.SnapshotCreate="snapshot_create",t.SnapshotComplete="snapshot_complete",t.RestoreCreate="restore_create",t.RestoreComplete="restore_complete",t.MaxDeliver="max_deliver",t.Terminated="terminated",t.Ack="consumer_ack",t.StreamLeaderElected="stream_leader_elected",t.StreamQuorumLost="stream_quorum_lost",t.ConsumerLeaderElected="consumer_leader_elected",t.ConsumerQuorumLost="consumer_quorum_lost"})($y||($y={}));var ln;(function(t){t.StreamSourceHdr="Nats-Stream-Source",t.LastConsumerSeqHdr="Nats-Last-Consumer",t.LastStreamSeqHdr="Nats-Last-Stream",t.ConsumerStalledHdr="Nats-Consumer-Stalled",t.MessageSizeHdr="Nats-Msg-Size",t.RollupHdr="Nats-Rollup",t.RollupValueSubject="sub",t.RollupValueAll="all",t.PendingMessagesHdr="Nats-Pending-Messages",t.PendingBytesHdr="Nats-Pending-Bytes"})(ln||(ln={}));var rr;(function(t){t.LastValue="",t.AllHistory="history",t.UpdatesOnly="updates"})(rr||(rr={}));var Ya;(function(t){t.Stream="Nats-Stream",t.Sequence="Nats-Sequence",t.TimeStamp="Nats-Time-Stamp",t.Subject="Nats-Subject"})(Ya||(Ya={}));var Gy;(function(t){t.Stream="Nats-Stream",t.Subject="Nats-Subject",t.Sequence="Nats-Sequence",t.LastSequence="Nats-Last-Sequence",t.Size="Nats-Msg-Size"})(Gy||(Gy={}));const An="KV_";class fw{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=cw("",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?It.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 Ja(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=Rt.StartSequence,this.config.opt_start_seq=n,this}startTime(n){return this.config.deliver_policy=Rt.StartTime,this.config.opt_start_time=n.toISOString(),this}deliverAll(){return this.config.deliver_policy=Rt.All,this}deliverLastPerSubject(){return this.config.deliver_policy=Rt.LastPerSubject,this}deliverLast(){return this.config.deliver_policy=Rt.Last,this}deliverNew(){return this.config.deliver_policy=Rt.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=It.None,this}ackAll(){return this.config.ack_policy=It.All,this}ackExplicit(){return this.config.ack_policy=It.Explicit,this}ackWait(n){return this.config.ack_wait=Et(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=es.Instant,this}replayOriginal(){return this.config.replay_policy=es.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=Et(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=Et(n),this}maxPullBatch(n){return this.config.max_batch=n,this}maxPullRequestExpires(n){return this.config.max_expires=Et(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 Ei(t){return new fw(t)}function Yy(t){return typeof t.getOpts=="function"}class hw{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 Qa{static encode(n){return Qa.toB64URLEncoding(hw.encode(n))}static decode(n,r=!1){return Qa.decode(Qa.fromB64URLEncoding(n),r)}static toB64URLEncoding(n){return n.replace(/\+/g,"-").replace(/\//g,"_")}static fromB64URLEncoding(n){return n.replace(/_/g,"/").replace(/-/g,"+")}}class ts{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=""),ta.encode(n)}static toAscii(n){return Tn.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 dw(t,n){return n.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(a){if(a!=="default"&&!(a in t)){var l=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(t,a,l.get?l:{enumerable:!0,get:function(){return r[a]}})}})}),Object.freeze(t)}var mw=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},nl=mw.performance||{};nl.now||nl.mozNow||nl.msNow||nl.oNow||nl.webkitNow;var Vy={versions:{}},pw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gw(t){if(t.__esModule)return t;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach(function(r){var a=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return t[r]}})}),n}var th,Ou={exports:{}},Jy={},Xy=gw(dw({__proto__:null,default:Jy},[Jy]));th=Ou,(function(){var t="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&&Vy.versions&&Vy.versions.node;l?r=pw:a&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&th.exports,c=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),m=[-2147483648,8388608,32768,128],d=[24,16,8,0],y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=["hex","array","digest","arrayBuffer"],x=[];!r.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(j){return Object.prototype.toString.call(j)==="[object Array]"}),!c||!r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(j){return typeof j=="object"&&j.buffer&&j.buffer.constructor===ArrayBuffer});var v=function(j,O){return function(J){return new G(O,!0).update(J)[j]()}},C=function(j){var O=v("hex",j);l&&(O=D(O,j)),O.create=function(){return new G(j)},O.update=function(X){return O.create().update(X)};for(var J=0;J<g.length;++J){var F=g[J];O[F]=v(F,j)}return O},D=function(j,O){var J,F=Xy,X=Xy.Buffer,z=O?"sha224":"sha256";return J=X.from&&!r.JS_SHA256_NO_BUFFER_FROM?X.from:function(ie){return new X(ie)},function(ie){if(typeof ie=="string")return F.createHash(z).update(ie,"utf8").digest("hex");if(ie==null)throw new Error(t);return ie.constructor===ArrayBuffer&&(ie=new Uint8Array(ie)),Array.isArray(ie)||ArrayBuffer.isView(ie)||ie.constructor===X?F.createHash(z).update(J(ie)).digest("hex"):j(ie)}},q=function(j,O){return function(J,F){return new V(J,O,!0).update(F)[j]()}},M=function(j){var O=q("hex",j);O.create=function(X){return new V(X,j)},O.update=function(X,z){return O.create(X).update(z)};for(var J=0;J<g.length;++J){var F=g[J];O[F]=q(F,j)}return O};function G(j,O){O?(x[0]=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],j?(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=j}function V(j,O,J){var F,X=typeof j;if(X==="string"){var z,ie=[],K=j.length,ge=0;for(F=0;F<K;++F)(z=j.charCodeAt(F))<128?ie[ge++]=z:z<2048?(ie[ge++]=192|z>>>6,ie[ge++]=128|63&z):z<55296||z>=57344?(ie[ge++]=224|z>>>12,ie[ge++]=128|z>>>6&63,ie[ge++]=128|63&z):(z=65536+((1023&z)<<10|1023&j.charCodeAt(++F)),ie[ge++]=240|z>>>18,ie[ge++]=128|z>>>12&63,ie[ge++]=128|z>>>6&63,ie[ge++]=128|63&z);j=ie}else{if(X!=="object")throw new Error(t);if(j===null)throw new Error(t);if(c&&j.constructor===ArrayBuffer)j=new Uint8Array(j);else if(!(Array.isArray(j)||c&&ArrayBuffer.isView(j)))throw new Error(t)}j.length>64&&(j=new G(O,!0).update(j).array());var he=[],I=[];for(F=0;F<64;++F){var H=j[F]||0;he[F]=92^H,I[F]=54^H}G.call(this,O,J),this.update(I),this.oKeyPad=he,this.inner=!0,this.sharedMemory=J}G.prototype.update=function(j){if(!this.finalized){var O,J=typeof j;if(J!=="string"){if(J!=="object")throw new Error(t);if(j===null)throw new Error(t);if(c&&j.constructor===ArrayBuffer)j=new Uint8Array(j);else if(!(Array.isArray(j)||c&&ArrayBuffer.isView(j)))throw new Error(t);O=!0}for(var F,X,z=0,ie=j.length,K=this.blocks;z<ie;){if(this.hashed&&(this.hashed=!1,K[0]=this.block,this.block=K[16]=K[1]=K[2]=K[3]=K[4]=K[5]=K[6]=K[7]=K[8]=K[9]=K[10]=K[11]=K[12]=K[13]=K[14]=K[15]=0),O)for(X=this.start;z<ie&&X<64;++z)K[X>>>2]|=j[z]<<d[3&X++];else for(X=this.start;z<ie&&X<64;++z)(F=j.charCodeAt(z))<128?K[X>>>2]|=F<<d[3&X++]:F<2048?(K[X>>>2]|=(192|F>>>6)<<d[3&X++],K[X>>>2]|=(128|63&F)<<d[3&X++]):F<55296||F>=57344?(K[X>>>2]|=(224|F>>>12)<<d[3&X++],K[X>>>2]|=(128|F>>>6&63)<<d[3&X++],K[X>>>2]|=(128|63&F)<<d[3&X++]):(F=65536+((1023&F)<<10|1023&j.charCodeAt(++z)),K[X>>>2]|=(240|F>>>18)<<d[3&X++],K[X>>>2]|=(128|F>>>12&63)<<d[3&X++],K[X>>>2]|=(128|F>>>6&63)<<d[3&X++],K[X>>>2]|=(128|63&F)<<d[3&X++]);this.lastByteIndex=X,this.bytes+=X-this.start,X>=64?(this.block=K[16],this.start=X-64,this.hash(),this.hashed=!0):this.start=X}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},G.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var j=this.blocks,O=this.lastByteIndex;j[16]=this.block,j[O>>>2]|=m[3&O],this.block=j[16],O>=56&&(this.hashed||this.hash(),j[0]=this.block,j[16]=j[1]=j[2]=j[3]=j[4]=j[5]=j[6]=j[7]=j[8]=j[9]=j[10]=j[11]=j[12]=j[13]=j[14]=j[15]=0),j[14]=this.hBytes<<3|this.bytes>>>29,j[15]=this.bytes<<3,this.hash()}},G.prototype.hash=function(){var j,O,J,F,X,z,ie,K,ge,he=this.h0,I=this.h1,H=this.h2,te=this.h3,me=this.h4,Ae=this.h5,N=this.h6,L=this.h7,Y=this.blocks;for(j=16;j<64;++j)O=((X=Y[j-15])>>>7|X<<25)^(X>>>18|X<<14)^X>>>3,J=((X=Y[j-2])>>>17|X<<15)^(X>>>19|X<<13)^X>>>10,Y[j]=Y[j-16]+O+Y[j-7]+J|0;for(ge=I&H,j=0;j<64;j+=4)this.first?(this.is224?(z=300032,L=(X=Y[0]-1413257819)-150054599|0,te=X+24177077|0):(z=704751109,L=(X=Y[0]-210244248)-1521486534|0,te=X+143694565|0),this.first=!1):(O=(he>>>2|he<<30)^(he>>>13|he<<19)^(he>>>22|he<<10),F=(z=he&I)^he&H^ge,L=te+(X=L+(J=(me>>>6|me<<26)^(me>>>11|me<<21)^(me>>>25|me<<7))+(me&Ae^~me&N)+y[j]+Y[j])|0,te=X+(O+F)|0),O=(te>>>2|te<<30)^(te>>>13|te<<19)^(te>>>22|te<<10),F=(ie=te&he)^te&I^z,N=H+(X=N+(J=(L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(L&me^~L&Ae)+y[j+1]+Y[j+1])|0,O=((H=X+(O+F)|0)>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),F=(K=H&te)^H&he^ie,Ae=I+(X=Ae+(J=(N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7))+(N&L^~N&me)+y[j+2]+Y[j+2])|0,O=((I=X+(O+F)|0)>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10),F=(ge=I&H)^I&te^K,me=he+(X=me+(J=(Ae>>>6|Ae<<26)^(Ae>>>11|Ae<<21)^(Ae>>>25|Ae<<7))+(Ae&N^~Ae&L)+y[j+3]+Y[j+3])|0,he=X+(O+F)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+he|0,this.h1=this.h1+I|0,this.h2=this.h2+H|0,this.h3=this.h3+te|0,this.h4=this.h4+me|0,this.h5=this.h5+Ae|0,this.h6=this.h6+N|0,this.h7=this.h7+L|0},G.prototype.hex=function(){this.finalize();var j=this.h0,O=this.h1,J=this.h2,F=this.h3,X=this.h4,z=this.h5,ie=this.h6,K=this.h7,ge=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[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[F>>>28&15]+f[F>>>24&15]+f[F>>>20&15]+f[F>>>16&15]+f[F>>>12&15]+f[F>>>8&15]+f[F>>>4&15]+f[15&F]+f[X>>>28&15]+f[X>>>24&15]+f[X>>>20&15]+f[X>>>16&15]+f[X>>>12&15]+f[X>>>8&15]+f[X>>>4&15]+f[15&X]+f[z>>>28&15]+f[z>>>24&15]+f[z>>>20&15]+f[z>>>16&15]+f[z>>>12&15]+f[z>>>8&15]+f[z>>>4&15]+f[15&z]+f[ie>>>28&15]+f[ie>>>24&15]+f[ie>>>20&15]+f[ie>>>16&15]+f[ie>>>12&15]+f[ie>>>8&15]+f[ie>>>4&15]+f[15&ie];return this.is224||(ge+=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]),ge},G.prototype.toString=G.prototype.hex,G.prototype.digest=function(){this.finalize();var j=this.h0,O=this.h1,J=this.h2,F=this.h3,X=this.h4,z=this.h5,ie=this.h6,K=this.h7,ge=[j>>>24&255,j>>>16&255,j>>>8&255,255&j,O>>>24&255,O>>>16&255,O>>>8&255,255&O,J>>>24&255,J>>>16&255,J>>>8&255,255&J,F>>>24&255,F>>>16&255,F>>>8&255,255&F,X>>>24&255,X>>>16&255,X>>>8&255,255&X,z>>>24&255,z>>>16&255,z>>>8&255,255&z,ie>>>24&255,ie>>>16&255,ie>>>8&255,255&ie];return this.is224||ge.push(K>>>24&255,K>>>16&255,K>>>8&255,255&K),ge},G.prototype.array=G.prototype.digest,G.prototype.arrayBuffer=function(){this.finalize();var j=new ArrayBuffer(this.is224?28:32),O=new DataView(j);return O.setUint32(0,this.h0),O.setUint32(4,this.h1),O.setUint32(8,this.h2),O.setUint32(12,this.h3),O.setUint32(16,this.h4),O.setUint32(20,this.h5),O.setUint32(24,this.h6),this.is224||O.setUint32(28,this.h7),j},V.prototype=new G,V.prototype.finalize=function(){if(G.prototype.finalize.call(this),this.inner){this.inner=!1;var j=this.array();G.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(j),G.prototype.finalize.call(this)}};var le=C();le.sha256=le,le.sha224=C(!0),le.sha256.hmac=M(),le.sha224.hmac=M(!0),u?th.exports=le:(r.sha256=le.sha256,r.sha224=le.sha224)})();Ou.exports;Ou.exports.sha224;var Qy=Ou.exports.sha256;function Mh(t){return _w(t)}function yw(t){if(!/^[0-9A-Fa-f]+$/.test(t))return!1;const r=/^[0-9A-F]+$/.test(t),a=/^[0-9a-f]+$/.test(t);return r||a?t.length%2===0:!1}function bw(t){return/^[A-Za-z0-9\-_]*(={0,2})?$/.test(t)||/^[A-Za-z0-9+/]*(={0,2})?$/.test(t)}function xw(t){return yw(t)?"hex":bw(t)?"b64":""}function vw(t){if(t.length%2!==0)throw new Error("hex string must have an even length");const n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=parseInt(t.substring(r,r+2),16);return n}function Sw(t){t=t.replace(/-/g,"+"),t=t.replace(/_/g,"/");const n=atob(t);return Uint8Array.from(n,r=>r.charCodeAt(0))}function _w(t){switch(xw(t)){case"hex":return vw(t);case"b64":return Sw(t)}return null}function ww(t,n){const r=typeof t=="string"?Mh(t):t,a=typeof n=="string"?Mh(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 Tb{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=ki.next(),a&&(this.ctx=new Error)}}class Ew extends Tb{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=kt(),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===ir.Count&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===ir.JitterTimer&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.jitter||300)),this.opts.strategy===ir.SentinelMsg&&a&&a.data.length===0&&this.cancel())}}class Ob extends Tb{constructor(r,a,l={timeout:1e3},u=!0){super(r,a,u);k(this,"deferred");k(this,"timer");this.deferred=kt(),this.timer=Wa(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||Te.errorForCode(_e.Cancelled))}}const kw="$JS.API";function Cw(t){return t=t||{},t.domain&&(t.apiPrefix=`$JS.${t.domain}.API`,delete t.domain),Au({apiPrefix:kw,timeout:5e3},t)}class Ol{constructor(n,r){k(this,"nc");k(this,"opts");k(this,"prefix");k(this,"timeout");k(this,"jc");this.nc=n,this.opts=Cw(r),this._parseOpts(),this.prefix=this.opts.apiPrefix,this.timeout=this.opts.timeout,this.jc=ar()}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=Nn;r&&(l=this.jc.encode(r));let{retries:u}=a;u=u||1,u=u===-1?Number.MAX_SAFE_INTEGER:u;const c=ud();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===_e.Timeout)&&f+1<u)await as(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=Ab(a.error.code,a.error.description);if(l!==null)throw l.api_error=a.error,l}return r}}class cl{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 Zi(t=""){const n=t.match(/(\d+).(\d+).(\d+)/);if(n)return{major:parseInt(n[1]),minor:parseInt(n[2]),micro:parseInt(n[3])};throw new Error(`'${t}' is not a semver value`)}function Dh(t,n){return t.major<n.major?-1:t.major>n.major?1:t.minor<n.minor?-1:t.minor>n.minor?1:t.micro<n.micro?-1:t.micro>n.micro?1:0}var nt;(function(t){t.JS_KV="js_kv",t.JS_OBJECTSTORE="js_objectstore",t.JS_PULL_MAX_BYTES="js_pull_max_bytes",t.JS_NEW_CONSUMER_CREATE_API="js_new_consumer_create",t.JS_ALLOW_DIRECT="js_allow_direct",t.JS_MULTIPLE_CONSUMER_FILTER="js_multiple_consumer_filter",t.JS_SIMPLIFICATION="js_simplification",t.JS_STREAM_CONSUMER_METADATA="js_stream_consumer_metadata",t.JS_CONSUMER_FILTER_SUBJECTS="js_consumer_filter_subjects",t.JS_STREAM_FIRST_SEQ="js_stream_first_seq",t.JS_STREAM_SUBJECT_TRANSFORM="js_stream_subject_transform",t.JS_STREAM_SOURCE_SUBJECT_TRANSFORM="js_stream_source_subject_transform",t.JS_STREAM_COMPRESSION="js_stream_compression",t.JS_DEFAULT_CONSUMER_LIMITS="js_default_consumer_limits",t.JS_BATCH_DIRECT_GET="js_batch_direct_get"})(nt||(nt={}));class Aw{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=Zi(n)),this.server=n,this.set(nt.JS_KV,"2.6.2"),this.set(nt.JS_OBJECTSTORE,"2.6.3"),this.set(nt.JS_PULL_MAX_BYTES,"2.8.3"),this.set(nt.JS_NEW_CONSUMER_CREATE_API,"2.9.0"),this.set(nt.JS_ALLOW_DIRECT,"2.9.0"),this.set(nt.JS_MULTIPLE_CONSUMER_FILTER,"2.10.0"),this.set(nt.JS_SIMPLIFICATION,"2.9.4"),this.set(nt.JS_STREAM_CONSUMER_METADATA,"2.10.0"),this.set(nt.JS_CONSUMER_FILTER_SUBJECTS,"2.10.0"),this.set(nt.JS_STREAM_FIRST_SEQ,"2.10.0"),this.set(nt.JS_STREAM_SUBJECT_TRANSFORM,"2.10.0"),this.set(nt.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,"2.10.0"),this.set(nt.JS_STREAM_COMPRESSION,"2.10.0"),this.set(nt.JS_DEFAULT_CONSUMER_LIMITS,"2.10.0"),this.set(nt.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:Dh(this.server,Zi(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=Zi(n)),Dh(this.server,n)>=0}}class gu extends Ol{constructor(n,r){super(n,r)}async add(n,r,a=pu.Create){if(rn(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&&Ja(l.config.durable_name);const u=this.nc;let{min:c,ok:f}=u.features.get(nt.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{Tu("name",m)}catch(x){const v=x.message,C=v.indexOf("cannot contain");throw C!==-1?new Error(`consumer 'name' ${v.substring(C)}`):x}let d,y="";if(Array.isArray(r.filter_subjects)){const{min:x,ok:v}=u.features.get(nt.JS_MULTIPLE_CONSUMER_FILTER);if(!v)throw new Error(`consumer 'filter_subjects' requires server ${x}`);f=!1}if(r.metadata){const{min:x,ok:v}=u.features.get(nt.JS_STREAM_CONSUMER_METADATA);if(!v)throw new Error(`consumer 'metadata' requires server ${x}`)}if(f&&(y=r.name??r.durable_name??""),y!==""){let x=r.filter_subject??void 0;x===">"&&(x=void 0),d=x!==void 0?`${this.prefix}.CONSUMER.CREATE.${n}.${y}.${x}`:`${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),pu.Update)}async info(n,r){return rn(n),Ja(r),await this._request(`${this.prefix}.CONSUMER.INFO.${n}.${r}`)}async delete(n,r){return rn(n),Ja(r),(await this._request(`${this.prefix}.CONSUMER.DELETE.${n}.${r}`)).success}list(n){rn(n);const r=l=>l.consumers,a=`${this.prefix}.CONSUMER.LIST.${n}`;return new cl(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 Ha(t,n,r=!1){if(r===!0&&!t)throw Te.errorForCode(_e.ApiError,new Error(`${n} is not a function`));if(t&&typeof t!="function")throw Te.errorForCode(_e.ApiError,new Error(`${n} is not a function`))}class Tw extends Ft{constructor(r,a,l){super();k(this,"sub");k(this,"adapter");k(this,"subIterDone");Ha(l.adapter,"adapter",!0),this.adapter=l.adapter,l.callback&&Ha(l.callback,"callback"),this.noIterator=typeof l.callback=="function",l.ingestionFilterFn&&(Ha(l.ingestionFilterFn,"ingestionFilterFn"),this.ingestionFilterFn=l.ingestionFilterFn),l.protocolFilterFn&&(Ha(l.protocolFilterFn,"protocolFilterFn"),this.protocolFilterFn=l.protocolFilterFn),l.dispatchedFn&&(Ha(l.dispatchedFn,"dispatchedFn"),this.dispatchedFn=l.dispatchedFn),l.cleanupFn&&Ha(l.cleanupFn,"cleanupFn");let u=(y,g)=>{this.callback(y,g)};if(l.callback){const y=l.callback;u=(g,x)=>{const[v,C]=this.adapter(g,x);if(v){y(v,null);return}const{ingest:D}=this.ingestionFilterFn?this.ingestionFilterFn(C,this):{ingest:!0};D&&(!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=kt(),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 On;function Ow(t){On=t}function jb(){return On!==void 0&&On.defaultPort!==void 0?On.defaultPort:4222}function nh(){return On!==void 0&&On.urlParseFn?On.urlParseFn:void 0}function jw(){if(!On||typeof On.factory!="function")throw new Error("transport fn is not set");return On.factory()}function zh(){return On!==void 0&&On.dnsResolveFn?On.dnsResolveFn:void 0}const su=`\r
|
|
71
|
+
`,yu=ts.fromAscii(su),Nw=new Uint8Array(yu)[0],Rw=new Uint8Array(yu)[1];function Mw(t){for(let n=0;n<t.length;n++){const r=n+1;if(t.byteLength>r&&t[n]===Nw&&t[r]===Rw)return r+1}return 0}function Dw(t){const n=Mw(t);if(n>0){const a=new Uint8Array(t).slice(0,n);return Tn.decode(a)}return""}const zw=4,Nb=48,Lw=65,Uw=97;function Bw(t,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]=t,l[13]=n,l[14]=r,l[15]=a,l}function Lh(t){return qw(t)!==void 0}function qw(t){for(let n=0;n<t.length;n++)switch(t[n]){case".":return Rb(t);case":":return Hw(t)}}function Rb(t){const n=new Uint8Array(4);for(let r=0;r<4;r++){if(t.length===0)return;if(r>0){if(t[0]!==".")return;t=t.substring(1)}const{n:a,c:l,ok:u}=Pw(t);if(!u||a>255)return;t=t.substring(l),n[r]=a}return Bw(n[0],n[1],n[2],n[3])}function Hw(t){const n=new Uint8Array(16);let r=-1;if(t.length>=2&&t[0]===":"&&t[1]===":"&&(r=0,t=t.substring(2),t.length===0))return n;let a=0;for(;a<16;){const{n:l,c:u,ok:c}=Iw(t);if(!c||l>65535)return;if(u<t.length&&t[u]==="."){if(r<0&&a!=12||a+4>16)return;const f=Rb(t);if(f===void 0)return;n[a]=f[12],n[a+1]=f[13],n[a+2]=f[14],n[a+3]=f[15],t="",a+=zw;break}if(n[a]=l>>8,n[a+1]=l,a+=2,t=t.substring(u),t.length===0)break;if(t[0]!==":"||t.length==1)return;if(t=t.substring(1),t[0]===":"){if(r>=0)return;if(r=a,t=t.substring(1),t.length===0)break}}if(t.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 Pw(t){let n=0,r=0;for(n=0;n<t.length&&48<=t.charCodeAt(n)&&t.charCodeAt(n)<=57;n++)if(r=r*10+(t.charCodeAt(n)-Nb),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 Iw(t){let n=0,r=0;for(r=0;r<t.length;r++){if(48<=t.charCodeAt(r)&&t.charCodeAt(r)<=57)n*=16,n+=t.charCodeAt(r)-Nb;else if(97<=t.charCodeAt(r)&&t.charCodeAt(r)<=102)n*=16,n+=t.charCodeAt(r)-Uw+10;else if(65<=t.charCodeAt(r)&&t.charCodeAt(r)<=70)n*=16,n+=t.charCodeAt(r)-Lw+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 Fw(t){return t.indexOf("[")!==-1||t.indexOf("::")!==-1?!1:t.indexOf(".")!==-1||t.split(":").length<=2}function Uh(t){return!Fw(t)}function $w(t){const n="::FFFF:",r=t.toUpperCase().indexOf(n);if(r!==-1&&t.indexOf(".")!==-1){let a=t.substring(r+n.length);return a=a.replace("[",""),a.replace("]","")}return t}function Gw(t){t=t.trim(),t.match(/^(.*:\/\/)(.*)/m)&&(t=t.replace(/^(.*:\/\/)(.*)/gm,"$2")),t=$w(t),Uh(t)&&t.indexOf("[")===-1&&(t=`[${t}]`);const n=Uh(t)?t.match(/(]:)(\d+)/):t.match(/(:)(\d+)/),r=n&&n.length===3&&n[1]&&n[2]?parseInt(n[2]):4222,a=r===80?"https":"http",l=new URL(`${a}://${t}`);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 dl{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=Gw(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(Lh(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}://${Uh(l)?"["+l+"]":l}`);c.port=`${this.port}`;const f=new dl(c.host,!1);f.tlsName=this.hostname,r.push(f)}}return n.randomize&&kb(r),this.resolves=r,r}}class Yw{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=nh();n&&(n.forEach(l=>{l=a?a(l):l,this.servers.push(new dl(l))}),this.randomize&&(this.servers=kb(this.servers))),this.servers.length===0&&this.addServer(`${Th}:${jb()}`,!1),this.currentServer=this.servers[0]}clear(){this.servers.length=0}updateTLSName(){const n=this.getCurrentServer();Lh(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=nh();n=a?a(n):n;const l=new dl(n,r);Lh(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=nh(),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 dl(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 Vw{constructor(){k(this,"baseInbox");k(this,"reqs");this.reqs=new Map}size(){return this.reqs.size}init(n){return this.baseInbox=`${Pr(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=Cb(r)),l.resolver(n,r))}}}close(){const n=Te.errorForCode(_e.Timeout);this.reqs.forEach(r=>{r.resolver(n,{})})}}class Jw{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:Va.PingTimer,data:`${this.pendings.length+1}`}),this.pendings.length===this.maxOut){this.cancel(!0);return}const n=kt();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 Xw extends Error{constructor(n){super(n),this.name="AssertionError"}}function Qw(t,n="Assertion failed."){if(!t)throw new Xw(n)}const Zy=32*1024,rh=2**32-2;function Qo(t,n,r=0){const a=n.byteLength-r;return t.byteLength>a&&(t=t.subarray(0,a)),n.set(t,r),t.byteLength}class ih{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){Qw(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=Qo(this._buf.subarray(this._off),n);return this._off+=r,r}writeByte(n){return this.write(Uint8Array.of(n))}writeString(n){return this.write(ta.encode(n))}write(n){const r=this._grow(n.byteLength);return Qo(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)Qo(this._buf.subarray(this._off),this._buf);else{if(l+n>rh)throw new Error("The buffer cannot be grown beyond the maximum size.");{const u=new Uint8Array(Math.min(2*l+n,rh));Qo(this._buf.subarray(this._off),u),this._buf=u}}return this._off=0,this._reslice(Math.min(r+n,rh)),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(Zy);for(;;){const l=this.capacity-this.length<Zy,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 an;(function(t){t[t.OK=0]="OK",t[t.ERR=1]="ERR",t[t.MSG=2]="MSG",t[t.INFO=3]="INFO",t[t.PING=4]="PING",t[t.PONG=5]="PONG"})(an||(an={}));function Ky(){const t={};return t.sid=-1,t.hdr=-1,t.size=-1,t}const Zw=48;class Wy{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=Ee.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 Ee.OP_START:switch(a){case ke.M:case ke.m:this.state=Ee.OP_M,this.hdr=-1,this.ma=Ky();break;case ke.H:case ke.h:this.state=Ee.OP_H,this.hdr=0,this.ma=Ky();break;case ke.P:case ke.p:this.state=Ee.OP_P;break;case ke.PLUS:this.state=Ee.OP_PLUS;break;case ke.MINUS:this.state=Ee.OP_MINUS;break;case ke.I:case ke.i:this.state=Ee.OP_I;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_H:switch(a){case ke.M:case ke.m:this.state=Ee.OP_M;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_M:switch(a){case ke.S:case ke.s:this.state=Ee.OP_MS;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MS:switch(a){case ke.G:case ke.g:this.state=Ee.OP_MSG;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MSG:switch(a){case ke.SPACE:case ke.TAB:this.state=Ee.OP_MSG_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MSG_SPC:switch(a){case ke.SPACE:case ke.TAB:continue;default:this.state=Ee.MSG_ARG,this.as=r}break;case Ee.MSG_ARG:switch(a){case ke.CR:this.drop=1;break;case ke.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=Ee.MSG_PAYLOAD,r=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;case Ee.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){const l=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:an.MSG,msg:this.ma,data:l}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ee.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:an.MSG,msg:this.ma,data:n.subarray(this.as,r)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=Ee.MSG_END);break;case Ee.MSG_END:switch(a){case ke.NL:this.drop=0,this.as=r+1,this.state=Ee.OP_START;break;default:continue}break;case Ee.OP_PLUS:switch(a){case ke.O:case ke.o:this.state=Ee.OP_PLUS_O;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PLUS_O:switch(a){case ke.K:case ke.k:this.state=Ee.OP_PLUS_OK;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PLUS_OK:switch(a){case ke.NL:this.dispatcher.push({kind:an.OK}),this.drop=0,this.state=Ee.OP_START;break}break;case Ee.OP_MINUS:switch(a){case ke.E:case ke.e:this.state=Ee.OP_MINUS_E;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MINUS_E:switch(a){case ke.R:case ke.r:this.state=Ee.OP_MINUS_ER;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MINUS_ER:switch(a){case ke.R:case ke.r:this.state=Ee.OP_MINUS_ERR;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MINUS_ERR:switch(a){case ke.SPACE:case ke.TAB:this.state=Ee.OP_MINUS_ERR_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_MINUS_ERR_SPC:switch(a){case ke.SPACE:case ke.TAB:continue;default:this.state=Ee.MINUS_ERR_ARG,this.as=r}break;case Ee.MINUS_ERR_ARG:switch(a){case ke.CR:this.drop=1;break;case ke.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:an.ERR,data:l}),this.drop=0,this.as=r+1,this.state=Ee.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(a))}break;case Ee.OP_P:switch(a){case ke.I:case ke.i:this.state=Ee.OP_PI;break;case ke.O:case ke.o:this.state=Ee.OP_PO;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PO:switch(a){case ke.N:case ke.n:this.state=Ee.OP_PON;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PON:switch(a){case ke.G:case ke.g:this.state=Ee.OP_PONG;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PONG:switch(a){case ke.NL:this.dispatcher.push({kind:an.PONG}),this.drop=0,this.state=Ee.OP_START;break}break;case Ee.OP_PI:switch(a){case ke.N:case ke.n:this.state=Ee.OP_PIN;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PIN:switch(a){case ke.G:case ke.g:this.state=Ee.OP_PING;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_PING:switch(a){case ke.NL:this.dispatcher.push({kind:an.PING}),this.drop=0,this.state=Ee.OP_START;break}break;case Ee.OP_I:switch(a){case ke.N:case ke.n:this.state=Ee.OP_IN;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_IN:switch(a){case ke.F:case ke.f:this.state=Ee.OP_INF;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_INF:switch(a){case ke.O:case ke.o:this.state=Ee.OP_INFO;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_INFO:switch(a){case ke.SPACE:case ke.TAB:this.state=Ee.OP_INFO_SPC;break;default:throw this.fail(n.subarray(r))}break;case Ee.OP_INFO_SPC:switch(a){case ke.SPACE:case ke.TAB:continue;default:this.state=Ee.INFO_ARG,this.as=r}break;case Ee.INFO_ARG:switch(a){case ke.CR:this.drop=1;break;case ke.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:an.INFO,data:l}),this.drop=0,this.as=r+1,this.state=Ee.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(a)}break;default:throw this.fail(n.subarray(r))}}(this.state===Ee.MSG_ARG||this.state===Ee.MINUS_ERR_ARG||this.state===Ee.INFO_ARG)&&!this.argBuf&&(this.argBuf=new ih(n.subarray(this.as,r-this.drop))),this.state===Ee.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new ih(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 ih(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 ke.SPACE:case ke.TAB:case ke.CR:case ke.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}: ${Tn.decode(n)}`)}processHeaderMsgArgs(n){const r=[];let a=-1;for(let l=0;l<n.length;l++)switch(n[l]){case ke.SPACE:case ke.TAB:case ke.CR:case ke.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]-Zw)}return r}}var Ee;(function(t){t[t.OP_START=0]="OP_START",t[t.OP_PLUS=1]="OP_PLUS",t[t.OP_PLUS_O=2]="OP_PLUS_O",t[t.OP_PLUS_OK=3]="OP_PLUS_OK",t[t.OP_MINUS=4]="OP_MINUS",t[t.OP_MINUS_E=5]="OP_MINUS_E",t[t.OP_MINUS_ER=6]="OP_MINUS_ER",t[t.OP_MINUS_ERR=7]="OP_MINUS_ERR",t[t.OP_MINUS_ERR_SPC=8]="OP_MINUS_ERR_SPC",t[t.MINUS_ERR_ARG=9]="MINUS_ERR_ARG",t[t.OP_M=10]="OP_M",t[t.OP_MS=11]="OP_MS",t[t.OP_MSG=12]="OP_MSG",t[t.OP_MSG_SPC=13]="OP_MSG_SPC",t[t.MSG_ARG=14]="MSG_ARG",t[t.MSG_PAYLOAD=15]="MSG_PAYLOAD",t[t.MSG_END=16]="MSG_END",t[t.OP_H=17]="OP_H",t[t.OP_P=18]="OP_P",t[t.OP_PI=19]="OP_PI",t[t.OP_PIN=20]="OP_PIN",t[t.OP_PING=21]="OP_PING",t[t.OP_PO=22]="OP_PO",t[t.OP_PON=23]="OP_PON",t[t.OP_PONG=24]="OP_PONG",t[t.OP_I=25]="OP_I",t[t.OP_IN=26]="OP_IN",t[t.OP_INF=27]="OP_INF",t[t.OP_INFO=28]="OP_INFO",t[t.OP_INFO_SPC=29]="OP_INFO_SPC",t[t.INFO_ARG=30]="INFO_ARG"})(Ee||(Ee={}));var ke;(function(t){t[t.CR=13]="CR",t[t.E=69]="E",t[t.e=101]="e",t[t.F=70]="F",t[t.f=102]="f",t[t.G=71]="G",t[t.g=103]="g",t[t.H=72]="H",t[t.h=104]="h",t[t.I=73]="I",t[t.i=105]="i",t[t.K=75]="K",t[t.k=107]="k",t[t.M=77]="M",t[t.m=109]="m",t[t.MINUS=45]="MINUS",t[t.N=78]="N",t[t.n=110]="n",t[t.NL=10]="NL",t[t.O=79]="O",t[t.o=111]="o",t[t.P=80]="P",t[t.p=112]="p",t[t.PLUS=43]="PLUS",t[t.R=82]="R",t[t.r=114]="r",t[t.S=83]="S",t[t.s=115]="s",t[t.SPACE=32]="SPACE",t[t.TAB=9]="TAB"})(ke||(ke={}));(function(t){var n=function(w,T){this.hi=w|0,this.lo=T|0},r=function(w){var T,A=new Float64Array(16);if(w)for(T=0;T<w.length;T++)A[T]=w[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]),x=r([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=r([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function C(w,T){return w<<T|w>>>32-T}function D(w,T){var A=w[T+3]&255;return A=A<<8|w[T+2]&255,A=A<<8|w[T+1]&255,A<<8|w[T+0]&255}function q(w,T){var A=w[T]<<24|w[T+1]<<16|w[T+2]<<8|w[T+3],R=w[T+4]<<24|w[T+5]<<16|w[T+6]<<8|w[T+7];return new n(A,R)}function M(w,T,A){var R;for(R=0;R<4;R++)w[T+R]=A&255,A>>>=8}function G(w,T,A){w[T]=A.hi>>24&255,w[T+1]=A.hi>>16&255,w[T+2]=A.hi>>8&255,w[T+3]=A.hi&255,w[T+4]=A.lo>>24&255,w[T+5]=A.lo>>16&255,w[T+6]=A.lo>>8&255,w[T+7]=A.lo&255}function V(w,T,A,R,P){var Z,de=0;for(Z=0;Z<P;Z++)de|=w[T+Z]^A[R+Z];return(1&de-1>>>8)-1}function le(w,T,A,R){return V(w,T,A,R,16)}function j(w,T,A,R){return V(w,T,A,R,32)}function O(w,T,A,R,P){var Z=new Uint32Array(16),de=new Uint32Array(16),ye=new Uint32Array(16),re=new Uint32Array(4),fe,je,Je;for(fe=0;fe<4;fe++)de[5*fe]=D(R,4*fe),de[1+fe]=D(A,4*fe),de[6+fe]=D(T,4*fe),de[11+fe]=D(A,16+4*fe);for(fe=0;fe<16;fe++)ye[fe]=de[fe];for(fe=0;fe<20;fe++){for(je=0;je<4;je++){for(Je=0;Je<4;Je++)re[Je]=de[(5*je+4*Je)%16];for(re[1]^=C(re[0]+re[3]|0,7),re[2]^=C(re[1]+re[0]|0,9),re[3]^=C(re[2]+re[1]|0,13),re[0]^=C(re[3]+re[2]|0,18),Je=0;Je<4;Je++)Z[4*je+(je+Je)%4]=re[Je]}for(Je=0;Je<16;Je++)de[Je]=Z[Je]}if(P){for(fe=0;fe<16;fe++)de[fe]=de[fe]+ye[fe]|0;for(fe=0;fe<4;fe++)de[5*fe]=de[5*fe]-D(R,4*fe)|0,de[6+fe]=de[6+fe]-D(T,4*fe)|0;for(fe=0;fe<4;fe++)M(w,4*fe,de[5*fe]),M(w,16+4*fe,de[6+fe])}else for(fe=0;fe<16;fe++)M(w,4*fe,de[fe]+ye[fe]|0)}function J(w,T,A,R){return O(w,T,A,R,!1),0}function F(w,T,A,R){return O(w,T,A,R,!0),0}var X=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function z(w,T,A,R,P,Z,de){var ye=new Uint8Array(16),re=new Uint8Array(64),fe,je;if(!P)return 0;for(je=0;je<16;je++)ye[je]=0;for(je=0;je<8;je++)ye[je]=Z[je];for(;P>=64;){for(J(re,ye,de,X),je=0;je<64;je++)w[T+je]=(A?A[R+je]:0)^re[je];for(fe=1,je=8;je<16;je++)fe=fe+(ye[je]&255)|0,ye[je]=fe&255,fe>>>=8;P-=64,T+=64,A&&(R+=64)}if(P>0)for(J(re,ye,de,X),je=0;je<P;je++)w[T+je]=(A?A[R+je]:0)^re[je];return 0}function ie(w,T,A,R,P){return z(w,T,null,0,A,R,P)}function K(w,T,A,R,P){var Z=new Uint8Array(32);return F(Z,R,P,X),ie(w,T,A,R.subarray(16),Z)}function ge(w,T,A,R,P,Z,de){var ye=new Uint8Array(32);return F(ye,Z,de,X),z(w,T,A,R,P,Z.subarray(16),ye)}function he(w,T){var A,R=0;for(A=0;A<17;A++)R=R+(w[A]+T[A]|0)|0,w[A]=R&255,R>>>=8}var I=new Uint32Array([5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,252]);function H(w,T,A,R,P,Z){var de,ye,re,fe,je=new Uint32Array(17),Je=new Uint32Array(17),xt=new Uint32Array(17),Qt=new Uint32Array(17),Wn=new Uint32Array(17);for(re=0;re<17;re++)Je[re]=xt[re]=0;for(re=0;re<16;re++)Je[re]=Z[re];for(Je[3]&=15,Je[4]&=252,Je[7]&=15,Je[8]&=252,Je[11]&=15,Je[12]&=252,Je[15]&=15;P>0;){for(re=0;re<17;re++)Qt[re]=0;for(re=0;re<16&&re<P;++re)Qt[re]=A[R+re];for(Qt[re]=1,R+=re,P-=re,he(xt,Qt),ye=0;ye<17;ye++)for(je[ye]=0,re=0;re<17;re++)je[ye]=je[ye]+xt[re]*(re<=ye?Je[ye-re]:320*Je[ye+17-re]|0)|0|0;for(ye=0;ye<17;ye++)xt[ye]=je[ye];for(fe=0,re=0;re<16;re++)fe=fe+xt[re]|0,xt[re]=fe&255,fe>>>=8;for(fe=fe+xt[16]|0,xt[16]=fe&3,fe=5*(fe>>>2)|0,re=0;re<16;re++)fe=fe+xt[re]|0,xt[re]=fe&255,fe>>>=8;fe=fe+xt[16]|0,xt[16]=fe}for(re=0;re<17;re++)Wn[re]=xt[re];for(he(xt,I),de=-(xt[16]>>>7)|0,re=0;re<17;re++)xt[re]^=de&(Wn[re]^xt[re]);for(re=0;re<16;re++)Qt[re]=Z[re+16];for(Qt[16]=0,he(xt,Qt),re=0;re<16;re++)w[T+re]=xt[re];return 0}function te(w,T,A,R,P,Z){var de=new Uint8Array(16);return H(de,0,A,R,P,Z),le(w,T,de,0)}function me(w,T,A,R,P){var Z;if(A<32)return-1;for(ge(w,0,T,0,A,R,P),H(w,16,w,32,A-32,w),Z=0;Z<16;Z++)w[Z]=0;return 0}function Ae(w,T,A,R,P){var Z,de=new Uint8Array(32);if(A<32||(K(de,0,32,R,P),te(T,16,T,32,A-32,de)!==0))return-1;for(ge(w,0,T,0,A,R,P),Z=0;Z<32;Z++)w[Z]=0;return 0}function N(w,T){var A;for(A=0;A<16;A++)w[A]=T[A]|0}function L(w){var T,A;for(A=0;A<16;A++)w[A]+=65536,T=Math.floor(w[A]/65536),w[(A+1)*(A<15?1:0)]+=T-1+37*(T-1)*(A===15?1:0),w[A]-=T*65536}function Y(w,T,A){for(var R,P=~(A-1),Z=0;Z<16;Z++)R=P&(w[Z]^T[Z]),w[Z]^=R,T[Z]^=R}function E(w,T){var A,R,P,Z=r(),de=r();for(A=0;A<16;A++)de[A]=T[A];for(L(de),L(de),L(de),R=0;R<2;R++){for(Z[0]=de[0]-65517,A=1;A<15;A++)Z[A]=de[A]-65535-(Z[A-1]>>16&1),Z[A-1]&=65535;Z[15]=de[15]-32767-(Z[14]>>16&1),P=Z[15]>>16&1,Z[14]&=65535,Y(de,Z,1-P)}for(A=0;A<16;A++)w[2*A]=de[A]&255,w[2*A+1]=de[A]>>8}function se(w,T){var A=new Uint8Array(32),R=new Uint8Array(32);return E(A,w),E(R,T),j(A,0,R,0)}function we(w){var T=new Uint8Array(32);return E(T,w),T[0]&1}function xe(w,T){var A;for(A=0;A<16;A++)w[A]=T[2*A]+(T[2*A+1]<<8);w[15]&=32767}function Oe(w,T,A){var R;for(R=0;R<16;R++)w[R]=T[R]+A[R]|0}function ze(w,T,A){var R;for(R=0;R<16;R++)w[R]=T[R]-A[R]|0}function Ce(w,T,A){var R,P,Z=new Float64Array(31);for(R=0;R<31;R++)Z[R]=0;for(R=0;R<16;R++)for(P=0;P<16;P++)Z[R+P]+=T[R]*A[P];for(R=0;R<15;R++)Z[R]+=38*Z[R+16];for(R=0;R<16;R++)w[R]=Z[R];L(w),L(w)}function Me(w,T){Ce(w,T,T)}function Le(w,T){var A=r(),R;for(R=0;R<16;R++)A[R]=T[R];for(R=253;R>=0;R--)Me(A,A),R!==2&&R!==4&&Ce(A,A,T);for(R=0;R<16;R++)w[R]=A[R]}function Fe(w,T){var A=r(),R;for(R=0;R<16;R++)A[R]=T[R];for(R=250;R>=0;R--)Me(A,A),R!==1&&Ce(A,A,T);for(R=0;R<16;R++)w[R]=A[R]}function gn(w,T,A){var R=new Uint8Array(32),P=new Float64Array(80),Z,de,ye=r(),re=r(),fe=r(),je=r(),Je=r(),xt=r();for(de=0;de<31;de++)R[de]=T[de];for(R[31]=T[31]&127|64,R[0]&=248,xe(P,A),de=0;de<16;de++)re[de]=P[de],je[de]=ye[de]=fe[de]=0;for(ye[0]=je[0]=1,de=254;de>=0;--de)Z=R[de>>>3]>>>(de&7)&1,Y(ye,re,Z),Y(fe,je,Z),Oe(Je,ye,fe),ze(ye,ye,fe),Oe(fe,re,je),ze(re,re,je),Me(je,Je),Me(xt,ye),Ce(ye,fe,ye),Ce(fe,re,Je),Oe(Je,ye,fe),ze(ye,ye,fe),Me(re,ye),ze(fe,je,xt),Ce(ye,fe,m),Oe(ye,ye,je),Ce(fe,fe,ye),Ce(ye,je,xt),Ce(je,re,P),Me(re,Je),Y(ye,re,Z),Y(fe,je,Z);for(de=0;de<16;de++)P[de+16]=ye[de],P[de+32]=fe[de],P[de+48]=re[de],P[de+64]=je[de];var Qt=P.subarray(32),Wn=P.subarray(16);return Le(Qt,Qt),Ce(Wn,Wn,Qt),E(w,Wn),0}function Xt(w,T){return gn(w,T,u)}function Rn(w,T){return a(T,32),Xt(w,T)}function ve(w,T,A){var R=new Uint8Array(32);return gn(R,A,T),F(w,l,R,X)}var Pe=me,He=Ae;function _t(w,T,A,R,P,Z){var de=new Uint8Array(32);return ve(de,P,Z),Pe(w,T,A,R,de)}function Mn(w,T,A,R,P,Z){var de=new Uint8Array(32);return ve(de,P,Z),He(w,T,A,R,de)}function Qn(){var w=0,T=0,A=0,R=0,P=65535,Z,de,ye;for(ye=0;ye<arguments.length;ye++)Z=arguments[ye].lo,de=arguments[ye].hi,w+=Z&P,T+=Z>>>16,A+=de&P,R+=de>>>16;return T+=w>>>16,A+=T>>>16,R+=A>>>16,new n(A&P|R<<16,w&P|T<<16)}function ra(w,T){return new n(w.hi>>>T,w.lo>>>T|w.hi<<32-T)}function Gr(){var w=0,T=0,A;for(A=0;A<arguments.length;A++)w^=arguments[A].lo,T^=arguments[A].hi;return new n(T,w)}function yt(w,T){var A,R,P=32-T;return T<32?(A=w.hi>>>T|w.lo<<P,R=w.lo>>>T|w.hi<<P):T<64&&(A=w.lo>>>T|w.hi<<P,R=w.hi>>>T|w.lo<<P),new n(A,R)}function os(w,T,A){var R=w.hi&T.hi^~w.hi&A.hi,P=w.lo&T.lo^~w.lo&A.lo;return new n(R,P)}function ue(w,T,A){var R=w.hi&T.hi^w.hi&A.hi^T.hi&A.hi,P=w.lo&T.lo^w.lo&A.lo^T.lo&A.lo;return new n(R,P)}function Se(w){return Gr(yt(w,28),yt(w,34),yt(w,39))}function qe(w){return Gr(yt(w,14),yt(w,18),yt(w,41))}function Ve(w){return Gr(yt(w,1),yt(w,8),ra(w,7))}function rt(w){return Gr(yt(w,19),yt(w,61),ra(w,6))}var en=[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 Dn(w,T,A){var R=[],P=[],Z=[],de=[],ye,re,fe;for(re=0;re<8;re++)R[re]=Z[re]=q(w,8*re);for(var je=0;A>=128;){for(re=0;re<16;re++)de[re]=q(T,8*re+je);for(re=0;re<80;re++){for(fe=0;fe<8;fe++)P[fe]=Z[fe];for(ye=Qn(Z[7],qe(Z[4]),os(Z[4],Z[5],Z[6]),en[re],de[re%16]),P[7]=Qn(ye,Se(Z[0]),ue(Z[0],Z[1],Z[2])),P[3]=Qn(P[3],ye),fe=0;fe<8;fe++)Z[(fe+1)%8]=P[fe];if(re%16===15)for(fe=0;fe<16;fe++)de[fe]=Qn(de[fe],de[(fe+9)%16],Ve(de[(fe+1)%16]),rt(de[(fe+14)%16]))}for(re=0;re<8;re++)Z[re]=Qn(Z[re],R[re]),R[re]=Z[re];je+=128,A-=128}for(re=0;re<8;re++)G(w,8*re,R[re]);return A}var $t=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 dt(w,T,A){var R=new Uint8Array(64),P=new Uint8Array(256),Z,de=A;for(Z=0;Z<64;Z++)R[Z]=$t[Z];for(Dn(R,T,A),A%=128,Z=0;Z<256;Z++)P[Z]=0;for(Z=0;Z<A;Z++)P[Z]=T[de-A+Z];for(P[A]=128,A=256-128*(A<112?1:0),P[A-9]=0,G(P,A-8,new n(de/536870912|0,de<<3)),Dn(R,P,A),Z=0;Z<64;Z++)w[Z]=R[Z];return 0}function Bt(w,T){var A=r(),R=r(),P=r(),Z=r(),de=r(),ye=r(),re=r(),fe=r(),je=r();ze(A,w[1],w[0]),ze(je,T[1],T[0]),Ce(A,A,je),Oe(R,w[0],w[1]),Oe(je,T[0],T[1]),Ce(R,R,je),Ce(P,w[3],T[3]),Ce(P,P,y),Ce(Z,w[2],T[2]),Oe(Z,Z,Z),ze(de,R,A),ze(ye,Z,P),Oe(re,Z,P),Oe(fe,R,A),Ce(w[0],de,ye),Ce(w[1],fe,re),Ce(w[2],re,ye),Ce(w[3],de,fe)}function lt(w,T,A){var R;for(R=0;R<4;R++)Y(w[R],T[R],A)}function zn(w,T){var A=r(),R=r(),P=r();Le(P,T[2]),Ce(A,T[0],P),Ce(R,T[1],P),E(w,R),w[31]^=we(A)<<7}function tn(w,T,A){var R,P;for(N(w[0],c),N(w[1],f),N(w[2],f),N(w[3],c),P=255;P>=0;--P)R=A[P/8|0]>>(P&7)&1,lt(w,T,R),Bt(T,w),Bt(w,w),lt(w,T,R)}function ia(w,T){var A=[r(),r(),r(),r()];N(A[0],g),N(A[1],x),N(A[2],f),Ce(A[3],g,x),tn(w,A,T)}function Yr(w,T,A){var R=new Uint8Array(64),P=[r(),r(),r(),r()],Z;for(A||a(T,32),dt(R,T,32),R[0]&=248,R[31]&=127,R[31]|=64,ia(P,R),zn(w,P),Z=0;Z<32;Z++)T[Z+32]=w[Z];return 0}var vr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Vr(w,T){var A,R,P,Z;for(R=63;R>=32;--R){for(A=0,P=R-32,Z=R-12;P<Z;++P)T[P]+=A-16*T[R]*vr[P-(R-32)],A=Math.floor((T[P]+128)/256),T[P]-=A*256;T[P]+=A,T[R]=0}for(A=0,P=0;P<32;P++)T[P]+=A-(T[31]>>4)*vr[P],A=T[P]>>8,T[P]&=255;for(P=0;P<32;P++)T[P]-=A*vr[P];for(R=0;R<32;R++)T[R+1]+=T[R]>>8,w[R]=T[R]&255}function Zn(w){var T=new Float64Array(64),A;for(A=0;A<64;A++)T[A]=w[A];for(A=0;A<64;A++)w[A]=0;Vr(w,T)}function Ti(w,T,A,R){var P=new Uint8Array(64),Z=new Uint8Array(64),de=new Uint8Array(64),ye,re,fe=new Float64Array(64),je=[r(),r(),r(),r()];dt(P,R,32),P[0]&=248,P[31]&=127,P[31]|=64;var Je=A+64;for(ye=0;ye<A;ye++)w[64+ye]=T[ye];for(ye=0;ye<32;ye++)w[32+ye]=P[32+ye];for(dt(de,w.subarray(32),A+32),Zn(de),ia(je,de),zn(w,je),ye=32;ye<64;ye++)w[ye]=R[ye];for(dt(Z,w,A+64),Zn(Z),ye=0;ye<64;ye++)fe[ye]=0;for(ye=0;ye<32;ye++)fe[ye]=de[ye];for(ye=0;ye<32;ye++)for(re=0;re<32;re++)fe[ye+re]+=Z[ye]*P[re];return Vr(w.subarray(32),fe),Je}function Oi(w,T){var A=r(),R=r(),P=r(),Z=r(),de=r(),ye=r(),re=r();return N(w[2],f),xe(w[1],T),Me(P,w[1]),Ce(Z,P,d),ze(P,P,w[2]),Oe(Z,w[2],Z),Me(de,Z),Me(ye,de),Ce(re,ye,de),Ce(A,re,P),Ce(A,A,Z),Fe(A,A),Ce(A,A,P),Ce(A,A,Z),Ce(A,A,Z),Ce(w[0],A,Z),Me(R,w[0]),Ce(R,R,Z),se(R,P)&&Ce(w[0],w[0],v),Me(R,w[0]),Ce(R,R,Z),se(R,P)?-1:(we(w[0])===T[31]>>7&&ze(w[0],c,w[0]),Ce(w[3],w[0],w[1]),0)}function us(w,T,A,R){var P,Z=new Uint8Array(32),de=new Uint8Array(64),ye=[r(),r(),r(),r()],re=[r(),r(),r(),r()];if(A<64||Oi(re,R))return-1;for(P=0;P<A;P++)w[P]=T[P];for(P=0;P<32;P++)w[P+32]=R[P];if(dt(de,w,A),Zn(de),tn(ye,re,de),ia(re,T.subarray(32)),Bt(ye,re),zn(Z,ye),A-=64,j(T,0,Z,0)){for(P=0;P<A;P++)w[P]=0;return-1}for(P=0;P<A;P++)w[P]=T[P+64];return A}var aa=32,Jr=24,Kn=32,Xr=16,Qr=32,ji=32,Zr=32,Sr=32,Ni=32,cs=Jr,Dl=Kn,lr=Xr,mt=64,At=32,yn=64,Ri=32,fs=64;t.lowlevel={crypto_core_hsalsa20:F,crypto_stream_xor:ge,crypto_stream:K,crypto_stream_salsa20_xor:z,crypto_stream_salsa20:ie,crypto_onetimeauth:H,crypto_onetimeauth_verify:te,crypto_verify_16:le,crypto_verify_32:j,crypto_secretbox:me,crypto_secretbox_open:Ae,crypto_scalarmult:gn,crypto_scalarmult_base:Xt,crypto_box_beforenm:ve,crypto_box_afternm:Pe,crypto_box:_t,crypto_box_open:Mn,crypto_box_keypair:Rn,crypto_hash:dt,crypto_sign:Ti,crypto_sign_keypair:Yr,crypto_sign_open:us,crypto_secretbox_KEYBYTES:aa,crypto_secretbox_NONCEBYTES:Jr,crypto_secretbox_ZEROBYTES:Kn,crypto_secretbox_BOXZEROBYTES:Xr,crypto_scalarmult_BYTES:Qr,crypto_scalarmult_SCALARBYTES:ji,crypto_box_PUBLICKEYBYTES:Zr,crypto_box_SECRETKEYBYTES:Sr,crypto_box_BEFORENMBYTES:Ni,crypto_box_NONCEBYTES:cs,crypto_box_ZEROBYTES:Dl,crypto_box_BOXZEROBYTES:lr,crypto_sign_BYTES:mt,crypto_sign_PUBLICKEYBYTES:At,crypto_sign_SECRETKEYBYTES:yn,crypto_sign_SEEDBYTES:Ri,crypto_hash_BYTES:fs,gf:r,D:d,L:vr,pack25519:E,unpack25519:xe,M:Ce,A:Oe,S:Me,Z:ze,pow2523:Fe,add:Bt,set25519:N,modL:Vr,scalarmult:tn,scalarbase:ia};function zl(w,T){if(w.length!==aa)throw new Error("bad key size");if(T.length!==Jr)throw new Error("bad nonce size")}function Ll(w,T){if(w.length!==Zr)throw new Error("bad public key size");if(T.length!==Sr)throw new Error("bad secret key size")}function qt(){for(var w=0;w<arguments.length;w++)if(!(arguments[w]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function sa(w){for(var T=0;T<w.length;T++)w[T]=0}t.randomBytes=function(w){var T=new Uint8Array(w);return a(T,w),T},t.secretbox=function(w,T,A){qt(w,T,A),zl(A,T);for(var R=new Uint8Array(Kn+w.length),P=new Uint8Array(R.length),Z=0;Z<w.length;Z++)R[Z+Kn]=w[Z];return me(P,R,R.length,T,A),P.subarray(Xr)},t.secretbox.open=function(w,T,A){qt(w,T,A),zl(A,T);for(var R=new Uint8Array(Xr+w.length),P=new Uint8Array(R.length),Z=0;Z<w.length;Z++)R[Z+Xr]=w[Z];return R.length<32||Ae(P,R,R.length,T,A)!==0?null:P.subarray(Kn)},t.secretbox.keyLength=aa,t.secretbox.nonceLength=Jr,t.secretbox.overheadLength=Xr,t.scalarMult=function(w,T){if(qt(w,T),w.length!==ji)throw new Error("bad n size");if(T.length!==Qr)throw new Error("bad p size");var A=new Uint8Array(Qr);return gn(A,w,T),A},t.scalarMult.base=function(w){if(qt(w),w.length!==ji)throw new Error("bad n size");var T=new Uint8Array(Qr);return Xt(T,w),T},t.scalarMult.scalarLength=ji,t.scalarMult.groupElementLength=Qr,t.box=function(w,T,A,R){var P=t.box.before(A,R);return t.secretbox(w,T,P)},t.box.before=function(w,T){qt(w,T),Ll(w,T);var A=new Uint8Array(Ni);return ve(A,w,T),A},t.box.after=t.secretbox,t.box.open=function(w,T,A,R){var P=t.box.before(A,R);return t.secretbox.open(w,T,P)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var w=new Uint8Array(Zr),T=new Uint8Array(Sr);return Rn(w,T),{publicKey:w,secretKey:T}},t.box.keyPair.fromSecretKey=function(w){if(qt(w),w.length!==Sr)throw new Error("bad secret key size");var T=new Uint8Array(Zr);return Xt(T,w),{publicKey:T,secretKey:new Uint8Array(w)}},t.box.publicKeyLength=Zr,t.box.secretKeyLength=Sr,t.box.sharedKeyLength=Ni,t.box.nonceLength=cs,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(w,T){if(qt(w,T),T.length!==yn)throw new Error("bad secret key size");var A=new Uint8Array(mt+w.length);return Ti(A,w,w.length,T),A},t.sign.open=function(w,T){if(qt(w,T),T.length!==At)throw new Error("bad public key size");var A=new Uint8Array(w.length),R=us(A,w,w.length,T);if(R<0)return null;for(var P=new Uint8Array(R),Z=0;Z<P.length;Z++)P[Z]=A[Z];return P},t.sign.detached=function(w,T){for(var A=t.sign(w,T),R=new Uint8Array(mt),P=0;P<R.length;P++)R[P]=A[P];return R},t.sign.detached.verify=function(w,T,A){if(qt(w,T,A),T.length!==mt)throw new Error("bad signature size");if(A.length!==At)throw new Error("bad public key size");var R=new Uint8Array(mt+w.length),P=new Uint8Array(mt+w.length),Z;for(Z=0;Z<mt;Z++)R[Z]=T[Z];for(Z=0;Z<w.length;Z++)R[Z+mt]=w[Z];return us(P,R,R.length,A)>=0},t.sign.keyPair=function(){var w=new Uint8Array(At),T=new Uint8Array(yn);return Yr(w,T),{publicKey:w,secretKey:T}},t.sign.keyPair.fromSecretKey=function(w){if(qt(w),w.length!==yn)throw new Error("bad secret key size");for(var T=new Uint8Array(At),A=0;A<T.length;A++)T[A]=w[32+A];return{publicKey:T,secretKey:new Uint8Array(w)}},t.sign.keyPair.fromSeed=function(w){if(qt(w),w.length!==Ri)throw new Error("bad seed size");for(var T=new Uint8Array(At),A=new Uint8Array(yn),R=0;R<32;R++)A[R]=w[R];return Yr(T,A,!0),{publicKey:T,secretKey:A}},t.sign.publicKeyLength=At,t.sign.secretKeyLength=yn,t.sign.seedLength=Ri,t.sign.signatureLength=mt,t.hash=function(w){qt(w);var T=new Uint8Array(fs);return dt(T,w,w.length),T},t.hash.hashLength=fs,t.verify=function(w,T){return qt(w,T),w.length===0||T.length===0||w.length!==T.length?!1:V(w,0,T,0,w.length)===0},t.setPRNG=function(w){a=w},(function(){var w=typeof globalThis<"u"?globalThis.crypto||globalThis.msCrypto:null;if(w&&w.getRandomValues){var T=65536;t.setPRNG(function(A,R){var P,Z=new Uint8Array(R);for(P=0;P<R;P+=T)w.getRandomValues(Z.subarray(P,P+Math.min(R-P,T)));for(P=0;P<R;P++)A[P]=Z[P];sa(Z)})}else typeof require<"u"&&(w=require("crypto"),w&&w.randomBytes&&t.setPRNG(function(A,R){var P,Z=w.randomBytes(R);for(P=0;P<R;P++)A[P]=Z[P];sa(Z)}))})()})(typeof Ki<"u"&&Ki.exports?Ki.exports:globalThis.nacl=globalThis.nacl||{});const Zo=typeof Ki<"u"&&Ki.exports?Ki.exports:globalThis.nacl;Zo.sign.keyPair.fromSeed,Zo.sign.detached,Zo.sign.detached.verify,Zo.randomBytes;var e0;(function(t){t.InvalidPrefixByte="nkeys: invalid prefix byte",t.InvalidKey="nkeys: invalid key",t.InvalidPublicKey="nkeys: invalid public key",t.InvalidSeedLen="nkeys: invalid seed length",t.InvalidSeed="nkeys: invalid seed",t.InvalidEncoding="nkeys: invalid encoded key",t.InvalidSignature="nkeys: signature verification failed",t.CannotSign="nkeys: cannot sign, no private key available",t.PublicKeyOnly="nkeys: no seed or private key available",t.InvalidChecksum="nkeys: invalid checksum",t.SerializationError="nkeys: serialization error",t.ApiError="nkeys: api error",t.ClearedPair="nkeys: pair is cleared"})(e0||(e0={}));var t0;(function(t){t[t.Seed=144]="Seed",t[t.Private=120]="Private",t[t.Operator=112]="Operator",t[t.Server=104]="Server",t[t.Cluster=16]="Cluster",t[t.Account=0]="Account",t[t.User=160]="User"})(t0||(t0={}));function Kw(t){return n=>{let r={};return t.forEach(a=>{const l=a(n)||{};r=Object.assign(r,l)}),r}}function Ww(){return()=>{}}function e2(t,n){return()=>{const r=typeof t=="function"?t():t,a=typeof n=="function"?n():n;return{user:r,pass:a}}}function t2(t){return()=>({auth_token:typeof t=="function"?t():t})}const Mb=120*1e3,n2=2,Db=2*1e3;function r2(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:Mb,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:1e3,reconnectTimeWait:Db,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function i2(t){const n=[];return typeof t.authenticator=="function"&&n.push(t.authenticator),Array.isArray(t.authenticator)&&n.push(...t.authenticator),t.token&&n.push(t2(t.token)),t.user&&n.push(e2(t.user,t.pass)),n.length===0?Ww():Kw(n)}function a2(t){const n=`${Th}:${jb()}`;if(t=t||{servers:[n]},t.servers=t.servers||[],typeof t.servers=="string"&&(t.servers=[t.servers]),t.servers.length>0&&t.port)throw new Te("port and servers options are mutually exclusive",_e.InvalidOption);t.servers.length===0&&t.port&&(t.servers=[`${Th}:${t.port}`]),t.servers&&t.servers.length===0&&(t.servers=[n]);const r=Au(r2(),t);if(r.authenticator=i2(r),["reconnectDelayHandler","authenticator"].forEach(a=>{if(r[a]&&typeof r[a]!="function")throw new Te(`${a} option should be a function`,_e.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{Pr(r.inboxPrefix)}catch(a){throw new Te(a.message,_e.ApiError)}if(r.resolve===void 0&&(r.resolve=typeof zh()=="function"),r.resolve&&typeof zh()!="function")throw new Te("'resolve' is not supported on this client",_e.InvalidOption);return r}function s2(t,n){const{proto:r,tls_required:a,tls_available:l}=t;if((r===void 0||r<1)&&n.noEcho)throw new Te("noEcho",_e.ServerOptionNotAvailable);const u=a||l||!1;if(n.tls&&!u)throw new Te("tls",_e.ServerOptionNotAvailable)}const l2=1024*32,o2=/^INFO\s+([^\r\n]+)\r\n/i,u2=fl(`PONG\r
|
|
72
|
+
`),n0=fl(`PING\r
|
|
73
|
+
`);class c2{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):{})||{};Au(this,l)}}class zb extends Ft{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");Au(this,l),this.protocol=r,this.subject=a,this.draining=!1,this.noIterator=typeof l.callback=="function",this.closed=kt();const u=!((c=r.options)!=null&&c.noAsyncTraces);l.timeout&&(this.timer=Wa(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(Te.errorForCode(_e.ConnectionClosed)):this.isClosed()?Promise.reject(Te.errorForCode(_e.SubClosed)):(this.drained||(this.draining=!0,this.protocol.unsub(this),this.drained=this.protocol.flush(kt()).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 f2{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 bu{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=l2,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=n,this.publisher=r,this.subscriptions=new f2,this.muxSubscriptions=new Vw,this.outbound=new ts,this.pongs=[],this.whyClosed="",this.pendingLimit=n.pendingLimit||this.pendingLimit,this.features=new Aw({major:0,minor:0,micro:0}),this.connectPromise=null;const a=typeof n.servers=="string"?[n.servers]:n.servers;this.servers=new Yw(a,{randomize:!n.noRandomize}),this.closed=kt(),this.parser=new Wy(this),this.heartbeats=new Jw(this,this.options.pingInterval||Mb,this.options.maxPingOut||n2)}resetOutbound(){this.outbound.reset();const n=this.pongs;this.pongs=[];const r=Te.errorForCode(_e.Disconnect);r.stack="",n.forEach(a=>{a.reject(r)}),this.parser=new Wy(this),this.infoReceived=!1}dispatchStatus(n){this.listeners.forEach(r=>{r.push(n)})}status(){const n=new Ft;return this.listeners.push(n),n}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();const n=kt();return n.catch(()=>{}),this.pongs.unshift(n),this.connectError=r=>{n.reject(r)},this.transport=jw(),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:Va.StaleConnection,data:""}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:Va.ClientInitiatedReconnect,data:""}),this.transport.disconnect()),Promise.resolve()}async disconnected(n){this.dispatchStatus({type:Hr.Disconnect,data:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{var r;this.dispatchStatus({type:Hr.Reconnect,data:this.servers.getCurrentServer().toString()}),((r=this.lastError)==null?void 0:r.code)===_e.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=Wa(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:zh(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:r});let l=null;for(const u of a)try{l=null,this.dispatchStatus({type:Va.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():Db;let a=r;const l=this.selectServer();if(!l||this.abortReconnect)throw n||(this.lastError?this.lastError:Te.errorForCode(_e.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 as(a)}}static async connect(n,r){const a=new bu(n,r);return await a.dialLoop(),a}static toError(n){const r=n?n.toLowerCase():"";if(r.indexOf("permissions violation")!==-1){const a=new Te(n,_e.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 Te(n,_e.AuthorizationViolation):r.indexOf("user authentication expired")!==-1?new Te(n,_e.AuthenticationExpired):r.indexOf("account authentication expired")!=-1?new Te(n,_e.AccountExpired):r.indexOf("authentication timeout")!==-1?new Te(n,_e.AuthenticationTimeout):new Te(n,_e.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 fd(n,r,this)),a.max!==void 0&&a.received>=a.max&&a.unsubscribe())}processError(n){const r=By(n),a=bu.toError(r),l={type:Hr.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(u2)}processPong(){const n=this.pongs.shift();n&&n.resolve()}processInfo(n){const r=JSON.parse(By(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(Zi(r.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();const{version:u,lang:c}=this.transport;try{const f=new c2({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(fl(`CONNECT ${m}${su}`)),this.transport.send(n0)}catch(f){this._close(f)}}a&&this.dispatchStatus({type:Hr.Update,data:a}),(r.ldm!==void 0?r.ldm:!1)&&this.dispatchStatus({type:Hr.LDM,data:this.servers.getCurrentServer().toString()})}push(n){switch(n.kind){case an.MSG:{const{msg:r,data:a}=n;this.processMsg(r,a);break}case an.OK:break;case an.ERR:this.processError(n.data);break;case an.PING:this.processPing();break;case an.PONG:this.processPong();break;case an.INFO:this.processInfo(n.data);break}}sendCommand(n,...r){const a=this.outbound.length();let l;typeof n=="string"?l=fl(n):l=n,this.outbound.fill(l,...r),a===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(n,r=Nn,a){let l;if(r instanceof Uint8Array)l=r;else if(typeof r=="string")l=ta.encode(r);else throw Te.errorForCode(_e.BadPayload);let u=l.length;a=a||{},a.reply=a.reply||"";let c=Nn,f=0;if(a.headers){if(this.info&&!this.info.headers)throw new Te("headers",_e.ServerOptionNotAvailable);c=a.headers.encode(),f=c.length,u=l.length+f}if(this.info&&u>this.info.max_payload)throw Te.errorForCode(_e.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,yu)):(a.reply?m=`PUB ${n} ${a.reply} ${u}\r
|
|
76
|
+
`:m=`PUB ${n} ${u}\r
|
|
77
|
+
`,this.sendCommand(m,l,yu))}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=kt()),this.pongs.push(n),this.outbound.fill(n0),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}${su}`):n.push(`SUB ${a.subject} ${a.sid}${su}`)}),n.length&&this.transport.send(fl(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 zb(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 h2="$SRV";class r0{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||Fr(),(u=l.headers)==null||u.set(hu,`${n}`),(c=l.headers)==null||c.set(fu,r),this.msg.respond(a,l)}json(n){return this.msg.json(n)}string(){return this.msg.string()}}class vl{constructor(n,r="",a=""){k(this,"subject");k(this,"queue");k(this,"srv");r!==""&&m2("service group",r);let l="";if(n instanceof jl)this.srv=n,l="";else if(n instanceof vl){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;ul("endpoint",n);let{subject:l,handler:u,metadata:c,queue:f}=a;l=l||n,f=f||this.queue,d2("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 vl(this,n,r)}}function d2(t,n){if(n==="")throw new Error(`${t} cannot be empty`);if(n.indexOf(" ")!==-1)throw new Error(`${t} cannot contain spaces: '${n}'`);const r=n.split(".");r.forEach((a,l)=>{if(a===">"&&l!==r.length-1)throw new Error(`${t} cannot have internal '>': '${n}'`)})}function m2(t,n){if(n.indexOf(" ")!==-1)throw new Error(`${t} cannot contain spaces: '${n}'`);n.split(".").forEach(a=>{if(a===">")throw new Error(`${t} name cannot contain internal '>': '${n}'`)})}class jl{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"),ul("name",this.config.name),ul("queue",this.config.queue),Zi(this.config.version),this._id=ki.next(),this.internal=[],this._done=kt(),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??h2;return r===""&&a===""?`${u}.${n}`:(ul("control subject name",r),a!==""?(ul("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=Fr();if(n instanceof du){const a=n;r.set(fu,a.message),r.set(hu,`${a.code}`)}else r.set(fu,n.message),r.set(hu,"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 p2(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 r0(y))}catch(x){f.stats.countError(x),y==null||y.respond(Nn,{headers:this.errorToHeader(x)})}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:hl.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:hl.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=jl.controlSubject(r,l,u),c.handler=a,this.setupHandler(c,!0)}start(){const n=ar(),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(_i.PING,u),this.addInternalHandler(_i.STATS,r),this.addInternalHandler(_i.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:hl.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 vl(this,n,r)}addEndpoint(n,r){return new vl(this).addEndpoint(n,r)}_addEndpoint(n){const r=new Ft;r.noIterator=typeof n.handler=="function",r.noIterator||(n.handler=(l,u)=>{l?this.stop(l).catch():r.push(new r0(u))},r.iterClosed.then(()=>{this.close().catch()}));const a=this.setupHandler(n,!1);return a.qi=r,this.handlers.push(a),r}}class p2{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+=Et(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=Et(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 g2{constructor(n,r={strategy:ir.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(_i.PING,n,r)}stats(n="",r=""){return this.q(_i.STATS,n,r)}info(n="",r=""){return this.q(_i.INFO,n,r)}async q(n,r="",a=""){const l=new Ft,u=ar(),c=jl.controlSubject(n,r,a,this.prefix),f=await this.nc.requestMany(c,Nn,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 Lb(){return{key:{encode(t){return t},decode(t){return t}},value:{encode(t){return t},decode(t){return t}}}}function y2(){return{replicas:1,history:1,timeout:2e3,max_bytes:-1,maxValueSize:-1,codec:Lb(),storage:Rh.File}}const xu="KV-Operation",i0="$KV",b2=/^[-/=.\w]+$/,x2=/^[-/=.>*\w]+$/,v2=/^[-\w]+$/;function S2(t){if(t.startsWith(".")||t.endsWith(".")||!b2.test(t))throw new Error(`invalid key: ${t}`)}function _2(t){if(t.startsWith(".")||t.endsWith(".")||!x2.test(t))throw new Error(`invalid key: ${t}`)}function w2(t){if(t.startsWith(".")||t.endsWith("."))throw new Error(`invalid key: ${t}`);const n=t.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: ${t}`);r=!0;break}return r}function lu(t){if(!v2.test(t))throw new Error(`invalid bucket name: ${t}`)}var dr;(function(t){t.MsgIdHdr="Nats-Msg-Id",t.ExpectedStreamHdr="Nats-Expected-Stream",t.ExpectedLastSeqHdr="Nats-Expected-Last-Sequence",t.ExpectedLastMsgIdHdr="Nats-Expected-Last-Msg-Id",t.ExpectedLastSubjectSequenceHdr="Nats-Expected-Last-Subject-Sequence"})(dr||(dr={}));class Sl{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",S2);k(this,"validateSearchKey",_2);k(this,"hasWildcards",w2);lu(n),this.js=r,this.jsm=a,this.bucket=n,this.prefix=i0,this.editPrefix="",this.useJsPrefix=!1,this._prefixLen=0}static async create(n,r,a={}){lu(r);const l=await n.jetstreamManager(),u=new Sl(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}};lu(r);const c=new Sl(r,n,l);return u.config.name=a.streamName??c.bucketName(),Object.assign(c,u),c.stream=u.config.name,c.codec=a.codec||Lb(),c.direct=u.config.allow_direct??!1,c.initializePrefixes(u),c}async init(n={}){const r=Object.assign(y2(),n);this.codec=r.codec;const a={};this.stream=a.name=n.streamName??this.bucketName(),a.retention=Nh.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(An)||(g.name=`${An}${g.name}`),a.mirror=g,a.mirror_direct=!0}else if(n.sources){const g=n.sources.map(x=>{const v=Object.assign({},x),C=v.name.startsWith(An)?v.name.substring(An.length):v.name;return v.name.startsWith(An)||(v.name=`${An}${v.name}`),!x.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?Ci.S2:Ci.None);const u=this.js.nc,c=u.getServerVersion(),f=c?Dh(c,Zi("2.7.2"))>=0:!1;a.discard=f?xl.New:xl.Old;const{ok:m,min:d}=u.features.get(nt.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=Et(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(An)&&(a=a.substring(An.length)),r.external&&r.external.api!==""){const l=r.name.substring(An.length);this.useJsPrefix=!1,this.prefix=`$KV.${l}`,this.editPrefix=`${r.external.api}.$KV.${a}`}else this.editPrefix=this.prefix}}bucketName(){return this.stream??`${An}${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}`:`${i0}.${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(ln.MessageSizeHdr)||"";return a!==""?parseInt(a,10):n.length}smToEntry(n){return new B2(this.bucket,this.prefixLen,n)}jmToEntry(n){const r=this.decodeKey(n.subject.substring(this.prefixLen));return new q2(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=Fr();u.headers=m,m.set(dr.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===_e.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=kt(),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=Fr();u.set(xu,r),r==="PURGE"&&u.set(ln.RollupHdr,ln.RollupValueSubject),a!=null&&a.previousSeq&&u.set(dr.ExpectedLastSubjectSequenceHdr,`${a.previousSeq}`),await this.js.publish(this.subjectForKey(l,!0),Nn,{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=Rt.LastPerSubject;r===rr.AllHistory&&(c=Rt.All),r===rr.UpdatesOnly&&(c=Rt.New);let f;return u.length===1&&(f=u[0],u=void 0),Object.assign({deliver_policy:c,ack_policy:It.None,filter_subjects:u,filter_subject:f,flow_control:!0,idle_heartbeat:Et(5*1e3)},a)}remove(n){return this.purge(n)}async history(n={}){const r=n.key??">",a=new Ft,l={};l.headers_only=n.headers_only||!1;let u;u=()=>{a.stop()};let c=0;const f=this._buildCC(r,rr.AllHistory,l),m=f.filter_subject,d=Ei(f);d.bindStream(this.stream),d.orderedConsumer(),d.callback((g,x)=>{if(g){a.stop(g);return}if(x){const v=this.jmToEntry(x);a.push(v),a.received++,(u&&c>0&&a.received>=c||x.info.pending===0)&&(a.push(u),u=void 0)}});const y=await this.js.subscribe(m,d);if(u){const{info:{last:g}}=y,x=g.num_pending+g.delivered.consumer_seq;if(x===0||a.received>=x)try{u()}catch(v){a.stop(v)}finally{u=void 0}else c=x}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(nt.JS_NEW_CONSUMER_CREATE_API);return a}async watch(n={}){const r=n.key??">",a=new Ft,l={};l.headers_only=n.headers_only||!1;let u=rr.LastValue;n.include===rr.AllHistory?u=rr.AllHistory:n.include===rr.UpdatesOnly&&(u=rr.UpdatesOnly);const c=n.ignoreDeletes===!0;let f=n.initializedFn,m=0;const d=this._buildCC(r,u,l),y=d.filter_subject,g=Ei(d);this.canSetWatcherName()&&g.consumerName(ki.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 D=this.jmToEntry(C);if(c&&D.operation==="DEL")return;a.push(D),a.received++,f&&(m>0&&a.received>=m||C.info.pending===0)&&(a.push(f),f=void 0)}});const x=await this.js.subscribe(y,g);if(f){const{info:{last:v}}=x,C=v.num_pending+v.delivered.consumer_seq;if(C===0||a.received>=C)try{f()}catch(D){a.stop(D)}finally{f=void 0}else m=C}return a._data=x,a.iterClosed.then(()=>{x.unsubscribe()}),x.closed.then(()=>{a.stop()}).catch(v=>{a.stop(v)}),a}async keys(n=">"){const r=new Ft,a=this._buildCC(n,rr.LastValue,{headers_only:!0}),l=Array.isArray(n)?">":a.filter_subject,u=Ei(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(xu);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 Ub(l,r)}}class Ub{constructor(n,r=""){k(this,"si");k(this,"cluster");this.si=n,this.cluster=r}get bucket(){return this.si.config.name.startsWith(An)?this.si.config.name.substring(An.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 cd(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!==Ci.None:!1}}const dd="OBJ_",a0="SHA-256=";function E2(t){return lu(t),`${dd}${t}`}function k2(t){return t.startsWith(dd)?t.substring(4):t}class Bh{constructor(n){k(this,"si");k(this,"backingStore");this.si=n,this.backingStore="JetStream"}get bucket(){return k2(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!==Ci.None:!1}}function Ko(t){if(t===void 0)return;const{domain:n}=t;if(n===void 0)return t;const r=Object.assign({},t);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 Yn;(function(t){t[t.Unset=-1]="Unset",t[t.Consume=0]="Consume",t[t.Fetch=1]="Fetch"})(Yn||(Yn={}));var mr;(function(t){t.HeartbeatsMissed="heartbeats_missed",t.ConsumerNotFound="consumer_not_found",t.StreamNotFound="stream_not_found",t.ConsumerDeleted="consumer_deleted",t.OrderedConsumerRecreated="ordered_consumer_recreated",t.NoResponders="no_responders"})(mr||(mr={}));var Za;(function(t){t.DebugEvent="debug",t.Discard="discard",t.Reset="reset",t.Next="next"})(Za||(Za={}));const s0=Uint8Array.of(43,65,67,75),C2=Uint8Array.of(45,78,65,75),rl=Uint8Array.of(43,87,80,73),A2=Uint8Array.of(43,78,88,84),T2=Uint8Array.of(43,84,69,82,77),O2=Uint8Array.of(32);function _l(t,n=5e3){return new Y2(t,n)}class ah extends Ft{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=Pr(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,x,v,C;if(m){this.stop(m);return}if((g=this.monitor)==null||g.work(),d.subject===this.inbox){if(jh(d))return;const D=(x=d.headers)==null?void 0:x.code,q=((C=(v=d.headers)==null?void 0:v.description)==null?void 0:C.toLowerCase())||"unknown",{msgsLeft:M,bytesLeft:G}=this.parseDiscard(d.headers);if(M>0||G>0)this.pending.msgs-=M,this.pending.bytes-=G,this.pending.requests--,this.notify(Za.Discard,{msgsLeft:M,bytesLeft:G});else if(D===400){this.stop(new Te(q,`${D}`));return}else if(D===409&&q==="consumer deleted"){if(this.notify(mr.ConsumerDeleted,`${D} ${q}`),!this.refilling||this.abortOnMissingResource){const V=new Te(q,`${D}`);this.stop(V);return}}else if(D===503){if(this.notify(mr.NoResponders,`${D} No Responders`),!this.refilling||this.abortOnMissingResource){const V=new Te("no responders",`${D}`);this.stop(V);return}}else this.notify(Za.DebugEvent,`${D} ${q}`)}else this._push(_l(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 D=this.pullOptions();this.pull(D)}}else this.pending.requests===0&&this._push(()=>{this.stop()})}}),this.sub.closed.then(()=>{this.sub.draining&&this._push(()=>{this.stop()})}),l&&(this.monitor=new hd(l,m=>(this.notify(mr.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 Hr.Disconnect:(d=this.monitor)==null||d.cancel();break;case Hr.Reconnect:this.resetPending().then(g=>{var x;g&&((x=this.monitor)==null||x.restart())}).catch(()=>{});break}})(),this.pull(this.pullOptions())}_push(r){if(!this.callback)super.push(r);else{const 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=ud([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(mr.StreamNotFound,a),!this.refilling||this.abortOnMissingResource)return this.stop(c),!1}else if(c.message==="consumer not found"){if(r++,this.notify(mr.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=as(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(Za.Next,r)})}pullOptions(){const r=this.opts.max_messages-this.pending.msgs,a=this.opts.max_bytes-this.pending.bytes,l=Et(this.opts.idle_heartbeat),u=Et(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(ln.PendingMessagesHdr);l&&(a.msgsLeft=parseInt(l));const u=r==null?void 0:r.get(ln.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 Ft;return this.listeners.push(r),Promise.resolve(r)}}class j2 extends Ft{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 Ft;return this.listeners.push(r),Promise.resolve(r)}}class qh{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 ah(this,n,!0))}fetch(n={max_messages:100,expires:3e4}){const r=new ah(this,n,!1),a=Math.round(r.opts.expires*1.05),l=Wa(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=kt(),a=n;a.max_messages=1;const l=new ah(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===mr.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=Wa(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 N2{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=ki.next(),typeof a.name_prefix=="string"&&(Tu("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=Yn.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:Rt.StartSequence,opt_start_seq:n,ack_policy:It.None,inactive_threshold:Et(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||Rt.StartSequence,(this.consumerOpts.deliver_policy===Rt.LastPerSubject||this.consumerOpts.deliver_policy===Rt.New||this.consumerOpts.deliver_policy===Rt.Last)&&(delete a.opt_start_seq,a.deliver_policy=this.consumerOpts.deliver_policy),a.deliver_policy===Rt.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=Rt.StartTime,a.opt_start_time=this.consumerOpts.opt_start_time),this.consumerOpts.inactive_threshold&&(a.inactive_threshold=Et(this.consumerOpts.inactive_threshold))),a}async resetConsumer(n=0){var c,f,m,d,y;ki.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=ud([((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(mr.OrderedConsumerRecreated,u.name);break}catch(x){if(x.message==="stream not found"&&((d=this.iter)==null||d.notify(mr.StreamNotFound,g),this.type===Yn.Fetch||this.opts.abort_on_missing_resource===!0))return(y=this.iter)==null||y.stop(x),Promise.reject(x);if(r&&g>=this.maxInitialReset)throw x;await as(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===Yn.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 j2),this.consumer=new qh(this.api,this.currentConsumer);const u=n;u.callback=this.internalHandler(this.serial);let c=null;this.type===Yn.Fetch&&a?c=await this.consumer.fetch(n):this.type===Yn.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(Za.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===Yn.Fetch)return Promise.reject(new Error("ordered consumer initialized as fetch"));if(this.type===Yn.Consume)return Promise.reject(new Error("ordered consumer doesn't support concurrent consume"));const{callback:a}=n;return a&&(this.userCallback=a),this.type=Yn.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===Yn.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=Yn.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=kt();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 Hh{constructor(n){k(this,"api");k(this,"notified");this.api=n,this.notified=!1}checkVersion(){const n=this.api.nc.features.get(nt.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 qh(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 qh(this.api,a)).catch(a=>Promise.reject(a)))}async ordered(n,r){await this.checkVersion();const a=this.api;return new md(a.nc,a.opts).info(n).then(u=>Promise.resolve(new N2(this.api,n,r))).catch(u=>Promise.reject(u))}}class ju{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 ju(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 Hh(new gu(this.api.nc,this.api.opts)).getPullConsumerFor(n)}getConsumer(n){return new Hh(new gu(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 md extends Ol{constructor(n,r){super(n,r)}checkStreamConfigVersions(n){const r=this.nc;if(n.metadata){const{min:l,ok:u}=r.features.get(nt.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(nt.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(nt.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(nt.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(nt.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(nt.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),rn(n.name),n.mirror=Ko(n.mirror),n.sources=(l=n.sources)==null?void 0:l.map(Ko);const a=await this._request(`${this.prefix}.STREAM.CREATE.${n.name}`,n);return this._fixInfo(a),a}async delete(n){return rn(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),rn(n);const a=await this.info(n),l=Object.assign(a.config,r);l.mirror=Ko(l.mirror),l.sources=(f=l.sources)==null?void 0:f.map(Ko);const c=await this._request(`${this.prefix}.STREAM.UPDATE.${n}`,l);return this._fixInfo(c),c}async info(n,r){rn(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 x={};for(let v=0;v<d.length;v++)u=d[v],u.state.subjects&&(x=Object.assign(x,u.state.subjects));u.offset=0,u.total=0,u.limit=0,u.state.subjects=x}return this._fixInfo(u),u}list(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 cl(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 rn(n),await this._request(`${this.prefix}.STREAM.PURGE.${n}`,r)}async deleteMessage(n,r,a=!0){rn(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){rn(n);const l=await this._request(`${this.prefix}.STREAM.MSG.GET.${n}`,r);return new Bb(l)}find(n){return this.findStream(n)}listKvs(){const n=a=>{var m;const u=a.streams.filter(d=>d.config.name.startsWith(An));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 Ub(d,c))},r=`${this.prefix}.STREAM.LIST`;return new cl(r,n,this)}listObjectStores(){const n=a=>{const u=a.streams.filter(f=>f.config.name.startsWith(dd));return u.forEach(f=>{this._fixInfo(f)}),u.map(f=>new Bh(f))},r=`${this.prefix}.STREAM.LIST`;return new cl(r,n,this)}names(n=""){const r=n!=null&&n.length?{subject:n}:{},a=u=>u.streams,l=`${this.prefix}.STREAM.NAMES`;return new cl(l,a,this,r)}async get(n){const r=await this.info(n);return Promise.resolve(new ju(this,r))}}class R2 extends Ol{constructor(n,r){super(n,r)}async getMessage(n,r){rn(n);let a=r;const{last_by_subj:l}=a;l&&(a=null);const u=a?this.jc.encode(a):Nn,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=Xa(m);if(d)return Promise.reject(d);const y=new Ph(m);return Promise.resolve(y)}async getBatch(n,r){rn(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 Ft,f=await this.nc.requestMany(l,u,{strategy:ir.SentinelMsg});return(async()=>{var g,x,v;let m=!1,d=!1,y;for await(const C of f){if(!m){m=!0;const D=((g=C.headers)==null?void 0:g.code)||0;if(D!==0&&D<200||D>299){y=(x=C.headers)==null?void 0:x.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 Ph(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 Ph{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(Ya.Subject)}get seq(){const n=this.header.last(Ya.Sequence);return typeof n=="string"?parseInt(n):0}get time(){return new Date(Date.parse(this.timestamp))}get timestamp(){return this.header.last(Ya.TimeStamp)}get stream(){return this.header.last(Ya.Stream)}json(n){return ar(n).decode(this.data)}string(){return Tn.decode(this.data)}}k(Ph,"jc");class M2 extends Ol{constructor(r,a){super(r,a);k(this,"streams");k(this,"consumers");k(this,"direct");this.streams=new md(r,a),this.consumers=new gu(r,a),this.direct=new R2(r,a)}async getAccountInfo(){return await this._request(`${this.prefix}.INFO`)}jetstream(){return this.nc.jetstream(this.getOptions())}advisories(){const r=new Ft;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 Bb{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):Nn}get header(){if(!this._header)if(this.smr.message.hdrs){const n=this._parse(this.smr.message.hdrs);this._header=wi.decode(n)}else this._header=Fr();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 ar(n).decode(this.data)}string(){return Tn.decode(this.data)}}k(Bb,"jc");class D2{constructor(n){k(this,"api");this.api=n}get(n){return this.api.info(n).then(r=>new ju(this.api,r))}}class sh{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=wi.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 l0(t){const n={name:t.name,description:t.description??"",options:t.options,metadata:t.metadata};if(t.headers){const r=t.headers;n.headers=r.toRecord()}return n}function z2(){return new ReadableStream({pull(t){t.enqueue(new Uint8Array(0)),t.close()}})}class ml{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 sh(r):null}async list(){const n=[],r=await this.watch({ignoreDeletes:!0,includeHistory:!0});for await(const a of r){if(a===null)break;n.push(a)}return Promise.resolve(n)}async rawInfo(n){const{name:r,error:a}=this._checkNotEmpty(n);if(a)return Promise.reject(a);const l=this._metaSubject(r);try{const u=await this.jsm.streams.getMessage(this.stream,{last_by_subj:l}),f=ar().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 Bh(n)))}async status(n){const r=await this._si(n);return r===null?Promise.reject(new Error("object store not found")):Promise.resolve(new Bh(r))}destroy(){return this.jsm.streams.delete(this.stream)}async _put(n,r,a){var le;const l=this.js.getOptions();a=a||{timeout:l.timeout},a.timeout=a.timeout||l.timeout,a.previousRevision=a.previousRevision??void 0;const{timeout:u,previousRevision:c}=a,f=this.js.nc.info,m=(f==null?void 0:f.max_payload)||1024;n=n||{},n.options=n.options||{};let d=((le=n.options)==null?void 0:le.max_chunk_size)||128*1024;d=d>m?m:d,n.options.max_chunk_size=d;const y=await this.info(n.name),{name:g,error:x}=this._checkNotEmpty(n.name);if(x)return Promise.reject(x);const v=ki.next(),C=this._chunkSubject(v),D=this._metaSubject(g),q=Object.assign({bucket:this.name,nuid:v,size:0,chunks:0},l0(n)),M=kt(),G=[],V=new ts;try{const j=r?r.getReader():null,O=Qy.create();for(;;){const{done:J,value:F}=j?await j.read():{done:!0,value:void 0};if(J){if(V.size()>0){const K=V.drain();O.update(K),q.chunks++,q.size+=K.length,G.push(this.js.publish(C,K,{timeout:u}))}await Promise.all(G),G.length=0,q.mtime=new Date().toISOString();const X=Qa.encode(O.digest());q.digest=`${a0}${X}`,q.deleted=!1;const z=Fr();typeof c=="number"&&z.set(dr.ExpectedLastSubjectSequenceHdr,`${c}`),z.set(ln.RollupHdr,ln.RollupValueSubject);const ie=await this.js.publish(D,ar().encode(q),{headers:z,timeout:u});if(q.revision=ie.seq,y)try{await this.jsm.streams.purge(this.stream,{filter:`$O.${this.name}.C.${y.nuid}`})}catch{}M.resolve(new sh(q));break}if(F)for(V.fill(F);V.size()>d;){q.chunks++,q.size+=d;const X=V.drain(n.options.max_chunk_size);O.update(X),G.push(this.js.publish(C,X,{timeout:u}))}}}catch(j){await this.jsm.streams.purge(this.stream,{filter:C}),M.reject(j)}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 ts,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 ml.create(this.js,r.options.link.bucket):this).get(g)}if(!r.digest.startsWith(a0))return Promise.reject(new Error(`unknown digest type: ${r.digest}`));const a=Mh(r.digest.substring(8));if(a===null)return Promise.reject(new Error(`unable to parse digest: ${r.digest}`));const l=kt(),u={info:new sh(r),error:l};if(r.size===0)return u.data=z2(),l.resolve(null),Promise.resolve(u);let c;const f=Ei();f.orderedConsumer();const m=Qy.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&&(ww(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 ml))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=ar(),l=Fr();return l.set(ln.RollupHdr,ln.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,l0(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 Ft,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=ar(),c=Ei();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.${Qa.encode(n)}`}_metaSubjectAll(){return`$O.${this.name}.M.>`}async init(n={}){try{this.stream=E2(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=xl.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?Ci.S2:Ci.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 ml(r,l,n);return await u.init(a),Promise.resolve(u)}}class L2{constructor(n){k(this,"js");this.js=n}kv(n,r={}){const a=this.js,{ok:l,min:u}=a.nc.features.get(nt.JS_KV);return l?r.bindOnly?Sl.bind(this.js,n,r):Sl.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(nt.JS_OBJECTSTORE);return l?ml.create(this.js,n,r):Promise.reject(new Error(`objectstore is only supported on servers ${u} or better`))}}class pd extends Ol{constructor(r,a){super(r,a);k(this,"consumers");k(this,"streams");k(this,"consumerAPI");k(this,"streamAPI");this.consumerAPI=new gu(r,a),this.streamAPI=new md(r,a),this.consumers=new Hh(this.consumerAPI),this.streams=new D2(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 L2(this)}async publish(r,a=Nn,l){l=l||{},l.expect=l.expect||{};const u=(l==null?void 0:l.headers)||Fr();l&&(l.msgID&&u.set(dr.MsgIdHdr,l.msgID),l.expect.lastMsgID&&u.set(dr.ExpectedLastMsgIdHdr,l.expect.lastMsgID),l.expect.streamName&&u.set(dr.ExpectedStreamHdr,l.expect.streamName),typeof l.expect.lastSequence=="number"&&u.set(dr.ExpectedLastSeqHdr,`${l.expect.lastSequence}`),typeof l.expect.lastSubjectSequence=="number"&&u.set(dr.ExpectedLastSubjectSequenceHdr,`${l.expect.lastSubjectSequence}`));const c=l.timeout||this.timeout,f={};c&&(f.timeout=c),l&&(f.headers=u);let{retries:m,retry_delay:d}=l;m=m||1,d=d||250;let y;for(let x=0;x<m;x++)try{y=await this.nc.request(r,a,f);break}catch(v){if(v.code==="503"&&x+1<m)await as(d);else throw v}const g=this.parseJsResponse(y);if(g.stream==="")throw Te.errorForCode(_e.JetStreamInvalidAck);return g.duplicate=g.duplicate?g.duplicate:!1,g}async pull(r,a,l=0){rn(r),Ja(a);let u=this.timeout;l>u&&(u=l),l=l<0?0:Et(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=Xa(f);if(m)throw m;return _l(f,this.timeout)}fetch(r,a,l={}){rn(r),Ja(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 G=this.nc.features.get(nt.JS_PULL_MAX_BYTES);if(!G.ok)throw new Error(`max_bytes is only supported on servers ${G.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=Et(g)),g===0&&y.no_wait===!1)throw new Error("expires or no_wait is required");const x=l.idle_heartbeat||0;x&&(y.idle_heartbeat=Et(x),l.delay_heartbeat===!0&&(y.idle_heartbeat=Et(x*4)));const v=new Ft,C=y.batch;let D=0;v.protocolFilterFn=(G,V=!1)=>jh(G.msg)?(d==null||d.work(),!1):!0,v.dispatchedFn=G=>{if(G){if(c&&(f+=G.data.length),D++,u&&G.info.pending===0)return;(v.getPending()===1&&G.info.pending===0||C===D||m>0&&f>=m)&&v.stop()}};const q=Pr(this.nc.options.inboxPrefix),M=this.nc.subscribe(q,{max:l.batch,callback:(G,V)=>{G===null&&(G=Xa(V)),G!==null?(u&&(u.cancel(),u=null),iw(G)?v.stop(Hb(G)===null?void 0:G):v.stop(G)):(d==null||d.work(),v.received++,v.push(_l(V,this.timeout)))}});return g&&(u=Wa(g),u.catch(()=>{M.isClosed()||(M.drain().catch(()=>{}),u=null),d&&d.cancel()})),(async()=>{try{x&&(d=new hd(x,G=>(v.push(()=>{v.err=new Te(`${Vn.IdleHeartbeatMissed}: ${G}`,_e.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:q}),v}async pullSubscribe(r,a=Ei()){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===It.None||u===It.All)throw new Error("ack policy for pull consumers must be explicit");const c=this._buildTypedSubscriptionOpts(l),f=new H2(this,l.deliver,c);f.info=l;try{await this._maybeCreateConsumer(l)}catch(m){throw f.unsubscribe(),m}return f}async subscribe(r,a=Ei()){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 qb(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=Ei()){const l=Yy(a)?a.getOpts():a;if(l.isBind=Yy(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!==It.NotSet&&l.config.ack_policy!==It.None)throw new Te("ordered consumer: ack_policy can only be set to 'none'",_e.ApiError);if(l.config.durable_name&&l.config.durable_name.length>0)throw new Te("ordered consumer: durable_name cannot be set",_e.ApiError);if(l.config.deliver_subject&&l.config.deliver_subject.length>0)throw new Te("ordered consumer: deliver_subject cannot be set",_e.ApiError);if(l.config.max_deliver!==void 0&&l.config.max_deliver>1)throw new Te("ordered consumer: max_deliver cannot be set",_e.ApiError);if(l.config.deliver_group&&l.config.deliver_group.length>0)throw new Te("ordered consumer: deliver_group cannot be set",_e.ApiError);l.config.deliver_subject=Pr(this.nc.options.inboxPrefix),l.config.ack_policy=It.None,l.config.max_deliver=1,l.config.flow_control=!0,l.config.idle_heartbeat=l.config.idle_heartbeat||Et(5e3),l.config.ack_wait=Et(1320*60*1e3),l.config.mem_storage=!0,l.config.num_replicas=1}if(l.config.ack_policy===It.NotSet&&(l.config.ack_policy=It.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||Pr(this.nc.options.inboxPrefix),l}_buildTypedSubscriptionOpts(r){const a={};return a.adapter=P2(r.callbackFn===void 0,this.timeout),a.ingestionFilterFn=pd.ingestionFn(r.ordered),a.protocolFilterFn=(l,u=!1)=>{const c=l;return Oh(c.msg)?(u||c.msg.respond(),!1):!0},!r.mack&&r.config.ack_policy!==It.None&&(a.dispatchedFn=$2),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:Rt.All,ack_policy:It.Explicit,ack_wait:Et(30*1e3),replay_policy:es.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(Xa(c.msg)||(m=u.monitor)==null||m.work(),jh(c.msg)){const d=r?u._checkHbOrderConsumer(c.msg):!0;return r||u.info.flow_control.heartbeat_count++,{ingest:d,protocol:!0}}else if(Oh(c.msg))return u.info.flow_control.fc_count++,{ingest:!0,protocol:!0};return{ingest:r?u._checkOrderedConsumer(a):!0,protocol:!1}}}}class gd{constructor(n){k(this,"options");k(this,"protocol");k(this,"draining");k(this,"listeners");k(this,"_services");this.draining=!1,this.options=a2(n),this.listeners=[]}static connect(n={}){return new Promise((r,a)=>{const l=new gd(n);bu.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 Te.errorForCode(_e.ConnectionClosed);if(r&&this.isDraining()||a&&this.protocol.noMorePublishing)throw Te.errorForCode(_e.ConnectionDraining);if(n=n||"",n.length===0)throw Te.errorForCode(_e.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 zb(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=Nn,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||ir.Timer,a.maxWait=a.maxWait||1e3,a.maxWait<1)return Promise.reject(new Te("timeout",_e.InvalidOption));const u=new Ft;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(Pr(this.options.inboxPrefix),{callback:(C,D)=>{var q,M;if(((q=D==null?void 0:D.data)==null?void 0:q.length)===0&&((M=D==null?void 0:D.headers)==null?void 0:M.status)===_e.NoResponders&&(C=Te.errorForCode(_e.NoResponders)),C){m&&(C.stack+=`
|
|
82
|
+
|
|
83
|
+
${m}`),g(C);return}f(null,D),a.strategy===ir.Count&&(d--,d===0&&g()),a.strategy===ir.JitterTimer&&(v(),x=setTimeout(()=>{g()},300)),a.strategy===ir.SentinelMsg&&D&&D.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(D=>{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 x=setTimeout(()=>{g()},a.maxWait);const v=()=>{x&&clearTimeout(x)}}else{const m=a;m.callback=f,u.iterClosed.then(()=>{d.cancel()}).catch(y=>{d.cancel(y)});const d=new Ew(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 Te("timeout",_e.InvalidOption));if(!a.noMux&&a.reply)return Promise.reject(new Te("reply can only be used with noMux",_e.InvalidOption));if(a.noMux){const u=a.reply?a.reply:Pr(this.options.inboxPrefix),c=kt(),f=l?new Error:null,m=this.subscribe(u,{max:1,timeout:a.timeout,callback:(d,y)=>{d?(f&&d.code!==_e.Timeout&&(d.stack+=`
|
|
84
|
+
|
|
85
|
+
${f.stack}`),m.unsubscribe(),c.reject(d)):(d=Cb(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 Ob(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(Te.errorForCode(_e.ConnectionClosed)):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(Te.errorForCode(_e.ConnectionClosed)):this.isDraining()?Promise.reject(Te.errorForCode(_e.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 Ft;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 M2(this,n);if(n.checkAPI!==!1)try{await r.getAccountInfo()}catch(a){const l=a;throw l.code===_e.NoResponders&&(l.code=_e.JetStreamNotEnabled),l}return r}jetstream(n={}){return new pd(this,n)}getServerVersion(){const n=this.info;return n?Zi(n.version):void 0}async rtt(){if(!this.protocol._closed&&!this.protocol.connected)throw Te.errorForCode(_e.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 U2(this)),this._services}reconnect(){return this.isClosed()?Promise.reject(Te.errorForCode(_e.ConnectionClosed)):this.isDraining()?Promise.reject(Te.errorForCode(_e.ConnectionDraining)):this.protocol.reconnect()}}class U2{constructor(n){k(this,"nc");this.nc=n}add(n){try{return new jl(this.nc,n).start()}catch(r){return Promise.reject(r)}}client(n,r){return new g2(this.nc,n,r)}}class B2{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(xu)||"PUT"}get length(){const n=this.sm.header.get(ln.MessageSizeHdr)||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class q2{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(cd(this.sm.info.timestampNanos))}get revision(){return this.sm.seq}get operation(){var n;return((n=this.sm.headers)==null?void 0:n.get(xu))||"PUT"}get delta(){return this.sm.info.pending}get length(){var r;const n=((r=this.sm.headers)==null?void 0:r.get(ln.MessageSizeHdr))||"";return n!==""?parseInt(n,10):this.sm.data.length}json(){return this.sm.json()}string(){return this.sm.string()}}class qb extends Tw{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=Pr(this.js.nc.options.inboxPrefix);this.js.nc._resub(this.sub,a);const u=this.info;u.config.name=ki.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=Rt.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 Te(`unable to recreate ordered consumer ${u.stream} at seq ${r}`,_e.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(cd(r))}_setupHbMonitoring(r,a=0){const l={cancelAfter:0,maxOut:2};a&&(l.cancelAfter=a);const u=this.sub,c=f=>{var y,g,x,v;const m=ow(409,`${Vn.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=((x=(g=this.info)==null?void 0:g.ordered_consumer_sequence)==null?void 0:x.stream_seq)||0;return this._resetOrderedConsumer(C+1),(v=this.monitor)==null||v.restart(),!1}return!u.noIterator};this.monitor=new hd(r,c,l)}_checkHbOrderConsumer(r){const a=r.headers.get(ln.ConsumerStalledHdr);a!==""&&this.js.nc.publish(a);const l=parseInt(r.headers.get(ln.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 H2 extends qb{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(nt.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=Et(f));let m=0;if(n.idle_heartbeat&&n.idle_heartbeat>0&&(m=n.idle_heartbeat,c.idle_heartbeat=Et(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 P2(t,n){return t?F2(n):I2(n)}function I2(t){return(n,r)=>n?[n,null]:(n=Xa(r),n?[n,null]:[null,_l(r,t)])}function F2(t){return(n,r)=>{if(n)return[n,null];const a=Xa(r);return a!==null?[Hb(a),null]:[null,_l(r,t)]}}function Hb(t){if(t!==null)switch(t.code){case _e.JetStream404NoMessages:case _e.JetStream408RequestTimeout:return null;case _e.JetStream409:return uw(t)?t:null;default:return t}return null}function $2(t){t&&t.ack()}function G2(t){const n=t.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 Y2{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=G2(this.reply)),this.di}get redelivered(){return this.info.deliveryCount>1}get reply(){return this.msg.reply||""}get seq(){return this.info.streamSequence}doAck(n){this.didAck||(this.didAck=!this.isWIP(n),this.msg.respond(n))}isWIP(n){return n.length===4&&n[0]===rl[0]&&n[1]===rl[1]&&n[2]===rl[2]&&n[3]===rl[3]}async ackAck(n){var a;n=n||{},n.timeout=n.timeout||this.timeout;const r=kt();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 Ob(u.muxSubscriptions,this.msg.reply,{timeout:n.timeout},c);u.request(f);try{u.publish(this.msg.reply,s0,{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(s0)}nak(n){let r=C2;n&&(r=mu().encode(`-NAK ${JSON.stringify({delay:Et(n)})}`)),this.doAck(r)}working(){this.doAck(rl)}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=Et(r.expires));const l=ar().encode(a),u=ts.concat(A2,O2,l),c=n?{reply:n}:void 0;this.msg.respond(u,c)}term(n=""){let r=T2;(n==null?void 0:n.length)>0&&(r=mu().encode(`+TERM ${n}`)),this.doAck(r)}json(){return this.msg.json()}string(){return this.msg.string()}}const V2="1.30.3",J2="nats.ws";class X2{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=V2,this.lang=J2,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=kt(),this.closedNotification=kt()}async connect(n,r){const a=kt();if(r.tls)return a.reject(new Te("tls",_e.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=ts.concat(...this.yields),f=Dw(c);if(f!==""){const m=o2.exec(f);if(!m){r.debug&&console.error("!!!",Xo(c)),a.reject(new Error("unexpected response from server"));return}try{const d=JSON.parse(m[1]);s2(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 Te(c.message,_e.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 as(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(`> ${Xo(n[r])}`),yield n[r];if(this.done)break;this.yields.length===0&&(n.length=0,this.yields=n,this.signal=kt())}}isEncrypted(){return this.connected&&this.encrypted}send(n){if(!this.isDiscarded())try{this.socket.send(n.buffer),this.options.debug&&console.info(`< ${Xo(n)}`);return}catch(r){this.options.debug&&console.error(`!!! ${Xo(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 Q2(t,n){/^(.*:\/\/)(.*)/.test(t)||(typeof n=="boolean"?t=`${n===!0?"https":"http"}://${t}`:t=`https://${t}`);let a=new URL(t);const l=a.protocol.toLowerCase();l==="ws:"&&(n=!1),l==="wss:"&&(n=!0),l!=="https:"&&l!=="http"&&(t=t.replace(/^(.*:\/\/)(.*)/gm,"$2"),a=new URL(`http://${t}`));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 Pb(t={}){return Ow({defaultPort:443,urlParseFn:Q2,factory:()=>new X2}),gd.connect(t)}const Ib=U.createContext({connected:!1,mode:"disconnected",nc:null,request(){return Promise.reject(new Error("No host connection"))},subscribeEvents(){return()=>{}},activeHost:null,unauthorized:!1}),Z2=2e3,lh=6e3;function K2({children:t}){const{getActiveHost:n}=Tl(),r=n(),[a,l]=U.useState(null),[u,c]=U.useState(!1),f=U.useRef(null),[m,d]=U.useState(!1),[y,g]=U.useState(!1),x=U.useRef(mu()),v=U.useRef(new Set),C=U.useRef(0),D=r!=null&&!!r.directUrl,q=r?D?m?"direct":"disconnected":u?"nats":"disconnected":"disconnected",M=q!=="disconnected";U.useEffect(()=>{g(!1)},[r==null?void 0:r.hostId,r==null?void 0:r.clientToken]),U.useEffect(()=>{if(D){f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1));return}if(!r)return;let le=!1;async function j(){try{const O=await fetch("/api/config");if(!O.ok){console.error("[NATS] Failed to fetch config");return}const J=await O.json();if(!J.natsWsUrl){console.warn("[NATS] No WebSocket URL configured");return}if(le)return;console.log("[NATS] Connecting to",J.natsWsUrl);const F=await Pb({servers:J.natsWsUrl,token:J.natsToken});if(le){F.close().catch(()=>{});return}console.log("[NATS] Connected"),f.current=F,l(F),c(!0),F.closed().then(()=>{console.log("[NATS] Connection closed"),le||(l(null),c(!1),f.current=null)})}catch(O){console.error("[NATS] Connection failed:",O),le||c(!1)}}return j(),()=>{le=!0,f.current&&(f.current.close().catch(()=>{}),f.current=null,l(null),c(!1))}},[D,r]),U.useEffect(()=>{if(!r||!D){d(!1);return}const le=new AbortController;async function j(){var X;const J=new AbortController,F=setTimeout(()=>J.abort(),Z2);le.signal.addEventListener("abort",()=>J.abort());try{const z=await fetch(`${r.directUrl}/events`,{headers:{Authorization:`Bearer ${r.clientToken}`},signal:J.signal});return clearTimeout(F),z.ok?((X=z.body)==null?void 0:X.getReader())??null:null}catch{return clearTimeout(F),null}}async function O(J){d(!0),console.log("[HOST] SSE connected to",r.directUrl),C.current=Date.now();function F(){setTimeout(()=>{le.signal.aborted||Date.now()-C.current<lh||(console.log("[HOST] Heartbeat timeout — no data for",lh/1e3,"s"),le.abort(),d(!1),console.log("[HOST] Direct host unreachable"))},lh)}F();const X=new TextDecoder;let z="";try{for(;;){const{done:ie,value:K}=await J.read();if(ie)break;z+=X.decode(K,{stream:!0}),C.current=Date.now(),F();const ge=z.split(`
|
|
88
|
+
`);z=ge.pop()??"";for(const he of ge)if(he.startsWith("data: ")){const I=he.slice(6);try{const H=JSON.parse(I);if(H.task_id&&H.event_type){const te=`host-event.${r.hostId}.${H.task_id}`;for(const me of v.current)me({subject:te,data:x.current.encode(I)})}}catch{}}}}catch{}}return(async()=>{const J=await j();J&&await O(J)})(),()=>{le.abort(),d(!1)}},[r,D]);const G=U.useCallback(async(le,j,O)=>{if(!r)throw new Error("No active host");function J(ge){ge&&typeof ge=="object"&&ge.error==="Unauthorized"&&g(!0)}if(D){console.log(`[HOST/HTTP] → ${le}`,j??"");const ge=await fetch(`${r.directUrl}/rpc/${le}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.clientToken}`},body:j!=null?JSON.stringify(j):void 0,signal:O!=null&&O.timeout?AbortSignal.timeout(O.timeout):void 0});if(ge.status===401)throw g(!0),new Error("Unauthorized");const he=await ge.json();return J(he),console.log(`[HOST/HTTP] ← ${le}`,he),he}if(!f.current)throw new Error("Not connected");const F=`host.${r.hostId}.rpc.${le}`,X={...j??{},clientToken:r.clientToken},z=x.current.encode(JSON.stringify(X));console.log(`[HOST/NATS] → ${le}`,j??"");const ie=await f.current.request(F,z,{timeout:(O==null?void 0:O.timeout)??1e4}),K=JSON.parse(x.current.decode(ie.data));return J(K),console.log(`[HOST/NATS] ← ${le}`,K),K},[r,D]),V=U.useCallback((le,j)=>{if(D)return v.current.add(j),()=>{v.current.delete(j)};if(f.current){const O=f.current.subscribe(`host-event.${le}.>`);let J=!1;return(async()=>{try{for await(const F of O){if(J)break;j({subject:F.subject,data:F.data})}}catch{}})(),()=>{J=!0,O.unsubscribe()}}return()=>{}},[r,D]);return S.jsx(Ib.Provider,{value:{connected:M,mode:q,nc:a,request:G,subscribeEvents:V,activeHost:r,unauthorized:y},children:t})}function yd(){return U.useContext(Ib)}function vu(t){const n=new Date(t),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 Fb={};function W2(t){for(const n of t)Fb[n.key]=n.label}function Ih(t){return Fb[t]??t}const eE=()=>window.matchMedia("(max-width: 600px)").matches;function tE({task:t,lastEvent:n,onEdit:r,onDelete:a,onViewRun:l}){const{request:u}=yd(),[c,f]=U.useState(!1),[m,d]=U.useState(!1),[y,g]=U.useState(!1),x=U.useRef(null),v=(n==null?void 0:n.running_state)==="started",C=!t.triggers_enabled||t.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)";U.useEffect(()=>{if(!m)return;function F(X){x.current&&!x.current.contains(X.target)&&d(!1)}return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[m]);function D(){eE()?g(!0):d(F=>!F)}function q(){d(!1),g(!1)}async function M(){if(q(),!!confirm("Abort this task?")){f(!0);try{await u("task.abort",{id:t.id})}catch(F){console.error("Abort failed:",F)}finally{f(!1)}}}async function G(){q();try{const F=await u("task.run",{id:t.id});l(t.id,F.run_id)}catch(F){console.error("Run failed:",F)}}async function V(){if(q(),!!confirm("Delete this task? Results and reports will be kept."))try{await u("task.delete",{id:t.id}),a(t.id)}catch(F){console.error("Delete failed:",F)}}const le={started:"Started",finished:"Finished",aborted:"Aborted",failed:"Failed"};function j(F){if(F.type==="once"){const te=new Date(F.value);return isNaN(te.getTime())?F.value:`Once on ${te.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})} at ${te.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`}const X=F.value.split(" ");if(X.length!==5)return F.value;const[z,ie,K,,ge]=X,he=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];if(ie==="*")return"Every hour";const I=new Date;I.setHours(Number(ie),Number(z),0,0);const H=I.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return ge!=="*"?`Weekly on ${he[Number(ge)]??ge} at ${H}`:K!=="*"?`Monthly on day ${K} at ${H}`:`Daily at ${H}`}const O=t.triggers.map(j).join(", "),J=S.jsxs(S.Fragment,{children:[S.jsxs("button",{onClick:()=>{q(),r(t)},children:[S.jsx("span",{className:"menu-icon",children:"✎"}),"Edit"]}),S.jsxs("button",{onClick:()=>{q(),l(t.id)},children:[S.jsx("span",{className:"menu-icon",children:"📄"}),"View All Runs"]}),v?S.jsxs("button",{className:"menu-item-danger",onClick:M,disabled:c,children:[S.jsx("span",{className:"menu-icon",children:"◼"}),"Abort"]}):S.jsxs(S.Fragment,{children:[S.jsxs("button",{onClick:G,children:[S.jsx("span",{className:"menu-icon",children:"▶"}),"Run Now"]}),S.jsxs("button",{className:"menu-item-danger",onClick:V,children:[S.jsx("span",{className:"menu-icon",children:"🗑"}),"Delete"]})]})]});return S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"task-card",onClick:()=>v?l(t.id,"latest"):l(t.id),children:[S.jsxs("div",{className:"task-card-header",children:[S.jsxs("div",{className:"task-card-title-row",children:[v?S.jsx("span",{className:"status-spinner",children:S.jsx("span",{})}):S.jsx("span",{className:"status-dot",style:{backgroundColor:C}}),S.jsx("h3",{className:"task-card-name",children:t.name||t.user_prompt})]}),S.jsx("div",{className:"task-card-actions",onClick:F=>F.stopPropagation(),children:S.jsxs("div",{className:"task-card-menu",ref:x,children:[S.jsx("button",{className:"task-card-menu-btn",onClick:D,"aria-label":"Task actions",children:"⋮"}),m&&S.jsx("div",{className:"task-card-menu-dropdown",children:J})]})})]}),S.jsxs("div",{className:"task-card-meta",children:[t.agent&&S.jsx("span",{className:"task-card-agent",children:Ih(t.agent)}),n&&le[n.running_state]&&S.jsxs("span",{className:"task-card-last-event",children:[le[n.running_state]," ",vu(n.time_stamp)]}),t.triggers.length>0&&S.jsx("span",{className:"task-card-triggers",children:t.triggers_enabled?O:"Triggers disabled"})]})]}),y&&cu.createPortal(S.jsx("div",{className:"bottom-sheet-overlay",onClick:()=>g(!1),children:S.jsxs("div",{className:"bottom-sheet",onClick:F=>F.stopPropagation(),children:[S.jsx("div",{className:"bottom-sheet-handle"}),S.jsx("div",{className:"bottom-sheet-title",children:t.name||t.user_prompt}),S.jsx("div",{className:"bottom-sheet-actions",children:J})]})}),document.body)]})}function nE(t,n){const r={};return(t[t.length-1]===""?[...t,""]:t).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const rE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aE={};function o0(t,n){return(aE.jsx?iE:rE).test(t)}const sE=/[ \t\n\f\r]/g;function lE(t){return typeof t=="object"?t.type==="text"?u0(t.value):!1:u0(t)}function u0(t){return t.replace(sE,"")===""}class Nl{constructor(n,r,a){this.normal=r,this.property=n,a&&(this.space=a)}}Nl.prototype.normal={};Nl.prototype.property={};Nl.prototype.space=void 0;function $b(t,n){const r={},a={};for(const l of t)Object.assign(r,l.property),Object.assign(a,l.normal);return new Nl(r,a,n)}function Fh(t){return t.toLowerCase()}class pn{constructor(n,r){this.attribute=r,this.property=n}}pn.prototype.attribute="";pn.prototype.booleanish=!1;pn.prototype.boolean=!1;pn.prototype.commaOrSpaceSeparated=!1;pn.prototype.commaSeparated=!1;pn.prototype.defined=!1;pn.prototype.mustUseProperty=!1;pn.prototype.number=!1;pn.prototype.overloadedBoolean=!1;pn.prototype.property="";pn.prototype.spaceSeparated=!1;pn.prototype.space=void 0;let oE=0;const Ye=na(),Ut=na(),$h=na(),be=na(),bt=na(),Ka=na(),kn=na();function na(){return 2**++oE}const Gh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:Ut,commaOrSpaceSeparated:kn,commaSeparated:Ka,number:be,overloadedBoolean:$h,spaceSeparated:bt},Symbol.toStringTag,{value:"Module"})),oh=Object.keys(Gh);class bd extends pn{constructor(n,r,a,l){let u=-1;if(super(n,r),c0(this,"space",l),typeof a=="number")for(;++u<oh.length;){const c=oh[u];c0(this,oh[u],(a&Gh[c])===Gh[c])}}}bd.prototype.defined=!0;function c0(t,n,r){r&&(t[n]=r)}function ss(t){const n={},r={};for(const[a,l]of Object.entries(t.properties)){const u=new bd(a,t.transform(t.attributes||{},a),l,t.space);t.mustUseProperty&&t.mustUseProperty.includes(a)&&(u.mustUseProperty=!0),n[a]=u,r[Fh(a)]=a,r[Fh(u.attribute)]=a}return new Nl(n,r,t.space)}const Gb=ss({properties:{ariaActiveDescendant:null,ariaAtomic:Ut,ariaAutoComplete:null,ariaBusy:Ut,ariaChecked:Ut,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:bt,ariaCurrent:null,ariaDescribedBy:bt,ariaDetails:null,ariaDisabled:Ut,ariaDropEffect:bt,ariaErrorMessage:null,ariaExpanded:Ut,ariaFlowTo:bt,ariaGrabbed:Ut,ariaHasPopup:null,ariaHidden:Ut,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:bt,ariaLevel:be,ariaLive:null,ariaModal:Ut,ariaMultiLine:Ut,ariaMultiSelectable:Ut,ariaOrientation:null,ariaOwns:bt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:Ut,ariaReadOnly:Ut,ariaRelevant:null,ariaRequired:Ut,ariaRoleDescription:bt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:Ut,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(t,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Yb(t,n){return n in t?t[n]:n}function Vb(t,n){return Yb(t,n.toLowerCase())}const uE=ss({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ka,acceptCharset:bt,accessKey:bt,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:bt,autoFocus:Ye,autoPlay:Ye,blocking:bt,capture:null,charSet:null,checked:Ye,cite:null,className:bt,cols:be,colSpan:null,content:null,contentEditable:Ut,controls:Ye,controlsList:bt,coords:be|Ka,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:$h,draggable:Ut,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:bt,height:be,hidden:$h,high:be,href:null,hrefLang:null,htmlFor:bt,httpEquiv:bt,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:bt,itemRef:bt,itemScope:Ye,itemType:bt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,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:Ye,optimum:be,pattern:null,ping:bt,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:bt,required:Ye,reversed:Ye,rows:be,rowSpan:be,sandbox:bt,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:Ut,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:Ye,useMap:null,value:Ut,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:bt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:Ut,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ye,disableRemotePlayback:Ye,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:Vb}),cE=ss({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:kn,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:bt,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:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:Ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,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:Ka,g2:Ka,glyphName:Ka,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:kn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,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:be,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:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:bt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kn,rev:kn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kn,requiredFeatures:kn,requiredFonts:kn,requiredFormats:kn,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:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:kn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kn,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Yb}),Jb=ss({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,n){return"xlink:"+n.slice(5).toLowerCase()}}),Xb=ss({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Vb}),Qb=ss({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,n){return"xml:"+n.slice(3).toLowerCase()}}),fE={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"},hE=/[A-Z]/g,f0=/-[a-z]/g,dE=/^data[-\w.:]+$/i;function mE(t,n){const r=Fh(n);let a=n,l=pn;if(r in t.normal)return t.property[t.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&dE.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(f0,gE);a="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!f0.test(u)){let c=u.replace(hE,pE);c.charAt(0)!=="-"&&(c="-"+c),n="data"+c}}l=bd}return new l(a,n)}function pE(t){return"-"+t.toLowerCase()}function gE(t){return t.charAt(1).toUpperCase()}const yE=$b([Gb,uE,Jb,Xb,Qb],"html"),xd=$b([Gb,cE,Jb,Xb,Qb],"svg");function bE(t){return t.join(" ").trim()}var Pa={},uh,h0;function xE(){if(h0)return uh;h0=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
89
|
+
`,d="/",y="*",g="",x="comment",v="declaration";function C(q,M){if(typeof q!="string")throw new TypeError("First argument must be a string");if(!q)return[];M=M||{};var G=1,V=1;function le(he){var I=he.match(n);I&&(G+=I.length);var H=he.lastIndexOf(m);V=~H?he.length-H:V+he.length}function j(){var he={line:G,column:V};return function(I){return I.position=new O(he),X(),I}}function O(he){this.start=he,this.end={line:G,column:V},this.source=M.source}O.prototype.content=q;function J(he){var I=new Error(M.source+":"+G+":"+V+": "+he);if(I.reason=he,I.filename=M.source,I.line=G,I.column=V,I.source=q,!M.silent)throw I}function F(he){var I=he.exec(q);if(I){var H=I[0];return le(H),q=q.slice(H.length),I}}function X(){F(r)}function z(he){var I;for(he=he||[];I=ie();)I!==!1&&he.push(I);return he}function ie(){var he=j();if(!(d!=q.charAt(0)||y!=q.charAt(1))){for(var I=2;g!=q.charAt(I)&&(y!=q.charAt(I)||d!=q.charAt(I+1));)++I;if(I+=2,g===q.charAt(I-1))return J("End of comment missing");var H=q.slice(2,I-2);return V+=2,le(H),q=q.slice(I),V+=2,he({type:x,comment:H})}}function K(){var he=j(),I=F(a);if(I){if(ie(),!F(l))return J("property missing ':'");var H=F(u),te=he({type:v,property:D(I[0].replace(t,g)),value:H?D(H[0].replace(t,g)):g});return F(c),te}}function ge(){var he=[];z(he);for(var I;I=K();)I!==!1&&(he.push(I),z(he));return he}return X(),ge()}function D(q){return q?q.replace(f,g):g}return uh=C,uh}var d0;function vE(){if(d0)return Pa;d0=1;var t=Pa&&Pa.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.default=r;const n=t(xE());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 Pa}var il={},m0;function SE(){if(m0)return il;m0=1,Object.defineProperty(il,"__esModule",{value:!0}),il.camelCase=void 0;var t=/^--[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)||t.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 il.camelCase=m,il}var al,p0;function _E(){if(p0)return al;p0=1;var t=al&&al.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},n=t(vE()),r=SE();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,al=a,al}var wE=_E();const EE=tb(wE),Zb=Kb("end"),vd=Kb("start");function Kb(t){return n;function n(r){const a=r&&r.position&&r.position[t]||{};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 kE(t){const n=vd(t),r=Zb(t);if(n&&r)return{start:n,end:r}}function pl(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?g0(t.position):"start"in t||"end"in t?g0(t):"line"in t||"column"in t?Yh(t):""}function Yh(t){return y0(t&&t.line)+":"+y0(t&&t.column)}function g0(t){return Yh(t&&t.start)+"-"+Yh(t&&t.end)}function y0(t){return t&&typeof t=="number"?t:1}class Wt 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=pl(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}}Wt.prototype.file="";Wt.prototype.name="";Wt.prototype.reason="";Wt.prototype.message="";Wt.prototype.stack="";Wt.prototype.column=void 0;Wt.prototype.line=void 0;Wt.prototype.ancestors=void 0;Wt.prototype.cause=void 0;Wt.prototype.fatal=void 0;Wt.prototype.place=void 0;Wt.prototype.ruleId=void 0;Wt.prototype.source=void 0;const Sd={}.hasOwnProperty,CE=new Map,AE=/[A-Z]/g,TE=new Set(["table","tbody","thead","tfoot","tr"]),OE=new Set(["td","th"]),Wb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jE(t,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=BE(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=UE(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"?xd:yE,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=e1(l,t,void 0);return u&&typeof u!="string"?u:l.create(t,l.Fragment,{children:u||void 0},void 0)}function e1(t,n,r){if(n.type==="element")return NE(t,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return RE(t,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return DE(t,n,r);if(n.type==="mdxjsEsm")return ME(t,n);if(n.type==="root")return zE(t,n,r);if(n.type==="text")return LE(t,n)}function NE(t,n,r){const a=t.schema;let l=a;n.tagName.toLowerCase()==="svg"&&a.space==="html"&&(l=xd,t.schema=l),t.ancestors.push(n);const u=n1(t,n.tagName,!1),c=qE(t,n);let f=wd(t,n);return TE.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!lE(m):!0})),t1(t,c,u,n),_d(c,f),t.ancestors.pop(),t.schema=a,t.create(n,u,c,r)}function RE(t,n){if(n.data&&n.data.estree&&t.evaluater){const a=n.data.estree.body[0];return a.type,t.evaluater.evaluateExpression(a.expression)}wl(t,n.position)}function ME(t,n){if(n.data&&n.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(n.data.estree);wl(t,n.position)}function DE(t,n,r){const a=t.schema;let l=a;n.name==="svg"&&a.space==="html"&&(l=xd,t.schema=l),t.ancestors.push(n);const u=n.name===null?t.Fragment:n1(t,n.name,!0),c=HE(t,n),f=wd(t,n);return t1(t,c,u,n),_d(c,f),t.ancestors.pop(),t.schema=a,t.create(n,u,c,r)}function zE(t,n,r){const a={};return _d(a,wd(t,n)),t.create(n,t.Fragment,a,r)}function LE(t,n){return n.value}function t1(t,n,r,a){typeof r!="string"&&r!==t.Fragment&&t.passNode&&(n.node=a)}function _d(t,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(t.children=r)}}function UE(t,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 BE(t,n){return r;function r(a,l,u,c){const f=Array.isArray(u.children),m=vd(a);return n(l,u,c,f,{columnNumber:m?m.column-1:void 0,fileName:t,lineNumber:m?m.line:void 0},void 0)}}function qE(t,n){const r={};let a,l;for(l in n.properties)if(l!=="children"&&Sd.call(n.properties,l)){const u=PE(t,l,n.properties[l]);if(u){const[c,f]=u;t.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&OE.has(n.tagName)?a=f:r[c]=f}}if(a){const u=r.style||(r.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return r}function HE(t,n){const r={};for(const a of n.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&t.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,t.evaluater.evaluateExpression(f.argument))}else wl(t,n.position);else{const l=a.name;let u;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&t.evaluater){const f=a.value.data.estree.body[0];f.type,u=t.evaluater.evaluateExpression(f.expression)}else wl(t,n.position);else u=a.value===null?!0:a.value;r[l]=u}return r}function wd(t,n){const r=[];let a=-1;const l=t.passKeys?new Map:CE;for(;++a<n.children.length;){const u=n.children[a];let c;if(t.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=e1(t,u,c);f!==void 0&&r.push(f)}return r}function PE(t,n,r){const a=mE(t.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?nE(r):bE(r)),a.property==="style"){let l=typeof r=="object"?r:IE(t,String(r));return t.stylePropertyNameCase==="css"&&(l=FE(l)),["style",l]}return[t.elementAttributeNameCase==="react"&&a.space?fE[a.property]||a.property:a.attribute,r]}}function IE(t,n){try{return EE(n,{reactCompat:!0})}catch(r){if(t.ignoreInvalidStyle)return{};const a=r,l=new Wt("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=t.filePath||void 0,l.url=Wb+"#cannot-parse-style-attribute",l}}function n1(t,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=o0(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=o0(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(a.type==="Literal"){const l=a.value;return Sd.call(t.components,l)?t.components[l]:l}if(t.evaluater)return t.evaluater.evaluateExpression(a);wl(t)}function wl(t,n){const r=new Wt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=t.filePath||void 0,r.url=Wb+"#cannot-handle-mdx-estrees-without-createevaluater",r}function FE(t){const n={};let r;for(r in t)Sd.call(t,r)&&(n[$E(r)]=t[r]);return n}function $E(t){let n=t.replace(AE,GE);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function GE(t){return"-"+t.toLowerCase()}const ch={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"]},YE={};function Ed(t,n){const r=YE,a=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,l=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return r1(t,a,l)}function r1(t,n,r){if(VE(t)){if("value"in t)return t.type==="html"&&!r?"":t.value;if(n&&"alt"in t&&t.alt)return t.alt;if("children"in t)return b0(t.children,n,r)}return Array.isArray(t)?b0(t,n,r):""}function b0(t,n,r){const a=[];let l=-1;for(;++l<t.length;)a[l]=r1(t[l],n,r);return a.join("")}function VE(t){return!!(t&&typeof t=="object")}const x0=document.createElement("i");function kd(t){const n="&"+t+";";x0.innerHTML=n;const r=x0.textContent;return r.charCodeAt(r.length-1)===59&&t!=="semi"||r===n?!1:r}function jn(t,n,r,a){const l=t.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),t.splice(...c);else for(r&&t.splice(n,r);u<a.length;)c=a.slice(u,u+1e4),c.unshift(n,0),t.splice(...c),u+=1e4,n+=1e4}function Jn(t,n){return t.length>0?(jn(t,t.length,0,n),t):n}const v0={}.hasOwnProperty;function i1(t){const n={};let r=-1;for(;++r<t.length;)JE(n,t[r]);return n}function JE(t,n){let r;for(r in n){const l=(v0.call(t,r)?t[r]:void 0)||(t[r]={}),u=n[r];let c;if(u)for(c in u){v0.call(l,c)||(l[c]=[]);const f=u[c];XE(l[c],Array.isArray(f)?f:f?[f]:[])}}}function XE(t,n){let r=-1;const a=[];for(;++r<n.length;)(n[r].add==="after"?t:a).push(n[r]);jn(t,0,0,a)}function a1(t,n){const r=Number.parseInt(t,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 sr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=Ai(/[A-Za-z]/),Kt=Ai(/[\dA-Za-z]/),QE=Ai(/[#-'*+\--9=?A-Z^-~]/);function Su(t){return t!==null&&(t<32||t===127)}const Vh=Ai(/\d/),ZE=Ai(/[\dA-Fa-f]/),KE=Ai(/[!-/:-@[-`{-~]/);function Ue(t){return t!==null&&t<-2}function gt(t){return t!==null&&(t<0||t===32)}function Ze(t){return t===-2||t===-1||t===32}const Nu=Ai(new RegExp("\\p{P}|\\p{S}","u")),Wi=Ai(/\s/);function Ai(t){return n;function n(r){return r!==null&&r>-1&&t.test(String.fromCharCode(r))}}function ls(t){const n=[];let r=-1,a=0,l=0;for(;++r<t.length;){const u=t.charCodeAt(r);let c="";if(u===37&&Kt(t.charCodeAt(r+1))&&Kt(t.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=t.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(t.slice(a,r),encodeURIComponent(c)),a=r+l+1,c=""),l&&(r+=l,l=0)}return n.join("")+t.slice(a)}function tt(t,n,r,a){const l=a?a-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return Ze(m)?(t.enter(r),f(m)):n(m)}function f(m){return Ze(m)&&u++<l?(t.consume(m),f):(t.exit(r),n(m))}}const WE={tokenize:ek};function ek(t){const n=t.attempt(this.parser.constructs.contentInitial,a,l);let r;return n;function a(f){if(f===null){t.consume(f);return}return t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),tt(t,n,"linePrefix")}function l(f){return t.enter("paragraph"),u(f)}function u(f){const m=t.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,c(f)}function c(f){if(f===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(f);return}return Ue(f)?(t.consume(f),t.exit("chunkText"),u):(t.consume(f),c)}}const tk={tokenize:nk},S0={tokenize:rk};function nk(t){const n=this,r=[];let a=0,l,u,c;return f;function f(V){if(a<r.length){const le=r[a];return n.containerState=le[1],t.attempt(le[0].continuation,m,d)(V)}return d(V)}function m(V){if(a++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,l&&G();const le=n.events.length;let j=le,O;for(;j--;)if(n.events[j][0]==="exit"&&n.events[j][1].type==="chunkFlow"){O=n.events[j][1].end;break}M(a);let J=le;for(;J<n.events.length;)n.events[J][1].end={...O},J++;return jn(n.events,j+1,0,n.events.slice(le)),n.events.length=J,d(V)}return f(V)}function d(V){if(a===r.length){if(!l)return x(V);if(l.currentConstruct&&l.currentConstruct.concrete)return C(V);n.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return n.containerState={},t.check(S0,y,g)(V)}function y(V){return l&&G(),M(a),x(V)}function g(V){return n.parser.lazy[n.now().line]=a!==r.length,c=n.now().offset,C(V)}function x(V){return n.containerState={},t.attempt(S0,v,C)(V)}function v(V){return a++,r.push([n.currentConstruct,n.containerState]),x(V)}function C(V){if(V===null){l&&G(),M(0),t.consume(V);return}return l=l||n.parser.flow(n.now()),t.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),D(V)}function D(V){if(V===null){q(t.exit("chunkFlow"),!0),M(0),t.consume(V);return}return Ue(V)?(t.consume(V),q(t.exit("chunkFlow")),a=0,n.interrupt=void 0,f):(t.consume(V),D)}function q(V,le){const j=n.sliceStream(V);if(le&&j.push(null),V.previous=u,u&&(u.next=V),u=V,l.defineSkip(V.start),l.write(j),n.parser.lazy[V.start.line]){let O=l.events.length;for(;O--;)if(l.events[O][1].start.offset<c&&(!l.events[O][1].end||l.events[O][1].end.offset>c))return;const J=n.events.length;let F=J,X,z;for(;F--;)if(n.events[F][0]==="exit"&&n.events[F][1].type==="chunkFlow"){if(X){z=n.events[F][1].end;break}X=!0}for(M(a),O=J;O<n.events.length;)n.events[O][1].end={...z},O++;jn(n.events,F+1,0,n.events.slice(J)),n.events.length=O}}function M(V){let le=r.length;for(;le-- >V;){const j=r[le];n.containerState=j[1],j[0].exit.call(n,t)}r.length=V}function G(){l.write([null]),u=void 0,l=void 0,n.containerState._closeFlow=void 0}}function rk(t,n,r){return tt(t,t.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ns(t){if(t===null||gt(t)||Wi(t))return 1;if(Nu(t))return 2}function Ru(t,n,r){const a=[];let l=-1;for(;++l<t.length;){const u=t[l].resolveAll;u&&!a.includes(u)&&(n=u(n,r),a.push(u))}return n}const Jh={name:"attention",resolveAll:ik,tokenize:ak};function ik(t,n){let r=-1,a,l,u,c,f,m,d,y;for(;++r<t.length;)if(t[r][0]==="enter"&&t[r][1].type==="attentionSequence"&&t[r][1]._close){for(a=r;a--;)if(t[a][0]==="exit"&&t[a][1].type==="attentionSequence"&&t[a][1]._open&&n.sliceSerialize(t[a][1]).charCodeAt(0)===n.sliceSerialize(t[r][1]).charCodeAt(0)){if((t[a][1]._close||t[r][1]._open)&&(t[r][1].end.offset-t[r][1].start.offset)%3&&!((t[a][1].end.offset-t[a][1].start.offset+t[r][1].end.offset-t[r][1].start.offset)%3))continue;m=t[a][1].end.offset-t[a][1].start.offset>1&&t[r][1].end.offset-t[r][1].start.offset>1?2:1;const g={...t[a][1].end},x={...t[r][1].start};_0(g,-m),_0(x,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...t[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...t[r][1].start},end:x},u={type:m>1?"strongText":"emphasisText",start:{...t[a][1].end},end:{...t[r][1].start}},l={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},t[a][1].end={...c.start},t[r][1].start={...f.end},d=[],t[a][1].end.offset-t[a][1].start.offset&&(d=Jn(d,[["enter",t[a][1],n],["exit",t[a][1],n]])),d=Jn(d,[["enter",l,n],["enter",c,n],["exit",c,n],["enter",u,n]]),d=Jn(d,Ru(n.parser.constructs.insideSpan.null,t.slice(a+1,r),n)),d=Jn(d,[["exit",u,n],["enter",f,n],["exit",f,n],["exit",l,n]]),t[r][1].end.offset-t[r][1].start.offset?(y=2,d=Jn(d,[["enter",t[r][1],n],["exit",t[r][1],n]])):y=0,jn(t,a-1,r-a+3,d),r=a+d.length-y-2;break}}for(r=-1;++r<t.length;)t[r][1].type==="attentionSequence"&&(t[r][1].type="data");return t}function ak(t,n){const r=this.parser.constructs.attentionMarkers.null,a=this.previous,l=ns(a);let u;return c;function c(m){return u=m,t.enter("attentionSequence"),f(m)}function f(m){if(m===u)return t.consume(m),f;const d=t.exit("attentionSequence"),y=ns(m),g=!y||y===2&&l||r.includes(m),x=!l||l===2&&y||r.includes(a);return d._open=!!(u===42?g:g&&(l||!x)),d._close=!!(u===42?x:x&&(y||!g)),n(m)}}function _0(t,n){t.column+=n,t.offset+=n,t._bufferIndex+=n}const sk={name:"autolink",tokenize:lk};function lk(t,n,r){let a=0;return l;function l(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(v){return sn(v)?(t.consume(v),c):v===64?r(v):d(v)}function c(v){return v===43||v===45||v===46||Kt(v)?(a=1,f(v)):d(v)}function f(v){return v===58?(t.consume(v),a=0,m):(v===43||v===45||v===46||Kt(v))&&a++<32?(t.consume(v),f):(a=0,d(v))}function m(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),n):v===null||v===32||v===60||Su(v)?r(v):(t.consume(v),m)}function d(v){return v===64?(t.consume(v),y):QE(v)?(t.consume(v),d):r(v)}function y(v){return Kt(v)?g(v):r(v)}function g(v){return v===46?(t.consume(v),a=0,y):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),n):x(v)}function x(v){if((v===45||Kt(v))&&a++<63){const C=v===45?x:g;return t.consume(v),C}return r(v)}}const Rl={partial:!0,tokenize:ok};function ok(t,n,r){return a;function a(u){return Ze(u)?tt(t,l,"linePrefix")(u):l(u)}function l(u){return u===null||Ue(u)?n(u):r(u)}}const s1={continuation:{tokenize:ck},exit:fk,name:"blockQuote",tokenize:uk};function uk(t,n,r){const a=this;return l;function l(c){if(c===62){const f=a.containerState;return f.open||(t.enter("blockQuote",{_container:!0}),f.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(c),t.exit("blockQuoteMarker"),u}return r(c)}function u(c){return Ze(c)?(t.enter("blockQuotePrefixWhitespace"),t.consume(c),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),n):(t.exit("blockQuotePrefix"),n(c))}}function ck(t,n,r){const a=this;return l;function l(c){return Ze(c)?tt(t,u,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return t.attempt(s1,n,r)(c)}}function fk(t){t.exit("blockQuote")}const l1={name:"characterEscape",tokenize:hk};function hk(t,n,r){return a;function a(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),l}function l(u){return KE(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),n):r(u)}}const o1={name:"characterReference",tokenize:dk};function dk(t,n,r){const a=this;let l=0,u,c;return f;function f(g){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),m}function m(g){return g===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(g),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),u=31,c=Kt,y(g))}function d(g){return g===88||g===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(g),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,c=ZE,y):(t.enter("characterReferenceValue"),u=7,c=Vh,y(g))}function y(g){if(g===59&&l){const x=t.exit("characterReferenceValue");return c===Kt&&!kd(a.sliceSerialize(x))?r(g):(t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),t.exit("characterReference"),n)}return c(g)&&l++<u?(t.consume(g),y):r(g)}}const w0={partial:!0,tokenize:pk},E0={concrete:!0,name:"codeFenced",tokenize:mk};function mk(t,n,r){const a=this,l={partial:!0,tokenize:j};let u=0,c=0,f;return m;function m(O){return d(O)}function d(O){const J=a.events[a.events.length-1];return u=J&&J[1].type==="linePrefix"?J[2].sliceSerialize(J[1],!0).length:0,f=O,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),y(O)}function y(O){return O===f?(c++,t.consume(O),y):c<3?r(O):(t.exit("codeFencedFenceSequence"),Ze(O)?tt(t,g,"whitespace")(O):g(O))}function g(O){return O===null||Ue(O)?(t.exit("codeFencedFence"),a.interrupt?n(O):t.check(w0,D,le)(O)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===null||Ue(O)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),g(O)):Ze(O)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),tt(t,v,"whitespace")(O)):O===96&&O===f?r(O):(t.consume(O),x)}function v(O){return O===null||Ue(O)?g(O):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),C(O))}function C(O){return O===null||Ue(O)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),g(O)):O===96&&O===f?r(O):(t.consume(O),C)}function D(O){return t.attempt(l,le,q)(O)}function q(O){return t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),M}function M(O){return u>0&&Ze(O)?tt(t,G,"linePrefix",u+1)(O):G(O)}function G(O){return O===null||Ue(O)?t.check(w0,D,le)(O):(t.enter("codeFlowValue"),V(O))}function V(O){return O===null||Ue(O)?(t.exit("codeFlowValue"),G(O)):(t.consume(O),V)}function le(O){return t.exit("codeFenced"),n(O)}function j(O,J,F){let X=0;return z;function z(I){return O.enter("lineEnding"),O.consume(I),O.exit("lineEnding"),ie}function ie(I){return O.enter("codeFencedFence"),Ze(I)?tt(O,K,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):K(I)}function K(I){return I===f?(O.enter("codeFencedFenceSequence"),ge(I)):F(I)}function ge(I){return I===f?(X++,O.consume(I),ge):X>=c?(O.exit("codeFencedFenceSequence"),Ze(I)?tt(O,he,"whitespace")(I):he(I)):F(I)}function he(I){return I===null||Ue(I)?(O.exit("codeFencedFence"),J(I)):F(I)}}}function pk(t,n,r){const a=this;return l;function l(c){return c===null?r(c):(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),u)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}const fh={name:"codeIndented",tokenize:yk},gk={partial:!0,tokenize:bk};function yk(t,n,r){const a=this;return l;function l(d){return t.enter("codeIndented"),tt(t,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):Ue(d)?t.attempt(gk,c,m)(d):(t.enter("codeFlowValue"),f(d))}function f(d){return d===null||Ue(d)?(t.exit("codeFlowValue"),c(d)):(t.consume(d),f)}function m(d){return t.exit("codeIndented"),n(d)}}function bk(t,n,r){const a=this;return l;function l(c){return a.parser.lazy[a.now().line]?r(c):Ue(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),l):tt(t,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):Ue(c)?l(c):r(c)}}const xk={name:"codeText",previous:Sk,resolve:vk,tokenize:_k};function vk(t){let n=t.length-4,r=3,a,l;if((t[r][1].type==="lineEnding"||t[r][1].type==="space")&&(t[n][1].type==="lineEnding"||t[n][1].type==="space")){for(a=r;++a<n;)if(t[a][1].type==="codeTextData"){t[r][1].type="codeTextPadding",t[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(a=r-1,n++;++a<=n;)l===void 0?a!==n&&t[a][1].type!=="lineEnding"&&(l=a):(a===n||t[a][1].type==="lineEnding")&&(t[l][1].type="codeTextData",a!==l+2&&(t[l][1].end=t[a-1][1].end,t.splice(l+2,a-l-2),n-=a-l-2,a=l+2),l=void 0);return t}function Sk(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _k(t,n,r){let a=0,l,u;return c;function c(g){return t.enter("codeText"),t.enter("codeTextSequence"),f(g)}function f(g){return g===96?(t.consume(g),a++,f):(t.exit("codeTextSequence"),m(g))}function m(g){return g===null?r(g):g===32?(t.enter("space"),t.consume(g),t.exit("space"),m):g===96?(u=t.enter("codeTextSequence"),l=0,y(g)):Ue(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),m):(t.enter("codeTextData"),d(g))}function d(g){return g===null||g===32||g===96||Ue(g)?(t.exit("codeTextData"),m(g)):(t.consume(g),d)}function y(g){return g===96?(t.consume(g),l++,y):l===a?(t.exit("codeTextSequence"),t.exit("codeText"),n(g)):(u.type="codeTextData",d(g))}}class wk{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&&sl(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),sl(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),sl(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);sl(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);sl(this.left,r.reverse())}}}function sl(t,n){let r=0;if(n.length<1e4)t.push(...n);else for(;r<n.length;)t.push(...n.slice(r,r+1e4)),r+=1e4}function u1(t){const n={};let r=-1,a,l,u,c,f,m,d;const y=new wk(t);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,Ek(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 jn(t,0,Number.POSITIVE_INFINITY,y.slice(0)),!d}function Ek(t,n){const r=t.get(n)[1],a=t.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,x=-1,v=r,C=0,D=0;const q=[D];for(;v;){for(;t.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;++x<f.length;)f[x][0]==="exit"&&f[x-1][0]==="enter"&&f[x][1].type===f[x-1][1].type&&f[x][1].start.line!==f[x][1].end.line&&(D=x+1,q.push(D),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):q.pop(),x=q.length;x--;){const M=f.slice(q[x],q[x+1]),G=u.pop();m.push([G,G+M.length-1]),t.splice(G,2,M)}for(m.reverse(),x=-1;++x<m.length;)d[C+m[x][0]]=C+m[x][1],C+=m[x][1]-m[x][0]-1;return d}const kk={resolve:Ak,tokenize:Tk},Ck={partial:!0,tokenize:Ok};function Ak(t){return u1(t),t}function Tk(t,n){let r;return a;function a(f){return t.enter("content"),r=t.enter("chunkContent",{contentType:"content"}),l(f)}function l(f){return f===null?u(f):Ue(f)?t.check(Ck,c,u)(f):(t.consume(f),l)}function u(f){return t.exit("chunkContent"),t.exit("content"),n(f)}function c(f){return t.consume(f),t.exit("chunkContent"),r.next=t.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,l}}function Ok(t,n,r){const a=this;return l;function l(c){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),tt(t,u,"linePrefix")}function u(c){if(c===null||Ue(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):t.interrupt(a.parser.constructs.flow,r,n)(c)}}function c1(t,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?(t.enter(a),t.enter(l),t.enter(u),t.consume(M),t.exit(u),x):M===null||M===32||M===41||Su(M)?r(M):(t.enter(a),t.enter(c),t.enter(f),t.enter("chunkString",{contentType:"string"}),D(M))}function x(M){return M===62?(t.enter(u),t.consume(M),t.exit(u),t.exit(l),t.exit(a),n):(t.enter(f),t.enter("chunkString",{contentType:"string"}),v(M))}function v(M){return M===62?(t.exit("chunkString"),t.exit(f),x(M)):M===null||M===60||Ue(M)?r(M):(t.consume(M),M===92?C:v)}function C(M){return M===60||M===62||M===92?(t.consume(M),v):v(M)}function D(M){return!y&&(M===null||M===41||gt(M))?(t.exit("chunkString"),t.exit(f),t.exit(c),t.exit(a),n(M)):y<d&&M===40?(t.consume(M),y++,D):M===41?(t.consume(M),y--,D):M===null||M===32||M===40||Su(M)?r(M):(t.consume(M),M===92?q:D)}function q(M){return M===40||M===41||M===92?(t.consume(M),D):D(M)}}function f1(t,n,r,a,l,u){const c=this;let f=0,m;return d;function d(v){return t.enter(a),t.enter(l),t.consume(v),t.exit(l),t.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?(t.exit(u),t.enter(l),t.consume(v),t.exit(l),t.exit(a),n):Ue(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),y):(t.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Ue(v)||f++>999?(t.exit("chunkString"),y(v)):(t.consume(v),m||(m=!Ze(v)),v===92?x:g)}function x(v){return v===91||v===92||v===93?(t.consume(v),f++,g):g(v)}}function h1(t,n,r,a,l,u){let c;return f;function f(x){return x===34||x===39||x===40?(t.enter(a),t.enter(l),t.consume(x),t.exit(l),c=x===40?41:x,m):r(x)}function m(x){return x===c?(t.enter(l),t.consume(x),t.exit(l),t.exit(a),n):(t.enter(u),d(x))}function d(x){return x===c?(t.exit(u),m(c)):x===null?r(x):Ue(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),tt(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===c||x===null||Ue(x)?(t.exit("chunkString"),d(x)):(t.consume(x),x===92?g:y)}function g(x){return x===c||x===92?(t.consume(x),y):y(x)}}function gl(t,n){let r;return a;function a(l){return Ue(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),r=!0,a):Ze(l)?tt(t,a,r?"linePrefix":"lineSuffix")(l):n(l)}}const jk={name:"definition",tokenize:Rk},Nk={partial:!0,tokenize:Mk};function Rk(t,n,r){const a=this;let l;return u;function u(v){return t.enter("definition"),c(v)}function c(v){return f1.call(a,t,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function f(v){return l=sr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),m):r(v)}function m(v){return gt(v)?gl(t,d)(v):d(v)}function d(v){return c1(t,y,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function y(v){return t.attempt(Nk,g,g)(v)}function g(v){return Ze(v)?tt(t,x,"whitespace")(v):x(v)}function x(v){return v===null||Ue(v)?(t.exit("definition"),a.parser.defined.push(l),n(v)):r(v)}}function Mk(t,n,r){return a;function a(f){return gt(f)?gl(t,l)(f):r(f)}function l(f){return h1(t,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Ze(f)?tt(t,c,"whitespace")(f):c(f)}function c(f){return f===null||Ue(f)?n(f):r(f)}}const Dk={name:"hardBreakEscape",tokenize:zk};function zk(t,n,r){return a;function a(u){return t.enter("hardBreakEscape"),t.consume(u),l}function l(u){return Ue(u)?(t.exit("hardBreakEscape"),n(u)):r(u)}}const Lk={name:"headingAtx",resolve:Uk,tokenize:Bk};function Uk(t,n){let r=t.length-2,a=3,l,u;return t[a][1].type==="whitespace"&&(a+=2),r-2>a&&t[r][1].type==="whitespace"&&(r-=2),t[r][1].type==="atxHeadingSequence"&&(a===r-1||r-4>a&&t[r-2][1].type==="whitespace")&&(r-=a+1===r?2:4),r>a&&(l={type:"atxHeadingText",start:t[a][1].start,end:t[r][1].end},u={type:"chunkText",start:t[a][1].start,end:t[r][1].end,contentType:"text"},jn(t,a,r-a+1,[["enter",l,n],["enter",u,n],["exit",u,n],["exit",l,n]])),t}function Bk(t,n,r){let a=0;return l;function l(y){return t.enter("atxHeading"),u(y)}function u(y){return t.enter("atxHeadingSequence"),c(y)}function c(y){return y===35&&a++<6?(t.consume(y),c):y===null||gt(y)?(t.exit("atxHeadingSequence"),f(y)):r(y)}function f(y){return y===35?(t.enter("atxHeadingSequence"),m(y)):y===null||Ue(y)?(t.exit("atxHeading"),n(y)):Ze(y)?tt(t,f,"whitespace")(y):(t.enter("atxHeadingText"),d(y))}function m(y){return y===35?(t.consume(y),m):(t.exit("atxHeadingSequence"),f(y))}function d(y){return y===null||y===35||gt(y)?(t.exit("atxHeadingText"),f(y)):(t.consume(y),d)}}const qk=["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"],k0=["pre","script","style","textarea"],Hk={concrete:!0,name:"htmlFlow",resolveTo:Fk,tokenize:$k},Pk={partial:!0,tokenize:Yk},Ik={partial:!0,tokenize:Gk};function Fk(t){let n=t.length;for(;n--&&!(t[n][0]==="enter"&&t[n][1].type==="htmlFlow"););return n>1&&t[n-2][1].type==="linePrefix"&&(t[n][1].start=t[n-2][1].start,t[n+1][1].start=t[n-2][1].start,t.splice(n-2,2)),t}function $k(t,n,r){const a=this;let l,u,c,f,m;return d;function d(E){return y(E)}function y(E){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(E),g}function g(E){return E===33?(t.consume(E),x):E===47?(t.consume(E),u=!0,D):E===63?(t.consume(E),l=3,a.interrupt?n:N):sn(E)?(t.consume(E),c=String.fromCharCode(E),q):r(E)}function x(E){return E===45?(t.consume(E),l=2,v):E===91?(t.consume(E),l=5,f=0,C):sn(E)?(t.consume(E),l=4,a.interrupt?n:N):r(E)}function v(E){return E===45?(t.consume(E),a.interrupt?n:N):r(E)}function C(E){const se="CDATA[";return E===se.charCodeAt(f++)?(t.consume(E),f===se.length?a.interrupt?n:K:C):r(E)}function D(E){return sn(E)?(t.consume(E),c=String.fromCharCode(E),q):r(E)}function q(E){if(E===null||E===47||E===62||gt(E)){const se=E===47,we=c.toLowerCase();return!se&&!u&&k0.includes(we)?(l=1,a.interrupt?n(E):K(E)):qk.includes(c.toLowerCase())?(l=6,se?(t.consume(E),M):a.interrupt?n(E):K(E)):(l=7,a.interrupt&&!a.parser.lazy[a.now().line]?r(E):u?G(E):V(E))}return E===45||Kt(E)?(t.consume(E),c+=String.fromCharCode(E),q):r(E)}function M(E){return E===62?(t.consume(E),a.interrupt?n:K):r(E)}function G(E){return Ze(E)?(t.consume(E),G):z(E)}function V(E){return E===47?(t.consume(E),z):E===58||E===95||sn(E)?(t.consume(E),le):Ze(E)?(t.consume(E),V):z(E)}function le(E){return E===45||E===46||E===58||E===95||Kt(E)?(t.consume(E),le):j(E)}function j(E){return E===61?(t.consume(E),O):Ze(E)?(t.consume(E),j):V(E)}function O(E){return E===null||E===60||E===61||E===62||E===96?r(E):E===34||E===39?(t.consume(E),m=E,J):Ze(E)?(t.consume(E),O):F(E)}function J(E){return E===m?(t.consume(E),m=null,X):E===null||Ue(E)?r(E):(t.consume(E),J)}function F(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||gt(E)?j(E):(t.consume(E),F)}function X(E){return E===47||E===62||Ze(E)?V(E):r(E)}function z(E){return E===62?(t.consume(E),ie):r(E)}function ie(E){return E===null||Ue(E)?K(E):Ze(E)?(t.consume(E),ie):r(E)}function K(E){return E===45&&l===2?(t.consume(E),H):E===60&&l===1?(t.consume(E),te):E===62&&l===4?(t.consume(E),L):E===63&&l===3?(t.consume(E),N):E===93&&l===5?(t.consume(E),Ae):Ue(E)&&(l===6||l===7)?(t.exit("htmlFlowData"),t.check(Pk,Y,ge)(E)):E===null||Ue(E)?(t.exit("htmlFlowData"),ge(E)):(t.consume(E),K)}function ge(E){return t.check(Ik,he,Y)(E)}function he(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),I}function I(E){return E===null||Ue(E)?ge(E):(t.enter("htmlFlowData"),K(E))}function H(E){return E===45?(t.consume(E),N):K(E)}function te(E){return E===47?(t.consume(E),c="",me):K(E)}function me(E){if(E===62){const se=c.toLowerCase();return k0.includes(se)?(t.consume(E),L):K(E)}return sn(E)&&c.length<8?(t.consume(E),c+=String.fromCharCode(E),me):K(E)}function Ae(E){return E===93?(t.consume(E),N):K(E)}function N(E){return E===62?(t.consume(E),L):E===45&&l===2?(t.consume(E),N):K(E)}function L(E){return E===null||Ue(E)?(t.exit("htmlFlowData"),Y(E)):(t.consume(E),L)}function Y(E){return t.exit("htmlFlow"),n(E)}}function Gk(t,n,r){const a=this;return l;function l(c){return Ue(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),u):r(c)}function u(c){return a.parser.lazy[a.now().line]?r(c):n(c)}}function Yk(t,n,r){return a;function a(l){return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),t.attempt(Rl,n,r)}}const Vk={name:"htmlText",tokenize:Jk};function Jk(t,n,r){const a=this;let l,u,c;return f;function f(N){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(N),m}function m(N){return N===33?(t.consume(N),d):N===47?(t.consume(N),j):N===63?(t.consume(N),V):sn(N)?(t.consume(N),F):r(N)}function d(N){return N===45?(t.consume(N),y):N===91?(t.consume(N),u=0,C):sn(N)?(t.consume(N),G):r(N)}function y(N){return N===45?(t.consume(N),v):r(N)}function g(N){return N===null?r(N):N===45?(t.consume(N),x):Ue(N)?(c=g,te(N)):(t.consume(N),g)}function x(N){return N===45?(t.consume(N),v):g(N)}function v(N){return N===62?H(N):N===45?x(N):g(N)}function C(N){const L="CDATA[";return N===L.charCodeAt(u++)?(t.consume(N),u===L.length?D:C):r(N)}function D(N){return N===null?r(N):N===93?(t.consume(N),q):Ue(N)?(c=D,te(N)):(t.consume(N),D)}function q(N){return N===93?(t.consume(N),M):D(N)}function M(N){return N===62?H(N):N===93?(t.consume(N),M):D(N)}function G(N){return N===null||N===62?H(N):Ue(N)?(c=G,te(N)):(t.consume(N),G)}function V(N){return N===null?r(N):N===63?(t.consume(N),le):Ue(N)?(c=V,te(N)):(t.consume(N),V)}function le(N){return N===62?H(N):V(N)}function j(N){return sn(N)?(t.consume(N),O):r(N)}function O(N){return N===45||Kt(N)?(t.consume(N),O):J(N)}function J(N){return Ue(N)?(c=J,te(N)):Ze(N)?(t.consume(N),J):H(N)}function F(N){return N===45||Kt(N)?(t.consume(N),F):N===47||N===62||gt(N)?X(N):r(N)}function X(N){return N===47?(t.consume(N),H):N===58||N===95||sn(N)?(t.consume(N),z):Ue(N)?(c=X,te(N)):Ze(N)?(t.consume(N),X):H(N)}function z(N){return N===45||N===46||N===58||N===95||Kt(N)?(t.consume(N),z):ie(N)}function ie(N){return N===61?(t.consume(N),K):Ue(N)?(c=ie,te(N)):Ze(N)?(t.consume(N),ie):X(N)}function K(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(t.consume(N),l=N,ge):Ue(N)?(c=K,te(N)):Ze(N)?(t.consume(N),K):(t.consume(N),he)}function ge(N){return N===l?(t.consume(N),l=void 0,I):N===null?r(N):Ue(N)?(c=ge,te(N)):(t.consume(N),ge)}function he(N){return N===null||N===34||N===39||N===60||N===61||N===96?r(N):N===47||N===62||gt(N)?X(N):(t.consume(N),he)}function I(N){return N===47||N===62||gt(N)?X(N):r(N)}function H(N){return N===62?(t.consume(N),t.exit("htmlTextData"),t.exit("htmlText"),n):r(N)}function te(N){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),me}function me(N){return Ze(N)?tt(t,Ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):Ae(N)}function Ae(N){return t.enter("htmlTextData"),c(N)}}const Cd={name:"labelEnd",resolveAll:Kk,resolveTo:Wk,tokenize:eC},Xk={tokenize:tC},Qk={tokenize:nC},Zk={tokenize:rC};function Kk(t){let n=-1;const r=[];for(;++n<t.length;){const a=t[n][1];if(r.push(t[n]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const l=a.type==="labelImage"?4:2;a.type="data",n+=l}}return t.length!==r.length&&jn(t,0,t.length,r),t}function Wk(t,n){let r=t.length,a=0,l,u,c,f;for(;r--;)if(l=t[r][1],u){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;t[r][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(t[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:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[u][1].start},end:{...t[c][1].end}},y={type:"labelText",start:{...t[u+a+2][1].end},end:{...t[c-2][1].start}};return f=[["enter",m,n],["enter",d,n]],f=Jn(f,t.slice(u+1,u+a+3)),f=Jn(f,[["enter",y,n]]),f=Jn(f,Ru(n.parser.constructs.insideSpan.null,t.slice(u+a+4,c-3),n)),f=Jn(f,[["exit",y,n],t[c-2],t[c-1],["exit",d,n]]),f=Jn(f,t.slice(c+1)),f=Jn(f,[["exit",m,n]]),jn(t,u,t.length,f),t}function eC(t,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(x){return u?u._inactive?g(x):(c=a.parser.defined.includes(sr(a.sliceSerialize({start:u.end,end:a.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(x),t.exit("labelMarker"),t.exit("labelEnd"),m):r(x)}function m(x){return x===40?t.attempt(Xk,y,c?y:g)(x):x===91?t.attempt(Qk,y,c?d:g)(x):c?y(x):g(x)}function d(x){return t.attempt(Zk,y,g)(x)}function y(x){return n(x)}function g(x){return u._balanced=!0,r(x)}}function tC(t,n,r){return a;function a(g){return t.enter("resource"),t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),l}function l(g){return gt(g)?gl(t,u)(g):u(g)}function u(g){return g===41?y(g):c1(t,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return gt(g)?gl(t,m)(g):y(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?h1(t,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function d(g){return gt(g)?gl(t,y)(g):y(g)}function y(g){return g===41?(t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),t.exit("resource"),n):r(g)}}function nC(t,n,r){const a=this;return l;function l(f){return f1.call(a,t,u,c,"reference","referenceMarker","referenceString")(f)}function u(f){return a.parser.defined.includes(sr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function c(f){return r(f)}}function rC(t,n,r){return a;function a(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),l}function l(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),n):r(u)}}const iC={name:"labelStartImage",resolveAll:Cd.resolveAll,tokenize:aC};function aC(t,n,r){const a=this;return l;function l(f){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(f),t.exit("labelImageMarker"),u}function u(f){return f===91?(t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelImage"),c):r(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(f):n(f)}}const sC={name:"labelStartLink",resolveAll:Cd.resolveAll,tokenize:lC};function lC(t,n,r){const a=this;return l;function l(c){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(c),t.exit("labelMarker"),t.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?r(c):n(c)}}const hh={name:"lineEnding",tokenize:oC};function oC(t,n){return r;function r(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),tt(t,n,"linePrefix")}}const ou={name:"thematicBreak",tokenize:uC};function uC(t,n,r){let a=0,l;return u;function u(d){return t.enter("thematicBreak"),c(d)}function c(d){return l=d,f(d)}function f(d){return d===l?(t.enter("thematicBreakSequence"),m(d)):a>=3&&(d===null||Ue(d))?(t.exit("thematicBreak"),n(d)):r(d)}function m(d){return d===l?(t.consume(d),a++,m):(t.exit("thematicBreakSequence"),Ze(d)?tt(t,f,"whitespace")(d):f(d))}}const mn={continuation:{tokenize:dC},exit:pC,name:"list",tokenize:hC},cC={partial:!0,tokenize:gC},fC={partial:!0,tokenize:mC};function hC(t,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:Vh(v)){if(a.containerState.type||(a.containerState.type=C,t.enter(C,{_container:!0})),C==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(ou,r,d)(v):d(v);if(!a.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),m(v)}return r(v)}function m(v){return Vh(v)&&++c<10?(t.consume(v),m):(!a.interrupt||c<2)&&(a.containerState.marker?v===a.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),d(v)):r(v)}function d(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||v,t.check(Rl,a.interrupt?r:y,t.attempt(cC,x,g))}function y(v){return a.containerState.initialBlankLine=!0,u++,x(v)}function g(v){return Ze(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),x):r(v)}function x(v){return a.containerState.size=u+a.sliceSerialize(t.exit("listItemPrefix"),!0).length,n(v)}}function dC(t,n,r){const a=this;return a.containerState._closeFlow=void 0,t.check(Rl,l,u);function l(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,tt(t,n,"listItemIndent",a.containerState.size+1)(f)}function u(f){return a.containerState.furtherBlankLines||!Ze(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,t.attempt(fC,n,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,tt(t,t.attempt(mn,n,r),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function mC(t,n,r){const a=this;return tt(t,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 pC(t){t.exit(this.containerState.type)}function gC(t,n,r){const a=this;return tt(t,l,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const c=a.events[a.events.length-1];return!Ze(u)&&c&&c[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const C0={name:"setextUnderline",resolveTo:yC,tokenize:bC};function yC(t,n){let r=t.length,a,l,u;for(;r--;)if(t[r][0]==="enter"){if(t[r][1].type==="content"){a=r;break}t[r][1].type==="paragraph"&&(l=r)}else t[r][1].type==="content"&&t.splice(r,1),!u&&t[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...t[a][1].start},end:{...t[t.length-1][1].end}};return t[l][1].type="setextHeadingText",u?(t.splice(l,0,["enter",c,n]),t.splice(u+1,0,["exit",t[a][1],n]),t[a][1].end={...t[u][1].end}):t[a][1]=c,t.push(["exit",c,n]),t}function bC(t,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)?(t.enter("setextHeadingLine"),l=d,c(d)):r(d)}function c(d){return t.enter("setextHeadingLineSequence"),f(d)}function f(d){return d===l?(t.consume(d),f):(t.exit("setextHeadingLineSequence"),Ze(d)?tt(t,m,"lineSuffix")(d):m(d))}function m(d){return d===null||Ue(d)?(t.exit("setextHeadingLine"),n(d)):r(d)}}const xC={tokenize:vC};function vC(t){const n=this,r=t.attempt(Rl,a,t.attempt(this.parser.constructs.flowInitial,l,tt(t,t.attempt(this.parser.constructs.flow,l,t.attempt(kk,l)),"linePrefix")));return r;function a(u){if(u===null){t.consume(u);return}return t.enter("lineEndingBlank"),t.consume(u),t.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function l(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),n.currentConstruct=void 0,r}}const SC={resolveAll:m1()},_C=d1("string"),wC=d1("text");function d1(t){return{resolveAll:m1(t==="text"?EC:void 0),tokenize:n};function n(r){const a=this,l=this.parser.constructs[t],u=r.attempt(l,c,f);return c;function c(y){return d(y)?u(y):f(y)}function f(y){if(y===null){r.consume(y);return}return r.enter("data"),r.consume(y),m}function m(y){return d(y)?(r.exit("data"),u(y)):(r.consume(y),m)}function d(y){if(y===null)return!0;const g=l[y];let x=-1;if(g)for(;++x<g.length;){const v=g[x];if(!v.previous||v.previous.call(a,a.previous))return!0}return!1}}}function m1(t){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 t?t(r,a):r}}function EC(t,n){let r=0;for(;++r<=t.length;)if((r===t.length||t[r][1].type==="lineEnding")&&t[r-1][1].type==="data"){const a=t[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===t.length&&(f=0),f){const d={type:r===t.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):(t.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return t}const kC={42:mn,43:mn,45:mn,48:mn,49:mn,50:mn,51:mn,52:mn,53:mn,54:mn,55:mn,56:mn,57:mn,62:s1},CC={91:jk},AC={[-2]:fh,[-1]:fh,32:fh},TC={35:Lk,42:ou,45:[C0,ou],60:Hk,61:C0,95:ou,96:E0,126:E0},OC={38:o1,92:l1},jC={[-5]:hh,[-4]:hh,[-3]:hh,33:iC,38:o1,42:Jh,60:[sk,Vk],91:sC,92:[Dk,l1],93:Cd,95:Jh,96:xk},NC={null:[Jh,SC]},RC={null:[42,95]},MC={null:[]},DC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:RC,contentInitial:CC,disable:MC,document:kC,flow:TC,flowInitial:AC,insideSpan:NC,string:OC,text:jC},Symbol.toStringTag,{value:"Module"}));function zC(t,n,r){let a={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const l={},u=[];let c=[],f=[];const m={attempt:J(j),check:J(O),consume:G,enter:V,exit:le,interrupt:J(O,{interrupt:!0})},d={code:null,containerState:{},defineSkip:D,events:[],now:C,parser:t,previous:null,sliceSerialize:x,sliceStream:v,write:g};let y=n.tokenize.call(d,m);return n.resolveAll&&u.push(n),d;function g(ie){return c=Jn(c,ie),q(),c[c.length-1]!==null?[]:(F(n,0),d.events=Ru(u,d.events,d),d.events)}function x(ie,K){return UC(v(ie),K)}function v(ie){return LC(c,ie)}function C(){const{_bufferIndex:ie,_index:K,line:ge,column:he,offset:I}=a;return{_bufferIndex:ie,_index:K,line:ge,column:he,offset:I}}function D(ie){l[ie.line]=ie.column,z()}function q(){let ie;for(;a._index<c.length;){const K=c[a._index];if(typeof K=="string")for(ie=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===ie&&a._bufferIndex<K.length;)M(K.charCodeAt(a._bufferIndex));else M(K)}}function M(ie){y=y(ie)}function G(ie){Ue(ie)?(a.line++,a.column=1,a.offset+=ie===-3?2:1,z()):ie!==-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=ie}function V(ie,K){const ge=K||{};return ge.type=ie,ge.start=C(),d.events.push(["enter",ge,d]),f.push(ge),ge}function le(ie){const K=f.pop();return K.end=C(),d.events.push(["exit",K,d]),K}function j(ie,K){F(ie,K.from)}function O(ie,K){K.restore()}function J(ie,K){return ge;function ge(he,I,H){let te,me,Ae,N;return Array.isArray(he)?Y(he):"tokenize"in he?Y([he]):L(he);function L(xe){return Oe;function Oe(ze){const Ce=ze!==null&&xe[ze],Me=ze!==null&&xe.null,Le=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(Me)?Me:Me?[Me]:[]];return Y(Le)(ze)}}function Y(xe){return te=xe,me=0,xe.length===0?H:E(xe[me])}function E(xe){return Oe;function Oe(ze){return N=X(),Ae=xe,xe.partial||(d.currentConstruct=xe),xe.name&&d.parser.constructs.disable.null.includes(xe.name)?we():xe.tokenize.call(K?Object.assign(Object.create(d),K):d,m,se,we)(ze)}}function se(xe){return ie(Ae,N),I}function we(xe){return N.restore(),++me<te.length?E(te[me]):H}}}function F(ie,K){ie.resolveAll&&!u.includes(ie)&&u.push(ie),ie.resolve&&jn(d.events,K,d.events.length-K,ie.resolve(d.events.slice(K),d)),ie.resolveTo&&(d.events=ie.resolveTo(d.events,d))}function X(){const ie=C(),K=d.previous,ge=d.currentConstruct,he=d.events.length,I=Array.from(f);return{from:he,restore:H};function H(){a=ie,d.previous=K,d.currentConstruct=ge,d.events.length=he,f=I,z()}}function z(){a.line in l&&a.column<2&&(a.column=l[a.line],a.offset+=l[a.line]-1)}}function LC(t,n){const r=n.start._index,a=n.start._bufferIndex,l=n.end._index,u=n.end._bufferIndex;let c;if(r===l)c=[t[r].slice(a,u)];else{if(c=t.slice(r,l),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}u>0&&c.push(t[l].slice(0,u))}return c}function UC(t,n){let r=-1;const a=[];let l;for(;++r<t.length;){const u=t[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
|
|
90
|
+
`;break}case-3:{c=`\r
|
|
91
|
+
`;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 BC(t){const a={constructs:i1([DC,...(t||{}).extensions||[]]),content:l(WE),defined:[],document:l(tk),flow:l(xC),lazy:{},string:l(_C),text:l(wC)};return a;function l(u){return c;function c(f){return zC(a,u,f)}}}function qC(t){for(;!u1(t););return t}const A0=/[\0\t\n\r]/g;function HC(){let t=1,n="",r=!0,a;return l;function l(u,c,f){const m=[];let d,y,g,x,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(A0.lastIndex=g,d=A0.exec(u),x=d&&d.index!==void 0?d.index:u.length,v=u.charCodeAt(x),!d){n=u.slice(g);break}if(v===10&&g===x&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<x&&(m.push(u.slice(g,x)),t+=x-g),v){case 0:{m.push(65533),t++;break}case 9:{for(y=Math.ceil(t/4)*4,m.push(-2);t++<y;)m.push(-1);break}case 10:{m.push(-4),t=1;break}default:a=!0,t=1}g=x+1}return f&&(a&&m.push(-5),n&&m.push(n),m.push(null)),m}}const PC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function IC(t){return t.replace(PC,FC)}function FC(t,n,r){if(n)return n;if(r.charCodeAt(0)===35){const l=r.charCodeAt(1),u=l===120||l===88;return a1(r.slice(u?2:1),u?16:10)}return kd(r)||t}const p1={}.hasOwnProperty;function $C(t,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),GC(r)(qC(BC(r).document().write(HC()(t,n,!0))))}function GC(t){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(_t),autolinkProtocol:X,autolinkEmail:X,atxHeading:u(Rn),blockQuote:u(Me),characterEscape:X,characterReference:X,codeFenced:u(Le),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(Le,c),codeText:u(Fe,c),codeTextData:X,data:X,codeFlowValue:X,definition:u(gn),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(Xt),hardBreakEscape:u(ve),hardBreakTrailing:u(ve),htmlFlow:u(Pe,c),htmlFlowData:X,htmlText:u(Pe,c),htmlTextData:X,image:u(He),label:c,link:u(_t),listItem:u(Qn),listItemValue:x,listOrdered:u(Mn,g),listUnordered:u(Mn),paragraph:u(ra),reference:E,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(Rn),strong:u(Gr),thematicBreak:u(os)},exit:{atxHeading:m(),atxHeadingSequence:j,autolink:m(),autolinkEmail:Ce,autolinkProtocol:ze,blockQuote:m(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:we,characterReferenceMarkerNumeric:we,characterReferenceValue:xe,characterReference:Oe,codeFenced:m(q),codeFencedFence:D,codeFencedFenceInfo:v,codeFencedFenceMeta:C,codeFlowValue:z,codeIndented:m(M),codeText:m(I),codeTextData:z,data:z,definition:m(),definitionDestinationString:le,definitionLabelString:G,definitionTitleString:V,emphasis:m(),hardBreakEscape:m(K),hardBreakTrailing:m(K),htmlFlow:m(ge),htmlFlowData:z,htmlText:m(he),htmlTextData:z,image:m(te),label:Ae,labelText:me,lineEnding:ie,link:m(H),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:se,resourceDestinationString:N,resourceTitleString:L,resource:Y,setextHeading:m(F),setextHeadingLineSequence:J,setextHeadingText:O,strong:m(),thematicBreak:m()}};g1(n,(t||{}).mdastExtensions||[]);const r={};return a;function a(ue){let Se={type:"root",children:[]};const qe={stack:[Se],tokenStack:[],config:n,enter:f,exit:d,buffer:c,resume:y,data:r},Ve=[];let rt=-1;for(;++rt<ue.length;)if(ue[rt][1].type==="listOrdered"||ue[rt][1].type==="listUnordered")if(ue[rt][0]==="enter")Ve.push(rt);else{const en=Ve.pop();rt=l(ue,en,rt)}for(rt=-1;++rt<ue.length;){const en=n[ue[rt][0]];p1.call(en,ue[rt][1].type)&&en[ue[rt][1].type].call(Object.assign({sliceSerialize:ue[rt][2].sliceSerialize},qe),ue[rt][1])}if(qe.tokenStack.length>0){const en=qe.tokenStack[qe.tokenStack.length-1];(en[1]||T0).call(qe,void 0,en[0])}for(Se.position={start:Si(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Si(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},rt=-1;++rt<n.transforms.length;)Se=n.transforms[rt](Se)||Se;return Se}function l(ue,Se,qe){let Ve=Se-1,rt=-1,en=!1,Dn,$t,dt,Bt;for(;++Ve<=qe;){const lt=ue[Ve];switch(lt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{lt[0]==="enter"?rt++:rt--,Bt=void 0;break}case"lineEndingBlank":{lt[0]==="enter"&&(Dn&&!Bt&&!rt&&!dt&&(dt=Ve),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!rt&<[0]==="enter"&<[1].type==="listItemPrefix"||rt===-1&<[0]==="exit"&&(lt[1].type==="listUnordered"||lt[1].type==="listOrdered")){if(Dn){let zn=Ve;for($t=void 0;zn--;){const tn=ue[zn];if(tn[1].type==="lineEnding"||tn[1].type==="lineEndingBlank"){if(tn[0]==="exit")continue;$t&&(ue[$t][1].type="lineEndingBlank",en=!0),tn[1].type="lineEnding",$t=zn}else if(!(tn[1].type==="linePrefix"||tn[1].type==="blockQuotePrefix"||tn[1].type==="blockQuotePrefixWhitespace"||tn[1].type==="blockQuoteMarker"||tn[1].type==="listItemIndent"))break}dt&&(!$t||dt<$t)&&(Dn._spread=!0),Dn.end=Object.assign({},$t?ue[$t][1].start:lt[1].end),ue.splice($t||Ve,0,["exit",Dn,lt[2]]),Ve++,qe++}if(lt[1].type==="listItemPrefix"){const zn={type:"listItem",_spread:!1,start:Object.assign({},lt[1].start),end:void 0};Dn=zn,ue.splice(Ve,0,["enter",zn,lt[2]]),Ve++,qe++,dt=void 0,Bt=!0}}}return ue[Se][1]._spread=en,qe}function u(ue,Se){return qe;function qe(Ve){f.call(this,ue(Ve),Ve),Se&&Se.call(this,Ve)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ue,Se,qe){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([Se,qe||void 0]),ue.position={start:Si(Se.start),end:void 0}}function m(ue){return Se;function Se(qe){ue&&ue.call(this,qe),d.call(this,qe)}}function d(ue,Se){const qe=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==ue.type&&(Se?Se.call(this,ue,Ve[0]):(Ve[1]||T0).call(this,ue,Ve[0]));else throw new Error("Cannot close `"+ue.type+"` ("+pl({start:ue.start,end:ue.end})+"): it’s not open");qe.position.end=Si(ue.end)}function y(){return Ed(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(ue){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=ue}function C(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=ue}function D(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function q(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue.replace(/(\r?\n|\r)$/g,"")}function G(ue){const Se=this.resume(),qe=this.stack[this.stack.length-1];qe.label=Se,qe.identifier=sr(this.sliceSerialize(ue)).toLowerCase()}function V(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ue}function le(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ue}function j(ue){const Se=this.stack[this.stack.length-1];if(!Se.depth){const qe=this.sliceSerialize(ue).length;Se.depth=qe}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function J(ue){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function X(ue){const qe=this.stack[this.stack.length-1].children;let Ve=qe[qe.length-1];(!Ve||Ve.type!=="text")&&(Ve=yt(),Ve.position={start:Si(ue.start),end:void 0},qe.push(Ve)),this.stack.push(Ve)}function z(ue){const Se=this.stack.pop();Se.value+=this.sliceSerialize(ue),Se.position.end=Si(ue.end)}function ie(ue){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const qe=Se.children[Se.children.length-1];qe.position.end=Si(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(Se.type)&&(X.call(this,ue),z.call(this,ue))}function K(){this.data.atHardBreak=!0}function ge(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue}function he(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue}function I(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue}function H(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=Se,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function te(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=Se,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function me(ue){const Se=this.sliceSerialize(ue),qe=this.stack[this.stack.length-2];qe.label=IC(Se),qe.identifier=sr(Se).toLowerCase()}function Ae(){const ue=this.stack[this.stack.length-1],Se=this.resume(),qe=this.stack[this.stack.length-1];if(this.data.inReference=!0,qe.type==="link"){const Ve=ue.children;qe.children=Ve}else qe.alt=Se}function N(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ue}function L(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ue}function Y(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function se(ue){const Se=this.resume(),qe=this.stack[this.stack.length-1];qe.label=Se,qe.identifier=sr(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function we(ue){this.data.characterReferenceType=ue.type}function xe(ue){const Se=this.sliceSerialize(ue),qe=this.data.characterReferenceType;let Ve;qe?(Ve=a1(Se,qe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=kd(Se);const rt=this.stack[this.stack.length-1];rt.value+=Ve}function Oe(ue){const Se=this.stack.pop();Se.position.end=Si(ue.end)}function ze(ue){z.call(this,ue);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(ue)}function Ce(ue){z.call(this,ue);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(ue)}function Me(){return{type:"blockquote",children:[]}}function Le(){return{type:"code",lang:null,meta:null,value:""}}function Fe(){return{type:"inlineCode",value:""}}function gn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Xt(){return{type:"emphasis",children:[]}}function Rn(){return{type:"heading",depth:0,children:[]}}function ve(){return{type:"break"}}function Pe(){return{type:"html",value:""}}function He(){return{type:"image",title:null,url:"",alt:null}}function _t(){return{type:"link",title:null,url:"",children:[]}}function Mn(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function Qn(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function ra(){return{type:"paragraph",children:[]}}function Gr(){return{type:"strong",children:[]}}function yt(){return{type:"text",value:""}}function os(){return{type:"thematicBreak"}}}function Si(t){return{line:t.line,column:t.column,offset:t.offset}}function g1(t,n){let r=-1;for(;++r<n.length;){const a=n[r];Array.isArray(a)?g1(t,a):YC(t,a)}}function YC(t,n){let r;for(r in n)if(p1.call(n,r))switch(r){case"canContainEols":{const a=n[r];a&&t[r].push(...a);break}case"transforms":{const a=n[r];a&&t[r].push(...a);break}case"enter":case"exit":{const a=n[r];a&&Object.assign(t[r],a);break}}}function T0(t,n){throw t?new Error("Cannot close `"+t.type+"` ("+pl({start:t.start,end:t.end})+"): a different token (`"+n.type+"`, "+pl({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+pl({start:n.start,end:n.end})+") is still open")}function VC(t){const n=this;n.parser=r;function r(a){return $C(a,{...n.data("settings"),...t,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function JC(t,n){const r={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(n),!0)};return t.patch(n,r),t.applyData(n,r)}function XC(t,n){const r={type:"element",tagName:"br",properties:{},children:[]};return t.patch(n,r),[t.applyData(n,r),{type:"text",value:`
|
|
92
|
+
`}]}function QC(t,n){const r=n.value?n.value+`
|
|
93
|
+
`:"",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}),t.patch(n,u),u=t.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},t.patch(n,u),u}function ZC(t,n){const r={type:"element",tagName:"del",properties:{},children:t.all(n)};return t.patch(n,r),t.applyData(n,r)}function KC(t,n){const r={type:"element",tagName:"em",properties:{},children:t.all(n)};return t.patch(n,r),t.applyData(n,r)}function WC(t,n){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",a=String(n.identifier).toUpperCase(),l=ls(a.toLowerCase()),u=t.footnoteOrder.indexOf(a);let c,f=t.footnoteCounts.get(a);f===void 0?(f=0,t.footnoteOrder.push(a),c=t.footnoteOrder.length):c=u+1,f+=1,t.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)}]};t.patch(n,m);const d={type:"element",tagName:"sup",properties:{},children:[m]};return t.patch(n,d),t.applyData(n,d)}function eA(t,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:t.all(n)};return t.patch(n,r),t.applyData(n,r)}function tA(t,n){if(t.options.allowDangerousHtml){const r={type:"raw",value:n.value};return t.patch(n,r),t.applyData(n,r)}}function y1(t,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=t.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 nA(t,n){const r=String(n.identifier).toUpperCase(),a=t.definitionById.get(r);if(!a)return y1(t,n);const l={src:ls(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 t.patch(n,u),t.applyData(n,u)}function rA(t,n){const r={src:ls(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 t.patch(n,a),t.applyData(n,a)}function iA(t,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};t.patch(n,r);const a={type:"element",tagName:"code",properties:{},children:[r]};return t.patch(n,a),t.applyData(n,a)}function aA(t,n){const r=String(n.identifier).toUpperCase(),a=t.definitionById.get(r);if(!a)return y1(t,n);const l={href:ls(a.url||"")};a.title!==null&&a.title!==void 0&&(l.title=a.title);const u={type:"element",tagName:"a",properties:l,children:t.all(n)};return t.patch(n,u),t.applyData(n,u)}function sA(t,n){const r={href:ls(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const a={type:"element",tagName:"a",properties:r,children:t.all(n)};return t.patch(n,a),t.applyData(n,a)}function lA(t,n,r){const a=t.all(n),l=r?oA(r):b1(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:`
|
|
94
|
+
`}),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:`
|
|
95
|
+
`});const d={type:"element",tagName:"li",properties:u,children:c};return t.patch(n,d),t.applyData(n,d)}function oA(t){let n=!1;if(t.type==="list"){n=t.spread||!1;const r=t.children;let a=-1;for(;!n&&++a<r.length;)n=b1(r[a])}return n}function b1(t){const n=t.spread;return n??t.children.length>1}function uA(t,n){const r={},a=t.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:t.wrap(a,!0)};return t.patch(n,u),t.applyData(n,u)}function cA(t,n){const r={type:"element",tagName:"p",properties:{},children:t.all(n)};return t.patch(n,r),t.applyData(n,r)}function fA(t,n){const r={type:"root",children:t.wrap(t.all(n))};return t.patch(n,r),t.applyData(n,r)}function hA(t,n){const r={type:"element",tagName:"strong",properties:{},children:t.all(n)};return t.patch(n,r),t.applyData(n,r)}function dA(t,n){const r=t.all(n),a=r.shift(),l=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:t.wrap([a],!0)};t.patch(n.children[0],c),l.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:t.wrap(r,!0)},f=vd(n.children[1]),m=Zb(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:t.wrap(l,!0)};return t.patch(n,u),t.applyData(n,u)}function mA(t,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],x={},v=c?c[m]:void 0;v&&(x.align=v);let C={type:"element",tagName:u,properties:x,children:[]};g&&(C.children=t.all(g),t.patch(g,C),C=t.applyData(g,C)),d.push(C)}const y={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(n,y),t.applyData(n,y)}function pA(t,n){const r={type:"element",tagName:"td",properties:{},children:t.all(n)};return t.patch(n,r),t.applyData(n,r)}const O0=9,j0=32;function gA(t){const n=String(t),r=/\r?\n|\r/g;let a=r.exec(n),l=0;const u=[];for(;a;)u.push(N0(n.slice(l,a.index),l>0,!0),a[0]),l=a.index+a[0].length,a=r.exec(n);return u.push(N0(n.slice(l),l>0,!1)),u.join("")}function N0(t,n,r){let a=0,l=t.length;if(n){let u=t.codePointAt(a);for(;u===O0||u===j0;)a++,u=t.codePointAt(a)}if(r){let u=t.codePointAt(l-1);for(;u===O0||u===j0;)l--,u=t.codePointAt(l-1)}return l>a?t.slice(a,l):""}function yA(t,n){const r={type:"text",value:gA(String(n.value))};return t.patch(n,r),t.applyData(n,r)}function bA(t,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(n,r),t.applyData(n,r)}const xA={blockquote:JC,break:XC,code:QC,delete:ZC,emphasis:KC,footnoteReference:WC,heading:eA,html:tA,imageReference:nA,image:rA,inlineCode:iA,linkReference:aA,link:sA,listItem:lA,list:uA,paragraph:cA,root:fA,strong:hA,table:dA,tableCell:pA,tableRow:mA,text:yA,thematicBreak:bA,toml:Wo,yaml:Wo,definition:Wo,footnoteDefinition:Wo};function Wo(){}const x1=-1,Mu=0,yl=1,_u=2,Ad=3,Td=4,Od=5,jd=6,v1=7,S1=8,R0=typeof self=="object"?self:globalThis,vA=(t,n)=>{const r=(l,u)=>(t.set(u,l),l),a=l=>{if(t.has(l))return t.get(l);const[u,c]=n[l];switch(u){case Mu:case x1:return r(c,l);case yl:{const f=r([],l);for(const m of c)f.push(a(m));return f}case _u:{const f=r({},l);for(const[m,d]of c)f[a(m)]=a(d);return f}case Ad:return r(new Date(c),l);case Td:{const{source:f,flags:m}=c;return r(new RegExp(f,m),l)}case Od:{const f=r(new Map,l);for(const[m,d]of c)f.set(a(m),a(d));return f}case jd:{const f=r(new Set,l);for(const m of c)f.add(a(m));return f}case v1:{const{name:f,message:m}=c;return r(new R0[f](m),l)}case S1:return r(BigInt(c),l);case"BigInt":return r(Object(BigInt(c)),l);case"ArrayBuffer":return r(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return r(new DataView(f),c)}}return r(new R0[u](c),l)};return a},M0=t=>vA(new Map,t)(0),Ia="",{toString:SA}={},{keys:_A}=Object,ll=t=>{const n=typeof t;if(n!=="object"||!t)return[Mu,n];const r=SA.call(t).slice(8,-1);switch(r){case"Array":return[yl,Ia];case"Object":return[_u,Ia];case"Date":return[Ad,Ia];case"RegExp":return[Td,Ia];case"Map":return[Od,Ia];case"Set":return[jd,Ia];case"DataView":return[yl,r]}return r.includes("Array")?[yl,r]:r.includes("Error")?[v1,r]:[_u,r]},eu=([t,n])=>t===Mu&&(n==="function"||n==="symbol"),wA=(t,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]=ll(c);switch(f){case Mu:{let y=c;switch(m){case"bigint":f=S1,y=c.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+m);y=null;break;case"undefined":return l([x1],c)}return l([f,y],c)}case yl:{if(m){let x=c;return m==="DataView"?x=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(x=new Uint8Array(c)),l([m,[...x]],c)}const y=[],g=l([f,y],c);for(const x of c)y.push(u(x));return g}case _u:{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 x of _A(c))(t||!eu(ll(c[x])))&&y.push([u(x),u(c[x])]);return g}case Ad:return l([f,c.toISOString()],c);case Td:{const{source:y,flags:g}=c;return l([f,{source:y,flags:g}],c)}case Od:{const y=[],g=l([f,y],c);for(const[x,v]of c)(t||!(eu(ll(x))||eu(ll(v))))&&y.push([u(x),u(v)]);return g}case jd:{const y=[],g=l([f,y],c);for(const x of c)(t||!eu(ll(x)))&&y.push(u(x));return g}}const{message:d}=c;return l([f,{name:m,message:d}],c)};return u},D0=(t,{json:n,lossy:r}={})=>{const a=[];return wA(!(n||r),!!n,new Map,a)(t),a},wu=typeof structuredClone=="function"?(t,n)=>n&&("json"in n||"lossy"in n)?M0(D0(t,n)):structuredClone(t):(t,n)=>M0(D0(t,n));function EA(t,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function kA(t,n){return"Back to reference "+(t+1)+(n>1?"-"+n:"")}function CA(t){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=t.options.footnoteBackContent||EA,a=t.options.footnoteBackLabel||kA,l=t.options.footnoteLabel||"Footnotes",u=t.options.footnoteLabelTagName||"h2",c=t.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[m]);if(!d)continue;const y=t.all(d),g=String(d.identifier).toUpperCase(),x=ls(g.toLowerCase());let v=0;const C=[],D=t.footnoteCounts.get(g);for(;D!==void 0&&++v<=D;){C.length>0&&C.push({type:"text",value:" "});let G=typeof r=="string"?r:r(m,v);typeof G=="string"&&(G={type:"text",value:G}),C.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+x+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,v),className:["data-footnote-backref"]},children:Array.isArray(G)?G:[G]})}const q=y[y.length-1];if(q&&q.type==="element"&&q.tagName==="p"){const G=q.children[q.children.length-1];G&&G.type==="text"?G.value+=" ":q.children.push({type:"text",value:" "}),q.children.push(...C)}else y.push(...C);const M={type:"element",tagName:"li",properties:{id:n+"fn-"+x},children:t.wrap(y,!0)};t.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:{...wu(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
96
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(f,!0)},{type:"text",value:`
|
|
97
|
+
`}]}}const Du=(function(t){if(t==null)return jA;if(typeof t=="function")return zu(t);if(typeof t=="object")return Array.isArray(t)?AA(t):TA(t);if(typeof t=="string")return OA(t);throw new Error("Expected function, string, or object as test")});function AA(t){const n=[];let r=-1;for(;++r<t.length;)n[r]=Du(t[r]);return zu(a);function a(...l){let u=-1;for(;++u<n.length;)if(n[u].apply(this,l))return!0;return!1}}function TA(t){const n=t;return zu(r);function r(a){const l=a;let u;for(u in t)if(l[u]!==n[u])return!1;return!0}}function OA(t){return zu(n);function n(r){return r&&r.type===t}}function zu(t){return n;function n(r,a,l){return!!(NA(r)&&t.call(this,r,typeof a=="number"?a:void 0,l||void 0))}}function jA(){return!0}function NA(t){return t!==null&&typeof t=="object"&&"type"in t}const _1=[],RA=!0,Xh=!1,MA="skip";function w1(t,n,r,a){let l;typeof n=="function"&&typeof r!="function"?(a=r,r=n):l=n;const u=Du(l),c=a?-1:1;f(t,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(x,"name",{value:"node ("+(m.type+(v?"<"+v+">":""))+")"})}return x;function x(){let v=_1,C,D,q;if((!n||u(m,d,y[y.length-1]||void 0))&&(v=DA(r(m,y)),v[0]===Xh))return v;if("children"in m&&m.children){const M=m;if(M.children&&v[0]!==MA)for(D=(a?M.children.length:-1)+c,q=y.concat(M);D>-1&&D<M.children.length;){const G=M.children[D];if(C=f(G,D,q)(),C[0]===Xh)return C;D=typeof C[1]=="number"?C[1]:D+c}}return v}}}function DA(t){return Array.isArray(t)?t:typeof t=="number"?[RA,t]:t==null?_1:[t]}function Nd(t,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),w1(t,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 Qh={}.hasOwnProperty,zA={};function LA(t,n){const r=n||zA,a=new Map,l=new Map,u=new Map,c={...xA,...r.handlers},f={all:d,applyData:BA,definitionById:a,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:UA,wrap:HA};return Nd(t,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?a:l,x=String(y.identifier).toUpperCase();g.has(x)||g.set(x,y)}}),f;function m(y,g){const x=y.type,v=f.handlers[x];if(Qh.call(f.handlers,x)&&v)return v(f,y,g);if(f.options.passThrough&&f.options.passThrough.includes(x)){if("children"in y){const{children:D,...q}=y,M=wu(q);return M.children=f.all(y),M}return wu(y)}return(f.options.unknownHandler||qA)(f,y,g)}function d(y){const g=[];if("children"in y){const x=y.children;let v=-1;for(;++v<x.length;){const C=f.one(x[v],y);if(C){if(v&&x[v-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=z0(C.value)),!Array.isArray(C)&&C.type==="element")){const D=C.children[0];D&&D.type==="text"&&(D.value=z0(D.value))}Array.isArray(C)?g.push(...C):g.push(C)}}}return g}}function UA(t,n){t.position&&(n.position=kE(t))}function BA(t,n){let r=n;if(t&&t.data){const a=t.data.hName,l=t.data.hChildren,u=t.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,wu(u)),"children"in r&&r.children&&l!==null&&l!==void 0&&(r.children=l)}return r}function qA(t,n){const r=n.data||{},a="value"in n&&!(Qh.call(r,"hProperties")||Qh.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:t.all(n)};return t.patch(n,a),t.applyData(n,a)}function HA(t,n){const r=[];let a=-1;for(n&&r.push({type:"text",value:`
|
|
98
|
+
`});++a<t.length;)a&&r.push({type:"text",value:`
|
|
99
|
+
`}),r.push(t[a]);return n&&t.length>0&&r.push({type:"text",value:`
|
|
100
|
+
`}),r}function z0(t){let n=0,r=t.charCodeAt(n);for(;r===9||r===32;)n++,r=t.charCodeAt(n);return t.slice(n)}function L0(t,n){const r=LA(t,n),a=r.one(t,void 0),l=CA(r),u=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
|
|
101
|
+
`},l),u}function PA(t,n){return t&&"run"in t?async function(r,a){const l=L0(r,{file:a,...n});await t.run(l,a)}:function(r,a){return L0(r,{file:a,...t||n})}}function U0(t){if(t)throw t}var dh,B0;function IA(){if(B0)return dh;B0=1;var t=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=t.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!y&&!g)return!1;var x;for(x in d);return typeof x>"u"||t.call(d,x)},c=function(d,y){r&&y.name==="__proto__"?r(d,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):d[y.name]=y.newValue},f=function(d,y){if(y==="__proto__")if(t.call(d,y)){if(a)return a(d,y).value}else return;return d[y]};return dh=function m(){var d,y,g,x,v,C,D=arguments[0],q=1,M=arguments.length,G=!1;for(typeof D=="boolean"&&(G=D,D=arguments[1]||{},q=2),(D==null||typeof D!="object"&&typeof D!="function")&&(D={});q<M;++q)if(d=arguments[q],d!=null)for(y in d)g=f(D,y),x=f(d,y),D!==x&&(G&&x&&(u(x)||(v=l(x)))?(v?(v=!1,C=g&&l(g)?g:[]):C=g&&u(g)?g:{},c(D,{name:y,newValue:m(G,C,x)})):typeof x<"u"&&c(D,{name:y,newValue:x}));return D},dh}var FA=IA();const mh=tb(FA);function Zh(t){if(typeof t!="object"||t===null)return!1;const n=Object.getPrototypeOf(t);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function $A(){const t=[],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=t[++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?GA(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 t.push(l),n}}function GA(t,n){let r;return a;function a(...c){const f=t.length>c.length;let m;f&&c.push(l);try{m=t.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 hr={basename:YA,dirname:VA,extname:JA,join:XA,sep:"/"};function YA(t,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Ml(t);let r=0,a=-1,l=t.length,u;if(n===void 0||n.length===0||n.length>t.length){for(;l--;)if(t.codePointAt(l)===47){if(u){r=l+1;break}}else a<0&&(u=!0,a=l+1);return a<0?"":t.slice(r,a)}if(n===t)return"";let c=-1,f=n.length-1;for(;l--;)if(t.codePointAt(l)===47){if(u){r=l+1;break}}else c<0&&(u=!0,c=l+1),f>-1&&(t.codePointAt(l)===n.codePointAt(f--)?f<0&&(a=l):(f=-1,a=c));return r===a?a=c:a<0&&(a=t.length),t.slice(r,a)}function VA(t){if(Ml(t),t.length===0)return".";let n=-1,r=t.length,a;for(;--r;)if(t.codePointAt(r)===47){if(a){n=r;break}}else a||(a=!0);return n<0?t.codePointAt(0)===47?"/":".":n===1&&t.codePointAt(0)===47?"//":t.slice(0,n)}function JA(t){Ml(t);let n=t.length,r=-1,a=0,l=-1,u=0,c;for(;n--;){const f=t.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?"":t.slice(l,r)}function XA(...t){let n=-1,r;for(;++n<t.length;)Ml(t[n]),t[n]&&(r=r===void 0?t[n]:r+"/"+t[n]);return r===void 0?".":QA(r)}function QA(t){Ml(t);const n=t.codePointAt(0)===47;let r=ZA(t,!n);return r.length===0&&!n&&(r="."),r.length>0&&t.codePointAt(t.length-1)===47&&(r+="/"),n?"/"+r:r}function ZA(t,n){let r="",a=0,l=-1,u=0,c=-1,f,m;for(;++c<=t.length;){if(c<t.length)f=t.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+="/"+t.slice(l+1,c):r=t.slice(l+1,c),a=c-l-1;l=c,u=0}else f===46&&u>-1?u++:u=-1}return r}function Ml(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const KA={cwd:WA};function WA(){return"/"}function Kh(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function eT(t){if(typeof t=="string")t=new URL(t);else if(!Kh(t)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(t.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return tT(t)}function tT(t){if(t.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=t.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const a=n.codePointAt(r+2);if(a===70||a===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(n)}const ph=["history","path","basename","stem","extname","dirname"];class E1{constructor(n){let r;n?Kh(n)?r={path:n}:typeof n=="string"||nT(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":KA.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<ph.length;){const u=ph[a];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let l;for(l in r)ph.includes(l)||(this[l]=r[l])}get basename(){return typeof this.path=="string"?hr.basename(this.path):void 0}set basename(n){yh(n,"basename"),gh(n,"basename"),this.path=hr.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?hr.dirname(this.path):void 0}set dirname(n){q0(this.basename,"dirname"),this.path=hr.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?hr.extname(this.path):void 0}set extname(n){if(gh(n,"extname"),q0(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=hr.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Kh(n)&&(n=eT(n)),yh(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?hr.basename(this.path,this.extname):void 0}set stem(n){yh(n,"stem"),gh(n,"stem"),this.path=hr.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 Wt(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 gh(t,n){if(t&&t.includes(hr.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+hr.sep+"`")}function yh(t,n){if(!t)throw new Error("`"+n+"` cannot be empty")}function q0(t,n){if(!t)throw new Error("Setting `"+n+"` requires `path` to be set too")}function nT(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const rT=(function(t){const a=this.constructor.prototype,l=a[t],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,a),u}),iT={}.hasOwnProperty;class Rd extends rT{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=$A()}copy(){const n=new Rd;let r=-1;for(;++r<this.attachers.length;){const a=this.attachers[r];n.use(...a)}return n.data(mh(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(vh("data",this.frozen),this.namespace[n]=r,this):iT.call(this.namespace,n)&&this.namespace[n]||void 0:n?(vh("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=tu(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),xh("process",this.compiler||this.Compiler),r?l(void 0,r):new Promise(l);function l(u,c){const f=tu(n),m=a.parse(f);a.run(m,f,function(y,g,x){if(y||!g||!x)return d(y);const v=g,C=a.stringify(v,x);lT(C)?x.value=C:x.result=C,d(y,x)});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),xh("processSync",this.compiler||this.Compiler),this.process(n,l),P0("processSync","process",r),a;function l(u,c){r=!0,U0(u),a=c}}run(n,r,a){H0(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=tu(r);l.run(n,m,d);function d(y,g,x){const v=g||n;y?f(y):c?c(v):a(void 0,v,x)}}}runSync(n,r){let a=!1,l;return this.run(n,r,u),P0("runSync","run",a),l;function u(c,f){U0(c),l=f,a=!0}}stringify(n,r){this.freeze();const a=tu(r),l=this.compiler||this.Compiler;return xh("stringify",l),H0(n),l(n,a)}use(n,...r){const a=this.attachers,l=this.namespace;if(vh("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=mh(!0,l.settings,d.settings))}function f(d){let y=-1;if(d!=null)if(Array.isArray(d))for(;++y<d.length;){const g=d[y];u(g)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function m(d,y){let g=-1,x=-1;for(;++g<a.length;)if(a[g][0]===d){x=g;break}if(x===-1)a.push([d,...y]);else if(y.length>0){let[v,...C]=y;const D=a[x][1];Zh(D)&&Zh(v)&&(v=mh(!0,D,v)),a[x]=[d,v,...C]}}}}const aT=new Rd().freeze();function bh(t,n){if(typeof n!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function xh(t,n){if(typeof n!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function vh(t,n){if(n)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function H0(t){if(!Zh(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function P0(t,n,r){if(!r)throw new Error("`"+t+"` finished async. Use `"+n+"` instead")}function tu(t){return sT(t)?t:new E1(t)}function sT(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function lT(t){return typeof t=="string"||oT(t)}function oT(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const uT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",I0=[],F0={allowDangerousHtml:!0},cT=/^(https?|ircs?|mailto|xmpp)$/i,fT=[{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 Wh(t){const n=hT(t),r=dT(t);return mT(n.runSync(n.parse(r),r),t)}function hT(t){const n=t.rehypePlugins||I0,r=t.remarkPlugins||I0,a=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...F0}:F0;return aT().use(VC).use(r).use(PA,a).use(n)}function dT(t){const n=t.children||"",r=new E1;return typeof n=="string"&&(r.value=n),r}function mT(t,n){const r=n.allowedElements,a=n.allowElement,l=n.components,u=n.disallowedElements,c=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||pT;for(const y of fT)Object.hasOwn(n,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+uT+y.id,void 0);return Nd(t,d),jE(t,{Fragment:S.Fragment,components:l,ignoreInvalidStyle:!0,jsx:S.jsx,jsxs:S.jsxs,passKeys:!0,passNode:!0});function d(y,g,x){if(y.type==="raw"&&x&&typeof g=="number")return c?x.children.splice(g,1):x.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let v;for(v in ch)if(Object.hasOwn(ch,v)&&Object.hasOwn(y.properties,v)){const C=y.properties[v],D=ch[v];(D===null||D.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,x)),v&&x&&typeof g=="number")return f&&y.children?x.children.splice(g,1,...y.children):x.children.splice(g,1),g}}}function pT(t){const n=t.indexOf(":"),r=t.indexOf("?"),a=t.indexOf("#"),l=t.indexOf("/");return n===-1||l!==-1&&n>l||r!==-1&&n>r||a!==-1&&n>a||cT.test(t.slice(0,n))?t:""}function $0(t,n){const r=String(t);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 gT(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function k1(t,n,r){const l=Du((r||{}).ignore||[]),u=yT(n);let c=-1;for(;++c<u.length;)w1(t,"text",f);function f(d,y){let g=-1,x;for(;++g<y.length;){const v=y[g],C=x?x.children:void 0;if(l(v,C?C.indexOf(v):void 0,x))return;x=v}if(x)return m(d,y)}function m(d,y){const g=y[y.length-1],x=u[c][0],v=u[c][1];let C=0;const q=g.children.indexOf(d);let M=!1,G=[];x.lastIndex=0;let V=x.exec(d.value);for(;V;){const le=V.index,j={index:V.index,input:V.input,stack:[...y,d]};let O=v(...V,j);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?x.lastIndex=le+1:(C!==le&&G.push({type:"text",value:d.value.slice(C,le)}),Array.isArray(O)?G.push(...O):O&&G.push(O),C=le+V[0].length,M=!0),!x.global)break;V=x.exec(d.value)}return M?(C<d.value.length&&G.push({type:"text",value:d.value.slice(C)}),g.children.splice(q,1,...G)):G=[d],q+G.length}}function yT(t){const n=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let a=-1;for(;++a<r.length;){const l=r[a];n.push([bT(l[0]),xT(l[1])])}return n}function bT(t){return typeof t=="string"?new RegExp(gT(t),"g"):t}function xT(t){return typeof t=="function"?t:function(){return t}}const Sh="phrasing",_h=["autolink","link","image","label"];function vT(){return{transforms:[AT],enter:{literalAutolink:_T,literalAutolinkEmail:wh,literalAutolinkHttp:wh,literalAutolinkWww:wh},exit:{literalAutolink:CT,literalAutolinkEmail:kT,literalAutolinkHttp:wT,literalAutolinkWww:ET}}}function ST(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Sh,notInConstruct:_h},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Sh,notInConstruct:_h},{character:":",before:"[ps]",after:"\\/",inConstruct:Sh,notInConstruct:_h}]}}function _T(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function wh(t){this.config.enter.autolinkProtocol.call(this,t)}function wT(t){this.config.exit.autolinkProtocol.call(this,t)}function ET(t){this.config.exit.data.call(this,t);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(t)}function kT(t){this.config.exit.autolinkEmail.call(this,t)}function CT(t){this.exit(t)}function AT(t){k1(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,TT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),OT]],{ignore:["link","linkReference"]})}function TT(t,n,r,a,l){let u="";if(!C1(l)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!jT(r)))return!1;const c=NT(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 OT(t,n,r,a){return!C1(a,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function jT(t){const n=t.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 NT(t){const n=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!n)return[t,void 0];t=t.slice(0,n.index);let r=n[0],a=r.indexOf(")");const l=$0(t,"(");let u=$0(t,")");for(;a!==-1&&l>u;)t+=r.slice(0,a+1),r=r.slice(a+1),a=r.indexOf(")"),u++;return[t,r]}function C1(t,n){const r=t.input.charCodeAt(t.index-1);return(t.index===0||Wi(r)||Nu(r))&&(!n||r!==47)}A1.peek=HT;function RT(){this.buffer()}function MT(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function DT(){this.buffer()}function zT(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function LT(t){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=sr(this.sliceSerialize(t)).toLowerCase(),r.label=n}function UT(t){this.exit(t)}function BT(t){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=sr(this.sliceSerialize(t)).toLowerCase(),r.label=n}function qT(t){this.exit(t)}function HT(){return"["}function A1(t,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(t),{after:"]",before:u})),f(),c(),u+=l.move("]"),u}function PT(){return{enter:{gfmFootnoteCallString:RT,gfmFootnoteCall:MT,gfmFootnoteDefinitionLabelString:DT,gfmFootnoteDefinition:zT},exit:{gfmFootnoteCallString:LT,gfmFootnoteCall:UT,gfmFootnoteDefinitionLabelString:BT,gfmFootnoteDefinition:qT}}}function IT(t){let n=!1;return t&&t.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:A1},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?`
|
|
102
|
+
`:" ")+u.indentLines(u.containerFlow(a,f.current()),n?T1:FT))),d(),m}}function FT(t,n,r){return n===0?t:T1(t,n,r)}function T1(t,n,r){return(r?"":" ")+t}const $T=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];O1.peek=XT;function GT(){return{canContainEols:["delete"],enter:{strikethrough:VT},exit:{strikethrough:JT}}}function YT(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$T}],handlers:{delete:O1}}}function VT(t){this.enter({type:"delete",children:[]},t)}function JT(t){this.exit(t)}function O1(t,n,r,a){const l=r.createTracker(a),u=r.enter("strikethrough");let c=l.move("~~");return c+=r.containerPhrasing(t,{...l.current(),before:c,after:"~"}),c+=l.move("~~"),u(),c}function XT(){return"~"}function QT(t){return t.length}function ZT(t,n){const r=n||{},a=(r.align||[]).concat(),l=r.stringLength||QT,u=[],c=[],f=[],m=[];let d=0,y=-1;for(;++y<t.length;){const D=[],q=[];let M=-1;for(t[y].length>d&&(d=t[y].length);++M<t[y].length;){const G=KT(t[y][M]);if(r.alignDelimiters!==!1){const V=l(G);q[M]=V,(m[M]===void 0||V>m[M])&&(m[M]=V)}D.push(G)}c[y]=D,f[y]=q}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<d;)u[g]=G0(a[g]);else{const D=G0(a);for(;++g<d;)u[g]=D}g=-1;const x=[],v=[];for(;++g<d;){const D=u[g];let q="",M="";D===99?(q=":",M=":"):D===108?q=":":D===114&&(M=":");let G=r.alignDelimiters===!1?1:Math.max(1,m[g]-q.length-M.length);const V=q+"-".repeat(G)+M;r.alignDelimiters!==!1&&(G=q.length+G+M.length,G>m[g]&&(m[g]=G),v[g]=G),x[g]=V}c.splice(1,0,x),f.splice(1,0,v),y=-1;const C=[];for(;++y<c.length;){const D=c[y],q=f[y];g=-1;const M=[];for(;++g<d;){const G=D[g]||"";let V="",le="";if(r.alignDelimiters!==!1){const j=m[g]-(q[g]||0),O=u[g];O===114?V=" ".repeat(j):O===99?j%2?(V=" ".repeat(j/2+.5),le=" ".repeat(j/2-.5)):(V=" ".repeat(j/2),le=V):le=" ".repeat(j)}r.delimiterStart!==!1&&!g&&M.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&G==="")&&(r.delimiterStart!==!1||g)&&M.push(" "),r.alignDelimiters!==!1&&M.push(V),M.push(G),r.alignDelimiters!==!1&&M.push(le),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(`
|
|
103
|
+
`)}function KT(t){return t==null?"":String(t)}function G0(t){const n=typeof t=="string"?t.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function WT(t,n,r,a){const l=r.enter("blockquote"),u=r.createTracker(a);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(t,u.current()),eO);return l(),c}function eO(t,n,r){return">"+(r?"":" ")+t}function tO(t,n){return Y0(t,n.inConstruct,!0)&&!Y0(t,n.notInConstruct,!1)}function Y0(t,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let a=-1;for(;++a<n.length;)if(t.includes(n[a]))return!0;return!1}function V0(t,n,r,a){let l=-1;for(;++l<r.unsafe.length;)if(r.unsafe[l].character===`
|
|
104
|
+
`&&tO(r.stack,r.unsafe[l]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
105
|
+
`}function nO(t,n){const r=String(t);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 rO(t,n){return!!(n.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function iO(t){const n=t.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function aO(t,n,r,a){const l=iO(r),u=t.value||"",c=l==="`"?"GraveAccent":"Tilde";if(rO(t,r)){const g=r.enter("codeIndented"),x=r.indentLines(u,sO);return g(),x}const f=r.createTracker(a),m=l.repeat(Math.max(nO(u,l)+1,3)),d=r.enter("codeFenced");let y=f.move(m);if(t.lang){const g=r.enter(`codeFencedLang${c}`);y+=f.move(r.safe(t.lang,{before:y,after:" ",encode:["`"],...f.current()})),g()}if(t.lang&&t.meta){const g=r.enter(`codeFencedMeta${c}`);y+=f.move(" "),y+=f.move(r.safe(t.meta,{before:y,after:`
|
|
106
|
+
`,encode:["`"],...f.current()})),g()}return y+=f.move(`
|
|
107
|
+
`),u&&(y+=f.move(u+`
|
|
108
|
+
`)),y+=f.move(m),d(),y}function sO(t,n,r){return(r?"":" ")+t}function Md(t){const n=t.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function lO(t,n,r,a){const l=Md(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(t),{before:d,after:"]",...m.current()})),d+=m.move("]: "),f(),!t.url||/[\0- \u007F]/.test(t.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(t.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(t.url,{before:d,after:t.title?" ":`
|
|
109
|
+
`,...m.current()}))),f(),t.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(t.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),c(),d}function oO(t){const n=t.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function El(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Eu(t,n,r){const a=ns(t),l=ns(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}}j1.peek=uO;function j1(t,n,r,a){const l=oO(r),u=r.enter("emphasis"),c=r.createTracker(a),f=c.move(l);let m=c.move(r.containerPhrasing(t,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Eu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=El(d)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Eu(a.after.charCodeAt(0),g,l);x.inside&&(m=m.slice(0,-1)+El(g));const v=c.move(l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+m+v}function uO(t,n,r){return r.options.emphasis||"*"}function cO(t,n){let r=!1;return Nd(t,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return r=!0,Xh}),!!((!t.depth||t.depth<3)&&Ed(t)&&(n.options.setext||r))}function fO(t,n,r,a){const l=Math.max(Math.min(6,t.depth||1),1),u=r.createTracker(a);if(cO(t,r)){const y=r.enter("headingSetext"),g=r.enter("phrasing"),x=r.containerPhrasing(t,{...u.current(),before:`
|
|
110
|
+
`,after:`
|
|
111
|
+
`});return g(),y(),x+`
|
|
112
|
+
`+(l===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
113
|
+
`))+1))}const c="#".repeat(l),f=r.enter("headingAtx"),m=r.enter("phrasing");u.move(c+" ");let d=r.containerPhrasing(t,{before:"# ",after:`
|
|
114
|
+
`,...u.current()});return/^[\t ]/.test(d)&&(d=El(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,r.options.closeAtx&&(d+=" "+c),m(),f(),d}N1.peek=hO;function N1(t){return t.value||""}function hO(){return"<"}R1.peek=dO;function R1(t,n,r,a){const l=Md(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(t.alt,{before:d,after:"]",...m.current()})),d+=m.move("]("),f(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(f=r.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(r.safe(t.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(f=r.enter("destinationRaw"),d+=m.move(r.safe(t.url,{before:d,after:t.title?" ":")",...m.current()}))),f(),t.title&&(f=r.enter(`title${u}`),d+=m.move(" "+l),d+=m.move(r.safe(t.title,{before:d,after:l,...m.current()})),d+=m.move(l),f()),d+=m.move(")"),c(),d}function dO(){return"!"}M1.peek=mO;function M1(t,n,r,a){const l=t.referenceType,u=r.enter("imageReference");let c=r.enter("label");const f=r.createTracker(a);let m=f.move("![");const d=r.safe(t.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(t),{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 mO(){return"!"}D1.peek=pO;function D1(t,n,r){let a=t.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 pO(){return"`"}function z1(t,n){const r=Ed(t);return!!(!n.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}L1.peek=gO;function L1(t,n,r,a){const l=Md(r),u=l==='"'?"Quote":"Apostrophe",c=r.createTracker(a);let f,m;if(z1(t,r)){const y=r.stack;r.stack=[],f=r.enter("autolink");let g=c.move("<");return g+=c.move(r.containerPhrasing(t,{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(t,{before:d,after:"](",...c.current()})),d+=c.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=r.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(r.safe(t.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(m=r.enter("destinationRaw"),d+=c.move(r.safe(t.url,{before:d,after:t.title?" ":")",...c.current()}))),m(),t.title&&(m=r.enter(`title${u}`),d+=c.move(" "+l),d+=c.move(r.safe(t.title,{before:d,after:l,...c.current()})),d+=c.move(l),m()),d+=c.move(")"),f(),d}function gO(t,n,r){return z1(t,r)?"<":"["}U1.peek=yO;function U1(t,n,r,a){const l=t.referenceType,u=r.enter("linkReference");let c=r.enter("label");const f=r.createTracker(a);let m=f.move("[");const d=r.containerPhrasing(t,{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(t),{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 yO(){return"["}function Dd(t){const n=t.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function bO(t){const n=Dd(t),r=t.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 xO(t){const n=t.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function B1(t){const n=t.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function vO(t,n,r,a){const l=r.enter("list"),u=r.bulletCurrent;let c=t.ordered?xO(r):Dd(r);const f=t.ordered?c==="."?")":".":bO(r);let m=n&&r.bulletLastUsed?c===r.bulletLastUsed:!1;if(!t.ordered){const y=t.children?t.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),B1(r)===c&&y){let g=-1;for(;++g<t.children.length;){const x=t.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),r.bulletCurrent=c;const d=r.containerFlow(t,a);return r.bulletLastUsed=c,r.bulletCurrent=u,l(),d}function SO(t){const n=t.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 _O(t,n,r,a){const l=SO(r);let u=r.bulletCurrent||Dd(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(t))+u);let c=u.length+1;(l==="tab"||l==="mixed"&&(n&&n.type==="list"&&n.spread||t.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(t,f.current()),y);return m(),d;function y(g,x,v){return x?(v?"":" ".repeat(c))+g:(v?u:u+" ".repeat(c-u.length))+g}}function wO(t,n,r,a){const l=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(t,a);return u(),l(),c}const EO=Du(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function kO(t,n,r,a){return(t.children.some(function(c){return EO(c)})?r.containerPhrasing:r.containerFlow).call(r,t,a)}function CO(t){const n=t.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}q1.peek=AO;function q1(t,n,r,a){const l=CO(r),u=r.enter("strong"),c=r.createTracker(a),f=c.move(l+l);let m=c.move(r.containerPhrasing(t,{after:l,before:f,...c.current()}));const d=m.charCodeAt(0),y=Eu(a.before.charCodeAt(a.before.length-1),d,l);y.inside&&(m=El(d)+m.slice(1));const g=m.charCodeAt(m.length-1),x=Eu(a.after.charCodeAt(0),g,l);x.inside&&(m=m.slice(0,-1)+El(g));const v=c.move(l+l);return u(),r.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},f+m+v}function AO(t,n,r){return r.options.strong||"*"}function TO(t,n,r,a){return r.safe(t.value,a)}function OO(t){const n=t.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 jO(t,n,r){const a=(B1(r)+(r.options.ruleSpaces?" ":"")).repeat(OO(r));return r.options.ruleSpaces?a.slice(0,-1):a}const H1={blockquote:WT,break:V0,code:aO,definition:lO,emphasis:j1,hardBreak:V0,heading:fO,html:N1,image:R1,imageReference:M1,inlineCode:D1,link:L1,linkReference:U1,list:vO,listItem:_O,paragraph:wO,root:kO,strong:q1,text:TO,thematicBreak:jO};function NO(){return{enter:{table:RO,tableData:J0,tableHeader:J0,tableRow:DO},exit:{codeText:zO,table:MO,tableData:Eh,tableHeader:Eh,tableRow:Eh}}}function RO(t){const n=t._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}function MO(t){this.exit(t),this.data.inTable=void 0}function DO(t){this.enter({type:"tableRow",children:[]},t)}function Eh(t){this.exit(t)}function J0(t){this.enter({type:"tableCell",children:[]},t)}function zO(t){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,LO));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(t)}function LO(t,n){return n==="|"?n:t}function UO(t){const n=t||{},r=n.tableCellPadding,a=n.tablePipeAlign,l=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
115
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:c,tableCell:m,tableRow:f}};function c(v,C,D,q){return d(y(v,D,q),v.align)}function f(v,C,D,q){const M=g(v,D,q),G=d([M]);return G.slice(0,G.indexOf(`
|
|
116
|
+
`))}function m(v,C,D,q){const M=D.enter("tableCell"),G=D.enter("phrasing"),V=D.containerPhrasing(v,{...q,before:u,after:u});return G(),M(),V}function d(v,C){return ZT(v,{align:C,alignDelimiters:a,padding:r,stringLength:l})}function y(v,C,D){const q=v.children;let M=-1;const G=[],V=C.enter("table");for(;++M<q.length;)G[M]=g(q[M],C,D);return V(),G}function g(v,C,D){const q=v.children;let M=-1;const G=[],V=C.enter("tableRow");for(;++M<q.length;)G[M]=m(q[M],v,C,D);return V(),G}function x(v,C,D){let q=H1.inlineCode(v,C,D);return D.stack.includes("tableCell")&&(q=q.replace(/\|/g,"\\$&")),q}}function BO(){return{exit:{taskListCheckValueChecked:X0,taskListCheckValueUnchecked:X0,paragraph:HO}}}function qO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:PO}}}function X0(t){const n=this.stack[this.stack.length-2];n.type,n.checked=t.type==="taskListCheckValueChecked"}function HO(t){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(t)}function PO(t,n,r,a){const l=t.children[0],u=typeof t.checked=="boolean"&&l&&l.type==="paragraph",c="["+(t.checked?"x":" ")+"] ",f=r.createTracker(a);u&&f.move(c);let m=H1.listItem(t,n,r,{...a,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function IO(){return[vT(),PT(),GT(),NO(),BO()]}function FO(t){return{extensions:[ST(),IT(t),YT(),UO(t),qO()]}}const $O={tokenize:QO,partial:!0},P1={tokenize:ZO,partial:!0},I1={tokenize:KO,partial:!0},F1={tokenize:WO,partial:!0},GO={tokenize:ej,partial:!0},$1={name:"wwwAutolink",tokenize:JO,previous:Y1},G1={name:"protocolAutolink",tokenize:XO,previous:V1},$r={name:"emailAutolink",tokenize:VO,previous:J1},xr={};function YO(){return{text:xr}}let Xi=48;for(;Xi<123;)xr[Xi]=$r,Xi++,Xi===58?Xi=65:Xi===91&&(Xi=97);xr[43]=$r;xr[45]=$r;xr[46]=$r;xr[95]=$r;xr[72]=[$r,G1];xr[104]=[$r,G1];xr[87]=[$r,$1];xr[119]=[$r,$1];function VO(t,n,r){const a=this;let l,u;return c;function c(g){return!ed(g)||!J1.call(a,a.previous)||zd(a.events)?r(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),f(g))}function f(g){return ed(g)?(t.consume(g),f):g===64?(t.consume(g),m):r(g)}function m(g){return g===46?t.check(GO,y,d)(g):g===45||g===95||Kt(g)?(u=!0,t.consume(g),m):y(g)}function d(g){return t.consume(g),l=!0,m}function y(g){return u&&l&&sn(a.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),n(g)):r(g)}}function JO(t,n,r){const a=this;return l;function l(c){return c!==87&&c!==119||!Y1.call(a,a.previous)||zd(a.events)?r(c):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check($O,t.attempt(P1,t.attempt(I1,u),r),r)(c))}function u(c){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),n(c)}}function XO(t,n,r){const a=this;let l="",u=!1;return c;function c(g){return(g===72||g===104)&&V1.call(a,a.previous)&&!zd(a.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),l+=String.fromCodePoint(g),t.consume(g),f):r(g)}function f(g){if(sn(g)&&l.length<5)return l+=String.fromCodePoint(g),t.consume(g),f;if(g===58){const x=l.toLowerCase();if(x==="http"||x==="https")return t.consume(g),m}return r(g)}function m(g){return g===47?(t.consume(g),u?d:(u=!0,m)):r(g)}function d(g){return g===null||Su(g)||gt(g)||Wi(g)||Nu(g)?r(g):t.attempt(P1,t.attempt(I1,y),r)(g)}function y(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),n(g)}}function QO(t,n,r){let a=0;return l;function l(c){return(c===87||c===119)&&a<3?(a++,t.consume(c),l):c===46&&a===3?(t.consume(c),u):r(c)}function u(c){return c===null?r(c):n(c)}}function ZO(t,n,r){let a,l,u;return c;function c(d){return d===46||d===95?t.check(F1,m,f)(d):d===null||gt(d)||Wi(d)||d!==45&&Nu(d)?m(d):(u=!0,t.consume(d),c)}function f(d){return d===95?a=!0:(l=a,a=void 0),t.consume(d),c}function m(d){return l||a||!u?r(d):n(d)}}function KO(t,n){let r=0,a=0;return l;function l(c){return c===40?(r++,t.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?t.check(F1,n,u)(c):c===null||gt(c)||Wi(c)?n(c):(t.consume(c),l)}function u(c){return c===41&&a++,t.consume(c),l}}function WO(t,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?(t.consume(f),a):f===38?(t.consume(f),u):f===93?(t.consume(f),l):f===60||f===null||gt(f)||Wi(f)?n(f):r(f)}function l(f){return f===null||f===40||f===91||gt(f)||Wi(f)?n(f):a(f)}function u(f){return sn(f)?c(f):r(f)}function c(f){return f===59?(t.consume(f),a):sn(f)?(t.consume(f),c):r(f)}}function ej(t,n,r){return a;function a(u){return t.consume(u),l}function l(u){return Kt(u)?r(u):n(u)}}function Y1(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||gt(t)}function V1(t){return!sn(t)}function J1(t){return!(t===47||ed(t))}function ed(t){return t===43||t===45||t===46||t===95||Kt(t)}function zd(t){let n=t.length,r=!1;for(;n--;){const a=t[n][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){r=!0;break}if(a._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const tj={tokenize:uj,partial:!0};function nj(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:sj,continuation:{tokenize:lj},exit:oj}},text:{91:{name:"gfmFootnoteCall",tokenize:aj},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:rj,resolveTo:ij}}}}function rj(t,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=sr(a.sliceSerialize({start:c.end,end:a.now()}));return d.codePointAt(0)!==94||!u.includes(d.slice(1))?r(m):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),n(m))}}function ij(t,n){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[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({},t[t.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[t[r+1],t[r+2],["enter",a,n],t[r+3],t[r+4],["enter",l,n],["exit",l,n],["enter",u,n],["enter",c,n],["exit",c,n],["exit",u,n],t[t.length-2],t[t.length-1],["exit",a,n]];return t.splice(r,t.length-r+1,...f),t}function aj(t,n,r){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u=0,c;return f;function f(g){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?r(g):(t.enter("gfmFootnoteCallMarker"),t.consume(g),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",d)}function d(g){if(u>999||g===93&&!c||g===null||g===91||gt(g))return r(g);if(g===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return l.includes(sr(a.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),n):r(g)}return gt(g)||(c=!0),u++,t.consume(g),g===92?y:d}function y(g){return g===91||g===92||g===93?(t.consume(g),u++,d):d(g)}}function sj(t,n,r){const a=this,l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u,c=0,f;return m;function m(C){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(C),t.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(C){return C===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(C),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",y):r(C)}function y(C){if(c>999||C===93&&!f||C===null||C===91||gt(C))return r(C);if(C===93){t.exit("chunkString");const D=t.exit("gfmFootnoteDefinitionLabelString");return u=sr(a.sliceSerialize(D)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(C),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return gt(C)||(f=!0),c++,t.consume(C),C===92?g:y}function g(C){return C===91||C===92||C===93?(t.consume(C),c++,y):y(C)}function x(C){return C===58?(t.enter("definitionMarker"),t.consume(C),t.exit("definitionMarker"),l.includes(u)||l.push(u),tt(t,v,"gfmFootnoteDefinitionWhitespace")):r(C)}function v(C){return n(C)}}function lj(t,n,r){return t.check(Rl,n,t.attempt(tj,n,r))}function oj(t){t.exit("gfmFootnoteDefinition")}function uj(t,n,r){const a=this;return tt(t,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 cj(t){let r=(t||{}).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)},x=[["enter",y,f],["enter",c[d][1],f],["exit",c[d][1],f],["enter",g,f]],v=f.parser.constructs.insideSpan.null;v&&jn(x,x.length,0,Ru(v,c.slice(d+1,m),f)),jn(x,x.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",y,f]]),jn(c,d-1,m-d+3,x),m=d+x.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,f,m){const d=this.previous,y=this.events;let g=0;return x;function x(C){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(C):(c.enter("strikethroughSequenceTemporary"),v(C))}function v(C){const D=ns(d);if(C===126)return g>1?m(C):(c.consume(C),g++,v);if(g<2&&!r)return m(C);const q=c.exit("strikethroughSequenceTemporary"),M=ns(C);return q._open=!M||M===2&&!!D,q._close=!D||D===2&&!!M,f(C)}}}class fj{constructor(){this.map=[]}add(n,r,a){hj(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 hj(t,n,r,a){let l=0;if(!(r===0&&a.length===0)){for(;l<t.map.length;){if(t.map[l][0]===n){t.map[l][1]+=r,t.map[l][2].push(...a);return}l+=1}t.map.push([n,r,a])}}function dj(t,n){let r=!1;const a=[];for(;n<t.length;){const l=t[n];if(r){if(l[0]==="enter")l[1].type==="tableContent"&&a.push(t[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(t[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 mj(){return{flow:{null:{name:"table",tokenize:pj,resolveAll:gj}}}}function pj(t,n,r){const a=this;let l=0,u=0,c;return f;function f(z){let ie=a.events.length-1;for(;ie>-1;){const he=a.events[ie][1].type;if(he==="lineEnding"||he==="linePrefix")ie--;else break}const K=ie>-1?a.events[ie][1].type:null,ge=K==="tableHead"||K==="tableRow"?O:m;return ge===O&&a.parser.lazy[a.now().line]?r(z):ge(z)}function m(z){return t.enter("tableHead"),t.enter("tableRow"),d(z)}function d(z){return z===124||(c=!0,u+=1),y(z)}function y(z){return z===null?r(z):Ue(z)?u>1?(u=0,a.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),v):r(z):Ze(z)?tt(t,y,"whitespace")(z):(u+=1,c&&(c=!1,l+=1),z===124?(t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),c=!0,y):(t.enter("data"),g(z)))}function g(z){return z===null||z===124||gt(z)?(t.exit("data"),y(z)):(t.consume(z),z===92?x:g)}function x(z){return z===92||z===124?(t.consume(z),g):g(z)}function v(z){return a.interrupt=!1,a.parser.lazy[a.now().line]?r(z):(t.enter("tableDelimiterRow"),c=!1,Ze(z)?tt(t,C,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):C(z))}function C(z){return z===45||z===58?q(z):z===124?(c=!0,t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),D):j(z)}function D(z){return Ze(z)?tt(t,q,"whitespace")(z):q(z)}function q(z){return z===58?(u+=1,c=!0,t.enter("tableDelimiterMarker"),t.consume(z),t.exit("tableDelimiterMarker"),M):z===45?(u+=1,M(z)):z===null||Ue(z)?le(z):j(z)}function M(z){return z===45?(t.enter("tableDelimiterFiller"),G(z)):j(z)}function G(z){return z===45?(t.consume(z),G):z===58?(c=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(z),t.exit("tableDelimiterMarker"),V):(t.exit("tableDelimiterFiller"),V(z))}function V(z){return Ze(z)?tt(t,le,"whitespace")(z):le(z)}function le(z){return z===124?C(z):z===null||Ue(z)?!c||l!==u?j(z):(t.exit("tableDelimiterRow"),t.exit("tableHead"),n(z)):j(z)}function j(z){return r(z)}function O(z){return t.enter("tableRow"),J(z)}function J(z){return z===124?(t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),J):z===null||Ue(z)?(t.exit("tableRow"),n(z)):Ze(z)?tt(t,J,"whitespace")(z):(t.enter("data"),F(z))}function F(z){return z===null||z===124||gt(z)?(t.exit("data"),J(z)):(t.consume(z),z===92?X:F)}function X(z){return z===92||z===124?(t.consume(z),F):F(z)}}function gj(t,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 x=new fj;for(;++r<t.length;){const v=t[r],C=v[1];v[0]==="enter"?C.type==="tableHead"?(f=!1,m!==0&&(Q0(x,n,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},C.start),end:Object.assign({},C.end)},x.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)},x.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=nu(x,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=nu(x,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=nu(x,n,u,l,r,g)):c[1]!==0&&(g=nu(x,n,c,l,r,g)),l=0):l&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&Q0(x,n,m,d,y),x.consume(n.events),r=-1;++r<n.events.length;){const v=n.events[r];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=dj(n.events,r))}return t}function nu(t,n,r,a,l,u){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},$a(n.events,r[0])),t.add(r[0],0,[["exit",u,n]]));const m=$a(n.events,r[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},t.add(r[1],0,[["enter",u,n]]),r[2]!==0){const d=$a(n.events,r[2]),y=$a(n.events,r[3]),g={type:f,start:Object.assign({},d),end:Object.assign({},y)};if(t.add(r[2],0,[["enter",g,n]]),a!==2){const x=n.events[r[2]],v=n.events[r[3]];if(x[1].end=Object.assign({},v[1].end),x[1].type="chunkText",x[1].contentType="text",r[3]>r[2]+1){const C=r[2]+1,D=r[3]-r[2]-1;t.add(C,D,[])}}t.add(r[3]+1,0,[["exit",g,n]])}return l!==void 0&&(u.end=Object.assign({},$a(n.events,l)),t.add(l,0,[["exit",u,n]]),u=void 0),u}function Q0(t,n,r,a,l){const u=[],c=$a(n.events,r);l&&(l.end=Object.assign({},c),u.push(["exit",l,n])),a.end=Object.assign({},c),u.push(["exit",a,n]),t.add(r+1,0,u)}function $a(t,n){const r=t[n],a=r[0]==="enter"?"start":"end";return r[1][a]}const yj={name:"tasklistCheck",tokenize:xj};function bj(){return{text:{91:yj}}}function xj(t,n,r){const a=this;return l;function l(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?r(m):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(m),t.exit("taskListCheckMarker"),u)}function u(m){return gt(m)?(t.enter("taskListCheckValueUnchecked"),t.consume(m),t.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(t.enter("taskListCheckValueChecked"),t.consume(m),t.exit("taskListCheckValueChecked"),c):r(m)}function c(m){return m===93?(t.enter("taskListCheckMarker"),t.consume(m),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),f):r(m)}function f(m){return Ue(m)?n(m):Ze(m)?t.check({tokenize:vj},n,r)(m):r(m)}}function vj(t,n,r){return tt(t,a,"whitespace");function a(l){return l===null?r(l):n(l)}}function Sj(t){return i1([YO(),nj(),cj(t),mj(),bj()])}const _j={};function td(t){const n=this,r=t||_j,a=n.data(),l=a.micromarkExtensions||(a.micromarkExtensions=[]),u=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);l.push(Sj(r)),u.push(IO()),c.push(FO(r))}function wj({body:t,permissions:n}){return S.jsxs("div",{className:"plan-dialog",children:[S.jsx("h2",{children:"Task Execution Plan"}),S.jsxs("div",{className:"plan-dialog-scroll",children:[t?S.jsx("div",{className:"plan-preview",children:S.jsx(Wh,{remarkPlugins:[td],children:t})}):S.jsx("p",{className:"plan-empty",children:"No execution plan generated for this task. Your task description will be used directly."}),n&&n.length>0&&S.jsxs("div",{className:"permissions-section",children:[S.jsx("h3",{children:"Granted Permissions"}),S.jsx("ul",{className:"permissions-list",children:n.map((r,a)=>S.jsxs("li",{className:"permission-item",children:[S.jsx("span",{className:"permission-tool",children:r.name}),S.jsx("span",{className:"permission-desc",children:r.description})]},a))})]})]}),S.jsx("div",{className:"plan-dialog-actions",children:S.jsx("button",{className:"btn btn-secondary",onClick:()=>history.back(),children:"Back"})})]})}const Ga=[];function Ej(){const t=Ga.pop();t&&(t.pushed.current=!1,t.close())}let Z0=!1;function kj(){Z0||(Z0=!0,window.addEventListener("popstate",Ej))}function Cj(t,n){const r=U.useRef(!1),a=U.useRef(n);a.current=n;const l=U.useCallback(()=>a.current(),[]),u=U.useRef({close:l,pushed:r});u.current.close=l,U.useEffect(()=>{if(t&&!r.current)kj(),history.pushState({modal:!0},""),Ga.push(u.current),r.current=!0;else if(!t&&r.current){r.current=!1;const c=Ga.indexOf(u.current);c!==-1&&Ga.splice(c,1),history.back()}},[t,l]),U.useEffect(()=>{const c=u.current;return()=>{if(r.current){r.current=!1;const f=Ga.indexOf(c);f!==-1&&Ga.splice(f,1),history.back()}}},[])}const Aj=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Qi(t="daily"){return{schedule:t,time:"00:00",dayOfWeek:"1",dayOfMonth:"1",onceDate:"",onceTime:"00:00"}}function Tj(t){const n=t.split(" ");if(n.length!==5)return Qi();const[r,a,l,,u]=n;if(a==="*")return Qi("hourly");const c=`${a.padStart(2,"0")}:${r.padStart(2,"0")}`;return u!=="*"?{...Qi("weekly"),time:c,dayOfWeek:u}:l!=="*"?{...Qi("monthly"),time:c,dayOfMonth:l}:{...Qi("daily"),time:c}}function Oj(t){if(t.type==="once"){const[n,r]=t.value.split("T");return{...Qi("once"),onceDate:n??"",onceTime:(r??"09:00").slice(0,5)}}return Tj(t.value)}function jj(t){const[n,r]=t.time.split(":").map(Number);switch(t.schedule){case"hourly":return"0 * * * *";case"daily":return`${r} ${n} * * *`;case"weekly":return`${r} ${n} * * ${t.dayOfWeek}`;case"monthly":return`${r} ${n} ${t.dayOfMonth} * *`;default:return"0 * * * *"}}function Nj(t){return t.schedule==="once"?t.onceDate?{type:"once",value:`${t.onceDate}T${t.onceTime}`}:null:{type:"cron",value:jj(t)}}function Rj({initial:t,agents:n,hostPlatform:r,onSaved:a,onRun:l,onCancel:u}){var Rn;const{request:c}=yd(),f=()=>{var He;const ve=localStorage.getItem("palmier:lastAgent"),Pe=n.map(_t=>_t.key);return ve&&Pe.includes(ve)?ve:((He=n[0])==null?void 0:He.key)??""},[m,d]=U.useState((t==null?void 0:t.user_prompt)??""),[y,g]=U.useState((t==null?void 0:t.agent)??f()),[x]=U.useState((t==null?void 0:t.body)??""),v=!!t&&m!==(t.user_prompt??""),C=!!t&&y!==(t.agent??""),D=v||C,q=!!t&&(!!x||!!((Rn=t.permissions)!=null&&Rn.length))&&!D,[M,G]=U.useState(!1),V=U.useCallback(()=>G(!1),[]);Cj(M,V);const[le,j]=U.useState(null),[O,J]=U.useState(()=>((t==null?void 0:t.triggers)??[]).map(Oj)),[F,X]=U.useState((t==null?void 0:t.triggers_enabled)??!1),[z,ie]=U.useState((t==null?void 0:t.requires_confirmation)??!1),[K,ge]=U.useState((t==null?void 0:t.yolo_mode)??!1),[he,I]=U.useState((t==null?void 0:t.foreground_mode)??!1),[H,te]=U.useState(null),me=H!==null,[Ae,N]=U.useState(!!(t!=null&&t.command)),[L,Y]=U.useState((t==null?void 0:t.command)??""),E=U.useRef(null),se=!!t,we=!se||m!==((t==null?void 0:t.user_prompt)??"")||y!==((t==null?void 0:t.agent)??"")||F!==((t==null?void 0:t.triggers_enabled)??!0)||z!==((t==null?void 0:t.requires_confirmation)??!1)||K!==((t==null?void 0:t.yolo_mode)??!1)||he!==((t==null?void 0:t.foreground_mode)??!1)||Ae!==!!(t!=null&&t.command)||Ae&&L!==((t==null?void 0:t.command)??"")||JSON.stringify(Le())!==JSON.stringify((t==null?void 0:t.triggers)??[]),xe=F&&O.some(ve=>ve.schedule==="once"&&(!ve.onceDate||new Date(`${ve.onceDate}T${ve.onceTime}`)<=new Date)),Oe=we&&!!m.trim()&&!xe&&(!Ae||!!L.trim());function ze(ve,Pe){J(He=>He.map((_t,Mn)=>Mn===ve?{..._t,...Pe}:_t))}function Ce(ve){J(Pe=>{const He=Pe.filter((_t,Mn)=>Mn!==ve);return He.length===0&&(X(!1),ie(!1)),He})}function Me(){J(ve=>[...ve,Qi(ve.length>0?ve[ve.length-1].schedule:void 0)])}function Le(){return O.flatMap(ve=>{const Pe=Nj(ve);return Pe?[Pe]:[]})}function Fe(){return K?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.
|
|
117
|
+
|
|
118
|
+
Are you sure you want to continue?`):!0}async function gn(){te("save"),j(null);try{const ve=se?"task.update":"task.create",Pe={user_prompt:m,agent:y,triggers:Le(),triggers_enabled:F,requires_confirmation:z,yolo_mode:K,foreground_mode:he,command:Ae?L:""};se&&(Pe.id=t.id);const He=await c(ve,Pe,{timeout:13e4});return He.error?(j(He.error),null):(se||localStorage.setItem("palmier:lastAgent",y),a(He),He)}catch(ve){return j(ve instanceof Error?ve.message:String(ve)),null}finally{te(null)}}async function Xt(){te("run"),j(null);try{const Pe=await c("task.run_oneoff",{user_prompt:m,agent:y,requires_confirmation:z,yolo_mode:K,foreground_mode:he,command:Ae?L:""});if(Pe.error){j(Pe.error);return}localStorage.setItem("palmier:lastAgent",y),l(Pe.task_id,Pe.run_id),u()}catch(ve){j(ve instanceof Error?ve.message:String(ve))}finally{te(null)}}return S.jsx("div",{className:"task-form-overlay",children:S.jsx("div",{className:"task-form",children:M?S.jsx(wj,{body:x,permissions:t==null?void 0:t.permissions}):S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"task-form-header",children:S.jsx("h2",{children:t?"Edit Task":"New Task"})}),le&&S.jsx("div",{className:"form-error",children:le}),S.jsx("textarea",{autoFocus:!t,className:"form-textarea",value:m,onChange:ve=>d(ve.target.value),placeholder:Ae?"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:me}),S.jsxs("div",{className:"plan-actions",children:[q&&S.jsx("button",{className:"btn btn-link",onClick:()=>G(!0),children:"Execution Plan"}),S.jsxs("div",{className:"agent-picker-section-inline",style:{marginLeft:"auto"},children:[S.jsx("span",{className:"agent-picker-label",children:"Run with"}),S.jsx("select",{className:"form-select form-select-sm",value:y,onChange:ve=>g(ve.target.value),children:n.map(ve=>S.jsx("option",{value:ve.key,children:ve.label},ve.key))})]})]}),S.jsxs("div",{className:"toggles-group",children:[S.jsxs("div",{className:`command-section${Ae?" command-section-active":""}`,children:[S.jsxs("label",{className:"toggle-label",children:[S.jsx("input",{type:"checkbox",checked:Ae,onChange:ve=>{N(ve.target.checked),ve.target.checked?setTimeout(()=>{var Pe;return(Pe=E.current)==null?void 0:Pe.focus()},0):Y("")},disabled:me}),"Reactive"]}),Ae&&S.jsxs(S.Fragment,{children:[S.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."}),S.jsx("input",{ref:E,className:"form-input form-input-mono",type:"text",value:L,onChange:ve=>Y(ve.target.value),placeholder:"gws gmail +watch --project my-project",disabled:me})]})]}),r==="win32"&&S.jsxs("label",{className:"toggle-label",children:[S.jsx("input",{type:"checkbox",checked:he,onChange:ve=>I(ve.target.checked),disabled:me}),"Run in the foreground (host must login to Windows)"]}),S.jsxs("label",{className:"toggle-label",children:[S.jsx("input",{type:"checkbox",checked:K,onChange:ve=>ge(ve.target.checked),disabled:me}),"Yolo mode"]}),K&&S.jsx("p",{className:"command-help-text",children:"The agent will auto-approve all tool calls without asking for permission."}),S.jsxs("div",{className:"triggers-section",children:[S.jsxs("label",{className:"toggle-label",children:[S.jsx("input",{type:"checkbox",checked:F,onChange:ve=>{ve.target.checked?(X(!0),O.length===0&&Me()):(X(!1),ie(!1),J(Pe=>{const He=Pe.filter(_t=>_t.schedule==="once"?_t.onceDate&&new Date(`${_t.onceDate}T${_t.onceTime}`)>new Date:!0);return He.length===1&&He[0].schedule==="daily"&&He[0].time==="00:00"?[]:He}))},disabled:me}),"Add schedules"]}),S.jsxs("div",{className:`triggers-section-body${F?"":" disabled"}`,children:[O.map((ve,Pe)=>S.jsxs("div",{className:"trigger-row-card",children:[S.jsxs("div",{className:"trigger-row-content",children:[S.jsxs("div",{className:"trigger-row-top",children:[S.jsxs("select",{className:"form-select",value:ve.schedule,disabled:!F,onChange:He=>ze(Pe,{schedule:He.target.value}),children:[S.jsx("option",{value:"once",children:"Specific Time"}),S.jsx("option",{value:"hourly",children:"Hourly"}),S.jsx("option",{value:"daily",children:"Daily"}),S.jsx("option",{value:"weekly",children:"Weekly"}),S.jsx("option",{value:"monthly",children:"Monthly"})]}),ve.schedule==="daily"&&S.jsx("input",{className:"form-input",type:"time",value:ve.time,disabled:!F,onChange:He=>ze(Pe,{time:He.target.value})}),ve.schedule==="weekly"&&S.jsxs(S.Fragment,{children:[S.jsx("select",{className:"form-select",value:ve.dayOfWeek,disabled:!F,onChange:He=>ze(Pe,{dayOfWeek:He.target.value}),children:Aj.map((He,_t)=>S.jsx("option",{value:String(_t),children:He},_t))}),S.jsx("input",{className:"form-input",type:"time",value:ve.time,disabled:!F,onChange:He=>ze(Pe,{time:He.target.value})})]})]}),ve.schedule==="monthly"&&S.jsxs("div",{className:"trigger-details",children:[S.jsx("select",{className:"form-select",value:ve.dayOfMonth,disabled:!F,onChange:He=>ze(Pe,{dayOfMonth:He.target.value}),children:Array.from({length:28},(He,_t)=>_t+1).map(He=>S.jsxs("option",{value:String(He),children:["Day ",He]},He))}),S.jsx("input",{className:"form-input",type:"time",value:ve.time,disabled:!F,onChange:He=>ze(Pe,{time:He.target.value})})]}),ve.schedule==="once"&&S.jsxs("div",{className:"trigger-details",children:[S.jsx("input",{className:"form-input",type:"date",value:ve.onceDate,min:new Date().toISOString().split("T")[0],disabled:!F,onChange:He=>ze(Pe,{onceDate:He.target.value})}),S.jsx("input",{className:"form-input",type:"time",value:ve.onceTime,min:ve.onceDate===new Date().toISOString().split("T")[0]?new Date().toTimeString().slice(0,5):void 0,disabled:!F,onChange:He=>ze(Pe,{onceTime:He.target.value})})]})]}),S.jsx("button",{className:"trigger-remove-btn",onClick:()=>Ce(Pe),disabled:!F,title:"Remove trigger",children:"×"})]},Pe)),O.length>0&&S.jsx("button",{className:"trigger-add-btn",onClick:Me,disabled:!F,children:"+ Add Schedule"})]})]}),F&&O.length>0&&S.jsxs("label",{className:"toggle-label",children:[S.jsx("input",{type:"checkbox",checked:z,onChange:ve=>ie(ve.target.checked),disabled:me}),"Confirm before each run"]})]}),!K&&(()=>{const ve=n.find(Pe=>Pe.key===y);return(ve==null?void 0:ve.supportsPermissions)===!1&&S.jsxs("div",{className:"form-warning",children:["Palmier does not support runtime permission granting for ",ve.label,". The task may fail if required permissions are not pre-configured."]})})(),S.jsxs("div",{className:"form-actions",children:[(()=>{const ve=O.length>0,Pe=!!m.trim()&&(!Ae||!!L.trim());return se?we?S.jsxs("button",{className:"btn btn-primary",onClick:()=>Fe()&&gn(),disabled:!Oe||me,children:[H==="save"&&S.jsx("span",{className:"btn-spinner"}),"Save"]}):S.jsx("button",{className:"btn btn-primary",disabled:!0,children:"Save"}):ve?S.jsxs("button",{className:"btn btn-primary",onClick:()=>Fe()&&gn(),disabled:!Oe||me,children:[H==="save"&&S.jsx("span",{className:"btn-spinner"}),"Schedule"]}):S.jsxs(S.Fragment,{children:[S.jsxs("button",{className:"btn btn-primary",onClick:()=>Fe()&&Xt(),disabled:!Pe||me,children:[H==="run"&&S.jsx("span",{className:"btn-spinner"}),"Run"]}),S.jsx("button",{className:"btn btn-secondary",onClick:()=>Fe()&&gn(),disabled:!Oe||me,children:"Save"})]})})(),S.jsx("button",{className:"btn btn-secondary",onClick:()=>{we&&m.trim()&&!confirm("You have unsaved changes. Discard?")||u()},style:{marginLeft:"auto"},children:"Cancel"})]})]})})})}const Mj="0.5.7";function Dj(t,n){if(t.includes("-"))return!1;const r=t.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 zj({connected:t,hostId:n,request:r,subscribeEvents:a,onViewRun:l,onUpdateRequired:u,onVersion:c}){const[f,m]=U.useState([]),[d,y]=U.useState(!1),[g,x]=U.useState(null),[v,C]=U.useState(new Map),[D,q]=U.useState(new Set),[M,G]=U.useState(new Map),[V,le]=U.useState(new Map),[j,O]=U.useState(new Map),[J,F]=U.useState(!1),[X,z]=U.useState(void 0),[ie,K]=U.useState([]),[ge,he]=U.useState(),I=U.useCallback(()=>{F(!1),z(void 0)},[]),H=U.useCallback(async()=>{var Y,E;if(t){y(!0),x(null);try{const se=await r("task.list"),we=se.tasks??[],xe=new Map,Oe=new Set,ze=new Map,Ce=new Map,Me=new Map;for(const Fe of we)Fe.status&&(xe.set(Fe.id,Fe.status),Fe.status.pending_confirmation&&Oe.add(Fe.id),(Y=Fe.status.pending_permission)!=null&&Y.length&&ze.set(Fe.id,Fe.status.pending_permission),(E=Fe.status.pending_input)!=null&&E.length&&(Ce.set(Fe.id,Fe.status.pending_input),Me.set(Fe.id,new Array(Fe.status.pending_input.length).fill(""))));C(xe),q(Oe),G(ze),le(Ce),O(Me),m(we),K(se.agents??[]),he(se.host_platform),W2(se.agents??[]);const Le=se.version??null;c==null||c(Le),u==null||u(!!Le&&Dj(Le,Mj))}catch(se){const we=se instanceof Error?se.message:String(se);we==="Not connected"||we.includes("503")||we.toLowerCase().includes("no responders")?x(null):x(we),m([])}finally{y(!1)}}},[t,n,r]);U.useEffect(()=>{t?H():(m([]),y(!1))},[t,n,H]),U.useEffect(()=>{if(!t||!n)return;const Y={decode:se=>new TextDecoder().decode(se)};return a(n,async se=>{var ze,Ce;const we=se.subject.split(".");if(we.length<3)return;const xe=we.slice(2).join(".");let Oe;try{Oe=JSON.parse(Y.decode(se.data)).event_type}catch{return}if(Oe==="confirm-resolved"){q(Me=>{if(!Me.has(xe))return Me;const Le=new Set(Me);return Le.delete(xe),Le});return}if(Oe==="permission-resolved"){G(Me=>{if(!Me.has(xe))return Me;const Le=new Map(Me);return Le.delete(xe),Le});return}if(Oe==="input-resolved"){le(Me=>{if(!Me.has(xe))return Me;const Le=new Map(Me);return Le.delete(xe),Le}),O(Me=>{const Le=new Map(Me);return Le.delete(xe),Le});return}try{const Me=await r("task.status",{id:xe},{timeout:5e3});if(Me.error)return;C(Le=>{const Fe=new Map(Le);return Fe.set(xe,Me),Fe}),Me.pending_confirmation&&q(Le=>{if(Le.has(xe))return Le;const Fe=new Set(Le);return Fe.add(xe),Fe}),(ze=Me.pending_permission)!=null&&ze.length&&G(Le=>{if(Le.has(xe))return Le;const Fe=new Map(Le);return Fe.set(xe,Me.pending_permission),Fe}),(Ce=Me.pending_input)!=null&&Ce.length&&(le(Le=>{if(Le.has(xe))return Le;const Fe=new Map(Le);return Fe.set(xe,Me.pending_input),Fe}),O(Le=>{if(Le.has(xe))return Le;const Fe=new Map(Le);return Fe.set(xe,new Array(Me.pending_input.length).fill("")),Fe}))}catch{}})},[t,n,a,r]);async function te(Y,E){try{await r("task.user_input",{id:Y,value:[E]})}catch(se){console.error("[TaskListView] Failed to respond to confirmation:",se)}}async function me(Y,E){try{await r("task.user_input",{id:Y,value:[E]})}catch(se){console.error("[TaskListView] Failed to respond to permission request:",se)}}async function Ae(Y,E){try{await r("task.user_input",{id:Y,value:E})}catch(se){console.error("[TaskListView] Failed to respond to input request:",se)}}function N(Y){m(E=>{const se=E.findIndex(we=>we.id===Y.id);if(se>=0){const we=[...E];return we[se]=Y,we}return[Y,...E]}),F(!1),z(void 0)}function L(Y){m(E=>E.filter(se=>se.id!==Y)),C(E=>{const se=new Map(E);return se.delete(Y),se}),le(E=>{const se=new Map(E);return se.delete(Y),se}),O(E=>{const se=new Map(E);return se.delete(Y),se})}return S.jsxs(S.Fragment,{children:[g&&S.jsxs("div",{className:"form-error",children:[g,g.toLowerCase().includes("failed to fetch")&&S.jsxs(S.Fragment,{children:[" ",S.jsx("a",{href:"#",onClick:Y=>{Y.preventDefault(),window.location.reload()},children:"Reload"})]})]}),S.jsx("div",{className:"new-task-input-card",onClick:()=>{z(void 0),F(!0)},role:"button",tabIndex:0,onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(z(void 0),F(!0))},children:S.jsx("span",{className:"new-task-placeholder",children:"Describe your new task..."})}),d&&!f.length?S.jsx("div",{className:"task-list",children:[0,1,2].map(Y=>S.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[S.jsx("div",{className:"task-card-header",children:S.jsxs("div",{className:"task-card-title-row",children:[S.jsx("div",{className:"skeleton-line",style:{width:10,height:10,borderRadius:"50%"}}),S.jsx("div",{className:"skeleton-line",style:{width:`${60+Y*12}%`}})]})}),S.jsxs("div",{className:"task-card-meta",children:[S.jsx("div",{className:"skeleton-line",style:{width:"30%"}}),S.jsx("div",{className:"skeleton-line",style:{width:"25%"}})]})]},Y))}):S.jsx("div",{className:"task-list",children:f.map(Y=>S.jsx(tE,{task:Y,lastEvent:v.get(Y.id),onEdit:async E=>{try{const se=await r("task.get",{id:E.id});z(se.error?E:se)}catch{z(E)}F(!0)},onDelete:L,onViewRun:l},Y.id))}),J&&S.jsx(Rj,{initial:X,agents:ie,hostPlatform:ge,onSaved:N,onRun:l,onCancel:I}),cu.createPortal(S.jsxs(S.Fragment,{children:[[...D].map(Y=>{const E=f.find(se=>se.id===Y);return S.jsx("div",{className:"confirm-modal-overlay",children:S.jsxs("div",{className:"confirm-modal",children:[S.jsx("h2",{className:"confirm-modal-title",children:"Task Confirmation"}),S.jsxs("p",{className:"confirm-modal-message",children:['Run task "',S.jsx("strong",{children:(E==null?void 0:E.name)||(E==null?void 0:E.user_prompt)||Y}),'"?']}),S.jsxs("div",{className:"confirm-modal-actions",children:[S.jsx("button",{className:"btn btn-primary",onClick:()=>te(Y,"confirmed"),children:"Confirm"}),S.jsx("button",{className:"btn btn-secondary",onClick:()=>te(Y,"aborted"),children:"Abort"})]})]})},Y)}),[...M.entries()].map(([Y,E])=>{const se=f.find(we=>we.id===Y);return S.jsx("div",{className:"confirm-modal-overlay",children:S.jsxs("div",{className:"confirm-modal permission-modal",children:[S.jsx("h2",{className:"confirm-modal-title",children:"Permission Required"}),S.jsx("p",{className:"confirm-modal-message",children:S.jsx("strong",{children:(se==null?void 0:se.name)||(se==null?void 0:se.user_prompt)||Y})}),S.jsx("div",{className:"permission-list",children:E.map((we,xe)=>S.jsxs("div",{className:"permission-item",children:[S.jsx("span",{className:"permission-name",children:we.name}),we.description&&S.jsx("span",{className:"permission-desc",children:we.description})]},xe))}),S.jsxs("div",{className:"permission-actions",children:[S.jsx("button",{className:"btn btn-primary",onClick:()=>me(Y,"granted"),children:"Allow Once"}),S.jsx("button",{className:"btn btn-secondary",onClick:()=>me(Y,"granted_all"),children:"Allow Always"})]}),S.jsx("button",{className:"permission-abort-link",onClick:()=>me(Y,"aborted"),children:"Deny & Abort Task"})]})},Y)}),[...V.entries()].map(([Y,E])=>{const se=f.find(xe=>xe.id===Y),we=j.get(Y)??new Array(E.length).fill("");return S.jsx("div",{className:"confirm-modal-overlay",children:S.jsxs("div",{className:"confirm-modal input-modal",children:[S.jsx("h2",{className:"confirm-modal-title",children:"Input Required"}),S.jsx("p",{className:"confirm-modal-message",children:S.jsx("strong",{children:(se==null?void 0:se.name)||(se==null?void 0:se.user_prompt)||Y})}),S.jsx("div",{className:"input-list",children:E.map((xe,Oe)=>S.jsxs("div",{className:"input-item",children:[S.jsx("label",{className:"input-label",children:xe}),S.jsx("input",{type:"text",className:"input-field",value:we[Oe]??"",onChange:ze=>{O(Ce=>{const Me=new Map(Ce),Le=[...Me.get(Y)??[]];return Le[Oe]=ze.target.value,Me.set(Y,Le),Me})},autoFocus:Oe===0})]},Oe))}),S.jsx("div",{className:"input-actions",children:S.jsx("button",{className:"btn btn-primary",disabled:we.some(xe=>!xe.trim()),onClick:()=>Ae(Y,we),children:"Submit"})}),S.jsx("button",{className:"permission-abort-link",onClick:()=>Ae(Y,["aborted"]),children:"Cancel & Abort Task"})]})},Y)})]}),document.body)]})}function Lj(){const t=ea(),r=br().pathname.startsWith("/runs");return S.jsxs(S.Fragment,{children:[S.jsxs("button",{className:`tab-btn ${r?"":"tab-btn-active"}`,onClick:()=>t("/"),children:[S.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:[S.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),S.jsx("path",{d:"M5.5 8L7 9.5L10.5 6"})]}),"Tasks"]}),S.jsxs("button",{className:`tab-btn ${r?"tab-btn-active":""}`,onClick:()=>t("/runs"),children:[S.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:S.jsx("path",{d:"M2 8H4.5L6 4L8 12L10 6L11.5 8H14"})}),"Runs"]})]})}function X1(t){const[n,r]=U.useState(()=>window.matchMedia(t).matches);return U.useEffect(()=>{const a=window.matchMedia(t),l=u=>r(u.matches);return a.addEventListener("change",l),r(a.matches),()=>a.removeEventListener("change",l)},[t]),n}const K0=!!window.__PALMIER_SERVE__;function W0({daemonVersion:t}){var K;const{pairedHosts:n,activeHostId:r,setActiveHostId:a,removePairedHost:l,renamePairedHost:u}=Tl(),c=ea(),f=X1("(min-width: 768px)"),[m,d]=U.useState(!1),[y,g]=U.useState(!1),[x,v]=U.useState(null),[C,D]=U.useState(""),[q,M]=U.useState(null),G=U.useRef(null),V=U.useRef(null),le=U.useCallback(()=>{g(!0)},[]);function j(){y&&(d(!1),g(!1))}function O(){g(!1),d(!0)}function J(ge,he){v(ge),D(he)}function F(){x&&C.trim()&&u(x,C.trim()),v(null),D("")}function X(){v(null),D("")}U.useEffect(()=>{x&&V.current&&(V.current.focus(),V.current.select())},[x]),U.useEffect(()=>{if(!m||y)return;function ge(he){he.key==="Escape"&&le()}return document.addEventListener("keydown",ge),()=>{document.removeEventListener("keydown",ge)}},[m,y,le]);const z=S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"drawer-header",children:[S.jsx("span",{className:"drawer-title",children:"Palmier"}),!f&&S.jsx("button",{className:"drawer-close-btn",onClick:le,"aria-label":"Close menu",children:S.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:S.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),!K0&&n.length>0&&S.jsxs("div",{className:"drawer-section",children:[S.jsx("h3",{className:"drawer-section-label",children:"Hosts"}),S.jsx("div",{className:"host-picker-inline",children:S.jsx("div",{className:"host-picker-list",role:"listbox",children:n.map(ge=>{const he=ge.hostId===r,I=x===ge.hostId,H=ge.name||ge.hostId.slice(0,8);return S.jsx("div",{className:"host-picker-item-wrapper",children:S.jsxs("div",{className:`host-picker-item ${he?"host-picker-item-active":""}`,onClick:()=>{I||he||(a(ge.hostId),f||le())},role:"option","aria-selected":he,children:[I?S.jsx("input",{ref:V,className:"form-input host-picker-rename-input",type:"text",value:C,onChange:te=>D(te.target.value),onKeyDown:te=>{te.key==="Enter"&&F(),te.key==="Escape"&&X()},onBlur:F,onClick:te=>te.stopPropagation()}):S.jsx("span",{className:"host-picker-item-name",children:H}),S.jsxs("div",{className:"host-picker-item-actions",children:[he&&!I&&S.jsx("button",{className:"host-picker-edit-btn",onClick:te=>{te.stopPropagation(),J(ge.hostId,H)},"aria-label":"Rename host",children:S.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:S.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"})})}),!he&&S.jsx("button",{className:"host-picker-delete-btn",onClick:te=>{te.stopPropagation(),M(ge.hostId)},"aria-label":`Unpair ${H}`,children:S.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:S.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"})})})]})]})},ge.hostId)})})})]}),!K0&&S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"drawer-divider"}),S.jsx("div",{className:"drawer-section",children:S.jsx("button",{className:"btn btn-primary btn-full",onClick:()=>{c("/pair"),f||le()},children:"Pair New Host"})})]}),S.jsxs("div",{className:"drawer-footer",children:[t&&S.jsxs("div",{className:"drawer-version",children:["Palmier v",t]}),S.jsxs("div",{className:"drawer-legal",children:[S.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms"}),S.jsx("span",{className:"drawer-legal-sep",children:"·"}),S.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy"})]})]})]}),ie=q&&cu.createPortal(S.jsx("div",{className:"confirm-modal-overlay",onClick:()=>M(null),children:S.jsxs("div",{className:"confirm-modal",onClick:ge=>ge.stopPropagation(),children:[S.jsx("h2",{className:"confirm-modal-title",children:"Delete host?"}),S.jsxs("p",{className:"confirm-modal-message",children:['"',((K=n.find(ge=>ge.hostId===q))==null?void 0:K.name)||q.slice(0,8),'" will be unpaired from this device.']}),S.jsxs("div",{className:"confirm-modal-actions",children:[S.jsx("button",{className:"btn btn-secondary",onClick:()=>M(null),children:"Cancel"}),S.jsx("button",{className:"btn btn-danger",onClick:()=>{l(q),M(null)},children:"Delete"})]})]})}),document.body);return f?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"drawer-panel drawer-panel-desktop",ref:G,children:z}),ie]}):S.jsxs(S.Fragment,{children:[S.jsx("button",{className:"hamburger-btn",onClick:O,"aria-label":"Open menu",children:S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:S.jsx("path",{d:"M3 5H17M3 10H17M3 15H17",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),m&&cu.createPortal(S.jsx("div",{className:`drawer-overlay ${y?"drawer-overlay-closing":""}`,onClick:le,onAnimationEnd:j,children:S.jsx("div",{className:`drawer-panel ${y?"drawer-panel-closing":""}`,ref:G,onClick:ge=>ge.stopPropagation(),children:z})}),document.body),ie]})}const Uj=10;function Bj({connected:t,hostId:n,request:r,subscribeEvents:a,filterTaskId:l,onClearFilter:u}){const[c,f]=U.useState([]),[m,d]=U.useState(0),[y,g]=U.useState(!1),[x,v]=U.useState(!1),C=ea(),D=U.useRef(null),q=U.useCallback(j=>{const O={offset:j,limit:Uj};return l&&(O.task_id=l),O},[l]),M=U.useCallback(async(j,O)=>{if(t){O?v(!0):g(!0);try{const J=await r("taskrun.list",q(j)),F=J.entries??[];d(J.total??0),f(O?X=>{const z=new Set(X.map(K=>`${K.task_id}:${K.run_id}`)),ie=F.filter(K=>!z.has(`${K.task_id}:${K.run_id}`));return[...X,...ie]}:F)}catch(J){J instanceof Error&&J.message==="Not connected"||console.error("Failed to load runs:",J)}finally{g(!1),v(!1)}}},[t,r,q]);U.useEffect(()=>{t?(f([]),d(0),M(0,!1)):(f([]),d(0))},[t,n,M,l]),U.useEffect(()=>!t||!n?void 0:a(n,async O=>{try{const J=JSON.parse(new TextDecoder().decode(O.data));if(J.event_type==="running-state"&&J.running_state&&["monitoring","started","finished","failed","aborted"].includes(J.running_state)){const F=await r("taskrun.list",q(0)),X=F.entries??[];d(F.total??0),f(z=>{const ie=new Map(X.map(I=>[`${I.task_id}:${I.run_id}`,I])),K=z.map(I=>{const H=`${I.task_id}:${I.run_id}`;return ie.get(H)??I}),ge=new Set(K.map(I=>`${I.task_id}:${I.run_id}`));return[...X.filter(I=>!ge.has(`${I.task_id}:${I.run_id}`)),...K]})}}catch{}}),[t,n,a,r]),U.useEffect(()=>{const j=D.current;if(!j)return;const O=new IntersectionObserver(J=>{J[0].isIntersecting&&!x&&c.length<m&&M(c.length,!0)},{threshold:.1});return O.observe(j),()=>O.disconnect()},[c.length,m,x,M]);function G(j,O){if(!j||!O)return"";const J=Math.round((O-j)/1e3);if(J<60)return`${J}s`;const F=Math.floor(J/60),X=J%60;return`${F}m ${X}s`}const V={monitoring:"Monitoring",started:"Running",finished:"Finished",failed:"Failed",aborted:"Aborted"};function le(j){if(j==="failed")return"var(--color-error)";if(j==="aborted")return"var(--color-warning, #d97706)"}return y&&c.length===0&&t?S.jsx("div",{className:"task-list",children:[0,1,2].map(j=>S.jsxs("div",{className:"task-card",style:{pointerEvents:"none"},children:[S.jsx("div",{className:"task-card-header",children:S.jsx("div",{className:"task-card-title-row",children:S.jsx("div",{className:"skeleton-line",style:{width:`${70+j*10}%`}})})}),S.jsx("div",{className:"task-card-meta",children:S.jsx("div",{className:"skeleton-line",style:{width:"45%"}})})]},j))}):!t||y&&c.length===0?S.jsx("div",{className:"runs-view",children:S.jsxs("div",{className:"empty-state",children:[S.jsx("p",{className:"empty-state-text",children:"Runs"}),S.jsx("p",{className:"empty-state-hint",children:"Run history will appear here"})]})}):c.length===0?S.jsxs(S.Fragment,{children:[l&&u&&S.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:S.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",S.jsx("button",{onClick:u,"aria-label":"Clear filter",children:"×"})]})}),S.jsx("div",{className:"runs-view",children:S.jsxs("div",{className:"empty-state",children:[S.jsx("p",{className:"empty-state-text",children:"No runs yet"}),S.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."})]})})]}):S.jsxs(S.Fragment,{children:[l&&u&&S.jsx("div",{style:{marginBottom:"var(--space-sm)"},children:S.jsxs("span",{className:"runs-filter-chip",children:["Filtered by task",S.jsx("button",{onClick:u,"aria-label":"Clear filter",children:"×"})]})}),S.jsxs("div",{className:"task-list",children:[c.map((j,O)=>S.jsxs("div",{className:"runs-card",onClick:()=>!j.error&&C(`/runs/${j.task_id}/${encodeURIComponent(j.run_id)}`),children:[S.jsxs("div",{className:"runs-card-body",children:[S.jsx("h3",{className:"runs-card-name",children:j.task_name||j.task_id}),S.jsxs("div",{className:"runs-card-meta",children:[S.jsx("span",{style:{color:le(j.running_state)},children:V[j.running_state??""]??j.running_state}),j.end_time&&S.jsx("span",{children:vu(j.end_time)}),j.start_time&&j.end_time&&S.jsx("span",{style:{color:"var(--color-muted)"},children:G(j.start_time,j.end_time)}),j.error&&S.jsx("span",{style:{color:"var(--color-muted)"},children:j.error})]})]}),S.jsx("span",{className:"runs-card-chevron",children:"›"})]},`${j.task_id}-${j.run_id}-${O}`)),S.jsx("div",{ref:D,style:{height:1}}),x&&S.jsx("div",{className:"loading-state",style:{padding:"var(--space-md)"},children:S.jsx("div",{className:"spinner"})})]})]})}function qj(t){k1(t,[/\r?\n|\r/g,Hj])}function Hj(){return{type:"break"}}function eb(){return function(t){qj(t)}}function Pj({connected:t,hostId:n,request:r,subscribeEvents:a,taskId:l,runId:u}){const c=ea(),[f,m]=U.useState(!0),[d,y]=U.useState([]),[g,x]=U.useState(),[v,C]=U.useState(),D=g==="started"||g==="monitoring",q=g==="followup",M=g==="started"||g==="followup",[G,V]=U.useState(null),[le,j]=U.useState(!1),[O,J]=U.useState(""),[F,X]=U.useState(!1),z=U.useRef(null);async function ie(){try{const I=await r("task.result",{id:l,run_id:u});if(I.error){console.error("No result:",I.error),c("/runs",{replace:!0});return}y(I.messages??[]),x(I.running_state),C(I.agent)}catch(I){console.error("Failed to load result:",I),c("/runs",{replace:!0})}finally{m(!1)}}async function K(I){var H;try{const me=(H=(await r("task.reports",{id:l,run_id:u,report_files:[I]})).reports)==null?void 0:H[0];me!=null&&me.data_url?V({file:I,data_url:me.data_url}):V({file:I,content:(me==null?void 0:me.content)??"Report not found."})}catch{V({file:I,content:"Failed to load report."})}}U.useEffect(()=>{t&&(m(!0),ie())},[t,l,u]),U.useEffect(()=>!t||!n?void 0:a(n,async H=>{try{const te=JSON.parse(new TextDecoder().decode(H.data));if(te.event_type!=="running-state"&&te.event_type!=="result-updated"||H.subject.split(".").pop()!==l||te.event_type==="result-updated"&&te.run_id&&te.run_id!==u)return;ie()}catch{}}),[t,n,l,a,r]),U.useEffect(()=>{z.current&&(z.current.scrollTop=z.current.scrollHeight)},[d]);function ge(I){if(I==="input")return"User Input";if(I==="permission")return"Permission";if(I==="confirmation")return"Confirmation"}function he(I){return I==="started"?"Task started":I==="finished"?"Task finished":I==="failed"?"Task failed":I==="aborted"?"Task aborted":I==="confirmation"?"Task confirmed":I==="stopped"?"Follow-up stopped":I??""}return S.jsxs("div",{className:"run-detail",children:[S.jsxs("button",{className:"run-detail-back",onClick:()=>c(-1),children:[S.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:S.jsx("path",{d:"M15 18l-6-6 6-6"})}),"Back"]}),f?S.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)",padding:"var(--space-sm) 0"},children:[S.jsx("div",{className:"skeleton-line",style:{width:"40%"}}),S.jsx("div",{className:"skeleton-line",style:{width:"55%"}}),S.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"8rem",marginTop:"var(--space-sm)"}})]}):S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"chat-thread",ref:z,children:[d.map((I,H)=>{const te=M&&I.role==="assistant"&&!d.slice(H+1).some(me=>me.role==="assistant"||me.role==="user");return I.role==="status"&&I.type==="monitoring"?null:I.role==="status"?S.jsxs("div",{className:"chat-status",children:[he(I.type),I.time>0&&S.jsx("span",{className:"chat-status-time",children:vu(I.time)})]},H):S.jsxs("div",{className:`chat-message chat-message--${I.role}`,children:[I.role==="assistant"&&v&&S.jsx("div",{className:"chat-message-agent",children:Ih(v)}),S.jsxs("div",{className:"chat-message-content",children:[S.jsx(Wh,{remarkPlugins:[td,eb],children:I.content}),te&&S.jsxs("div",{className:"chat-typing-indicator",children:[S.jsx("span",{}),S.jsx("span",{}),S.jsx("span",{})]})]}),I.attachments&&I.attachments.length>0&&S.jsx("div",{className:"chat-message-attachments",children:I.attachments.map(me=>S.jsx("button",{className:"chat-attachment-chip",onClick:()=>K(me),children:me},me))}),S.jsxs("div",{className:"chat-message-meta",children:[ge(I.type)&&S.jsx("span",{className:"chat-message-type",children:ge(I.type)}),I.time>0&&S.jsx("span",{children:vu(I.time)})]})]},H)}),M&&(()=>{const I=d.filter(H=>H.role!=="status");return I.length===0||I[I.length-1].role!=="assistant"})()&&S.jsxs("div",{className:"chat-message chat-message--assistant",children:[v&&S.jsx("div",{className:"chat-message-agent",children:Ih(v)}),S.jsxs("div",{className:"chat-typing-indicator",children:[S.jsx("span",{}),S.jsx("span",{}),S.jsx("span",{})]})]}),g==="monitoring"&&S.jsxs("div",{className:"chat-monitoring-indicator",children:[S.jsx("span",{className:"chat-monitoring-dot"}),"Monitoring command output"]})]}),D?S.jsx("div",{className:"chat-abort-bar",children:S.jsx("button",{className:"btn btn-secondary chat-abort-btn",disabled:le,onClick:async()=>{if(confirm("Abort this task?")){j(!0);try{await r("task.abort",{id:l})}catch(I){console.error("Abort failed:",I)}finally{j(!1)}}},children:le?"Aborting...":"Abort Task"})}):q?S.jsx("div",{className:"chat-input-bar",children:S.jsx("button",{className:"btn btn-secondary chat-stop-btn",disabled:le,onClick:async()=>{j(!0);try{await r("task.stop_followup",{id:l,run_id:u})}catch(I){console.error("Stop failed:",I)}finally{j(!1)}},children:S.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:S.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})})}):S.jsxs("form",{className:"chat-input-bar",onSubmit:async I=>{I.preventDefault();const H=O.trim();if(!(!H||F)){X(!0);try{await r("task.followup",{id:l,run_id:u,message:H}),J("")}catch(te){console.error("Follow-up failed:",te)}finally{X(!1)}}},children:[S.jsx("input",{className:"chat-input",type:"text",placeholder:"Follow-up message",value:O,onChange:I=>J(I.target.value),disabled:F}),S.jsx("button",{className:"btn btn-primary chat-send-btn",type:"submit",disabled:!O.trim()||F,children:S.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[S.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),S.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]})]}),G&&S.jsx("div",{className:"report-dialog-overlay",onClick:()=>V(null),children:S.jsxs("div",{className:"report-dialog",onClick:I=>I.stopPropagation(),children:[S.jsxs("div",{className:"report-dialog-header",children:[S.jsx("span",{className:"report-dialog-title",children:G.file}),S.jsx("button",{className:"report-dialog-close",onClick:()=>V(null),"aria-label":"Close",children:S.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[S.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),S.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),S.jsx("div",{className:"report-dialog-body",children:G.data_url?S.jsx("img",{src:G.data_url,alt:G.file,style:{maxWidth:"100%",height:"auto"}}):S.jsx(Wh,{remarkPlugins:[td,eb],components:{a:({...I})=>S.jsx("a",{...I,target:"_blank",rel:"noopener noreferrer"})},children:G.content??""})})]})})]})}async function Q1(t,n,r,a){console.log(`[API] ${t} ${n}`);const u=await fetch(n,{method:t,headers:{"Content-Type":"application/json"},body:r!=null?JSON.stringify(r):void 0});if(!u.ok){const c=await u.text();let f;try{const m=JSON.parse(c);f=m.error??m.message??c}catch{f=c}throw console.error(`[API] ${t} ${n} failed:`,u.status,f),new Error(f||`Request failed with status ${u.status}`)}return console.log(`[API] ${t} ${n} ->`,u.status),u.json()}function Ij(t,n,r){return Q1("POST",t,n)}function Fj(t,n){return Q1("GET",t,void 0)}function $j(){const{getActiveHost:t}=Tl(),n=t(),r=U.useRef(null);U.useEffect(()=>{if(!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 Fj("/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 Ij("/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 ru(){const{pairedHosts:t,activeHostId:n,removePairedHost:r}=Tl(),{connected:a,request:l,subscribeEvents:u,unauthorized:c}=yd(),f=ea(),m=br(),d=KS(),y=X1("(min-width: 768px)"),g=m.pathname.startsWith("/runs"),x=d.runId?void 0:d.taskId,[v,C]=U.useState(null),D=d.runId,q=D==="latest";U.useEffect(()=>{if(!q||!d.taskId||!a){C(null);return}l("taskrun.list",{task_id:d.taskId,limit:1}).then(I=>{var te,me;const H=(me=(te=I.entries)==null?void 0:te[0])==null?void 0:me.run_id;C(H??null)}).catch(()=>C(null))},[q,d.taskId,a]);const M=q?v:D,G=!!(d.taskId&&M&&M!=="latest"),[V,le]=U.useState(!1),[j,O]=U.useState(!1),[J,F]=U.useState(null),[X,z]=U.useState(null);$j(),U.useEffect(()=>{window.scrollTo(0,0)},[n]);function ie(I,H){f(H?`/runs/${encodeURIComponent(I)}/${encodeURIComponent(H)}`:`/runs/${encodeURIComponent(I)}`)}async function K(){O(!0),F(null);try{const I=await l("host.update");if(I.error){F(I.error),O(!1);return}}catch{}setTimeout(()=>window.location.reload(),1e4)}const ge=t.length>0,he=ge&&a&&n&&!c;return S.jsxs("div",{className:"dashboard",children:[y&&S.jsx(W0,{daemonVersion:X}),S.jsxs("div",{className:"dashboard-content",children:[S.jsxs("div",{className:"tab-bar",children:[!y&&S.jsx(W0,{daemonVersion:X}),S.jsx(Lj,{})]}),S.jsx("main",{className:"dashboard-main",children:c?S.jsxs("div",{className:"revoked-state",children:[S.jsx("div",{className:"revoked-icon",children:S.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[S.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),S.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}),S.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"18"})]})}),S.jsx("h2",{className:"revoked-title",children:"Client Revoked"}),S.jsx("p",{className:"revoked-description",children:"This client was revoked by the host. To reconnect, generate a new pairing code on the host machine."}),S.jsx("div",{className:"revoked-command",children:S.jsx("code",{children:"palmier pair"})}),S.jsxs("div",{className:"revoked-actions",children:[S.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Re-pair Device"}),S.jsx("button",{className:"btn btn-secondary",onClick:()=>{n&&r(n)},children:"Remove Host"})]})]}):he?S.jsxs(S.Fragment,{children:[S.jsx("div",{style:{display:g?"none":"contents"},children:S.jsx(zj,{connected:a,hostId:n,request:l,subscribeEvents:u,onViewRun:ie,onUpdateRequired:le,onVersion:z})}),G?S.jsx(Pj,{connected:a,hostId:n,request:l,subscribeEvents:u,taskId:d.taskId,runId:decodeURIComponent(M)}):g?S.jsx(Bj,{connected:a,hostId:n,request:l,subscribeEvents:u,filterTaskId:x,onClearFilter:()=>f("/runs")}):null]}):S.jsxs("div",{className:"empty-state",children:[S.jsx("p",{children:ge?"Connecting to host...":"No hosts paired yet."}),!ge&&S.jsx("button",{className:"btn btn-primary",onClick:()=>f("/pair"),children:"Pair Host"})]})}),V&&!j&&!J&&S.jsx("div",{className:"confirm-modal-overlay",children:S.jsxs("div",{className:"confirm-modal",children:[S.jsx("h2",{className:"confirm-modal-title",children:"Update Required"}),S.jsxs("p",{className:"confirm-modal-message",children:["Your Palmier host",X?` (v${X})`:""," is too old for this version of the app. Please update to continue."]}),S.jsx("div",{className:"confirm-modal-actions",children:S.jsx("button",{className:"btn btn-primary",onClick:K,children:"Update Now"})})]})}),j&&S.jsx("div",{className:"confirm-modal-overlay",children:S.jsxs("div",{className:"confirm-modal",children:[S.jsx("h2",{className:"confirm-modal-title",children:"Updating..."}),S.jsx("p",{className:"confirm-modal-message",children:"Installing update and restarting daemon. Please wait..."})]})}),J&&S.jsx("div",{className:"confirm-modal-overlay",children:S.jsxs("div",{className:"confirm-modal",children:[S.jsx("h2",{className:"confirm-modal-title",children:"Update Failed"}),S.jsx("p",{className:"confirm-modal-message",style:{whiteSpace:"pre-line"},children:J}),S.jsx("div",{className:"confirm-modal-actions",children:S.jsx("button",{className:"btn btn-secondary",onClick:()=>{F(null)},children:"Retry"})})]})})]})]})}const ol=!!window.__PALMIER_SERVE__;function Gj(){const[t,n]=U.useState(""),[r,a]=U.useState(!1),[l,u]=U.useState(null),{addPairedHost:c}=Tl(),f=ea();async function m(){const d=t.trim().toUpperCase();if(!d){u("Enter a pairing code.");return}a(!0),u(null);try{let y;if(ol){const x=await fetch("/pair",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,label:navigator.userAgent})});if(!x.ok){const v=await x.json().catch(()=>({error:"Connection failed"}));throw new Error(v.error||`HTTP ${x.status}`)}y=await x.json()}else{const x=await fetch("/api/config");if(!x.ok)throw new Error("Failed to fetch server config");const v=await x.json();if(!v.natsWsUrl)throw new Error("Server has no NATS WebSocket URL configured");const C=await Pb({servers:v.natsWsUrl,token:v.natsToken}),D=mu(),q=`pair.${d}`,M=await C.request(q,D.encode(JSON.stringify({label:navigator.userAgent})),{timeout:1e4});y=JSON.parse(D.decode(M.data)),await C.close()}const g={hostId:y.hostId,clientToken:y.clientToken,directUrl:ol?window.location.origin:void 0};c(g),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 S.jsx("div",{className:"pair-page",children:S.jsxs("div",{className:"pair-card",children:[S.jsxs("div",{className:"pair-header",children:[S.jsx("h1",{className:"pair-title",children:ol?"Pair":"Pair with Host"}),S.jsx("p",{className:"pair-subtitle",children:ol?"Enter the pairing code shown in your terminal.":"Connect this device to a Palmier host"})]}),!ol&&S.jsxs("div",{className:"pair-instructions",children:[S.jsxs("div",{className:"pair-instruction-block",children:[S.jsx("h3",{className:"pair-instruction-heading",children:"Setting up a new host?"}),S.jsxs("ol",{className:"pair-steps",children:[S.jsxs("li",{children:["Install at least one agent CLI (e.g., ",S.jsx("a",{href:"https://www.palmier.me/agents",target:"_blank",rel:"noopener noreferrer",children:"Claude Code, Gemini CLI, Codex CLI"}),")"]}),S.jsxs("li",{children:["Install Palmier on your host machine:",S.jsx("code",{className:"pair-command",children:"npm install -g palmier"})]}),S.jsxs("li",{children:["Run the setup wizard:",S.jsx("code",{className:"pair-command",children:"palmier init"})]}),S.jsx("li",{children:"A pairing code will display automatically"})]})]}),S.jsx("div",{className:"pair-instruction-divider"}),S.jsxs("div",{className:"pair-instruction-block",children:[S.jsx("h3",{className:"pair-instruction-heading",children:"Pairing an existing host?"}),S.jsxs("ol",{className:"pair-steps",children:[S.jsxs("li",{children:["Run ",S.jsx("code",{children:"palmier pair"})," on the host machine"]}),S.jsx("li",{children:"Enter the 6-character code below"})]})]})]}),S.jsxs("div",{className:"pair-form",children:[S.jsxs("label",{className:"form-label",htmlFor:"pair-code",children:["Pairing code",S.jsx("input",{id:"pair-code",type:"text",maxLength:6,value:t,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&&S.jsx("p",{className:"pair-error",children:l}),S.jsxs("button",{className:"btn btn-primary btn-full",onClick:m,disabled:r||!t.trim(),children:[r&&S.jsx("span",{className:"btn-spinner"}),r?"Pairing...":"Pair"]}),S.jsx("button",{className:"btn btn-secondary btn-full",onClick:()=>f("/"),disabled:r,children:"Cancel"}),S.jsxs("p",{className:"pair-consent",children:["By pairing, you agree to our"," ",S.jsx("a",{href:"https://www.palmier.me/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," and"," ",S.jsx("a",{href:"https://www.palmier.me/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}),"."]})]})]})})}function Yj(){return S.jsx(Z_,{children:S.jsx(K2,{children:S.jsxs(d_,{children:[S.jsx(Fa,{path:"/",element:S.jsx(ru,{})}),S.jsx(Fa,{path:"/runs",element:S.jsx(ru,{})}),S.jsx(Fa,{path:"/runs/:taskId",element:S.jsx(ru,{})}),S.jsx(Fa,{path:"/runs/:taskId/:runId",element:S.jsx(ru,{})}),S.jsx(Fa,{path:"/pair",element:S.jsx(Gj,{})})]})})})}pS.createRoot(document.getElementById("root")).render(S.jsx(U.StrictMode,{children:S.jsx(U_,{children:S.jsx(Yj,{})})}))});export default Vj();
|