@agent-deck/backend 1.7.4 → 1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,499 +0,0 @@
1
- var aD=Object.defineProperty;var $1=e=>{throw TypeError(e)};var iD=(e,t,n)=>t in e?aD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ma=(e,t,n)=>iD(e,typeof t!="symbol"?t+"":t,n),Bm=(e,t,n)=>t.has(e)||$1("Cannot "+n);var z=(e,t,n)=>(Bm(e,t,"read from private field"),n?n.call(e):t.get(e)),xe=(e,t,n)=>t.has(e)?$1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ue=(e,t,n,r)=>(Bm(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ie=(e,t,n)=>(Bm(e,t,"access private method"),n);var Qd=(e,t,n,r)=>({set _(a){ue(e,t,a,n)},get _(){return z(e,t,r)}});function sD(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(r,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var wh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wC={exports:{}},zp={};/**
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 oD=Symbol.for("react.transitional.element"),lD=Symbol.for("react.fragment");function SC(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var a in t)a!=="key"&&(n[a]=t[a])}else n=t;return t=n.ref,{$$typeof:oD,type:e,key:r,ref:t!==void 0?t:null,props:n}}zp.Fragment=lD;zp.jsx=SC;zp.jsxs=SC;wC.exports=zp;var c=wC.exports,_C={exports:{}},Ip={},kC={exports:{}},EC={};/**
10
- * @license React
11
- * scheduler.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
- */(function(e){function t(H,B){var U=H.length;H.push(B);e:for(;0<U;){var Y=U-1>>>1,N=H[Y];if(0<a(N,B))H[Y]=B,H[U]=N,U=Y;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var B=H[0],U=H.pop();if(U!==B){H[0]=U;e:for(var Y=0,N=H.length,F=N>>>1;Y<F;){var V=2*(Y+1)-1,_=H[V],k=V+1,M=H[k];if(0>a(_,U))k<N&&0>a(M,_)?(H[Y]=M,H[k]=U,Y=k):(H[Y]=_,H[V]=U,Y=V);else if(k<N&&0>a(M,U))H[Y]=M,H[k]=U,Y=k;else break e}}return B}function a(H,B){var U=H.sortIndex-B.sortIndex;return U!==0?U:H.id-B.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,o=s.now();e.unstable_now=function(){return s.now()-o}}var l=[],u=[],d=1,f=null,p=3,h=!1,y=!1,m=!1,b=!1,g=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function S(H){for(var B=n(u);B!==null;){if(B.callback===null)r(u);else if(B.startTime<=H)r(u),B.sortIndex=B.expirationTime,t(l,B);else break;B=n(u)}}function E(H){if(m=!1,S(H),!y)if(n(l)!==null)y=!0,C||(C=!0,O());else{var B=n(u);B!==null&&A(E,B.startTime-H)}}var C=!1,T=-1,P=5,R=-1;function $(){return b?!0:!(e.unstable_now()-R<P)}function j(){if(b=!1,C){var H=e.unstable_now();R=H;var B=!0;try{e:{y=!1,m&&(m=!1,v(T),T=-1),h=!0;var U=p;try{t:{for(S(H),f=n(l);f!==null&&!(f.expirationTime>H&&$());){var Y=f.callback;if(typeof Y=="function"){f.callback=null,p=f.priorityLevel;var N=Y(f.expirationTime<=H);if(H=e.unstable_now(),typeof N=="function"){f.callback=N,S(H),B=!0;break t}f===n(l)&&r(l),S(H)}else r(l);f=n(l)}if(f!==null)B=!0;else{var F=n(u);F!==null&&A(E,F.startTime-H),B=!1}}break e}finally{f=null,p=U,h=!1}B=void 0}}finally{B?O():C=!1}}}var O;if(typeof w=="function")O=function(){w(j)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,D=L.port2;L.port1.onmessage=j,O=function(){D.postMessage(null)}}else O=function(){g(j,0)};function A(H,B){T=g(function(){H(e.unstable_now())},B)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.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"):P=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_next=function(H){switch(p){case 1:case 2:case 3:var B=3;break;default:B=p}var U=p;p=B;try{return H()}finally{p=U}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(H,B){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var U=p;p=H;try{return B()}finally{p=U}},e.unstable_scheduleCallback=function(H,B,U){var Y=e.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?Y+U:Y):U=Y,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=U+N,H={id:d++,callback:B,priorityLevel:H,startTime:U,expirationTime:N,sortIndex:-1},U>Y?(H.sortIndex=U,t(u,H),n(l)===null&&H===n(u)&&(m?(v(T),T=-1):m=!0,A(E,U-Y))):(H.sortIndex=N,t(l,H),y||h||(y=!0,C||(C=!0,O()))),H},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(H){var B=p;return function(){var U=p;p=B;try{return H.apply(this,arguments)}finally{p=U}}}})(EC);kC.exports=EC;var cD=kC.exports,CC={exports:{}},Re={};/**
18
- * @license React
19
- * react.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 Z0=Symbol.for("react.transitional.element"),uD=Symbol.for("react.portal"),dD=Symbol.for("react.fragment"),fD=Symbol.for("react.strict_mode"),hD=Symbol.for("react.profiler"),pD=Symbol.for("react.consumer"),mD=Symbol.for("react.context"),gD=Symbol.for("react.forward_ref"),yD=Symbol.for("react.suspense"),vD=Symbol.for("react.memo"),NC=Symbol.for("react.lazy"),bD=Symbol.for("react.activity"),O1=Symbol.iterator;function xD(e){return e===null||typeof e!="object"?null:(e=O1&&e[O1]||e["@@iterator"],typeof e=="function"?e:null)}var jC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},TC=Object.assign,AC={};function hc(e,t,n){this.props=e,this.context=t,this.refs=AC,this.updater=n||jC}hc.prototype.isReactComponent={};hc.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};hc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function RC(){}RC.prototype=hc.prototype;function K0(e,t,n){this.props=e,this.context=t,this.refs=AC,this.updater=n||jC}var G0=K0.prototype=new RC;G0.constructor=K0;TC(G0,hc.prototype);G0.isPureReactComponent=!0;var M1=Array.isArray;function _y(){}var Ct={H:null,A:null,T:null,S:null},$C=Object.prototype.hasOwnProperty;function Q0(e,t,n){var r=n.ref;return{$$typeof:Z0,type:e,key:t,ref:r!==void 0?r:null,props:n}}function wD(e,t){return Q0(e.type,t,e.props)}function Y0(e){return typeof e=="object"&&e!==null&&e.$$typeof===Z0}function SD(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var P1=/\/+/g;function Vm(e,t){return typeof e=="object"&&e!==null&&e.key!=null?SD(""+e.key):t.toString(36)}function _D(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(_y,_y):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Vo(e,t,n,r,a){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Z0:case uD:s=!0;break;case NC:return s=e._init,Vo(s(e._payload),t,n,r,a)}}if(s)return a=a(e),s=r===""?"."+Vm(e,0):r,M1(a)?(n="",s!=null&&(n=s.replace(P1,"$&/")+"/"),Vo(a,t,n,"",function(u){return u})):a!=null&&(Y0(a)&&(a=wD(a,n+(a.key==null||e&&e.key===a.key?"":(""+a.key).replace(P1,"$&/")+"/")+s)),t.push(a)),1;s=0;var o=r===""?".":r+":";if(M1(e))for(var l=0;l<e.length;l++)r=e[l],i=o+Vm(r,l),s+=Vo(r,t,n,i,a);else if(l=xD(e),typeof l=="function")for(e=l.call(e),l=0;!(r=e.next()).done;)r=r.value,i=o+Vm(r,l++),s+=Vo(r,t,n,i,a);else if(i==="object"){if(typeof e.then=="function")return Vo(_D(e),t,n,r,a);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return s}function Yd(e,t,n){if(e==null)return e;var r=[],a=0;return Vo(e,r,"","",function(i){return t.call(n,i,a++)}),r}function kD(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var D1=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=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(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},ED={map:Yd,forEach:function(e,t,n){Yd(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Yd(e,function(){t++}),t},toArray:function(e){return Yd(e,function(t){return t})||[]},only:function(e){if(!Y0(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Re.Activity=bD;Re.Children=ED;Re.Component=hc;Re.Fragment=dD;Re.Profiler=hD;Re.PureComponent=K0;Re.StrictMode=fD;Re.Suspense=yD;Re.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ct;Re.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Ct.H.useMemoCache(e)}};Re.cache=function(e){return function(){return e.apply(null,arguments)}};Re.cacheSignal=function(){return null};Re.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=TC({},e.props),a=e.key;if(t!=null)for(i in t.key!==void 0&&(a=""+t.key),t)!$C.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(r[i]=t[i]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var s=Array(i),o=0;o<i;o++)s[o]=arguments[o+2];r.children=s}return Q0(e.type,a,r)};Re.createContext=function(e){return e={$$typeof:mD,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:pD,_context:e},e};Re.createElement=function(e,t,n){var r,a={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)$C.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(a[r]=t[r]);var s=arguments.length-2;if(s===1)a.children=n;else if(1<s){for(var o=Array(s),l=0;l<s;l++)o[l]=arguments[l+2];a.children=o}if(e&&e.defaultProps)for(r in s=e.defaultProps,s)a[r]===void 0&&(a[r]=s[r]);return Q0(e,i,a)};Re.createRef=function(){return{current:null}};Re.forwardRef=function(e){return{$$typeof:gD,render:e}};Re.isValidElement=Y0;Re.lazy=function(e){return{$$typeof:NC,_payload:{_status:-1,_result:e},_init:kD}};Re.memo=function(e,t){return{$$typeof:vD,type:e,compare:t===void 0?null:t}};Re.startTransition=function(e){var t=Ct.T,n={};Ct.T=n;try{var r=e(),a=Ct.S;a!==null&&a(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(_y,D1)}catch(i){D1(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Ct.T=t}};Re.unstable_useCacheRefresh=function(){return Ct.H.useCacheRefresh()};Re.use=function(e){return Ct.H.use(e)};Re.useActionState=function(e,t,n){return Ct.H.useActionState(e,t,n)};Re.useCallback=function(e,t){return Ct.H.useCallback(e,t)};Re.useContext=function(e){return Ct.H.useContext(e)};Re.useDebugValue=function(){};Re.useDeferredValue=function(e,t){return Ct.H.useDeferredValue(e,t)};Re.useEffect=function(e,t){return Ct.H.useEffect(e,t)};Re.useEffectEvent=function(e){return Ct.H.useEffectEvent(e)};Re.useId=function(){return Ct.H.useId()};Re.useImperativeHandle=function(e,t,n){return Ct.H.useImperativeHandle(e,t,n)};Re.useInsertionEffect=function(e,t){return Ct.H.useInsertionEffect(e,t)};Re.useLayoutEffect=function(e,t){return Ct.H.useLayoutEffect(e,t)};Re.useMemo=function(e,t){return Ct.H.useMemo(e,t)};Re.useOptimistic=function(e,t){return Ct.H.useOptimistic(e,t)};Re.useReducer=function(e,t,n){return Ct.H.useReducer(e,t,n)};Re.useRef=function(e){return Ct.H.useRef(e)};Re.useState=function(e){return Ct.H.useState(e)};Re.useSyncExternalStore=function(e,t,n){return Ct.H.useSyncExternalStore(e,t,n)};Re.useTransition=function(){return Ct.H.useTransition()};Re.version="19.2.8";CC.exports=Re;var x=CC.exports;const fa=fc(x),hd=sD({__proto__:null,default:fa},[x]);var OC={exports:{}},Fn={};/**
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 CD=x;function MC(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Si(){}var Un={d:{f:Si,r:function(){throw Error(MC(522))},D:Si,C:Si,L:Si,m:Si,X:Si,S:Si,M:Si},p:0,findDOMNode:null},ND=Symbol.for("react.portal");function jD(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ND,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var uu=CD.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Lp(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Un;Fn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(MC(299));return jD(e,t,null,n)};Fn.flushSync=function(e){var t=uu.T,n=Un.p;try{if(uu.T=null,Un.p=2,e)return e()}finally{uu.T=t,Un.p=n,Un.d.f()}};Fn.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Un.d.C(e,t))};Fn.prefetchDNS=function(e){typeof e=="string"&&Un.d.D(e)};Fn.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=Lp(n,t.crossOrigin),a=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Un.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:i}):n==="script"&&Un.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Fn.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Lp(t.as,t.crossOrigin);Un.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&Un.d.M(e)};Fn.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=Lp(n,t.crossOrigin);Un.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Fn.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Lp(t.as,t.crossOrigin);Un.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else Un.d.m(e)};Fn.requestFormReset=function(e){Un.d.r(e)};Fn.unstable_batchedUpdates=function(e,t){return e(t)};Fn.useFormState=function(e,t,n){return uu.H.useFormState(e,t,n)};Fn.useFormStatus=function(){return uu.H.useHostTransitionStatus()};Fn.version="19.2.8";function PC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(PC)}catch(e){console.error(e)}}PC(),OC.exports=Fn;var No=OC.exports;const TD=fc(No);/**
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 nn=cD,DC=x,AD=No;function X(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function zC(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function pd(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function IC(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function LC(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function z1(e){if(pd(e)!==e)throw Error(X(188))}function RD(e){var t=e.alternate;if(!t){if(t=pd(e),t===null)throw Error(X(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var i=a.alternate;if(i===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===n)return z1(a),e;if(i===r)return z1(a),t;i=i.sibling}throw Error(X(188))}if(n.return!==r.return)n=a,r=i;else{for(var s=!1,o=a.child;o;){if(o===n){s=!0,n=a,r=i;break}if(o===r){s=!0,r=a,n=i;break}o=o.sibling}if(!s){for(o=i.child;o;){if(o===n){s=!0,n=i,r=a;break}if(o===r){s=!0,r=i,n=a;break}o=o.sibling}if(!s)throw Error(X(189))}}if(n.alternate!==r)throw Error(X(190))}if(n.tag!==3)throw Error(X(188));return n.stateNode.current===n?e:t}function UC(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=UC(e),t!==null)return t;e=e.sibling}return null}var Tt=Object.assign,$D=Symbol.for("react.element"),Xd=Symbol.for("react.transitional.element"),Wc=Symbol.for("react.portal"),tl=Symbol.for("react.fragment"),FC=Symbol.for("react.strict_mode"),ky=Symbol.for("react.profiler"),qC=Symbol.for("react.consumer"),Xa=Symbol.for("react.context"),X0=Symbol.for("react.forward_ref"),Ey=Symbol.for("react.suspense"),Cy=Symbol.for("react.suspense_list"),W0=Symbol.for("react.memo"),Ai=Symbol.for("react.lazy"),Ny=Symbol.for("react.activity"),OD=Symbol.for("react.memo_cache_sentinel"),I1=Symbol.iterator;function Pc(e){return e===null||typeof e!="object"?null:(e=I1&&e[I1]||e["@@iterator"],typeof e=="function"?e:null)}var MD=Symbol.for("react.client.reference");function jy(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===MD?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case tl:return"Fragment";case ky:return"Profiler";case FC:return"StrictMode";case Ey:return"Suspense";case Cy:return"SuspenseList";case Ny:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Wc:return"Portal";case Xa:return e.displayName||"Context";case qC:return(e._context.displayName||"Context")+".Consumer";case X0:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case W0:return t=e.displayName||null,t!==null?t:jy(e.type)||"Memo";case Ai:t=e._payload,e=e._init;try{return jy(e(t))}catch{}}return null}var Jc=Array.isArray,Ne=DC.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,tt=AD.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ro={pending:!1,data:null,method:null,action:null},Ty=[],nl=-1;function ja(e){return{current:e}}function cn(e){0>nl||(e.current=Ty[nl],Ty[nl]=null,nl--)}function mt(e,t){nl++,Ty[nl]=e.current,e.current=t}var Ea=ja(null),Lu=ja(null),ts=ja(null),Sh=ja(null);function _h(e,t){switch(mt(ts,t),mt(Lu,e),mt(Ea,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?BS(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=BS(t),e=l2(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}cn(Ea),mt(Ea,e)}function Bl(){cn(Ea),cn(Lu),cn(ts)}function Ay(e){e.memoizedState!==null&&mt(Sh,e);var t=Ea.current,n=l2(t,e.type);t!==n&&(mt(Lu,e),mt(Ea,n))}function kh(e){Lu.current===e&&(cn(Ea),cn(Lu)),Sh.current===e&&(cn(Sh),Yu._currentValue=ro)}var Zm,L1;function Ps(e){if(Zm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Zm=t&&t[1]||"",L1=-1<n.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+Zm+e+L1}var Km=!1;function Gm(e,t){if(!e||Km)return"";Km=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(h){var p=h}Reflect.construct(e,[],f)}else{try{f.call()}catch(h){p=h}e.call(f.prototype)}}else{try{throw Error()}catch(h){p=h}(f=e())&&typeof f.catch=="function"&&f.catch(function(){})}}catch(h){if(h&&p&&typeof h.stack=="string")return[h.stack,p.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),s=i[0],o=i[1];if(s&&o){var l=s.split(`
44
- `),u=o.split(`
45
- `);for(a=r=0;r<l.length&&!l[r].includes("DetermineComponentFrameRoot");)r++;for(;a<u.length&&!u[a].includes("DetermineComponentFrameRoot");)a++;if(r===l.length||a===u.length)for(r=l.length-1,a=u.length-1;1<=r&&0<=a&&l[r]!==u[a];)a--;for(;1<=r&&0<=a;r--,a--)if(l[r]!==u[a]){if(r!==1||a!==1)do if(r--,a--,0>a||l[r]!==u[a]){var d=`
46
- `+l[r].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=r&&0<=a);break}}}finally{Km=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ps(n):""}function PD(e,t){switch(e.tag){case 26:case 27:case 5:return Ps(e.type);case 16:return Ps("Lazy");case 13:return e.child!==t&&t!==null?Ps("Suspense Fallback"):Ps("Suspense");case 19:return Ps("SuspenseList");case 0:case 15:return Gm(e.type,!1);case 11:return Gm(e.type.render,!1);case 1:return Gm(e.type,!0);case 31:return Ps("Activity");default:return""}}function U1(e){try{var t="",n=null;do t+=PD(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
47
- Error generating stack: `+r.message+`
48
- `+r.stack}}var Ry=Object.prototype.hasOwnProperty,J0=nn.unstable_scheduleCallback,Qm=nn.unstable_cancelCallback,DD=nn.unstable_shouldYield,zD=nn.unstable_requestPaint,pr=nn.unstable_now,ID=nn.unstable_getCurrentPriorityLevel,HC=nn.unstable_ImmediatePriority,BC=nn.unstable_UserBlockingPriority,Eh=nn.unstable_NormalPriority,LD=nn.unstable_LowPriority,VC=nn.unstable_IdlePriority,UD=nn.log,FD=nn.unstable_setDisableYieldValue,md=null,mr=null;function Qi(e){if(typeof UD=="function"&&FD(e),mr&&typeof mr.setStrictMode=="function")try{mr.setStrictMode(md,e)}catch{}}var gr=Math.clz32?Math.clz32:BD,qD=Math.log,HD=Math.LN2;function BD(e){return e>>>=0,e===0?32:31-(qD(e)/HD|0)|0}var Wd=256,Jd=262144,ef=4194304;function Ds(e){var t=e&42;if(t!==0)return t;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 Up(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var a=0,i=e.suspendedLanes,s=e.pingedLanes;e=e.warmLanes;var o=r&134217727;return o!==0?(r=o&~i,r!==0?a=Ds(r):(s&=o,s!==0?a=Ds(s):n||(n=o&~e,n!==0&&(a=Ds(n))))):(o=r&~i,o!==0?a=Ds(o):s!==0?a=Ds(s):n||(n=r&~e,n!==0&&(a=Ds(n)))),a===0?0:t!==0&&t!==a&&!(t&i)&&(i=a&-a,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:a}function gd(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function VD(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 ZC(){var e=ef;return ef<<=1,!(ef&62914560)&&(ef=4194304),e}function Ym(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function yd(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ZD(e,t,n,r,a,i){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(n=s&~n;0<n;){var d=31-gr(n),f=1<<d;o[d]=0,l[d]=-1;var p=u[d];if(p!==null)for(u[d]=null,d=0;d<p.length;d++){var h=p[d];h!==null&&(h.lane&=-536870913)}n&=~f}r!==0&&KC(e,r,0),i!==0&&a===0&&e.tag!==0&&(e.suspendedLanes|=i&~(s&~t))}function KC(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-gr(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function GC(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-gr(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}function QC(e,t){var n=t&-t;return n=n&42?1:eb(n),n&(e.suspendedLanes|t)?0:n}function eb(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 tb(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function YC(){var e=tt.p;return e!==0?e:(e=window.event,e===void 0?32:b2(e.type))}function F1(e,t){var n=tt.p;try{return tt.p=e,t()}finally{tt.p=n}}var ws=Math.random().toString(36).slice(2),vn="__reactFiber$"+ws,nr="__reactProps$"+ws,pc="__reactContainer$"+ws,$y="__reactEvents$"+ws,KD="__reactListeners$"+ws,GD="__reactHandles$"+ws,q1="__reactResources$"+ws,vd="__reactMarker$"+ws;function nb(e){delete e[vn],delete e[nr],delete e[$y],delete e[KD],delete e[GD]}function rl(e){var t=e[vn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[pc]||n[vn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=QS(e);e!==null;){if(n=e[vn])return n;e=QS(e)}return t}e=n,n=e.parentNode}return null}function mc(e){if(e=e[vn]||e[pc]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function eu(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(X(33))}function yl(e){var t=e[q1];return t||(t=e[q1]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ln(e){e[vd]=!0}var XC=new Set,WC={};function jo(e,t){Vl(e,t),Vl(e+"Capture",t)}function Vl(e,t){for(WC[e]=t,e=0;e<t.length;e++)XC.add(t[e])}var QD=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]*$"),H1={},B1={};function YD(e){return Ry.call(B1,e)?!0:Ry.call(H1,e)?!1:QD.test(e)?B1[e]=!0:(H1[e]=!0,!1)}function Ff(e,t,n){if(YD(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function tf(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Pa(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+r)}}function Rr(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function JC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function XD(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(s){n=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Oy(e){if(!e._valueTracker){var t=JC(e)?"checked":"value";e._valueTracker=XD(e,t,""+e[t])}}function eN(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=JC(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ch(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 WD=/[\n"\\]/g;function Dr(e){return e.replace(WD,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function My(e,t,n,r,a,i,s,o){e.name="",s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.type=s:e.removeAttribute("type"),t!=null?s==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Rr(t)):e.value!==""+Rr(t)&&(e.value=""+Rr(t)):s!=="submit"&&s!=="reset"||e.removeAttribute("value"),t!=null?Py(e,s,Rr(t)):n!=null?Py(e,s,Rr(n)):r!=null&&e.removeAttribute("value"),a==null&&i!=null&&(e.defaultChecked=!!i),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+Rr(o):e.removeAttribute("name")}function tN(e,t,n,r,a,i,s,o){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){Oy(e);return}n=n!=null?""+Rr(n):"",t=t!=null?""+Rr(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}r=r??a,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=o?e.checked:!!r,e.defaultChecked=!!r,s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.name=s),Oy(e)}function Py(e,t,n){t==="number"&&Ch(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function vl(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Rr(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function nN(e,t,n){if(t!=null&&(t=""+Rr(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Rr(n):""}function rN(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(X(92));if(Jc(r)){if(1<r.length)throw Error(X(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=Rr(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),Oy(e)}function Zl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var JD=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 V1(e,t,n){var r=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,n):typeof n!="number"||n===0||JD.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function aN(e,t,n){if(t!=null&&typeof t!="object")throw Error(X(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&V1(e,a,r)}else for(var i in t)t.hasOwnProperty(i)&&V1(e,i,t[i])}function rb(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 e4=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"]]),t4=/^[\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 qf(e){return t4.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Wa(){}var Dy=null;function ab(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var al=null,bl=null;function Z1(e){var t=mc(e);if(t&&(e=t.stateNode)){var n=e[nr]||null;e:switch(e=t.stateNode,t.type){case"input":if(My(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Dr(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[nr]||null;if(!a)throw Error(X(90));My(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&eN(r)}break e;case"textarea":nN(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&vl(e,!!n.multiple,t,!1)}}}var Xm=!1;function iN(e,t,n){if(Xm)return e(t,n);Xm=!0;try{var r=e(t);return r}finally{if(Xm=!1,(al!==null||bl!==null)&&(Wp(),al&&(t=al,e=bl,bl=al=null,Z1(t),e)))for(t=0;t<e.length;t++)Z1(e[t])}}function Uu(e,t){var n=e.stateNode;if(n===null)return null;var r=n[nr]||null;if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(X(231,t,typeof n));return n}var li=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zy=!1;if(li)try{var Dc={};Object.defineProperty(Dc,"passive",{get:function(){zy=!0}}),window.addEventListener("test",Dc,Dc),window.removeEventListener("test",Dc,Dc)}catch{zy=!1}var Yi=null,ib=null,Hf=null;function sN(){if(Hf)return Hf;var e,t=ib,n=t.length,r,a="value"in Yi?Yi.value:Yi.textContent,i=a.length;for(e=0;e<n&&t[e]===a[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===a[i-r];r++);return Hf=a.slice(e,1<r?1-r:void 0)}function Bf(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function nf(){return!0}function K1(){return!1}function rr(e){function t(n,r,a,i,s){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?nf:K1,this.isPropagationStopped=K1,this}return Tt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=nf)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=nf)},persist:function(){},isPersistent:nf}),t}var To={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fp=rr(To),bd=Tt({},To,{view:0,detail:0}),n4=rr(bd),Wm,Jm,zc,qp=Tt({},bd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sb,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!==zc&&(zc&&e.type==="mousemove"?(Wm=e.screenX-zc.screenX,Jm=e.screenY-zc.screenY):Jm=Wm=0,zc=e),Wm)},movementY:function(e){return"movementY"in e?e.movementY:Jm}}),G1=rr(qp),r4=Tt({},qp,{dataTransfer:0}),a4=rr(r4),i4=Tt({},bd,{relatedTarget:0}),eg=rr(i4),s4=Tt({},To,{animationName:0,elapsedTime:0,pseudoElement:0}),o4=rr(s4),l4=Tt({},To,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),c4=rr(l4),u4=Tt({},To,{data:0}),Q1=rr(u4),d4={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},f4={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"},h4={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function p4(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=h4[e])?!!t[e]:!1}function sb(){return p4}var m4=Tt({},bd,{key:function(e){if(e.key){var t=d4[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Bf(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?f4[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sb,charCode:function(e){return e.type==="keypress"?Bf(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Bf(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),g4=rr(m4),y4=Tt({},qp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Y1=rr(y4),v4=Tt({},bd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sb}),b4=rr(v4),x4=Tt({},To,{propertyName:0,elapsedTime:0,pseudoElement:0}),w4=rr(x4),S4=Tt({},qp,{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}),_4=rr(S4),k4=Tt({},To,{newState:0,oldState:0}),E4=rr(k4),C4=[9,13,27,32],ob=li&&"CompositionEvent"in window,du=null;li&&"documentMode"in document&&(du=document.documentMode);var N4=li&&"TextEvent"in window&&!du,oN=li&&(!ob||du&&8<du&&11>=du),X1=" ",W1=!1;function lN(e,t){switch(e){case"keyup":return C4.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cN(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var il=!1;function j4(e,t){switch(e){case"compositionend":return cN(t);case"keypress":return t.which!==32?null:(W1=!0,X1);case"textInput":return e=t.data,e===X1&&W1?null:e;default:return null}}function T4(e,t){if(il)return e==="compositionend"||!ob&&lN(e,t)?(e=sN(),Hf=ib=Yi=null,il=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return oN&&t.locale!=="ko"?null:t.data;default:return null}}var A4={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 J1(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!A4[e.type]:t==="textarea"}function uN(e,t,n,r){al?bl?bl.push(r):bl=[r]:al=r,t=Bh(t,"onChange"),0<t.length&&(n=new Fp("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var fu=null,Fu=null;function R4(e){i2(e,0)}function Hp(e){var t=eu(e);if(eN(t))return e}function eS(e,t){if(e==="change")return t}var dN=!1;if(li){var tg;if(li){var ng="oninput"in document;if(!ng){var tS=document.createElement("div");tS.setAttribute("oninput","return;"),ng=typeof tS.oninput=="function"}tg=ng}else tg=!1;dN=tg&&(!document.documentMode||9<document.documentMode)}function nS(){fu&&(fu.detachEvent("onpropertychange",fN),Fu=fu=null)}function fN(e){if(e.propertyName==="value"&&Hp(Fu)){var t=[];uN(t,Fu,e,ab(e)),iN(R4,t)}}function $4(e,t,n){e==="focusin"?(nS(),fu=t,Fu=n,fu.attachEvent("onpropertychange",fN)):e==="focusout"&&nS()}function O4(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Hp(Fu)}function M4(e,t){if(e==="click")return Hp(t)}function P4(e,t){if(e==="input"||e==="change")return Hp(t)}function D4(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xr=typeof Object.is=="function"?Object.is:D4;function qu(e,t){if(xr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!Ry.call(t,a)||!xr(e[a],t[a]))return!1}return!0}function rS(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function aS(e,t){var n=rS(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=rS(n)}}function hN(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?hN(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function pN(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ch(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ch(e.document)}return t}function lb(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var z4=li&&"documentMode"in document&&11>=document.documentMode,sl=null,Iy=null,hu=null,Ly=!1;function iS(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ly||sl==null||sl!==Ch(r)||(r=sl,"selectionStart"in r&&lb(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),hu&&qu(hu,r)||(hu=r,r=Bh(Iy,"onSelect"),0<r.length&&(t=new Fp("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=sl)))}function As(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ol={animationend:As("Animation","AnimationEnd"),animationiteration:As("Animation","AnimationIteration"),animationstart:As("Animation","AnimationStart"),transitionrun:As("Transition","TransitionRun"),transitionstart:As("Transition","TransitionStart"),transitioncancel:As("Transition","TransitionCancel"),transitionend:As("Transition","TransitionEnd")},rg={},mN={};li&&(mN=document.createElement("div").style,"AnimationEvent"in window||(delete ol.animationend.animation,delete ol.animationiteration.animation,delete ol.animationstart.animation),"TransitionEvent"in window||delete ol.transitionend.transition);function Ao(e){if(rg[e])return rg[e];if(!ol[e])return e;var t=ol[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in mN)return rg[e]=t[n];return e}var gN=Ao("animationend"),yN=Ao("animationiteration"),vN=Ao("animationstart"),I4=Ao("transitionrun"),L4=Ao("transitionstart"),U4=Ao("transitioncancel"),bN=Ao("transitionend"),xN=new Map,Uy="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(" ");Uy.push("scrollEnd");function sa(e,t){xN.set(e,t),jo(t,[e])}var Nh=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=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(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},jr=[],ll=0,cb=0;function Bp(){for(var e=ll,t=cb=ll=0;t<e;){var n=jr[t];jr[t++]=null;var r=jr[t];jr[t++]=null;var a=jr[t];jr[t++]=null;var i=jr[t];if(jr[t++]=null,r!==null&&a!==null){var s=r.pending;s===null?a.next=a:(a.next=s.next,s.next=a),r.pending=a}i!==0&&wN(n,a,i)}}function Vp(e,t,n,r){jr[ll++]=e,jr[ll++]=t,jr[ll++]=n,jr[ll++]=r,cb|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ub(e,t,n,r){return Vp(e,t,n,r),jh(e)}function Ro(e,t){return Vp(e,null,null,t),jh(e)}function wN(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var a=!1,i=e.return;i!==null;)i.childLanes|=n,r=i.alternate,r!==null&&(r.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(a=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,a&&t!==null&&(a=31-gr(n),e=i.hiddenUpdates,r=e[a],r===null?e[a]=[t]:r.push(t),t.lane=n|536870912),i):null}function jh(e){if(50<Su)throw Su=0,ov=null,Error(X(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var cl={};function F4(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fr(e,t,n,r){return new F4(e,t,n,r)}function db(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ti(e,t){var n=e.alternate;return n===null?(n=fr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function SN(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Vf(e,t,n,r,a,i){var s=0;if(r=e,typeof e=="function")db(e)&&(s=1);else if(typeof e=="string")s=Zz(e,n,Ea.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Ny:return e=fr(31,n,t,a),e.elementType=Ny,e.lanes=i,e;case tl:return ao(n.children,a,i,t);case FC:s=8,a|=24;break;case ky:return e=fr(12,n,t,a|2),e.elementType=ky,e.lanes=i,e;case Ey:return e=fr(13,n,t,a),e.elementType=Ey,e.lanes=i,e;case Cy:return e=fr(19,n,t,a),e.elementType=Cy,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Xa:s=10;break e;case qC:s=9;break e;case X0:s=11;break e;case W0:s=14;break e;case Ai:s=16,r=null;break e}s=29,n=Error(X(130,e===null?"null":typeof e,"")),r=null}return t=fr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function ao(e,t,n,r){return e=fr(7,e,r,t),e.lanes=n,e}function ag(e,t,n){return e=fr(6,e,null,t),e.lanes=n,e}function _N(e){var t=fr(18,null,null,0);return t.stateNode=e,t}function ig(e,t,n){return t=fr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var sS=new WeakMap;function zr(e,t){if(typeof e=="object"&&e!==null){var n=sS.get(e);return n!==void 0?n:(t={value:e,source:t,stack:U1(t)},sS.set(e,t),t)}return{value:e,source:t,stack:U1(t)}}var ul=[],dl=0,Th=null,Hu=0,$r=[],Or=0,hs=null,xa=1,wa="";function Ha(e,t){ul[dl++]=Hu,ul[dl++]=Th,Th=e,Hu=t}function kN(e,t,n){$r[Or++]=xa,$r[Or++]=wa,$r[Or++]=hs,hs=e;var r=xa;e=wa;var a=32-gr(r)-1;r&=~(1<<a),n+=1;var i=32-gr(t)+a;if(30<i){var s=a-a%5;i=(r&(1<<s)-1).toString(32),r>>=s,a-=s,xa=1<<32-gr(t)+a|n<<a|r,wa=i+e}else xa=1<<i|n<<a|r,wa=e}function fb(e){e.return!==null&&(Ha(e,1),kN(e,1,0))}function hb(e){for(;e===Th;)Th=ul[--dl],ul[dl]=null,Hu=ul[--dl],ul[dl]=null;for(;e===hs;)hs=$r[--Or],$r[Or]=null,wa=$r[--Or],$r[Or]=null,xa=$r[--Or],$r[Or]=null}function EN(e,t){$r[Or++]=xa,$r[Or++]=wa,$r[Or++]=hs,xa=t.id,wa=t.overflow,hs=e}var bn=null,wt=null,Ye=!1,ns=null,Ir=!1,Fy=Error(X(519));function ps(e){var t=Error(X(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Bu(zr(t,e)),Fy}function oS(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[vn]=e,t[nr]=r,n){case"dialog":Be("cancel",t),Be("close",t);break;case"iframe":case"object":case"embed":Be("load",t);break;case"video":case"audio":for(n=0;n<Gu.length;n++)Be(Gu[n],t);break;case"source":Be("error",t);break;case"img":case"image":case"link":Be("error",t),Be("load",t);break;case"details":Be("toggle",t);break;case"input":Be("invalid",t),tN(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Be("invalid",t);break;case"textarea":Be("invalid",t),rN(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||r.suppressHydrationWarning===!0||o2(t.textContent,n)?(r.popover!=null&&(Be("beforetoggle",t),Be("toggle",t)),r.onScroll!=null&&Be("scroll",t),r.onScrollEnd!=null&&Be("scrollend",t),r.onClick!=null&&(t.onclick=Wa),t=!0):t=!1,t||ps(e,!0)}function lS(e){for(bn=e.return;bn;)switch(bn.tag){case 5:case 31:case 13:Ir=!1;return;case 27:case 3:Ir=!0;return;default:bn=bn.return}}function Do(e){if(e!==bn)return!1;if(!Ye)return lS(e),Ye=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||fv(e.type,e.memoizedProps)),n=!n),n&&wt&&ps(e),lS(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(X(317));wt=GS(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(X(317));wt=GS(e)}else t===27?(t=wt,Ss(e.type)?(e=gv,gv=null,wt=e):wt=t):wt=bn?Ur(e.stateNode.nextSibling):null;return!0}function co(){wt=bn=null,Ye=!1}function sg(){var e=ns;return e!==null&&(Yn===null?Yn=e:Yn.push.apply(Yn,e),ns=null),e}function Bu(e){ns===null?ns=[e]:ns.push(e)}var qy=ja(null),$o=null,Ja=null;function Pi(e,t,n){mt(qy,t._currentValue),t._currentValue=n}function ni(e){e._currentValue=qy.current,cn(qy)}function Hy(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function By(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var i=a.dependencies;if(i!==null){var s=a.child;i=i.firstContext;e:for(;i!==null;){var o=i;i=a;for(var l=0;l<t.length;l++)if(o.context===t[l]){i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),Hy(i.return,n,e),r||(s=null);break e}i=o.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(X(341));s.lanes|=n,i=s.alternate,i!==null&&(i.lanes|=n),Hy(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function gc(e,t,n,r){e=null;for(var a=t,i=!1;a!==null;){if(!i){if(a.flags&524288)i=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(X(387));if(s=s.memoizedProps,s!==null){var o=a.type;xr(a.pendingProps.value,s.value)||(e!==null?e.push(o):e=[o])}}else if(a===Sh.current){if(s=a.alternate,s===null)throw Error(X(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e!==null?e.push(Yu):e=[Yu])}a=a.return}e!==null&&By(t,e,n,r),t.flags|=262144}function Ah(e){for(e=e.firstContext;e!==null;){if(!xr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function uo(e){$o=e,Ja=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function xn(e){return CN($o,e)}function rf(e,t){return $o===null&&uo(e),CN(e,t)}function CN(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ja===null){if(e===null)throw Error(X(308));Ja=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ja=Ja.next=t;return n}var q4=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},H4=nn.unstable_scheduleCallback,B4=nn.unstable_NormalPriority,Gt={$$typeof:Xa,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pb(){return{controller:new q4,data:new Map,refCount:0}}function xd(e){e.refCount--,e.refCount===0&&H4(B4,function(){e.controller.abort()})}var pu=null,Vy=0,Kl=0,xl=null;function V4(e,t){if(pu===null){var n=pu=[];Vy=0,Kl=Lb(),xl={status:"pending",value:void 0,then:function(r){n.push(r)}}}return Vy++,t.then(cS,cS),t}function cS(){if(--Vy===0&&pu!==null){xl!==null&&(xl.status="fulfilled");var e=pu;pu=null,Kl=0,xl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Z4(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var a=0;a<n.length;a++)(0,n[a])(t)},function(a){for(r.status="rejected",r.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),r}var uS=Ne.S;Ne.S=function(e,t){Uj=pr(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&V4(e,t),uS!==null&&uS(e,t)};var io=ja(null);function mb(){var e=io.current;return e!==null?e:ht.pooledCache}function Zf(e,t){t===null?mt(io,io.current):mt(io,t.pool)}function NN(){var e=mb();return e===null?null:{parent:Gt._currentValue,pool:e}}var yc=Error(X(460)),gb=Error(X(474)),Zp=Error(X(542)),Rh={then:function(){}};function dS(e){return e=e.status,e==="fulfilled"||e==="rejected"}function jN(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Wa,Wa),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,hS(e),e;default:if(typeof t.status=="string")t.then(Wa,Wa);else{if(e=ht,e!==null&&100<e.shellSuspendCounter)throw Error(X(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var a=t;a.status="fulfilled",a.value=r}},function(r){if(t.status==="pending"){var a=t;a.status="rejected",a.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,hS(e),e}throw so=t,yc}}function zs(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(so=n,yc):n}}var so=null;function fS(){if(so===null)throw Error(X(459));var e=so;return so=null,e}function hS(e){if(e===yc||e===Zp)throw Error(X(483))}var wl=null,Vu=0;function af(e){var t=Vu;return Vu+=1,wl===null&&(wl=[]),jN(wl,e,t)}function Ic(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function sf(e,t){throw t.$$typeof===$D?Error(X(525)):(e=Object.prototype.toString.call(t),Error(X(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function TN(e){function t(g,v){if(e){var w=g.deletions;w===null?(g.deletions=[v],g.flags|=16):w.push(v)}}function n(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function r(g){for(var v=new Map;g!==null;)g.key!==null?v.set(g.key,g):v.set(g.index,g),g=g.sibling;return v}function a(g,v){return g=ti(g,v),g.index=0,g.sibling=null,g}function i(g,v,w){return g.index=w,e?(w=g.alternate,w!==null?(w=w.index,w<v?(g.flags|=67108866,v):w):(g.flags|=67108866,v)):(g.flags|=1048576,v)}function s(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function o(g,v,w,S){return v===null||v.tag!==6?(v=ag(w,g.mode,S),v.return=g,v):(v=a(v,w),v.return=g,v)}function l(g,v,w,S){var E=w.type;return E===tl?d(g,v,w.props.children,S,w.key):v!==null&&(v.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Ai&&zs(E)===v.type)?(v=a(v,w.props),Ic(v,w),v.return=g,v):(v=Vf(w.type,w.key,w.props,null,g.mode,S),Ic(v,w),v.return=g,v)}function u(g,v,w,S){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=ig(w,g.mode,S),v.return=g,v):(v=a(v,w.children||[]),v.return=g,v)}function d(g,v,w,S,E){return v===null||v.tag!==7?(v=ao(w,g.mode,S,E),v.return=g,v):(v=a(v,w),v.return=g,v)}function f(g,v,w){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return v=ag(""+v,g.mode,w),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Xd:return w=Vf(v.type,v.key,v.props,null,g.mode,w),Ic(w,v),w.return=g,w;case Wc:return v=ig(v,g.mode,w),v.return=g,v;case Ai:return v=zs(v),f(g,v,w)}if(Jc(v)||Pc(v))return v=ao(v,g.mode,w,null),v.return=g,v;if(typeof v.then=="function")return f(g,af(v),w);if(v.$$typeof===Xa)return f(g,rf(g,v),w);sf(g,v)}return null}function p(g,v,w,S){var E=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return E!==null?null:o(g,v,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Xd:return w.key===E?l(g,v,w,S):null;case Wc:return w.key===E?u(g,v,w,S):null;case Ai:return w=zs(w),p(g,v,w,S)}if(Jc(w)||Pc(w))return E!==null?null:d(g,v,w,S,null);if(typeof w.then=="function")return p(g,v,af(w),S);if(w.$$typeof===Xa)return p(g,v,rf(g,w),S);sf(g,w)}return null}function h(g,v,w,S,E){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return g=g.get(w)||null,o(v,g,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Xd:return g=g.get(S.key===null?w:S.key)||null,l(v,g,S,E);case Wc:return g=g.get(S.key===null?w:S.key)||null,u(v,g,S,E);case Ai:return S=zs(S),h(g,v,w,S,E)}if(Jc(S)||Pc(S))return g=g.get(w)||null,d(v,g,S,E,null);if(typeof S.then=="function")return h(g,v,w,af(S),E);if(S.$$typeof===Xa)return h(g,v,w,rf(v,S),E);sf(v,S)}return null}function y(g,v,w,S){for(var E=null,C=null,T=v,P=v=0,R=null;T!==null&&P<w.length;P++){T.index>P?(R=T,T=null):R=T.sibling;var $=p(g,T,w[P],S);if($===null){T===null&&(T=R);break}e&&T&&$.alternate===null&&t(g,T),v=i($,v,P),C===null?E=$:C.sibling=$,C=$,T=R}if(P===w.length)return n(g,T),Ye&&Ha(g,P),E;if(T===null){for(;P<w.length;P++)T=f(g,w[P],S),T!==null&&(v=i(T,v,P),C===null?E=T:C.sibling=T,C=T);return Ye&&Ha(g,P),E}for(T=r(T);P<w.length;P++)R=h(T,g,P,w[P],S),R!==null&&(e&&R.alternate!==null&&T.delete(R.key===null?P:R.key),v=i(R,v,P),C===null?E=R:C.sibling=R,C=R);return e&&T.forEach(function(j){return t(g,j)}),Ye&&Ha(g,P),E}function m(g,v,w,S){if(w==null)throw Error(X(151));for(var E=null,C=null,T=v,P=v=0,R=null,$=w.next();T!==null&&!$.done;P++,$=w.next()){T.index>P?(R=T,T=null):R=T.sibling;var j=p(g,T,$.value,S);if(j===null){T===null&&(T=R);break}e&&T&&j.alternate===null&&t(g,T),v=i(j,v,P),C===null?E=j:C.sibling=j,C=j,T=R}if($.done)return n(g,T),Ye&&Ha(g,P),E;if(T===null){for(;!$.done;P++,$=w.next())$=f(g,$.value,S),$!==null&&(v=i($,v,P),C===null?E=$:C.sibling=$,C=$);return Ye&&Ha(g,P),E}for(T=r(T);!$.done;P++,$=w.next())$=h(T,g,P,$.value,S),$!==null&&(e&&$.alternate!==null&&T.delete($.key===null?P:$.key),v=i($,v,P),C===null?E=$:C.sibling=$,C=$);return e&&T.forEach(function(O){return t(g,O)}),Ye&&Ha(g,P),E}function b(g,v,w,S){if(typeof w=="object"&&w!==null&&w.type===tl&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Xd:e:{for(var E=w.key;v!==null;){if(v.key===E){if(E=w.type,E===tl){if(v.tag===7){n(g,v.sibling),S=a(v,w.props.children),S.return=g,g=S;break e}}else if(v.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Ai&&zs(E)===v.type){n(g,v.sibling),S=a(v,w.props),Ic(S,w),S.return=g,g=S;break e}n(g,v);break}else t(g,v);v=v.sibling}w.type===tl?(S=ao(w.props.children,g.mode,S,w.key),S.return=g,g=S):(S=Vf(w.type,w.key,w.props,null,g.mode,S),Ic(S,w),S.return=g,g=S)}return s(g);case Wc:e:{for(E=w.key;v!==null;){if(v.key===E)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(g,v.sibling),S=a(v,w.children||[]),S.return=g,g=S;break e}else{n(g,v);break}else t(g,v);v=v.sibling}S=ig(w,g.mode,S),S.return=g,g=S}return s(g);case Ai:return w=zs(w),b(g,v,w,S)}if(Jc(w))return y(g,v,w,S);if(Pc(w)){if(E=Pc(w),typeof E!="function")throw Error(X(150));return w=E.call(w),m(g,v,w,S)}if(typeof w.then=="function")return b(g,v,af(w),S);if(w.$$typeof===Xa)return b(g,v,rf(g,w),S);sf(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint"?(w=""+w,v!==null&&v.tag===6?(n(g,v.sibling),S=a(v,w),S.return=g,g=S):(n(g,v),S=ag(w,g.mode,S),S.return=g,g=S),s(g)):n(g,v)}return function(g,v,w,S){try{Vu=0;var E=b(g,v,w,S);return wl=null,E}catch(T){if(T===yc||T===Zp)throw T;var C=fr(29,T,null,g.mode);return C.lanes=S,C.return=g,C}finally{}}}var fo=TN(!0),AN=TN(!1),Ri=!1;function yb(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Zy(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function rs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function as(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,et&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,t=jh(e),wN(e,null,n),t}return Vp(e,r,t,n),jh(e)}function mu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,GC(e,n)}}function og(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?a=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ky=!1;function gu(){if(Ky){var e=xl;if(e!==null)throw e}}function yu(e,t,n,r){Ky=!1;var a=e.updateQueue;Ri=!1;var i=a.firstBaseUpdate,s=a.lastBaseUpdate,o=a.shared.pending;if(o!==null){a.shared.pending=null;var l=o,u=l.next;l.next=null,s===null?i=u:s.next=u,s=l;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==s&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=l))}if(i!==null){var f=a.baseState;s=0,d=u=l=null,o=i;do{var p=o.lane&-536870913,h=p!==o.lane;if(h?(Ke&p)===p:(r&p)===p){p!==0&&p===Kl&&(Ky=!0),d!==null&&(d=d.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var y=e,m=o;p=t;var b=n;switch(m.tag){case 1:if(y=m.payload,typeof y=="function"){f=y.call(b,f,p);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=m.payload,p=typeof y=="function"?y.call(b,f,p):y,p==null)break e;f=Tt({},f,p);break e;case 2:Ri=!0}}p=o.callback,p!==null&&(e.flags|=64,h&&(e.flags|=8192),h=a.callbacks,h===null?a.callbacks=[p]:h.push(p))}else h={lane:p,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=h,l=f):d=d.next=h,s|=p;if(o=o.next,o===null){if(o=a.shared.pending,o===null)break;h=o,o=h.next,h.next=null,a.lastBaseUpdate=h,a.shared.pending=null}}while(!0);d===null&&(l=f),a.baseState=l,a.firstBaseUpdate=u,a.lastBaseUpdate=d,i===null&&(a.shared.lanes=0),gs|=s,e.lanes=s,e.memoizedState=f}}function RN(e,t){if(typeof e!="function")throw Error(X(191,e));e.call(t)}function $N(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)RN(n[e],t)}var Gl=ja(null),$h=ja(0);function pS(e,t){e=fi,mt($h,e),mt(Gl,t),fi=e|t.baseLanes}function Gy(){mt($h,fi),mt(Gl,Gl.current)}function vb(){fi=$h.current,cn(Gl),cn($h)}var wr=ja(null),Lr=null;function Di(e){var t=e.alternate;mt(Ht,Ht.current&1),mt(wr,e),Lr===null&&(t===null||Gl.current!==null||t.memoizedState!==null)&&(Lr=e)}function Qy(e){mt(Ht,Ht.current),mt(wr,e),Lr===null&&(Lr=e)}function ON(e){e.tag===22?(mt(Ht,Ht.current),mt(wr,e),Lr===null&&(Lr=e)):zi()}function zi(){mt(Ht,Ht.current),mt(wr,wr.current)}function cr(e){cn(wr),Lr===e&&(Lr=null),cn(Ht)}var Ht=ja(0);function Oh(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||pv(n)||mv(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ci=0,Oe=null,ct=null,Zt=null,Mh=!1,Sl=!1,ho=!1,Ph=0,Zu=0,_l=null,K4=0;function Lt(){throw Error(X(321))}function bb(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xr(e[n],t[n]))return!1;return!0}function xb(e,t,n,r,a,i){return ci=i,Oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ne.H=e===null||e.memoizedState===null?uj:Rb,ho=!1,i=n(r,a),ho=!1,Sl&&(i=PN(t,n,r,a)),MN(e),i}function MN(e){Ne.H=Ku;var t=ct!==null&&ct.next!==null;if(ci=0,Zt=ct=Oe=null,Mh=!1,Zu=0,_l=null,t)throw Error(X(300));e===null||Qt||(e=e.dependencies,e!==null&&Ah(e)&&(Qt=!0))}function PN(e,t,n,r){Oe=e;var a=0;do{if(Sl&&(_l=null),Zu=0,Sl=!1,25<=a)throw Error(X(301));if(a+=1,Zt=ct=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}Ne.H=dj,i=t(n,r)}while(Sl);return i}function G4(){var e=Ne.H,t=e.useState()[0];return t=typeof t.then=="function"?wd(t):t,e=e.useState()[0],(ct!==null?ct.memoizedState:null)!==e&&(Oe.flags|=1024),t}function wb(){var e=Ph!==0;return Ph=0,e}function Sb(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function _b(e){if(Mh){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Mh=!1}ci=0,Zt=ct=Oe=null,Sl=!1,Zu=Ph=0,_l=null}function Pn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?Oe.memoizedState=Zt=e:Zt=Zt.next=e,Zt}function Bt(){if(ct===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=ct.next;var t=Zt===null?Oe.memoizedState:Zt.next;if(t!==null)Zt=t,ct=e;else{if(e===null)throw Oe.alternate===null?Error(X(467)):Error(X(310));ct=e,e={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},Zt===null?Oe.memoizedState=Zt=e:Zt=Zt.next=e}return Zt}function Kp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wd(e){var t=Zu;return Zu+=1,_l===null&&(_l=[]),e=jN(_l,e,t),t=Oe,(Zt===null?t.memoizedState:Zt.next)===null&&(t=t.alternate,Ne.H=t===null||t.memoizedState===null?uj:Rb),e}function Gp(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return wd(e);if(e.$$typeof===Xa)return xn(e)}throw Error(X(438,String(e)))}function kb(e){var t=null,n=Oe.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Oe.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(a){return a.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Kp(),Oe.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=OD;return t.index++,n}function ui(e,t){return typeof t=="function"?t(e):t}function Kf(e){var t=Bt();return Eb(t,ct,e)}function Eb(e,t,n){var r=e.queue;if(r===null)throw Error(X(311));r.lastRenderedReducer=n;var a=e.baseQueue,i=r.pending;if(i!==null){if(a!==null){var s=a.next;a.next=i.next,i.next=s}t.baseQueue=a=i,r.pending=null}if(i=e.baseState,a===null)e.memoizedState=i;else{t=a.next;var o=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f!==u.lane?(Ke&f)===f:(ci&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Kl&&(d=!0);else if((ci&p)===p){u=u.next,p===Kl&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(o=l=f,s=i):l=l.next=f,Oe.lanes|=p,gs|=p;f=u.action,ho&&n(i,f),i=u.hasEagerState?u.eagerState:n(i,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(o=l=p,s=i):l=l.next=p,Oe.lanes|=f,gs|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=i:l.next=o,!xr(i,e.memoizedState)&&(Qt=!0,d&&(n=xl,n!==null)))throw n;e.memoizedState=i,e.baseState=s,e.baseQueue=l,r.lastRenderedState=i}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function lg(e){var t=Bt(),n=t.queue;if(n===null)throw Error(X(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,i=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do i=e(i,s.action),s=s.next;while(s!==a);xr(i,t.memoizedState)||(Qt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function DN(e,t,n){var r=Oe,a=Bt(),i=Ye;if(i){if(n===void 0)throw Error(X(407));n=n()}else n=t();var s=!xr((ct||a).memoizedState,n);if(s&&(a.memoizedState=n,Qt=!0),a=a.queue,Cb(LN.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||Zt!==null&&Zt.memoizedState.tag&1){if(r.flags|=2048,Ql(9,{destroy:void 0},IN.bind(null,r,a,n,t),null),ht===null)throw Error(X(349));i||ci&127||zN(r,t,n)}return n}function zN(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Oe.updateQueue,t===null?(t=Kp(),Oe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function IN(e,t,n,r){t.value=n,t.getSnapshot=r,UN(t)&&FN(e)}function LN(e,t,n){return n(function(){UN(t)&&FN(e)})}function UN(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xr(e,n)}catch{return!0}}function FN(e){var t=Ro(e,2);t!==null&&tr(t,e,2)}function Yy(e){var t=Pn();if(typeof e=="function"){var n=e;if(e=n(),ho){Qi(!0);try{n()}finally{Qi(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ui,lastRenderedState:e},t}function qN(e,t,n,r){return e.baseState=n,Eb(e,ct,typeof r=="function"?r:ui)}function Q4(e,t,n,r,a){if(Yp(e))throw Error(X(485));if(e=t.action,e!==null){var i={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(s){i.listeners.push(s)}};Ne.T!==null?n(!0):i.isTransition=!1,r(i),n=t.pending,n===null?(i.next=t.pending=i,HN(t,i)):(i.next=n.next,t.pending=n.next=i)}}function HN(e,t){var n=t.action,r=t.payload,a=e.state;if(t.isTransition){var i=Ne.T,s={};Ne.T=s;try{var o=n(a,r),l=Ne.S;l!==null&&l(s,o),mS(e,t,o)}catch(u){Xy(e,t,u)}finally{i!==null&&s.types!==null&&(i.types=s.types),Ne.T=i}}else try{i=n(a,r),mS(e,t,i)}catch(u){Xy(e,t,u)}}function mS(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){gS(e,t,r)},function(r){return Xy(e,t,r)}):gS(e,t,n)}function gS(e,t,n){t.status="fulfilled",t.value=n,BN(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,HN(e,n)))}function Xy(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,BN(t),t=t.next;while(t!==r)}e.action=null}function BN(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function VN(e,t){return t}function yS(e,t){if(Ye){var n=ht.formState;if(n!==null){e:{var r=Oe;if(Ye){if(wt){t:{for(var a=wt,i=Ir;a.nodeType!==8;){if(!i){a=null;break t}if(a=Ur(a.nextSibling),a===null){a=null;break t}}i=a.data,a=i==="F!"||i==="F"?a:null}if(a){wt=Ur(a.nextSibling),r=a.data==="F!";break e}}ps(r)}r=!1}r&&(t=n[0])}}return n=Pn(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:VN,lastRenderedState:t},n.queue=r,n=oj.bind(null,Oe,r),r.dispatch=n,r=Yy(!1),i=Ab.bind(null,Oe,!1,r.queue),r=Pn(),a={state:t,dispatch:null,action:e,pending:null},r.queue=a,n=Q4.bind(null,Oe,a,i,n),a.dispatch=n,r.memoizedState=e,[t,n,!1]}function vS(e){var t=Bt();return ZN(t,ct,e)}function ZN(e,t,n){if(t=Eb(e,t,VN)[0],e=Kf(ui)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=wd(t)}catch(s){throw s===yc?Zp:s}else r=t;t=Bt();var a=t.queue,i=a.dispatch;return n!==t.memoizedState&&(Oe.flags|=2048,Ql(9,{destroy:void 0},Y4.bind(null,a,n),null)),[r,i,e]}function Y4(e,t){e.action=t}function bS(e){var t=Bt(),n=ct;if(n!==null)return ZN(t,n,e);Bt(),t=t.memoizedState,n=Bt();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ql(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Oe.updateQueue,t===null&&(t=Kp(),Oe.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function KN(){return Bt().memoizedState}function Gf(e,t,n,r){var a=Pn();Oe.flags|=e,a.memoizedState=Ql(1|t,{destroy:void 0},n,r===void 0?null:r)}function Qp(e,t,n,r){var a=Bt();r=r===void 0?null:r;var i=a.memoizedState.inst;ct!==null&&r!==null&&bb(r,ct.memoizedState.deps)?a.memoizedState=Ql(t,i,n,r):(Oe.flags|=e,a.memoizedState=Ql(1|t,i,n,r))}function xS(e,t){Gf(8390656,8,e,t)}function Cb(e,t){Qp(2048,8,e,t)}function X4(e){Oe.flags|=4;var t=Oe.updateQueue;if(t===null)t=Kp(),Oe.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function GN(e){var t=Bt().memoizedState;return X4({ref:t,nextImpl:e}),function(){if(et&2)throw Error(X(440));return t.impl.apply(void 0,arguments)}}function QN(e,t){return Qp(4,2,e,t)}function YN(e,t){return Qp(4,4,e,t)}function XN(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function WN(e,t,n){n=n!=null?n.concat([e]):null,Qp(4,4,XN.bind(null,t,e),n)}function Nb(){}function JN(e,t){var n=Bt();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&bb(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ej(e,t){var n=Bt();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&bb(t,r[1]))return r[0];if(r=e(),ho){Qi(!0);try{e()}finally{Qi(!1)}}return n.memoizedState=[r,t],r}function jb(e,t,n){return n===void 0||ci&1073741824&&!(Ke&261930)?e.memoizedState=t:(e.memoizedState=n,e=qj(),Oe.lanes|=e,gs|=e,n)}function tj(e,t,n,r){return xr(n,t)?n:Gl.current!==null?(e=jb(e,n,r),xr(e,t)||(Qt=!0),e):!(ci&42)||ci&1073741824&&!(Ke&261930)?(Qt=!0,e.memoizedState=n):(e=qj(),Oe.lanes|=e,gs|=e,t)}function nj(e,t,n,r,a){var i=tt.p;tt.p=i!==0&&8>i?i:8;var s=Ne.T,o={};Ne.T=o,Ab(e,!1,t,n);try{var l=a(),u=Ne.S;if(u!==null&&u(o,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var d=Z4(l,r);vu(e,t,d,yr(e))}else vu(e,t,r,yr(e))}catch(f){vu(e,t,{then:function(){},status:"rejected",reason:f},yr())}finally{tt.p=i,s!==null&&o.types!==null&&(s.types=o.types),Ne.T=s}}function W4(){}function Wy(e,t,n,r){if(e.tag!==5)throw Error(X(476));var a=rj(e).queue;nj(e,a,t,ro,n===null?W4:function(){return aj(e),n(r)})}function rj(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ro,baseState:ro,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ui,lastRenderedState:ro},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ui,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function aj(e){var t=rj(e);t.next===null&&(t=e.alternate.memoizedState),vu(e,t.next.queue,{},yr())}function Tb(){return xn(Yu)}function ij(){return Bt().memoizedState}function sj(){return Bt().memoizedState}function J4(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=yr();e=rs(n);var r=as(t,e,n);r!==null&&(tr(r,t,n),mu(r,t,n)),t={cache:pb()},e.payload=t;return}t=t.return}}function ez(e,t,n){var r=yr();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Yp(e)?lj(t,n):(n=ub(e,t,n,r),n!==null&&(tr(n,e,r),cj(n,t,r)))}function oj(e,t,n){var r=yr();vu(e,t,n,r)}function vu(e,t,n,r){var a={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Yp(e))lj(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,o=i(s,n);if(a.hasEagerState=!0,a.eagerState=o,xr(o,s))return Vp(e,t,a,0),ht===null&&Bp(),!1}catch{}finally{}if(n=ub(e,t,a,r),n!==null)return tr(n,e,r),cj(n,t,r),!0}return!1}function Ab(e,t,n,r){if(r={lane:2,revertLane:Lb(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Yp(e)){if(t)throw Error(X(479))}else t=ub(e,n,r,2),t!==null&&tr(t,e,2)}function Yp(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function lj(e,t){Sl=Mh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cj(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,GC(e,n)}}var Ku={readContext:xn,use:Gp,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt};Ku.useEffectEvent=Lt;var uj={readContext:xn,use:Gp,useCallback:function(e,t){return Pn().memoizedState=[e,t===void 0?null:t],e},useContext:xn,useEffect:xS,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Gf(4194308,4,XN.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gf(4194308,4,e,t)},useInsertionEffect:function(e,t){Gf(4,2,e,t)},useMemo:function(e,t){var n=Pn();t=t===void 0?null:t;var r=e();if(ho){Qi(!0);try{e()}finally{Qi(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Pn();if(n!==void 0){var a=n(t);if(ho){Qi(!0);try{n(t)}finally{Qi(!1)}}}else a=t;return r.memoizedState=r.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},r.queue=e,e=e.dispatch=ez.bind(null,Oe,e),[r.memoizedState,e]},useRef:function(e){var t=Pn();return e={current:e},t.memoizedState=e},useState:function(e){e=Yy(e);var t=e.queue,n=oj.bind(null,Oe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Nb,useDeferredValue:function(e,t){var n=Pn();return jb(n,e,t)},useTransition:function(){var e=Yy(!1);return e=nj.bind(null,Oe,e.queue,!0,!1),Pn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Oe,a=Pn();if(Ye){if(n===void 0)throw Error(X(407));n=n()}else{if(n=t(),ht===null)throw Error(X(349));Ke&127||zN(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,xS(LN.bind(null,r,i,e),[e]),r.flags|=2048,Ql(9,{destroy:void 0},IN.bind(null,r,i,n,t),null),n},useId:function(){var e=Pn(),t=ht.identifierPrefix;if(Ye){var n=wa,r=xa;n=(r&~(1<<32-gr(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Ph++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=K4++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Tb,useFormState:yS,useActionState:yS,useOptimistic:function(e){var t=Pn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ab.bind(null,Oe,!0,n),n.dispatch=t,[e,t]},useMemoCache:kb,useCacheRefresh:function(){return Pn().memoizedState=J4.bind(null,Oe)},useEffectEvent:function(e){var t=Pn(),n={impl:e};return t.memoizedState=n,function(){if(et&2)throw Error(X(440));return n.impl.apply(void 0,arguments)}}},Rb={readContext:xn,use:Gp,useCallback:JN,useContext:xn,useEffect:Cb,useImperativeHandle:WN,useInsertionEffect:QN,useLayoutEffect:YN,useMemo:ej,useReducer:Kf,useRef:KN,useState:function(){return Kf(ui)},useDebugValue:Nb,useDeferredValue:function(e,t){var n=Bt();return tj(n,ct.memoizedState,e,t)},useTransition:function(){var e=Kf(ui)[0],t=Bt().memoizedState;return[typeof e=="boolean"?e:wd(e),t]},useSyncExternalStore:DN,useId:ij,useHostTransitionStatus:Tb,useFormState:vS,useActionState:vS,useOptimistic:function(e,t){var n=Bt();return qN(n,ct,e,t)},useMemoCache:kb,useCacheRefresh:sj};Rb.useEffectEvent=GN;var dj={readContext:xn,use:Gp,useCallback:JN,useContext:xn,useEffect:Cb,useImperativeHandle:WN,useInsertionEffect:QN,useLayoutEffect:YN,useMemo:ej,useReducer:lg,useRef:KN,useState:function(){return lg(ui)},useDebugValue:Nb,useDeferredValue:function(e,t){var n=Bt();return ct===null?jb(n,e,t):tj(n,ct.memoizedState,e,t)},useTransition:function(){var e=lg(ui)[0],t=Bt().memoizedState;return[typeof e=="boolean"?e:wd(e),t]},useSyncExternalStore:DN,useId:ij,useHostTransitionStatus:Tb,useFormState:bS,useActionState:bS,useOptimistic:function(e,t){var n=Bt();return ct!==null?qN(n,ct,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:kb,useCacheRefresh:sj};dj.useEffectEvent=GN;function cg(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Tt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Jy={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=yr(),a=rs(r);a.payload=t,n!=null&&(a.callback=n),t=as(e,a,r),t!==null&&(tr(t,e,r),mu(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=yr(),a=rs(r);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=as(e,a,r),t!==null&&(tr(t,e,r),mu(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=yr(),r=rs(n);r.tag=2,t!=null&&(r.callback=t),t=as(e,r,n),t!==null&&(tr(t,e,n),mu(t,e,n))}};function wS(e,t,n,r,a,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!qu(n,r)||!qu(a,i):!0}function SS(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Jy.enqueueReplaceState(t,t.state,null)}function po(e,t){var n=t;if("ref"in t){n={};for(var r in t)r!=="ref"&&(n[r]=t[r])}if(e=e.defaultProps){n===t&&(n=Tt({},n));for(var a in e)n[a]===void 0&&(n[a]=e[a])}return n}function fj(e){Nh(e)}function hj(e){console.error(e)}function pj(e){Nh(e)}function Dh(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function _S(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function ev(e,t,n){return n=rs(n),n.tag=3,n.payload={element:null},n.callback=function(){Dh(e,t)},n}function mj(e){return e=rs(e),e.tag=3,e}function gj(e,t,n,r){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var i=r.value;e.payload=function(){return a(i)},e.callback=function(){_S(t,n,r)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch=="function"&&(e.callback=function(){_S(t,n,r),typeof a!="function"&&(is===null?is=new Set([this]):is.add(this));var o=r.stack;this.componentDidCatch(r.value,{componentStack:o!==null?o:""})})}function tz(e,t,n,r,a){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&gc(t,n,a,!0),n=wr.current,n!==null){switch(n.tag){case 31:case 13:return Lr===null?Fh():n.alternate===null&&Ft===0&&(Ft=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Rh?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),xg(e,r,a)),!1;case 22:return n.flags|=65536,r===Rh?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),xg(e,r,a)),!1}throw Error(X(435,n.tag))}return xg(e,r,a),Fh(),!1}if(Ye)return t=wr.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Fy&&(e=Error(X(422),{cause:r}),Bu(zr(e,n)))):(r!==Fy&&(t=Error(X(423),{cause:r}),Bu(zr(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=zr(r,n),a=ev(e.stateNode,r,a),og(e,a),Ft!==4&&(Ft=2)),!1;var i=Error(X(520),{cause:r});if(i=zr(i,n),wu===null?wu=[i]:wu.push(i),Ft!==4&&(Ft=2),t===null)return!0;r=zr(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=ev(n.stateNode,r,e),og(n,e),!1;case 1:if(t=n.type,i=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(is===null||!is.has(i))))return n.flags|=65536,a&=-a,n.lanes|=a,a=mj(a),gj(a,e,n,r),og(n,a),!1}n=n.return}while(n!==null);return!1}var $b=Error(X(461)),Qt=!1;function pn(e,t,n,r){t.child=e===null?AN(t,null,n,r):fo(t,e.child,n,r)}function kS(e,t,n,r,a){n=n.render;var i=t.ref;if("ref"in r){var s={};for(var o in r)o!=="ref"&&(s[o]=r[o])}else s=r;return uo(t),r=xb(e,t,n,s,i,a),o=wb(),e!==null&&!Qt?(Sb(e,t,a),di(e,t,a)):(Ye&&o&&fb(t),t.flags|=1,pn(e,t,r,a),t.child)}function ES(e,t,n,r,a){if(e===null){var i=n.type;return typeof i=="function"&&!db(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,yj(e,t,i,r,a)):(e=Vf(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!Ob(e,a)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:qu,n(s,r)&&e.ref===t.ref)return di(e,t,a)}return t.flags|=1,e=ti(i,r),e.ref=t.ref,e.return=t,t.child=e}function yj(e,t,n,r,a){if(e!==null){var i=e.memoizedProps;if(qu(i,r)&&e.ref===t.ref)if(Qt=!1,t.pendingProps=r=i,Ob(e,a))e.flags&131072&&(Qt=!0);else return t.lanes=e.lanes,di(e,t,a)}return tv(e,t,n,r,a)}function vj(e,t,n,r){var a=r.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if(t.flags&128){if(i=i!==null?i.baseLanes|n:n,e!==null){for(r=t.child=e.child,a=0;r!==null;)a=a|r.lanes|r.childLanes,r=r.sibling;r=a&~i}else r=0,t.child=null;return CS(e,t,i,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Zf(t,i!==null?i.cachePool:null),i!==null?pS(t,i):Gy(),ON(t);else return r=t.lanes=536870912,CS(e,t,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(Zf(t,i.cachePool),pS(t,i),zi(),t.memoizedState=null):(e!==null&&Zf(t,null),Gy(),zi());return pn(e,t,a,n),t.child}function tu(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function CS(e,t,n,r,a){var i=mb();return i=i===null?null:{parent:Gt._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&Zf(t,null),Gy(),ON(t),e!==null&&gc(e,t,r,!0),t.childLanes=a,null}function Qf(e,t){return t=zh({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function NS(e,t,n){return fo(t,e.child,null,n),e=Qf(t,t.pendingProps),e.flags|=2,cr(t),t.memoizedState=null,e}function nz(e,t,n){var r=t.pendingProps,a=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ye){if(r.mode==="hidden")return e=Qf(t,r),t.lanes=536870912,tu(null,e);if(Qy(t),(e=wt)?(e=u2(e,Ir),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:hs!==null?{id:xa,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},n=_N(e),n.return=t,t.child=n,bn=t,wt=null)):e=null,e===null)throw ps(t);return t.lanes=536870912,null}return Qf(t,r)}var i=e.memoizedState;if(i!==null){var s=i.dehydrated;if(Qy(t),a)if(t.flags&256)t.flags&=-257,t=NS(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(X(558));else if(Qt||gc(e,t,n,!1),a=(n&e.childLanes)!==0,Qt||a){if(r=ht,r!==null&&(s=QC(r,n),s!==0&&s!==i.retryLane))throw i.retryLane=s,Ro(e,s),tr(r,e,s),$b;Fh(),t=NS(e,t,n)}else e=i.treeContext,wt=Ur(s.nextSibling),bn=t,Ye=!0,ns=null,Ir=!1,e!==null&&EN(t,e),t=Qf(t,r),t.flags|=4096;return t}return e=ti(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Yf(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(X(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function tv(e,t,n,r,a){return uo(t),n=xb(e,t,n,r,void 0,a),r=wb(),e!==null&&!Qt?(Sb(e,t,a),di(e,t,a)):(Ye&&r&&fb(t),t.flags|=1,pn(e,t,n,a),t.child)}function jS(e,t,n,r,a,i){return uo(t),t.updateQueue=null,n=PN(t,r,n,a),MN(e),r=wb(),e!==null&&!Qt?(Sb(e,t,i),di(e,t,i)):(Ye&&r&&fb(t),t.flags|=1,pn(e,t,n,i),t.child)}function TS(e,t,n,r,a){if(uo(t),t.stateNode===null){var i=cl,s=n.contextType;typeof s=="object"&&s!==null&&(i=xn(s)),i=new n(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Jy,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},yb(t),s=n.contextType,i.context=typeof s=="object"&&s!==null?xn(s):cl,i.state=t.memoizedState,s=n.getDerivedStateFromProps,typeof s=="function"&&(cg(t,n,s,r),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(s=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),s!==i.state&&Jy.enqueueReplaceState(i,i.state,null),yu(t,r,i,a),gu(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){i=t.stateNode;var o=t.memoizedProps,l=po(n,o);i.props=l;var u=i.context,d=n.contextType;s=cl,typeof d=="object"&&d!==null&&(s=xn(d));var f=n.getDerivedStateFromProps;d=typeof f=="function"||typeof i.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o||u!==s)&&SS(t,i,r,s),Ri=!1;var p=t.memoizedState;i.state=p,yu(t,r,i,a),gu(),u=t.memoizedState,o||p!==u||Ri?(typeof f=="function"&&(cg(t,n,f,r),u=t.memoizedState),(l=Ri||wS(t,n,l,r,p,u,s))?(d||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),i.props=r,i.state=u,i.context=s,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Zy(e,t),s=t.memoizedProps,d=po(n,s),i.props=d,f=t.pendingProps,p=i.context,u=n.contextType,l=cl,typeof u=="object"&&u!==null&&(l=xn(u)),o=n.getDerivedStateFromProps,(u=typeof o=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(s!==f||p!==l)&&SS(t,i,r,l),Ri=!1,p=t.memoizedState,i.state=p,yu(t,r,i,a),gu();var h=t.memoizedState;s!==f||p!==h||Ri||e!==null&&e.dependencies!==null&&Ah(e.dependencies)?(typeof o=="function"&&(cg(t,n,o,r),h=t.memoizedState),(d=Ri||wS(t,n,d,r,p,h,l)||e!==null&&e.dependencies!==null&&Ah(e.dependencies))?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,h,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,h,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),i.props=r,i.state=h,i.context=l,r=d):(typeof i.componentDidUpdate!="function"||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,Yf(e,t),r=(t.flags&128)!==0,i||r?(i=t.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&r?(t.child=fo(t,e.child,null,a),t.child=fo(t,null,n,a)):pn(e,t,n,a),t.memoizedState=i.state,e=t.child):e=di(e,t,a),e}function AS(e,t,n,r){return co(),t.flags|=256,pn(e,t,n,r),t.child}var ug={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function dg(e){return{baseLanes:e,cachePool:NN()}}function fg(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=hr),e}function bj(e,t,n){var r=t.pendingProps,a=!1,i=(t.flags&128)!==0,s;if((s=i)||(s=e!==null&&e.memoizedState===null?!1:(Ht.current&2)!==0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ye){if(a?Di(t):zi(),(e=wt)?(e=u2(e,Ir),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:hs!==null?{id:xa,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},n=_N(e),n.return=t,t.child=n,bn=t,wt=null)):e=null,e===null)throw ps(t);return mv(e)?t.lanes=32:t.lanes=536870912,null}var o=r.children;return r=r.fallback,a?(zi(),a=t.mode,o=zh({mode:"hidden",children:o},a),r=ao(r,a,n,null),o.return=t,r.return=t,o.sibling=r,t.child=o,r=t.child,r.memoizedState=dg(n),r.childLanes=fg(e,s,n),t.memoizedState=ug,tu(null,r)):(Di(t),nv(t,o))}var l=e.memoizedState;if(l!==null&&(o=l.dehydrated,o!==null)){if(i)t.flags&256?(Di(t),t.flags&=-257,t=hg(e,t,n)):t.memoizedState!==null?(zi(),t.child=e.child,t.flags|=128,t=null):(zi(),o=r.fallback,a=t.mode,r=zh({mode:"visible",children:r.children},a),o=ao(o,a,n,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,fo(t,e.child,null,n),r=t.child,r.memoizedState=dg(n),r.childLanes=fg(e,s,n),t.memoizedState=ug,t=tu(null,r));else if(Di(t),mv(o)){if(s=o.nextSibling&&o.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(X(419)),r.stack="",r.digest=s,Bu({value:r,source:null,stack:null}),t=hg(e,t,n)}else if(Qt||gc(e,t,n,!1),s=(n&e.childLanes)!==0,Qt||s){if(s=ht,s!==null&&(r=QC(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Ro(e,r),tr(s,e,r),$b;pv(o)||Fh(),t=hg(e,t,n)}else pv(o)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,wt=Ur(o.nextSibling),bn=t,Ye=!0,ns=null,Ir=!1,e!==null&&EN(t,e),t=nv(t,r.children),t.flags|=4096);return t}return a?(zi(),o=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ti(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u!==null?o=ti(u,o):(o=ao(o,a,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,tu(null,r),r=t.child,o=e.child.memoizedState,o===null?o=dg(n):(a=o.cachePool,a!==null?(l=Gt._currentValue,a=a.parent!==l?{parent:l,pool:l}:a):a=NN(),o={baseLanes:o.baseLanes|n,cachePool:a}),r.memoizedState=o,r.childLanes=fg(e,s,n),t.memoizedState=ug,tu(e.child,r)):(Di(t),n=e.child,e=n.sibling,n=ti(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function nv(e,t){return t=zh({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function zh(e,t){return e=fr(22,e,null,t),e.lanes=0,e}function hg(e,t,n){return fo(t,e.child,null,n),e=nv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function RS(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Hy(e.return,t,n)}function pg(e,t,n,r,a,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,treeForkCount:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=a,s.treeForkCount=i)}function xj(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;r=r.children;var s=Ht.current,o=(s&2)!==0;if(o?(s=s&1|2,t.flags|=128):s&=1,mt(Ht,s),pn(e,t,r,n),r=Ye?Hu:0,!o&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&RS(e,n,t);else if(e.tag===19)RS(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&Oh(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),pg(t,!1,a,n,i,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&Oh(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}pg(t,!0,n,null,i,r);break;case"together":pg(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function di(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),gs|=t.lanes,!(n&t.childLanes))if(e!==null){if(gc(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(X(153));if(t.child!==null){for(e=t.child,n=ti(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ti(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ob(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Ah(e)))}function rz(e,t,n){switch(t.tag){case 3:_h(t,t.stateNode.containerInfo),Pi(t,Gt,e.memoizedState.cache),co();break;case 27:case 5:Ay(t);break;case 4:_h(t,t.stateNode.containerInfo);break;case 10:Pi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Qy(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Di(t),t.flags|=128,null):n&t.child.childLanes?bj(e,t,n):(Di(t),e=di(e,t,n),e!==null?e.sibling:null);Di(t);break;case 19:var a=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(gc(e,t,n,!1),r=(n&t.childLanes)!==0),a){if(r)return xj(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),mt(Ht,Ht.current),r)break;return null;case 22:return t.lanes=0,vj(e,t,n,t.pendingProps);case 24:Pi(t,Gt,e.memoizedState.cache)}return di(e,t,n)}function wj(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Qt=!0;else{if(!Ob(e,n)&&!(t.flags&128))return Qt=!1,rz(e,t,n);Qt=!!(e.flags&131072)}else Qt=!1,Ye&&t.flags&1048576&&kN(t,Hu,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=zs(t.elementType),t.type=e,typeof e=="function")db(e)?(r=po(e,r),t.tag=1,t=TS(null,t,e,r,n)):(t.tag=0,t=tv(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===X0){t.tag=11,t=kS(null,t,e,r,n);break e}else if(a===W0){t.tag=14,t=ES(null,t,e,r,n);break e}}throw t=jy(e)||e,Error(X(306,t,""))}}return t;case 0:return tv(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=po(r,t.pendingProps),TS(e,t,r,a,n);case 3:e:{if(_h(t,t.stateNode.containerInfo),e===null)throw Error(X(387));r=t.pendingProps;var i=t.memoizedState;a=i.element,Zy(e,t),yu(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Pi(t,Gt,r),r!==i.cache&&By(t,[Gt],n,!0),gu(),r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=AS(e,t,r,n);break e}else if(r!==a){a=zr(Error(X(424)),t),Bu(a),t=AS(e,t,r,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(wt=Ur(e.firstChild),bn=t,Ye=!0,ns=null,Ir=!0,n=AN(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(co(),r===a){t=di(e,t,n);break e}pn(e,t,r,n)}t=t.child}return t;case 26:return Yf(e,t),e===null?(n=XS(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ye||(n=t.type,e=t.pendingProps,r=Vh(ts.current).createElement(n),r[vn]=t,r[nr]=e,Sn(r,n,e),ln(r),t.stateNode=r):t.memoizedState=XS(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ay(t),e===null&&Ye&&(r=t.stateNode=d2(t.type,t.pendingProps,ts.current),bn=t,Ir=!0,a=wt,Ss(t.type)?(gv=a,wt=Ur(r.firstChild)):wt=a),pn(e,t,t.pendingProps.children,n),Yf(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ye&&((a=r=wt)&&(r=Oz(r,t.type,t.pendingProps,Ir),r!==null?(t.stateNode=r,bn=t,wt=Ur(r.firstChild),Ir=!1,a=!0):a=!1),a||ps(t)),Ay(t),a=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,r=i.children,fv(a,i)?r=null:s!==null&&fv(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=xb(e,t,G4,null,null,n),Yu._currentValue=a),Yf(e,t),pn(e,t,r,n),t.child;case 6:return e===null&&Ye&&((e=n=wt)&&(n=Mz(n,t.pendingProps,Ir),n!==null?(t.stateNode=n,bn=t,wt=null,e=!0):e=!1),e||ps(t)),null;case 13:return bj(e,t,n);case 4:return _h(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=fo(t,null,r,n):pn(e,t,r,n),t.child;case 11:return kS(e,t,t.type,t.pendingProps,n);case 7:return pn(e,t,t.pendingProps,n),t.child;case 8:return pn(e,t,t.pendingProps.children,n),t.child;case 12:return pn(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Pi(t,t.type,r.value),pn(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,uo(t),a=xn(a),r=r(a),t.flags|=1,pn(e,t,r,n),t.child;case 14:return ES(e,t,t.type,t.pendingProps,n);case 15:return yj(e,t,t.type,t.pendingProps,n);case 19:return xj(e,t,n);case 31:return nz(e,t,n);case 22:return vj(e,t,n,t.pendingProps);case 24:return uo(t),r=xn(Gt),e===null?(a=mb(),a===null&&(a=ht,i=pb(),a.pooledCache=i,i.refCount++,i!==null&&(a.pooledCacheLanes|=n),a=i),t.memoizedState={parent:r,cache:a},yb(t),Pi(t,Gt,a)):(e.lanes&n&&(Zy(e,t),yu(t,null,null,n),gu()),a=e.memoizedState,i=t.memoizedState,a.parent!==r?(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Pi(t,Gt,r)):(r=i.cache,Pi(t,Gt,r),r!==a.cache&&By(t,[Gt],n,!0))),pn(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(X(156,t.tag))}function Da(e){e.flags|=4}function mg(e,t,n,r,a){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(a&335544128)===a)if(e.stateNode.complete)e.flags|=8192;else if(Vj())e.flags|=8192;else throw so=Rh,gb}else e.flags&=-16777217}function $S(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!p2(t))if(Vj())e.flags|=8192;else throw so=Rh,gb}function of(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ZC():536870912,e.lanes|=t,Yl|=t)}function Lc(e,t){if(!Ye)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function bt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&65011712,r|=a.flags&65011712,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function az(e,t,n){var r=t.pendingProps;switch(hb(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bt(t),null;case 1:return bt(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ni(Gt),Bl(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Do(t)?Da(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,sg())),bt(t),null;case 26:var a=t.type,i=t.memoizedState;return e===null?(Da(t),i!==null?(bt(t),$S(t,i)):(bt(t),mg(t,a,null,r,n))):i?i!==e.memoizedState?(Da(t),bt(t),$S(t,i)):(bt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Da(t),bt(t),mg(t,a,e,r,n)),null;case 27:if(kh(t),n=ts.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Da(t);else{if(!r){if(t.stateNode===null)throw Error(X(166));return bt(t),null}e=Ea.current,Do(t)?oS(t):(e=d2(a,r,n),t.stateNode=e,Da(t))}return bt(t),null;case 5:if(kh(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Da(t);else{if(!r){if(t.stateNode===null)throw Error(X(166));return bt(t),null}if(i=Ea.current,Do(t))oS(t);else{var s=Vh(ts.current);switch(i){case 1:i=s.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:i=s.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":i=s.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":i=s.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":i=s.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?s.createElement("select",{is:r.is}):s.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?s.createElement(a,{is:r.is}):s.createElement(a)}}i[vn]=t,i[nr]=r;e:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)i.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=i;e:switch(Sn(i,a,r),a){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Da(t)}}return bt(t),mg(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Da(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(X(166));if(e=ts.current,Do(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=bn,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[vn]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||o2(e.nodeValue,n)),e||ps(t,!0)}else e=Vh(e).createTextNode(r),e[vn]=t,t.stateNode=e}return bt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Do(t),n!==null){if(e===null){if(!r)throw Error(X(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(X(557));e[vn]=t}else co(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bt(t),e=!1}else n=sg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(cr(t),t):(cr(t),null);if(t.flags&128)throw Error(X(558))}return bt(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Do(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(X(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(X(317));a[vn]=t}else co(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bt(t),a=!1}else a=sg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(cr(t),t):(cr(t),null)}return cr(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),of(t,t.updateQueue),bt(t),null);case 4:return Bl(),e===null&&Ub(t.stateNode.containerInfo),bt(t),null;case 10:return ni(t.type),bt(t),null;case 19:if(cn(Ht),r=t.memoizedState,r===null)return bt(t),null;if(a=(t.flags&128)!==0,i=r.rendering,i===null)if(a)Lc(r,!1);else{if(Ft!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Oh(e),i!==null){for(t.flags|=128,Lc(r,!1),e=i.updateQueue,t.updateQueue=e,of(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)SN(n,e),n=n.sibling;return mt(Ht,Ht.current&1|2),Ye&&Ha(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&pr()>Lh&&(t.flags|=128,a=!0,Lc(r,!1),t.lanes=4194304)}else{if(!a)if(e=Oh(i),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,of(t,e),Lc(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!Ye)return bt(t),null}else 2*pr()-r.renderingStartTime>Lh&&n!==536870912&&(t.flags|=128,a=!0,Lc(r,!1),t.lanes=4194304);r.isBackwards?(i.sibling=t.child,t.child=i):(e=r.last,e!==null?e.sibling=i:t.child=i,r.last=i)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=pr(),e.sibling=null,n=Ht.current,mt(Ht,a?n&1|2:n&1),Ye&&Ha(t,r.treeForkCount),e):(bt(t),null);case 22:case 23:return cr(t),vb(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(bt(t),t.subtreeFlags&6&&(t.flags|=8192)):bt(t),n=t.updateQueue,n!==null&&of(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&cn(io),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ni(Gt),bt(t),null;case 25:return null;case 30:return null}throw Error(X(156,t.tag))}function iz(e,t){switch(hb(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ni(Gt),Bl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return kh(t),null;case 31:if(t.memoizedState!==null){if(cr(t),t.alternate===null)throw Error(X(340));co()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(cr(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(X(340));co()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return cn(Ht),null;case 4:return Bl(),null;case 10:return ni(t.type),null;case 22:case 23:return cr(t),vb(),e!==null&&cn(io),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ni(Gt),null;case 25:return null;default:return null}}function Sj(e,t){switch(hb(t),t.tag){case 3:ni(Gt),Bl();break;case 26:case 27:case 5:kh(t);break;case 4:Bl();break;case 31:t.memoizedState!==null&&cr(t);break;case 13:cr(t);break;case 19:cn(Ht);break;case 10:ni(t.type);break;case 22:case 23:cr(t),vb(),e!==null&&cn(io);break;case 24:ni(Gt)}}function Sd(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var a=r.next;n=a;do{if((n.tag&e)===e){r=void 0;var i=n.create,s=n.inst;r=i(),s.destroy=r}n=n.next}while(n!==a)}}catch(o){st(t,t.return,o)}}function ms(e,t,n){try{var r=t.updateQueue,a=r!==null?r.lastEffect:null;if(a!==null){var i=a.next;r=i;do{if((r.tag&e)===e){var s=r.inst,o=s.destroy;if(o!==void 0){s.destroy=void 0,a=t;var l=n,u=o;try{u()}catch(d){st(a,l,d)}}}r=r.next}while(r!==i)}}catch(d){st(t,t.return,d)}}function _j(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{$N(t,n)}catch(r){st(e,e.return,r)}}}function kj(e,t,n){n.props=po(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){st(e,t,r)}}function bu(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(a){st(e,t,a)}}function Sa(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(a){st(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){st(e,t,a)}else n.current=null}function Ej(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(a){st(e,e.return,a)}}function gg(e,t,n){try{var r=e.stateNode;Nz(r,e.type,n,t),r[nr]=t}catch(a){st(e,e.return,a)}}function Cj(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ss(e.type)||e.tag===4}function yg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cj(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&&Ss(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 rv(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Wa));else if(r!==4&&(r===27&&Ss(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(rv(e,t,n),e=e.sibling;e!==null;)rv(e,t,n),e=e.sibling}function Ih(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Ss(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Ih(e,t,n),e=e.sibling;e!==null;)Ih(e,t,n),e=e.sibling}function Nj(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);Sn(t,r,n),t[vn]=e,t[nr]=n}catch(i){st(e,e.return,i)}}var Qa=!1,Kt=!1,vg=!1,OS=typeof WeakSet=="function"?WeakSet:Set,on=null;function sz(e,t){if(e=e.containerInfo,uv=Qh,e=pN(e),lb(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,o=-1,l=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||a!==0&&f.nodeType!==3||(o=s+a),f!==i||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===a&&(o=s),p===i&&++d===r&&(l=s),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=o===-1||l===-1?null:{start:o,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(dv={focusedElem:e,selectionRange:n},Qh=!1,on=t;on!==null;)if(t=on,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,on=e;else for(;on!==null;){switch(t=on,i=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&i!==null){e=void 0,n=t,a=i.memoizedProps,i=i.memoizedState,r=n.stateNode;try{var y=po(n.type,a);e=r.getSnapshotBeforeUpdate(y,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(m){st(n,n.return,m)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)hv(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":hv(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(X(163))}if(e=t.sibling,e!==null){e.return=t.return,on=e;break}on=t.return}}function jj(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ia(e,n),r&4&&Sd(5,n);break;case 1:if(Ia(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(s){st(n,n.return,s)}else{var a=po(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(s){st(n,n.return,s)}}r&64&&_j(n),r&512&&bu(n,n.return);break;case 3:if(Ia(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{$N(e,t)}catch(s){st(n,n.return,s)}}break;case 27:t===null&&r&4&&Nj(n);case 26:case 5:Ia(e,n),t===null&&r&4&&Ej(n),r&512&&bu(n,n.return);break;case 12:Ia(e,n);break;case 31:Ia(e,n),r&4&&Rj(e,n);break;case 13:Ia(e,n),r&4&&$j(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=mz.bind(null,n),Pz(e,n))));break;case 22:if(r=n.memoizedState!==null||Qa,!r){t=t!==null&&t.memoizedState!==null||Kt,a=Qa;var i=Kt;Qa=r,(Kt=t)&&!i?Ua(e,n,(n.subtreeFlags&8772)!==0):Ia(e,n),Qa=a,Kt=i}break;case 30:break;default:Ia(e,n)}}function Tj(e){var t=e.alternate;t!==null&&(e.alternate=null,Tj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&nb(t)),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 At=null,Gn=!1;function za(e,t,n){for(n=n.child;n!==null;)Aj(e,t,n),n=n.sibling}function Aj(e,t,n){if(mr&&typeof mr.onCommitFiberUnmount=="function")try{mr.onCommitFiberUnmount(md,n)}catch{}switch(n.tag){case 26:Kt||Sa(n,t),za(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Kt||Sa(n,t);var r=At,a=Gn;Ss(n.type)&&(At=n.stateNode,Gn=!1),za(e,t,n),_u(n.stateNode),At=r,Gn=a;break;case 5:Kt||Sa(n,t);case 6:if(r=At,a=Gn,At=null,za(e,t,n),At=r,Gn=a,At!==null)if(Gn)try{(At.nodeType===9?At.body:At.nodeName==="HTML"?At.ownerDocument.body:At).removeChild(n.stateNode)}catch(i){st(n,t,i)}else try{At.removeChild(n.stateNode)}catch(i){st(n,t,i)}break;case 18:At!==null&&(Gn?(e=At,ZS(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),ec(e)):ZS(At,n.stateNode));break;case 4:r=At,a=Gn,At=n.stateNode.containerInfo,Gn=!0,za(e,t,n),At=r,Gn=a;break;case 0:case 11:case 14:case 15:ms(2,n,t),Kt||ms(4,n,t),za(e,t,n);break;case 1:Kt||(Sa(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&kj(n,t,r)),za(e,t,n);break;case 21:za(e,t,n);break;case 22:Kt=(r=Kt)||n.memoizedState!==null,za(e,t,n),Kt=r;break;default:za(e,t,n)}}function Rj(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ec(e)}catch(n){st(t,t.return,n)}}}function $j(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ec(e)}catch(n){st(t,t.return,n)}}function oz(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new OS),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new OS),t;default:throw Error(X(435,e.tag))}}function lf(e,t){var n=oz(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var a=gz.bind(null,e,r);r.then(a,a)}})}function Hn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],i=e,s=t,o=s;e:for(;o!==null;){switch(o.tag){case 27:if(Ss(o.type)){At=o.stateNode,Gn=!1;break e}break;case 5:At=o.stateNode,Gn=!1;break e;case 3:case 4:At=o.stateNode.containerInfo,Gn=!0;break e}o=o.return}if(At===null)throw Error(X(160));Aj(i,s,a),At=null,Gn=!1,i=a.alternate,i!==null&&(i.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Oj(t,e),t=t.sibling}var Jr=null;function Oj(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Hn(t,e),Bn(e),r&4&&(ms(3,e,e.return),Sd(3,e),ms(5,e,e.return));break;case 1:Hn(t,e),Bn(e),r&512&&(Kt||n===null||Sa(n,n.return)),r&64&&Qa&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=Jr;if(Hn(t,e),Bn(e),r&512&&(Kt||n===null||Sa(n,n.return)),r&4){var i=n!==null?n.memoizedState:null;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){e:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;t:switch(r){case"title":i=a.getElementsByTagName("title")[0],(!i||i[vd]||i[vn]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=a.createElement(r),a.head.insertBefore(i,a.querySelector("head > title"))),Sn(i,r,n),i[vn]=e,ln(i),r=i;break e;case"link":var s=JS("link","href",a).get(r+(n.href||""));if(s){for(var o=0;o<s.length;o++)if(i=s[o],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(o,1);break t}}i=a.createElement(r),Sn(i,r,n),a.head.appendChild(i);break;case"meta":if(s=JS("meta","content",a).get(r+(n.content||""))){for(o=0;o<s.length;o++)if(i=s[o],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){s.splice(o,1);break t}}i=a.createElement(r),Sn(i,r,n),a.head.appendChild(i);break;default:throw Error(X(468,r))}i[vn]=e,ln(i),r=i}e.stateNode=r}else e_(a,e.type,e.stateNode);else e.stateNode=WS(a,r,e.memoizedProps);else i!==r?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,r===null?e_(a,e.type,e.stateNode):WS(a,r,e.memoizedProps)):r===null&&e.stateNode!==null&&gg(e,e.memoizedProps,n.memoizedProps)}break;case 27:Hn(t,e),Bn(e),r&512&&(Kt||n===null||Sa(n,n.return)),n!==null&&r&4&&gg(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Hn(t,e),Bn(e),r&512&&(Kt||n===null||Sa(n,n.return)),e.flags&32){a=e.stateNode;try{Zl(a,"")}catch(y){st(e,e.return,y)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,gg(e,a,n!==null?n.memoizedProps:a)),r&1024&&(vg=!0);break;case 6:if(Hn(t,e),Bn(e),r&4){if(e.stateNode===null)throw Error(X(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(y){st(e,e.return,y)}}break;case 3:if(Jf=null,a=Jr,Jr=Zh(t.containerInfo),Hn(t,e),Jr=a,Bn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ec(t.containerInfo)}catch(y){st(e,e.return,y)}vg&&(vg=!1,Mj(e));break;case 4:r=Jr,Jr=Zh(e.stateNode.containerInfo),Hn(t,e),Bn(e),Jr=r;break;case 12:Hn(t,e),Bn(e);break;case 31:Hn(t,e),Bn(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,lf(e,r)));break;case 13:Hn(t,e),Bn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Xp=pr()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,lf(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Qa,d=Kt;if(Qa=u||a,Kt=d||l,Hn(t,e),Kt=d,Qa=u,Bn(e),r&8192)e:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Qa||Kt||Is(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(i=l.stateNode,a)s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none";else{o=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty("display")?f.display:null;o.style.display=p==null||typeof p=="boolean"?"":(""+p).trim()}}catch(y){st(l,l.return,y)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?"":l.memoizedProps}catch(y){st(l,l.return,y)}}}else if(t.tag===18){if(n===null){l=t;try{var h=l.stateNode;a?KS(h,!0):KS(l.stateNode,!1)}catch(y){st(l,l.return,y)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,lf(e,n))));break;case 19:Hn(t,e),Bn(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,lf(e,r)));break;case 30:break;case 21:break;default:Hn(t,e),Bn(e)}}function Bn(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Cj(r)){n=r;break}r=r.return}if(n==null)throw Error(X(160));switch(n.tag){case 27:var a=n.stateNode,i=yg(e);Ih(e,i,a);break;case 5:var s=n.stateNode;n.flags&32&&(Zl(s,""),n.flags&=-33);var o=yg(e);Ih(e,o,s);break;case 3:case 4:var l=n.stateNode.containerInfo,u=yg(e);rv(e,u,l);break;default:throw Error(X(161))}}catch(d){st(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Mj(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Mj(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ia(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)jj(e,t.alternate,t),t=t.sibling}function Is(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ms(4,t,t.return),Is(t);break;case 1:Sa(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&kj(t,t.return,n),Is(t);break;case 27:_u(t.stateNode);case 26:case 5:Sa(t,t.return),Is(t);break;case 22:t.memoizedState===null&&Is(t);break;case 30:Is(t);break;default:Is(t)}e=e.sibling}}function Ua(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,a=e,i=t,s=i.flags;switch(i.tag){case 0:case 11:case 15:Ua(a,i,n),Sd(4,i);break;case 1:if(Ua(a,i,n),r=i,a=r.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(u){st(r,r.return,u)}if(r=i,a=r.updateQueue,a!==null){var o=r.stateNode;try{var l=a.shared.hiddenCallbacks;if(l!==null)for(a.shared.hiddenCallbacks=null,a=0;a<l.length;a++)RN(l[a],o)}catch(u){st(r,r.return,u)}}n&&s&64&&_j(i),bu(i,i.return);break;case 27:Nj(i);case 26:case 5:Ua(a,i,n),n&&r===null&&s&4&&Ej(i),bu(i,i.return);break;case 12:Ua(a,i,n);break;case 31:Ua(a,i,n),n&&s&4&&Rj(a,i);break;case 13:Ua(a,i,n),n&&s&4&&$j(a,i);break;case 22:i.memoizedState===null&&Ua(a,i,n),bu(i,i.return);break;case 30:break;default:Ua(a,i,n)}t=t.sibling}}function Mb(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&xd(n))}function Pb(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&xd(e))}function Vr(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Pj(e,t,n,r),t=t.sibling}function Pj(e,t,n,r){var a=t.flags;switch(t.tag){case 0:case 11:case 15:Vr(e,t,n,r),a&2048&&Sd(9,t);break;case 1:Vr(e,t,n,r);break;case 3:Vr(e,t,n,r),a&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&xd(e)));break;case 12:if(a&2048){Vr(e,t,n,r),e=t.stateNode;try{var i=t.memoizedProps,s=i.id,o=i.onPostCommit;typeof o=="function"&&o(s,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(l){st(t,t.return,l)}}else Vr(e,t,n,r);break;case 31:Vr(e,t,n,r);break;case 13:Vr(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,s=t.alternate,t.memoizedState!==null?i._visibility&2?Vr(e,t,n,r):xu(e,t):i._visibility&2?Vr(e,t,n,r):(i._visibility|=2,Zo(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),a&2048&&Mb(s,t);break;case 24:Vr(e,t,n,r),a&2048&&Pb(t.alternate,t);break;default:Vr(e,t,n,r)}}function Zo(e,t,n,r,a){for(a=a&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,s=t,o=n,l=r,u=s.flags;switch(s.tag){case 0:case 11:case 15:Zo(i,s,o,l,a),Sd(8,s);break;case 23:break;case 22:var d=s.stateNode;s.memoizedState!==null?d._visibility&2?Zo(i,s,o,l,a):xu(i,s):(d._visibility|=2,Zo(i,s,o,l,a)),a&&u&2048&&Mb(s.alternate,s);break;case 24:Zo(i,s,o,l,a),a&&u&2048&&Pb(s.alternate,s);break;default:Zo(i,s,o,l,a)}t=t.sibling}}function xu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,a=r.flags;switch(r.tag){case 22:xu(n,r),a&2048&&Mb(r.alternate,r);break;case 24:xu(n,r),a&2048&&Pb(r.alternate,r);break;default:xu(n,r)}t=t.sibling}}var nu=8192;function zo(e,t,n){if(e.subtreeFlags&nu)for(e=e.child;e!==null;)Dj(e,t,n),e=e.sibling}function Dj(e,t,n){switch(e.tag){case 26:zo(e,t,n),e.flags&nu&&e.memoizedState!==null&&Kz(n,Jr,e.memoizedState,e.memoizedProps);break;case 5:zo(e,t,n);break;case 3:case 4:var r=Jr;Jr=Zh(e.stateNode.containerInfo),zo(e,t,n),Jr=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=nu,nu=16777216,zo(e,t,n),nu=r):zo(e,t,n));break;default:zo(e,t,n)}}function zj(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Uc(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];on=r,Lj(r,e)}zj(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ij(e),e=e.sibling}function Ij(e){switch(e.tag){case 0:case 11:case 15:Uc(e),e.flags&2048&&ms(9,e,e.return);break;case 3:Uc(e);break;case 12:Uc(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Xf(e)):Uc(e);break;default:Uc(e)}}function Xf(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];on=r,Lj(r,e)}zj(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ms(8,t,t.return),Xf(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Xf(t));break;default:Xf(t)}e=e.sibling}}function Lj(e,t){for(;on!==null;){var n=on;switch(n.tag){case 0:case 11:case 15:ms(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:xd(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,on=r;else e:for(n=e;on!==null;){r=on;var a=r.sibling,i=r.return;if(Tj(r),r===n){on=null;break e}if(a!==null){a.return=i,on=a;break e}on=i}}}var lz={getCacheForType:function(e){var t=xn(Gt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return xn(Gt).controller.signal}},cz=typeof WeakMap=="function"?WeakMap:Map,et=0,ht=null,Ve=null,Ke=0,at=0,lr=null,Xi=!1,vc=!1,Db=!1,fi=0,Ft=0,gs=0,oo=0,zb=0,hr=0,Yl=0,wu=null,Yn=null,av=!1,Xp=0,Uj=0,Lh=1/0,Uh=null,is=null,en=0,ss=null,Xl=null,ri=0,iv=0,sv=null,Fj=null,Su=0,ov=null;function yr(){return et&2&&Ke!==0?Ke&-Ke:Ne.T!==null?Lb():YC()}function qj(){if(hr===0)if(!(Ke&536870912)||Ye){var e=Jd;Jd<<=1,!(Jd&3932160)&&(Jd=262144),hr=e}else hr=536870912;return e=wr.current,e!==null&&(e.flags|=32),hr}function tr(e,t,n){(e===ht&&(at===2||at===9)||e.cancelPendingCommit!==null)&&(Wl(e,0),Wi(e,Ke,hr,!1)),yd(e,n),(!(et&2)||e!==ht)&&(e===ht&&(!(et&2)&&(oo|=n),Ft===4&&Wi(e,Ke,hr,!1)),Ta(e))}function Hj(e,t,n){if(et&6)throw Error(X(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||gd(e,t),a=r?fz(e,t):bg(e,t,!0),i=r;do{if(a===0){vc&&!r&&Wi(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!uz(n)){a=bg(e,t,!1),i=!1;continue}if(a===2){if(i=t,e.errorRecoveryDisabledLanes&i)var s=0;else s=e.pendingLanes&-536870913,s=s!==0?s:s&536870912?536870912:0;if(s!==0){t=s;e:{var o=e;a=wu;var l=o.current.memoizedState.isDehydrated;if(l&&(Wl(o,s).flags|=256),s=bg(o,s,!1),s!==2){if(Db&&!l){o.errorRecoveryDisabledLanes|=i,oo|=i,a=4;break e}i=Yn,Yn=a,i!==null&&(Yn===null?Yn=i:Yn.push.apply(Yn,i))}a=s}if(i=!1,a!==2)continue}}if(a===1){Wl(e,0),Wi(e,t,0,!0);break}e:{switch(r=e,i=a,i){case 0:case 1:throw Error(X(345));case 4:if((t&4194048)!==t)break;case 6:Wi(r,t,hr,!Xi);break e;case 2:Yn=null;break;case 3:case 5:break;default:throw Error(X(329))}if((t&62914560)===t&&(a=Xp+300-pr(),10<a)){if(Wi(r,t,hr,!Xi),Up(r,0,!0)!==0)break e;ri=t,r.timeoutHandle=c2(MS.bind(null,r,n,Yn,Uh,av,t,hr,oo,Yl,Xi,i,"Throttled",-0,0),a);break e}MS(r,n,Yn,Uh,av,t,hr,oo,Yl,Xi,i,null,-0,0)}}break}while(!0);Ta(e)}function MS(e,t,n,r,a,i,s,o,l,u,d,f,p,h){if(e.timeoutHandle=-1,f=t.subtreeFlags,f&8192||(f&16785408)===16785408){f={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Wa},Dj(t,i,f);var y=(i&62914560)===i?Xp-pr():(i&4194048)===i?Uj-pr():0;if(y=Gz(f,y),y!==null){ri=i,e.cancelPendingCommit=y(DS.bind(null,e,t,i,n,r,a,s,o,l,d,f,null,p,h)),Wi(e,i,s,!u);return}}DS(e,t,i,n,r,a,s,o,l)}function uz(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!xr(i(),a))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Wi(e,t,n,r){t&=~zb,t&=~oo,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var a=t;0<a;){var i=31-gr(a),s=1<<i;r[i]=-1,a&=~s}n!==0&&KC(e,n,t)}function Wp(){return et&6?!0:(_d(0),!1)}function Ib(){if(Ve!==null){if(at===0)var e=Ve.return;else e=Ve,Ja=$o=null,_b(e),wl=null,Vu=0,e=Ve;for(;e!==null;)Sj(e.alternate,e),e=e.return;Ve=null}}function Wl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Az(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),ri=0,Ib(),ht=e,Ve=n=ti(e.current,null),Ke=t,at=0,lr=null,Xi=!1,vc=gd(e,t),Db=!1,Yl=hr=zb=oo=gs=Ft=0,Yn=wu=null,av=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var a=31-gr(r),i=1<<a;t|=e[a],r&=~i}return fi=t,Bp(),n}function Bj(e,t){Oe=null,Ne.H=Ku,t===yc||t===Zp?(t=fS(),at=3):t===gb?(t=fS(),at=4):at=t===$b?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,lr=t,Ve===null&&(Ft=1,Dh(e,zr(t,e.current)))}function Vj(){var e=wr.current;return e===null?!0:(Ke&4194048)===Ke?Lr===null:(Ke&62914560)===Ke||Ke&536870912?e===Lr:!1}function Zj(){var e=Ne.H;return Ne.H=Ku,e===null?Ku:e}function Kj(){var e=Ne.A;return Ne.A=lz,e}function Fh(){Ft=4,Xi||(Ke&4194048)!==Ke&&wr.current!==null||(vc=!0),!(gs&134217727)&&!(oo&134217727)||ht===null||Wi(ht,Ke,hr,!1)}function bg(e,t,n){var r=et;et|=2;var a=Zj(),i=Kj();(ht!==e||Ke!==t)&&(Uh=null,Wl(e,t)),t=!1;var s=Ft;e:do try{if(at!==0&&Ve!==null){var o=Ve,l=lr;switch(at){case 8:Ib(),s=6;break e;case 3:case 2:case 9:case 6:wr.current===null&&(t=!0);var u=at;if(at=0,lr=null,fl(e,o,l,u),n&&vc){s=0;break e}break;default:u=at,at=0,lr=null,fl(e,o,l,u)}}dz(),s=Ft;break}catch(d){Bj(e,d)}while(!0);return t&&e.shellSuspendCounter++,Ja=$o=null,et=r,Ne.H=a,Ne.A=i,Ve===null&&(ht=null,Ke=0,Bp()),s}function dz(){for(;Ve!==null;)Gj(Ve)}function fz(e,t){var n=et;et|=2;var r=Zj(),a=Kj();ht!==e||Ke!==t?(Uh=null,Lh=pr()+500,Wl(e,t)):vc=gd(e,t);e:do try{if(at!==0&&Ve!==null){t=Ve;var i=lr;t:switch(at){case 1:at=0,lr=null,fl(e,t,i,1);break;case 2:case 9:if(dS(i)){at=0,lr=null,PS(t);break}t=function(){at!==2&&at!==9||ht!==e||(at=7),Ta(e)},i.then(t,t);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:dS(i)?(at=0,lr=null,PS(t)):(at=0,lr=null,fl(e,t,i,7));break;case 5:var s=null;switch(Ve.tag){case 26:s=Ve.memoizedState;case 5:case 27:var o=Ve;if(s?p2(s):o.stateNode.complete){at=0,lr=null;var l=o.sibling;if(l!==null)Ve=l;else{var u=o.return;u!==null?(Ve=u,Jp(u)):Ve=null}break t}}at=0,lr=null,fl(e,t,i,5);break;case 6:at=0,lr=null,fl(e,t,i,6);break;case 8:Ib(),Ft=6;break e;default:throw Error(X(462))}}hz();break}catch(d){Bj(e,d)}while(!0);return Ja=$o=null,Ne.H=r,Ne.A=a,et=n,Ve!==null?0:(ht=null,Ke=0,Bp(),Ft)}function hz(){for(;Ve!==null&&!DD();)Gj(Ve)}function Gj(e){var t=wj(e.alternate,e,fi);e.memoizedProps=e.pendingProps,t===null?Jp(e):Ve=t}function PS(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=jS(n,t,t.pendingProps,t.type,void 0,Ke);break;case 11:t=jS(n,t,t.pendingProps,t.type.render,t.ref,Ke);break;case 5:_b(t);default:Sj(n,t),t=Ve=SN(t,fi),t=wj(n,t,fi)}e.memoizedProps=e.pendingProps,t===null?Jp(e):Ve=t}function fl(e,t,n,r){Ja=$o=null,_b(t),wl=null,Vu=0;var a=t.return;try{if(tz(e,a,t,n,Ke)){Ft=1,Dh(e,zr(n,e.current)),Ve=null;return}}catch(i){if(a!==null)throw Ve=a,i;Ft=1,Dh(e,zr(n,e.current)),Ve=null;return}t.flags&32768?(Ye||r===1?e=!0:vc||Ke&536870912?e=!1:(Xi=e=!0,(r===2||r===9||r===3||r===6)&&(r=wr.current,r!==null&&r.tag===13&&(r.flags|=16384))),Qj(t,e)):Jp(t)}function Jp(e){var t=e;do{if(t.flags&32768){Qj(t,Xi);return}e=t.return;var n=az(t.alternate,t,fi);if(n!==null){Ve=n;return}if(t=t.sibling,t!==null){Ve=t;return}Ve=t=e}while(t!==null);Ft===0&&(Ft=5)}function Qj(e,t){do{var n=iz(e.alternate,e);if(n!==null){n.flags&=32767,Ve=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ve=e;return}Ve=e=n}while(e!==null);Ft=6,Ve=null}function DS(e,t,n,r,a,i,s,o,l){e.cancelPendingCommit=null;do em();while(en!==0);if(et&6)throw Error(X(327));if(t!==null){if(t===e.current)throw Error(X(177));if(i=t.lanes|t.childLanes,i|=cb,ZD(e,n,i,s,o,l),e===ht&&(Ve=ht=null,Ke=0),Xl=t,ss=e,ri=n,iv=i,sv=a,Fj=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,yz(Eh,function(){return e2(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,t.subtreeFlags&13878||r){r=Ne.T,Ne.T=null,a=tt.p,tt.p=2,s=et,et|=4;try{sz(e,t,n)}finally{et=s,tt.p=a,Ne.T=r}}en=1,Yj(),Xj(),Wj()}}function Yj(){if(en===1){en=0;var e=ss,t=Xl,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Ne.T,Ne.T=null;var r=tt.p;tt.p=2;var a=et;et|=4;try{Oj(t,e);var i=dv,s=pN(e.containerInfo),o=i.focusedElem,l=i.selectionRange;if(s!==o&&o&&o.ownerDocument&&hN(o.ownerDocument.documentElement,o)){if(l!==null&&lb(o)){var u=l.start,d=l.end;if(d===void 0&&(d=u),"selectionStart"in o)o.selectionStart=u,o.selectionEnd=Math.min(d,o.value.length);else{var f=o.ownerDocument||document,p=f&&f.defaultView||window;if(p.getSelection){var h=p.getSelection(),y=o.textContent.length,m=Math.min(l.start,y),b=l.end===void 0?m:Math.min(l.end,y);!h.extend&&m>b&&(s=b,b=m,m=s);var g=aS(o,m),v=aS(o,b);if(g&&v&&(h.rangeCount!==1||h.anchorNode!==g.node||h.anchorOffset!==g.offset||h.focusNode!==v.node||h.focusOffset!==v.offset)){var w=f.createRange();w.setStart(g.node,g.offset),h.removeAllRanges(),m>b?(h.addRange(w),h.extend(v.node,v.offset)):(w.setEnd(v.node,v.offset),h.addRange(w))}}}}for(f=[],h=o;h=h.parentNode;)h.nodeType===1&&f.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<f.length;o++){var S=f[o];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}Qh=!!uv,dv=uv=null}finally{et=a,tt.p=r,Ne.T=n}}e.current=t,en=2}}function Xj(){if(en===2){en=0;var e=ss,t=Xl,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Ne.T,Ne.T=null;var r=tt.p;tt.p=2;var a=et;et|=4;try{jj(e,t.alternate,t)}finally{et=a,tt.p=r,Ne.T=n}}en=3}}function Wj(){if(en===4||en===3){en=0,zD();var e=ss,t=Xl,n=ri,r=Fj;t.subtreeFlags&10256||t.flags&10256?en=5:(en=0,Xl=ss=null,Jj(e,e.pendingLanes));var a=e.pendingLanes;if(a===0&&(is=null),tb(n),t=t.stateNode,mr&&typeof mr.onCommitFiberRoot=="function")try{mr.onCommitFiberRoot(md,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=Ne.T,a=tt.p,tt.p=2,Ne.T=null;try{for(var i=e.onRecoverableError,s=0;s<r.length;s++){var o=r[s];i(o.value,{componentStack:o.stack})}}finally{Ne.T=t,tt.p=a}}ri&3&&em(),Ta(e),a=e.pendingLanes,n&261930&&a&42?e===ov?Su++:(Su=0,ov=e):Su=0,_d(0)}}function Jj(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,xd(t)))}function em(){return Yj(),Xj(),Wj(),e2()}function e2(){if(en!==5)return!1;var e=ss,t=iv;iv=0;var n=tb(ri),r=Ne.T,a=tt.p;try{tt.p=32>n?32:n,Ne.T=null,n=sv,sv=null;var i=ss,s=ri;if(en=0,Xl=ss=null,ri=0,et&6)throw Error(X(331));var o=et;if(et|=4,Ij(i.current),Pj(i,i.current,s,n),et=o,_d(0,!1),mr&&typeof mr.onPostCommitFiberRoot=="function")try{mr.onPostCommitFiberRoot(md,i)}catch{}return!0}finally{tt.p=a,Ne.T=r,Jj(e,t)}}function zS(e,t,n){t=zr(n,t),t=ev(e.stateNode,t,2),e=as(e,t,2),e!==null&&(yd(e,2),Ta(e))}function st(e,t,n){if(e.tag===3)zS(e,e,n);else for(;t!==null;){if(t.tag===3){zS(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(is===null||!is.has(r))){e=zr(n,e),n=mj(2),r=as(t,n,2),r!==null&&(gj(n,r,t,e),yd(r,2),Ta(r));break}}t=t.return}}function xg(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new cz;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(Db=!0,a.add(n),e=pz.bind(null,e,t,n),t.then(e,e))}function pz(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ht===e&&(Ke&n)===n&&(Ft===4||Ft===3&&(Ke&62914560)===Ke&&300>pr()-Xp?!(et&2)&&Wl(e,0):zb|=n,Yl===Ke&&(Yl=0)),Ta(e)}function t2(e,t){t===0&&(t=ZC()),e=Ro(e,t),e!==null&&(yd(e,t),Ta(e))}function mz(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),t2(e,n)}function gz(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(X(314))}r!==null&&r.delete(t),t2(e,n)}function yz(e,t){return J0(e,t)}var qh=null,Ko=null,lv=!1,Hh=!1,wg=!1,Ji=0;function Ta(e){e!==Ko&&e.next===null&&(Ko===null?qh=Ko=e:Ko=Ko.next=e),Hh=!0,lv||(lv=!0,bz())}function _d(e,t){if(!wg&&Hh){wg=!0;do for(var n=!1,r=qh;r!==null;){if(e!==0){var a=r.pendingLanes;if(a===0)var i=0;else{var s=r.suspendedLanes,o=r.pingedLanes;i=(1<<31-gr(42|e)+1)-1,i&=a&~(s&~o),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,IS(r,i))}else i=Ke,i=Up(r,r===ht?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(i&3)||gd(r,i)||(n=!0,IS(r,i));r=r.next}while(n);wg=!1}}function vz(){n2()}function n2(){Hh=lv=!1;var e=0;Ji!==0&&Tz()&&(e=Ji);for(var t=pr(),n=null,r=qh;r!==null;){var a=r.next,i=r2(r,t);i===0?(r.next=null,n===null?qh=a:n.next=a,a===null&&(Ko=n)):(n=r,(e!==0||i&3)&&(Hh=!0)),r=a}en!==0&&en!==5||_d(e),Ji!==0&&(Ji=0)}function r2(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var s=31-gr(i),o=1<<s,l=a[s];l===-1?(!(o&n)||o&r)&&(a[s]=VD(o,t)):l<=t&&(e.expiredLanes|=o),i&=~o}if(t=ht,n=Ke,n=Up(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(at===2||at===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Qm(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||gd(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Qm(r),tb(n)){case 2:case 8:n=BC;break;case 32:n=Eh;break;case 268435456:n=VC;break;default:n=Eh}return r=a2.bind(null,e),n=J0(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Qm(r),e.callbackPriority=2,e.callbackNode=null,2}function a2(e,t){if(en!==0&&en!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(em()&&e.callbackNode!==n)return null;var r=Ke;return r=Up(e,e===ht?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Hj(e,r,t),r2(e,pr()),e.callbackNode!=null&&e.callbackNode===n?a2.bind(null,e):null)}function IS(e,t){if(em())return null;Hj(e,t,!0)}function bz(){Rz(function(){et&6?J0(HC,vz):n2()})}function Lb(){if(Ji===0){var e=Kl;e===0&&(e=Wd,Wd<<=1,!(Wd&261888)&&(Wd=256)),Ji=e}return Ji}function LS(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:qf(""+e)}function US(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function xz(e,t,n,r,a){if(t==="submit"&&n&&n.stateNode===a){var i=LS((a[nr]||null).action),s=r.submitter;s&&(t=(t=s[nr]||null)?LS(t.formAction):s.getAttribute("formAction"),t!==null&&(i=t,s=null));var o=new Fp("action","action",null,r,a);e.push({event:o,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Ji!==0){var l=s?US(a,s):new FormData(a);Wy(n,{pending:!0,data:l,method:a.method,action:i},null,l)}}else typeof i=="function"&&(o.preventDefault(),l=s?US(a,s):new FormData(a),Wy(n,{pending:!0,data:l,method:a.method,action:i},i,l))},currentTarget:a}]})}}for(var Sg=0;Sg<Uy.length;Sg++){var _g=Uy[Sg],wz=_g.toLowerCase(),Sz=_g[0].toUpperCase()+_g.slice(1);sa(wz,"on"+Sz)}sa(gN,"onAnimationEnd");sa(yN,"onAnimationIteration");sa(vN,"onAnimationStart");sa("dblclick","onDoubleClick");sa("focusin","onFocus");sa("focusout","onBlur");sa(I4,"onTransitionRun");sa(L4,"onTransitionStart");sa(U4,"onTransitionCancel");sa(bN,"onTransitionEnd");Vl("onMouseEnter",["mouseout","mouseover"]);Vl("onMouseLeave",["mouseout","mouseover"]);Vl("onPointerEnter",["pointerout","pointerover"]);Vl("onPointerLeave",["pointerout","pointerover"]);jo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));jo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));jo("onBeforeInput",["compositionend","keypress","textInput","paste"]);jo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));jo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));jo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gu="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(" "),_z=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Gu));function i2(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var o=r[s],l=o.instance,u=o.currentTarget;if(o=o.listener,l!==i&&a.isPropagationStopped())break e;i=o,a.currentTarget=u;try{i(a)}catch(d){Nh(d)}a.currentTarget=null,i=l}else for(s=0;s<r.length;s++){if(o=r[s],l=o.instance,u=o.currentTarget,o=o.listener,l!==i&&a.isPropagationStopped())break e;i=o,a.currentTarget=u;try{i(a)}catch(d){Nh(d)}a.currentTarget=null,i=l}}}}function Be(e,t){var n=t[$y];n===void 0&&(n=t[$y]=new Set);var r=e+"__bubble";n.has(r)||(s2(t,e,2,!1),n.add(r))}function kg(e,t,n){var r=0;t&&(r|=4),s2(n,e,r,t)}var cf="_reactListening"+Math.random().toString(36).slice(2);function Ub(e){if(!e[cf]){e[cf]=!0,XC.forEach(function(n){n!=="selectionchange"&&(_z.has(n)||kg(n,!1,e),kg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[cf]||(t[cf]=!0,kg("selectionchange",!1,t))}}function s2(e,t,n,r){switch(b2(t)){case 2:var a=Xz;break;case 8:a=Wz;break;default:a=Bb}n=a.bind(null,t,n,e),a=void 0,!zy||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Eg(e,t,n,r,a){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var o=r.stateNode.containerInfo;if(o===a)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===a)return;s=s.return}for(;o!==null;){if(s=rl(o),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=i=s;continue e}o=o.parentNode}}r=r.return}iN(function(){var u=i,d=ab(n),f=[];e:{var p=xN.get(e);if(p!==void 0){var h=Fp,y=e;switch(e){case"keypress":if(Bf(n)===0)break e;case"keydown":case"keyup":h=g4;break;case"focusin":y="focus",h=eg;break;case"focusout":y="blur",h=eg;break;case"beforeblur":case"afterblur":h=eg;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=G1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=a4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=b4;break;case gN:case yN:case vN:h=o4;break;case bN:h=w4;break;case"scroll":case"scrollend":h=n4;break;case"wheel":h=_4;break;case"copy":case"cut":case"paste":h=c4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Y1;break;case"toggle":case"beforetoggle":h=E4}var m=(t&4)!==0,b=!m&&(e==="scroll"||e==="scrollend"),g=m?p!==null?p+"Capture":null:p;m=[];for(var v=u,w;v!==null;){var S=v;if(w=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||w===null||g===null||(S=Uu(v,g),S!=null&&m.push(Qu(v,S,w))),b)break;v=v.return}0<m.length&&(p=new h(p,y,null,n,d),f.push({event:p,listeners:m}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==Dy&&(y=n.relatedTarget||n.fromElement)&&(rl(y)||y[pc]))break e;if((h||p)&&(p=d.window===d?d:(p=d.ownerDocument)?p.defaultView||p.parentWindow:window,h?(y=n.relatedTarget||n.toElement,h=u,y=y?rl(y):null,y!==null&&(b=pd(y),m=y.tag,y!==b||m!==5&&m!==27&&m!==6)&&(y=null)):(h=null,y=u),h!==y)){if(m=G1,S="onMouseLeave",g="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(m=Y1,S="onPointerLeave",g="onPointerEnter",v="pointer"),b=h==null?p:eu(h),w=y==null?p:eu(y),p=new m(S,v+"leave",h,n,d),p.target=b,p.relatedTarget=w,S=null,rl(d)===u&&(m=new m(g,v+"enter",y,n,d),m.target=w,m.relatedTarget=b,S=m),b=S,h&&y)t:{for(m=kz,g=h,v=y,w=0,S=g;S;S=m(S))w++;S=0;for(var E=v;E;E=m(E))S++;for(;0<w-S;)g=m(g),w--;for(;0<S-w;)v=m(v),S--;for(;w--;){if(g===v||v!==null&&g===v.alternate){m=g;break t}g=m(g),v=m(v)}m=null}else m=null;h!==null&&FS(f,p,h,m,!1),y!==null&&b!==null&&FS(f,b,y,m,!0)}}e:{if(p=u?eu(u):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var C=eS;else if(J1(p))if(dN)C=P4;else{C=O4;var T=$4}else h=p.nodeName,!h||h.toLowerCase()!=="input"||p.type!=="checkbox"&&p.type!=="radio"?u&&rb(u.elementType)&&(C=eS):C=M4;if(C&&(C=C(e,u))){uN(f,C,n,d);break e}T&&T(e,p,u),e==="focusout"&&u&&p.type==="number"&&u.memoizedProps.value!=null&&Py(p,"number",p.value)}switch(T=u?eu(u):window,e){case"focusin":(J1(T)||T.contentEditable==="true")&&(sl=T,Iy=u,hu=null);break;case"focusout":hu=Iy=sl=null;break;case"mousedown":Ly=!0;break;case"contextmenu":case"mouseup":case"dragend":Ly=!1,iS(f,n,d);break;case"selectionchange":if(z4)break;case"keydown":case"keyup":iS(f,n,d)}var P;if(ob)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else il?lN(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(oN&&n.locale!=="ko"&&(il||R!=="onCompositionStart"?R==="onCompositionEnd"&&il&&(P=sN()):(Yi=d,ib="value"in Yi?Yi.value:Yi.textContent,il=!0)),T=Bh(u,R),0<T.length&&(R=new Q1(R,e,null,n,d),f.push({event:R,listeners:T}),P?R.data=P:(P=cN(n),P!==null&&(R.data=P)))),(P=N4?j4(e,n):T4(e,n))&&(R=Bh(u,"onBeforeInput"),0<R.length&&(T=new Q1("onBeforeInput","beforeinput",null,n,d),f.push({event:T,listeners:R}),T.data=P)),xz(f,e,u,n,d)}i2(f,t)})}function Qu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Bh(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,i=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||i===null||(a=Uu(e,n),a!=null&&r.unshift(Qu(e,a,i)),a=Uu(e,t),a!=null&&r.push(Qu(e,a,i))),e.tag===3)return r;e=e.return}return[]}function kz(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function FS(e,t,n,r,a){for(var i=t._reactName,s=[];n!==null&&n!==r;){var o=n,l=o.alternate,u=o.stateNode;if(o=o.tag,l!==null&&l===r)break;o!==5&&o!==26&&o!==27||u===null||(l=u,a?(u=Uu(n,i),u!=null&&s.unshift(Qu(n,u,l))):a||(u=Uu(n,i),u!=null&&s.push(Qu(n,u,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var Ez=/\r\n?/g,Cz=/\u0000|\uFFFD/g;function qS(e){return(typeof e=="string"?e:""+e).replace(Ez,`
49
- `).replace(Cz,"")}function o2(e,t){return t=qS(t),qS(e)===t}function lt(e,t,n,r,a,i){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||Zl(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&Zl(e,""+r);break;case"className":tf(e,"class",r);break;case"tabIndex":tf(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":tf(e,n,r);break;case"style":aN(e,r,i);break;case"data":if(t!=="object"){tf(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=qf(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(n,"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 i=="function"&&(n==="formAction"?(t!=="input"&&lt(e,t,"name",a.name,a,null),lt(e,t,"formEncType",a.formEncType,a,null),lt(e,t,"formMethod",a.formMethod,a,null),lt(e,t,"formTarget",a.formTarget,a,null)):(lt(e,t,"encType",a.encType,a,null),lt(e,t,"method",a.method,a,null),lt(e,t,"target",a.target,a,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=qf(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=Wa);break;case"onScroll":r!=null&&Be("scroll",e);break;case"onScrollEnd":r!=null&&Be("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(X(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(X(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}n=qf(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""+r):e.removeAttribute(n);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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":r===!0?e.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":Be("beforetoggle",e),Be("toggle",e),Ff(e,"popover",r);break;case"xlinkActuate":Pa(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Pa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Pa(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Pa(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Pa(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Pa(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Pa(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Ff(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=e4.get(n)||n,Ff(e,n,r))}}function cv(e,t,n,r,a,i){switch(n){case"style":aN(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(X(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(X(60));e.innerHTML=n}}break;case"children":typeof r=="string"?Zl(e,r):(typeof r=="number"||typeof r=="bigint")&&Zl(e,""+r);break;case"onScroll":r!=null&&Be("scroll",e);break;case"onScrollEnd":r!=null&&Be("scrollend",e);break;case"onClick":r!=null&&(e.onclick=Wa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!WC.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),i=e[nr]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,a),typeof r=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break e}n in e?e[n]=r:r===!0?e.setAttribute(n,""):Ff(e,n,r)}}}function Sn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Be("error",e),Be("load",e);var r=!1,a=!1,i;for(i in n)if(n.hasOwnProperty(i)){var s=n[i];if(s!=null)switch(i){case"src":r=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(X(137,t));default:lt(e,t,i,s,n,null)}}a&&lt(e,t,"srcSet",n.srcSet,n,null),r&&lt(e,t,"src",n.src,n,null);return;case"input":Be("invalid",e);var o=i=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case"name":a=d;break;case"type":s=d;break;case"checked":l=d;break;case"defaultChecked":u=d;break;case"value":i=d;break;case"defaultValue":o=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(X(137,t));break;default:lt(e,t,r,d,n,null)}}tN(e,i,o,l,u,s,a,!1);return;case"select":Be("invalid",e),r=s=i=null;for(a in n)if(n.hasOwnProperty(a)&&(o=n[a],o!=null))switch(a){case"value":i=o;break;case"defaultValue":s=o;break;case"multiple":r=o;default:lt(e,t,a,o,n,null)}t=i,n=s,e.multiple=!!r,t!=null?vl(e,!!r,t,!1):n!=null&&vl(e,!!r,n,!0);return;case"textarea":Be("invalid",e),i=a=r=null;for(s in n)if(n.hasOwnProperty(s)&&(o=n[s],o!=null))switch(s){case"value":r=o;break;case"defaultValue":a=o;break;case"children":i=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(X(91));break;default:lt(e,t,s,o,n,null)}rN(e,r,a,i);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:lt(e,t,l,r,n,null)}return;case"dialog":Be("beforetoggle",e),Be("toggle",e),Be("cancel",e),Be("close",e);break;case"iframe":case"object":Be("load",e);break;case"video":case"audio":for(r=0;r<Gu.length;r++)Be(Gu[r],e);break;case"image":Be("error",e),Be("load",e);break;case"details":Be("toggle",e);break;case"embed":case"source":case"link":Be("error",e),Be("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(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(X(137,t));default:lt(e,t,u,r,n,null)}return;default:if(rb(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&cv(e,t,d,r,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(r=n[o],r!=null&&lt(e,t,o,r,n,null))}function Nz(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,i=null,s=null,o=null,l=null,u=null,d=null;for(h in n){var f=n[h];if(n.hasOwnProperty(h)&&f!=null)switch(h){case"checked":break;case"value":break;case"defaultValue":l=f;default:r.hasOwnProperty(h)||lt(e,t,h,null,r,f)}}for(var p in r){var h=r[p];if(f=n[p],r.hasOwnProperty(p)&&(h!=null||f!=null))switch(p){case"type":i=h;break;case"name":a=h;break;case"checked":u=h;break;case"defaultChecked":d=h;break;case"value":s=h;break;case"defaultValue":o=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(X(137,t));break;default:h!==f&&lt(e,t,p,h,r,f)}}My(e,s,o,l,u,d,i,a);return;case"select":h=s=o=p=null;for(i in n)if(l=n[i],n.hasOwnProperty(i)&&l!=null)switch(i){case"value":break;case"multiple":h=l;default:r.hasOwnProperty(i)||lt(e,t,i,null,r,l)}for(a in r)if(i=r[a],l=n[a],r.hasOwnProperty(a)&&(i!=null||l!=null))switch(a){case"value":p=i;break;case"defaultValue":o=i;break;case"multiple":s=i;default:i!==l&&lt(e,t,a,i,r,l)}t=o,n=s,r=h,p!=null?vl(e,!!n,p,!1):!!r!=!!n&&(t!=null?vl(e,!!n,t,!0):vl(e,!!n,n?[]:"",!1));return;case"textarea":h=p=null;for(o in n)if(a=n[o],n.hasOwnProperty(o)&&a!=null&&!r.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:lt(e,t,o,null,r,a)}for(s in r)if(a=r[s],i=n[s],r.hasOwnProperty(s)&&(a!=null||i!=null))switch(s){case"value":p=a;break;case"defaultValue":h=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(X(91));break;default:a!==i&&lt(e,t,s,a,r,i)}nN(e,p,h);return;case"option":for(var y in n)if(p=n[y],n.hasOwnProperty(y)&&p!=null&&!r.hasOwnProperty(y))switch(y){case"selected":e.selected=!1;break;default:lt(e,t,y,null,r,p)}for(l in r)if(p=r[l],h=n[l],r.hasOwnProperty(l)&&p!==h&&(p!=null||h!=null))switch(l){case"selected":e.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:lt(e,t,l,p,r,h)}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 m in n)p=n[m],n.hasOwnProperty(m)&&p!=null&&!r.hasOwnProperty(m)&&lt(e,t,m,null,r,p);for(u in r)if(p=r[u],h=n[u],r.hasOwnProperty(u)&&p!==h&&(p!=null||h!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(X(137,t));break;default:lt(e,t,u,p,r,h)}return;default:if(rb(t)){for(var b in n)p=n[b],n.hasOwnProperty(b)&&p!==void 0&&!r.hasOwnProperty(b)&&cv(e,t,b,void 0,r,p);for(d in r)p=r[d],h=n[d],!r.hasOwnProperty(d)||p===h||p===void 0&&h===void 0||cv(e,t,d,p,r,h);return}}for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&lt(e,t,g,null,r,p);for(f in r)p=r[f],h=n[f],!r.hasOwnProperty(f)||p===h||p==null&&h==null||lt(e,t,f,p,r,h)}function HS(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function jz(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var a=n[r],i=a.transferSize,s=a.initiatorType,o=a.duration;if(i&&o&&HS(s)){for(s=0,o=a.responseEnd,r+=1;r<n.length;r++){var l=n[r],u=l.startTime;if(u>o)break;var d=l.transferSize,f=l.initiatorType;d&&HS(f)&&(l=l.responseEnd,s+=d*(l<o?1:(o-u)/(l-u)))}if(--r,t+=8*(i+s)/(a.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var uv=null,dv=null;function Vh(e){return e.nodeType===9?e:e.ownerDocument}function BS(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 l2(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function fv(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Cg=null;function Tz(){var e=window.event;return e&&e.type==="popstate"?e===Cg?!1:(Cg=e,!0):(Cg=null,!1)}var c2=typeof setTimeout=="function"?setTimeout:void 0,Az=typeof clearTimeout=="function"?clearTimeout:void 0,VS=typeof Promise=="function"?Promise:void 0,Rz=typeof queueMicrotask=="function"?queueMicrotask:typeof VS<"u"?function(e){return VS.resolve(null).then(e).catch($z)}:c2;function $z(e){setTimeout(function(){throw e})}function Ss(e){return e==="head"}function ZS(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(r===0){e.removeChild(a),ec(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")_u(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,_u(n);for(var i=n.firstChild;i;){var s=i.nextSibling,o=i.nodeName;i[vd]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=s}}else n==="body"&&_u(e.ownerDocument.body);n=a}while(n);ec(t)}function KS(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=r}while(n)}function hv(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":hv(n),nb(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Oz(e,t,n,r){for(;e.nodeType===1;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[vd])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==a.rel||e.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||e.getAttribute("title")!==(a.title==null?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(a.src==null?null:a.src)||e.getAttribute("type")!==(a.type==null?null:a.type)||e.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=a.name==null?null:""+a.name;if(a.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=Ur(e.nextSibling),e===null)break}return null}function Mz(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ur(e.nextSibling),e===null))return null;return e}function u2(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ur(e.nextSibling),e===null))return null;return e}function pv(e){return e.data==="$?"||e.data==="$~"}function mv(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Pz(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function Ur(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var gv=null;function GS(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Ur(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function QS(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function d2(e,t,n){switch(t=Vh(n),e){case"html":if(e=t.documentElement,!e)throw Error(X(452));return e;case"head":if(e=t.head,!e)throw Error(X(453));return e;case"body":if(e=t.body,!e)throw Error(X(454));return e;default:throw Error(X(451))}}function _u(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);nb(e)}var Fr=new Map,YS=new Set;function Zh(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var mi=tt.d;tt.d={f:Dz,r:zz,D:Iz,C:Lz,L:Uz,m:Fz,X:Hz,S:qz,M:Bz};function Dz(){var e=mi.f(),t=Wp();return e||t}function zz(e){var t=mc(e);t!==null&&t.tag===5&&t.type==="form"?aj(t):mi.r(e)}var bc=typeof document>"u"?null:document;function f2(e,t,n){var r=bc;if(r&&typeof t=="string"&&t){var a=Dr(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),YS.has(a)||(YS.add(a),e={rel:e,crossOrigin:n,href:t},r.querySelector(a)===null&&(t=r.createElement("link"),Sn(t,"link",e),ln(t),r.head.appendChild(t)))}}function Iz(e){mi.D(e),f2("dns-prefetch",e,null)}function Lz(e,t){mi.C(e,t),f2("preconnect",e,t)}function Uz(e,t,n){mi.L(e,t,n);var r=bc;if(r&&e&&t){var a='link[rel="preload"][as="'+Dr(t)+'"]';t==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Dr(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Dr(n.imageSizes)+'"]')):a+='[href="'+Dr(e)+'"]';var i=a;switch(t){case"style":i=Jl(e);break;case"script":i=xc(e)}Fr.has(i)||(e=Tt({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Fr.set(i,e),r.querySelector(a)!==null||t==="style"&&r.querySelector(kd(i))||t==="script"&&r.querySelector(Ed(i))||(t=r.createElement("link"),Sn(t,"link",e),ln(t),r.head.appendChild(t)))}}function Fz(e,t){mi.m(e,t);var n=bc;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+Dr(r)+'"][href="'+Dr(e)+'"]',i=a;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=xc(e)}if(!Fr.has(i)&&(e=Tt({rel:"modulepreload",href:e},t),Fr.set(i,e),n.querySelector(a)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ed(i)))return}r=n.createElement("link"),Sn(r,"link",e),ln(r),n.head.appendChild(r)}}}function qz(e,t,n){mi.S(e,t,n);var r=bc;if(r&&e){var a=yl(r).hoistableStyles,i=Jl(e);t=t||"default";var s=a.get(i);if(!s){var o={loading:0,preload:null};if(s=r.querySelector(kd(i)))o.loading=5;else{e=Tt({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Fr.get(i))&&Fb(e,n);var l=s=r.createElement("link");ln(l),Sn(l,"link",e),l._p=new Promise(function(u,d){l.onload=u,l.onerror=d}),l.addEventListener("load",function(){o.loading|=1}),l.addEventListener("error",function(){o.loading|=2}),o.loading|=4,Wf(s,t,r)}s={type:"stylesheet",instance:s,count:1,state:o},a.set(i,s)}}}function Hz(e,t){mi.X(e,t);var n=bc;if(n&&e){var r=yl(n).hoistableScripts,a=xc(e),i=r.get(a);i||(i=n.querySelector(Ed(a)),i||(e=Tt({src:e,async:!0},t),(t=Fr.get(a))&&qb(e,t),i=n.createElement("script"),ln(i),Sn(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(a,i))}}function Bz(e,t){mi.M(e,t);var n=bc;if(n&&e){var r=yl(n).hoistableScripts,a=xc(e),i=r.get(a);i||(i=n.querySelector(Ed(a)),i||(e=Tt({src:e,async:!0,type:"module"},t),(t=Fr.get(a))&&qb(e,t),i=n.createElement("script"),ln(i),Sn(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(a,i))}}function XS(e,t,n,r){var a=(a=ts.current)?Zh(a):null;if(!a)throw Error(X(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Jl(n.href),n=yl(a).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Jl(n.href);var i=yl(a).hoistableStyles,s=i.get(e);if(s||(a=a.ownerDocument||a,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,s),(i=a.querySelector(kd(e)))&&!i._p&&(s.instance=i,s.state.loading=5),Fr.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Fr.set(e,n),i||Vz(a,e,n,s.state))),t&&r===null)throw Error(X(528,""));return s}if(t&&r!==null)throw Error(X(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=xc(n),n=yl(a).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(X(444,e))}}function Jl(e){return'href="'+Dr(e)+'"'}function kd(e){return'link[rel="stylesheet"]['+e+"]"}function h2(e){return Tt({},e,{"data-precedence":e.precedence,precedence:null})}function Vz(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Sn(t,"link",n),ln(t),e.head.appendChild(t))}function xc(e){return'[src="'+Dr(e)+'"]'}function Ed(e){return"script[async]"+e}function WS(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Dr(n.href)+'"]');if(r)return t.instance=r,ln(r),r;var a=Tt({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),ln(r),Sn(r,"style",a),Wf(r,n.precedence,e),t.instance=r;case"stylesheet":a=Jl(n.href);var i=e.querySelector(kd(a));if(i)return t.state.loading|=4,t.instance=i,ln(i),i;r=h2(n),(a=Fr.get(a))&&Fb(r,a),i=(e.ownerDocument||e).createElement("link"),ln(i);var s=i;return s._p=new Promise(function(o,l){s.onload=o,s.onerror=l}),Sn(i,"link",r),t.state.loading|=4,Wf(i,n.precedence,e),t.instance=i;case"script":return i=xc(n.src),(a=e.querySelector(Ed(i)))?(t.instance=a,ln(a),a):(r=n,(a=Fr.get(i))&&(r=Tt({},n),qb(r,a)),e=e.ownerDocument||e,a=e.createElement("script"),ln(a),Sn(a,"link",r),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(X(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Wf(r,n.precedence,e));return t.instance}function Wf(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=r.length?r[r.length-1]:null,i=a,s=0;s<r.length;s++){var o=r[s];if(o.dataset.precedence===t)i=o;else if(i!==a)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Fb(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function qb(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Jf=null;function JS(e,t,n){if(Jf===null){var r=new Map,a=Jf=new Map;a.set(n,r)}else a=Jf,r=a.get(n),r||(r=new Map,a.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var i=n[a];if(!(i[vd]||i[vn]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var s=i.getAttribute(t)||"";s=e+s;var o=r.get(s);o?o.push(i):r.set(s,[i])}}return r}function e_(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Zz(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function p2(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function Kz(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var a=Jl(r.href),i=t.querySelector(kd(a));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Kh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,ln(i);return}i=t.ownerDocument||t,r=h2(r),(a=Fr.get(a))&&Fb(r,a),i=i.createElement("link"),ln(i);var s=i;s._p=new Promise(function(o,l){s.onload=o,s.onerror=l}),Sn(i,"link",r),n.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Kh.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Ng=0;function Gz(e,t){return e.stylesheets&&e.count===0&&eh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&eh(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&Ng===0&&(Ng=62500*jz());var a=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&eh(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>Ng?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(a)}}:null}function Kh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)eh(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Gh=null;function eh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Gh=new Map,t.forEach(Qz,e),Gh=null,Kh.call(e))}function Qz(e,t){if(!(t.state.loading&4)){var n=Gh.get(e);if(n)var r=n.get(null);else{n=new Map,Gh.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<a.length;i++){var s=a[i];(s.nodeName==="LINK"||s.getAttribute("media")!=="not all")&&(n.set(s.dataset.precedence,s),r=s)}r&&n.set(null,r)}a=t.instance,s=a.getAttribute("data-precedence"),i=n.get(s)||r,i===r&&n.set(null,a),n.set(s,a),this.count++,r=Kh.bind(this),a.addEventListener("load",r),a.addEventListener("error",r),i?i.parentNode.insertBefore(a,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(a,e.firstChild)),t.state.loading|=4}}var Yu={$$typeof:Xa,Provider:null,Consumer:null,_currentValue:ro,_currentValue2:ro,_threadCount:0};function Yz(e,t,n,r,a,i,s,o,l){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=Ym(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ym(0),this.hiddenUpdates=Ym(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=i,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function m2(e,t,n,r,a,i,s,o,l,u,d,f){return e=new Yz(e,t,n,s,l,u,d,f,o),t=1,i===!0&&(t|=24),i=fr(3,null,null,t),e.current=i,i.stateNode=e,t=pb(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},yb(i),e}function g2(e){return e?(e=cl,e):cl}function y2(e,t,n,r,a,i){a=g2(a),r.context===null?r.context=a:r.pendingContext=a,r=rs(t),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=as(e,r,t),n!==null&&(tr(n,e,t),mu(n,e,t))}function t_(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Hb(e,t){t_(e,t),(e=e.alternate)&&t_(e,t)}function v2(e){if(e.tag===13||e.tag===31){var t=Ro(e,67108864);t!==null&&tr(t,e,67108864),Hb(e,67108864)}}function n_(e){if(e.tag===13||e.tag===31){var t=yr();t=eb(t);var n=Ro(e,t);n!==null&&tr(n,e,t),Hb(e,t)}}var Qh=!0;function Xz(e,t,n,r){var a=Ne.T;Ne.T=null;var i=tt.p;try{tt.p=2,Bb(e,t,n,r)}finally{tt.p=i,Ne.T=a}}function Wz(e,t,n,r){var a=Ne.T;Ne.T=null;var i=tt.p;try{tt.p=8,Bb(e,t,n,r)}finally{tt.p=i,Ne.T=a}}function Bb(e,t,n,r){if(Qh){var a=yv(r);if(a===null)Eg(e,t,r,Yh,n),r_(e,r);else if(e3(a,e,t,n,r))r.stopPropagation();else if(r_(e,r),t&4&&-1<Jz.indexOf(e)){for(;a!==null;){var i=mc(a);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var s=Ds(i.pendingLanes);if(s!==0){var o=i;for(o.pendingLanes|=2,o.entangledLanes|=2;s;){var l=1<<31-gr(s);o.entanglements[1]|=l,s&=~l}Ta(i),!(et&6)&&(Lh=pr()+500,_d(0))}}break;case 31:case 13:o=Ro(i,2),o!==null&&tr(o,i,2),Wp(),Hb(i,2)}if(i=yv(r),i===null&&Eg(e,t,r,Yh,n),i===a)break;a=i}a!==null&&r.stopPropagation()}else Eg(e,t,r,null,n)}}function yv(e){return e=ab(e),Vb(e)}var Yh=null;function Vb(e){if(Yh=null,e=rl(e),e!==null){var t=pd(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=IC(t),e!==null)return e;e=null}else if(n===31){if(e=LC(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Yh=e,null}function b2(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(ID()){case HC:return 2;case BC:return 8;case Eh:case LD:return 32;case VC:return 268435456;default:return 32}default:return 32}}var vv=!1,os=null,ls=null,cs=null,Xu=new Map,Wu=new Map,Ii=[],Jz="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 r_(e,t){switch(e){case"focusin":case"focusout":os=null;break;case"dragenter":case"dragleave":ls=null;break;case"mouseover":case"mouseout":cs=null;break;case"pointerover":case"pointerout":Xu.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wu.delete(t.pointerId)}}function Fc(e,t,n,r,a,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[a]},t!==null&&(t=mc(t),t!==null&&v2(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function e3(e,t,n,r,a){switch(t){case"focusin":return os=Fc(os,e,t,n,r,a),!0;case"dragenter":return ls=Fc(ls,e,t,n,r,a),!0;case"mouseover":return cs=Fc(cs,e,t,n,r,a),!0;case"pointerover":var i=a.pointerId;return Xu.set(i,Fc(Xu.get(i)||null,e,t,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,Wu.set(i,Fc(Wu.get(i)||null,e,t,n,r,a)),!0}return!1}function x2(e){var t=rl(e.target);if(t!==null){var n=pd(t);if(n!==null){if(t=n.tag,t===13){if(t=IC(n),t!==null){e.blockedOn=t,F1(e.priority,function(){n_(n)});return}}else if(t===31){if(t=LC(n),t!==null){e.blockedOn=t,F1(e.priority,function(){n_(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function th(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=yv(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Dy=r,n.target.dispatchEvent(r),Dy=null}else return t=mc(n),t!==null&&v2(t),e.blockedOn=n,!1;t.shift()}return!0}function a_(e,t,n){th(e)&&n.delete(t)}function t3(){vv=!1,os!==null&&th(os)&&(os=null),ls!==null&&th(ls)&&(ls=null),cs!==null&&th(cs)&&(cs=null),Xu.forEach(a_),Wu.forEach(a_)}function uf(e,t){e.blockedOn===t&&(e.blockedOn=null,vv||(vv=!0,nn.unstable_scheduleCallback(nn.unstable_NormalPriority,t3)))}var df=null;function i_(e){df!==e&&(df=e,nn.unstable_scheduleCallback(nn.unstable_NormalPriority,function(){df===e&&(df=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],a=e[t+2];if(typeof r!="function"){if(Vb(r||n)===null)continue;break}var i=mc(n);i!==null&&(e.splice(t,3),t-=3,Wy(i,{pending:!0,data:a,method:n.method,action:r},r,a))}}))}function ec(e){function t(l){return uf(l,e)}os!==null&&uf(os,e),ls!==null&&uf(ls,e),cs!==null&&uf(cs,e),Xu.forEach(t),Wu.forEach(t);for(var n=0;n<Ii.length;n++){var r=Ii[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ii.length&&(n=Ii[0],n.blockedOn===null);)x2(n),n.blockedOn===null&&Ii.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var a=n[r],i=n[r+1],s=a[nr]||null;if(typeof i=="function")s||i_(n);else if(s){var o=null;if(i&&i.hasAttribute("formAction")){if(a=i,s=i[nr]||null)o=s.formAction;else if(Vb(a)!==null)continue}else o=s.action;typeof o=="function"?n[r+1]=o:(n.splice(r,3),r-=3),i_(n)}}}function w2(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(s){return a=s})},focusReset:"manual",scroll:"manual"})}function t(){a!==null&&(a(),a=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,a=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),a!==null&&(a(),a=null)}}}function Zb(e){this._internalRoot=e}tm.prototype.render=Zb.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(X(409));var n=t.current,r=yr();y2(n,r,e,t,null,null)};tm.prototype.unmount=Zb.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;y2(e.current,2,null,e,null,null),Wp(),t[pc]=null}};function tm(e){this._internalRoot=e}tm.prototype.unstable_scheduleHydration=function(e){if(e){var t=YC();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ii.length&&t!==0&&t<Ii[n].priority;n++);Ii.splice(n,0,e),n===0&&x2(e)}};var s_=DC.version;if(s_!=="19.2.8")throw Error(X(527,s_,"19.2.8"));tt.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(X(188)):(e=Object.keys(e).join(","),Error(X(268,e)));return e=RD(t),e=e!==null?UC(e):null,e=e===null?null:e.stateNode,e};var n3={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:Ne,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ff=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ff.isDisabled&&ff.supportsFiber)try{md=ff.inject(n3),mr=ff}catch{}}Ip.createRoot=function(e,t){if(!zC(e))throw Error(X(299));var n=!1,r="",a=fj,i=hj,s=pj;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(a=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=m2(e,1,!1,null,null,n,r,null,a,i,s,w2),e[pc]=t.current,Ub(e),new Zb(t)};Ip.hydrateRoot=function(e,t,n){if(!zC(e))throw Error(X(299));var r=!1,a="",i=fj,s=hj,o=pj,l=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(s=n.onCaughtError),n.onRecoverableError!==void 0&&(o=n.onRecoverableError),n.formState!==void 0&&(l=n.formState)),t=m2(e,1,!0,t,n??null,r,a,l,i,s,o,w2),t.context=g2(null),n=t.current,r=yr(),r=eb(r),a=rs(r),a.callback=null,as(n,a,r),n=r,t.current.lanes=n,yd(t,n),Ta(t),e[pc]=t.current,Ub(e),new tm(t)};Ip.version="19.2.8";function S2(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(S2)}catch(e){console.error(e)}}S2(),_C.exports=Ip;var r3=_C.exports;function a3(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,a,i,s=[],o="",l=e.split("/");for(l[0]||l.shift();a=l.shift();)n=a[0],n==="*"?(s.push(n),o+=a[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(r=a.indexOf("?",1),i=a.indexOf(".",1),s.push(a.substring(1,~r?r:~i?i:a.length)),o+=~r&&!~i?"(?:/([^/]+?))?":"/([^/]+?)",~i&&(o+=(~r?"?":"")+"\\"+a.substring(i))):o+="/"+a;return{keys:s,pattern:new RegExp("^"+o+(t?"(?=$|/)":"/?$"),"i")}}var _2={exports:{}},k2={};/**
50
- * @license React
51
- * use-sync-external-store-shim.production.js
52
- *
53
- * Copyright (c) Meta Platforms, Inc. and affiliates.
54
- *
55
- * This source code is licensed under the MIT license found in the
56
- * LICENSE file in the root directory of this source tree.
57
- */var tc=x;function i3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var s3=typeof Object.is=="function"?Object.is:i3,o3=tc.useState,l3=tc.useEffect,c3=tc.useLayoutEffect,u3=tc.useDebugValue;function d3(e,t){var n=t(),r=o3({inst:{value:n,getSnapshot:t}}),a=r[0].inst,i=r[1];return c3(function(){a.value=n,a.getSnapshot=t,jg(a)&&i({inst:a})},[e,n,t]),l3(function(){return jg(a)&&i({inst:a}),e(function(){jg(a)&&i({inst:a})})},[e]),u3(n),n}function jg(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!s3(e,n)}catch{return!0}}function f3(e,t){return t()}var h3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f3:d3;k2.useSyncExternalStore=tc.useSyncExternalStore!==void 0?tc.useSyncExternalStore:h3;_2.exports=k2;var p3=_2.exports;const m3=hd.useInsertionEffect,g3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",y3=g3?x.useLayoutEffect:x.useEffect,v3=m3||y3,E2=e=>{const t=x.useRef([e,(...n)=>t[0](...n)]).current;return v3(()=>{t[0]=e}),t[1]},b3="popstate",Kb="pushState",Gb="replaceState",x3="hashchange",o_=[b3,Kb,Gb,x3],w3=e=>{for(const t of o_)addEventListener(t,e);return()=>{for(const t of o_)removeEventListener(t,e)}},C2=(e,t)=>p3.useSyncExternalStore(w3,e,t),S3=()=>location.search,_3=({ssrSearch:e=""}={})=>C2(S3,()=>e),l_=()=>location.pathname,k3=({ssrPath:e}={})=>C2(l_,e?()=>e:l_),E3=(e,{replace:t=!1,state:n=null}={})=>history[t?Gb:Kb](n,"",e),C3=(e={})=>[k3(e),E3],c_=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[c_]>"u"){for(const e of[Kb,Gb]){const t=history[e];history[e]=function(){const n=t.apply(this,arguments),r=new Event(e);return r.arguments=arguments,dispatchEvent(r),n}}Object.defineProperty(window,c_,{value:!0})}const N3=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",N2=(e="")=>e==="/"?"":e,j3=(e,t)=>e[0]==="~"?e.slice(1):N2(t)+e,T3=(e="",t)=>N3(u_(N2(e)),u_(t)),u_=e=>{try{return decodeURI(e)}catch{return e}},j2={hook:C3,searchHook:_3,parser:a3,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},T2=x.createContext(j2),Cd=()=>x.useContext(T2),A2={},R2=x.createContext(A2),A3=()=>x.useContext(R2),nm=e=>{const[t,n]=e.hook(e);return[T3(e.base,t),E2((r,a)=>n(j3(r,e.base),a))]},R3=()=>nm(Cd()),$2=(e,t,n,r)=>{const{pattern:a,keys:i}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",r),s=a.exec(n)||[],[o,...l]=s;return o!==void 0?[!0,(()=>{const u=i!==!1?Object.fromEntries(i.map((f,p)=>[f,l[p]])):s.groups;let d={...l};return u&&Object.assign(d,u),d})(),...r?[o]:[]]:[!1,null]},$3=({children:e,...t})=>{var d,f;const n=Cd(),r=t.hook?j2:n;let a=r;const[i,s]=((d=t.ssrPath)==null?void 0:d.split("?"))??[];s&&(t.ssrSearch=s,t.ssrPath=i),t.hrefs=t.hrefs??((f=t.hook)==null?void 0:f.hrefs);let o=x.useRef({}),l=o.current,u=l;for(let p in r){const h=p==="base"?r[p]+(t[p]||""):t[p]||r[p];l===u&&h!==u[p]&&(o.current=u={...u}),u[p]=h,(h!==r[p]||h!==a[p])&&(a=u)}return x.createElement(T2.Provider,{value:a,children:e})},d_=({children:e,component:t},n)=>t?x.createElement(t,{params:n}):typeof e=="function"?e(n):e,O3=e=>{let t=x.useRef(A2);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([r,a])=>a!==n[r])?e:n},Rs=({path:e,nest:t,match:n,...r})=>{const a=Cd(),[i]=nm(a),[s,o,l]=n??$2(a.parser,e,i,t),u=O3({...A3(),...o});if(!s)return null;const d=l?x.createElement($3,{base:l},d_(r,u)):d_(r,u);return x.createElement(R2.Provider,{value:u,children:d})},nc=x.forwardRef((e,t)=>{const n=Cd(),[r,a]=nm(n),{to:i="",href:s=i,onClick:o,asChild:l,children:u,className:d,replace:f,state:p,...h}=e,y=E2(b=>{b.ctrlKey||b.metaKey||b.altKey||b.shiftKey||b.button!==0||(o==null||o(b),b.defaultPrevented||(b.preventDefault(),a(s,e)))}),m=n.hrefs(s[0]==="~"?s.slice(1):n.base+s,n);return l&&x.isValidElement(u)?x.cloneElement(u,{onClick:y,href:m}):x.createElement("a",{...h,onClick:y,href:m,className:d!=null&&d.call?d(r===s):d,children:u,ref:t})}),O2=e=>Array.isArray(e)?e.flatMap(t=>O2(t&&t.type===x.Fragment?t.props.children:t)):[e],M3=({children:e,location:t})=>{const n=Cd(),[r]=nm(n);for(const a of O2(e)){let i=0;if(x.isValidElement(a)&&(i=$2(n.parser,a.props.path,t||r,a.props.nest))[0])return x.cloneElement(a,{match:i})}return null};var wc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},mo=typeof window>"u"||"Deno"in globalThis;function In(){}function P3(e,t){return typeof e=="function"?e(t):e}function bv(e){return typeof e=="number"&&e>=0&&e!==1/0}function M2(e,t){return Math.max(e+(t||0)-Date.now(),0)}function us(e,t){return typeof e=="function"?e(t):e}function Ar(e,t){return typeof e=="function"?e(t):e}function f_(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:i,queryKey:s,stale:o}=e;if(s){if(r){if(t.queryHash!==Qb(s,t.options))return!1}else if(!Ju(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||a&&a!==t.state.fetchStatus||i&&!i(t))}function h_(e,t){const{exact:n,status:r,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(go(t.options.mutationKey)!==go(i))return!1}else if(!Ju(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function Qb(e,t){return((t==null?void 0:t.queryKeyHashFn)||go)(e)}function go(e){return JSON.stringify(e,(t,n)=>xv(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function Ju(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ju(e[n],t[n])):!1}function P2(e,t){if(e===t)return e;const n=p_(e)&&p_(t);if(n||xv(e)&&xv(t)){const r=n?e:Object.keys(e),a=r.length,i=n?t:Object.keys(t),s=i.length,o=n?[]:{},l=new Set(r);let u=0;for(let d=0;d<s;d++){const f=n?d:i[d];(!n&&l.has(f)||n)&&e[f]===void 0&&t[f]===void 0?(o[f]=void 0,u++):(o[f]=P2(e[f],t[f]),o[f]===e[f]&&e[f]!==void 0&&u++)}return a===s&&u===a?e:o}return t}function Xh(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function p_(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xv(e){if(!m_(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!m_(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function m_(e){return Object.prototype.toString.call(e)==="[object Object]"}function D3(e){return new Promise(t=>{setTimeout(t,e)})}function wv(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?P2(e,t):t}function z3(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function I3(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Yb=Symbol();function D2(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Yb?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function z2(e,t){return typeof e=="function"?e(...t):!!e}var Qs,Ui,Rl,dC,L3=(dC=class extends wc{constructor(){super();xe(this,Qs);xe(this,Ui);xe(this,Rl);ue(this,Rl,t=>{if(!mo&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){z(this,Ui)||this.setEventListener(z(this,Rl))}onUnsubscribe(){var t;this.hasListeners()||((t=z(this,Ui))==null||t.call(this),ue(this,Ui,void 0))}setEventListener(t){var n;ue(this,Rl,t),(n=z(this,Ui))==null||n.call(this),ue(this,Ui,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){z(this,Qs)!==t&&(ue(this,Qs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof z(this,Qs)=="boolean"?z(this,Qs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Qs=new WeakMap,Ui=new WeakMap,Rl=new WeakMap,dC),Xb=new L3,$l,Fi,Ol,fC,U3=(fC=class extends wc{constructor(){super();xe(this,$l,!0);xe(this,Fi);xe(this,Ol);ue(this,Ol,t=>{if(!mo&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){z(this,Fi)||this.setEventListener(z(this,Ol))}onUnsubscribe(){var t;this.hasListeners()||((t=z(this,Fi))==null||t.call(this),ue(this,Fi,void 0))}setEventListener(t){var n;ue(this,Ol,t),(n=z(this,Fi))==null||n.call(this),ue(this,Fi,t(this.setOnline.bind(this)))}setOnline(t){z(this,$l)!==t&&(ue(this,$l,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return z(this,$l)}},$l=new WeakMap,Fi=new WeakMap,Ol=new WeakMap,fC),Wh=new U3;function Sv(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},n.reject=a=>{r({status:"rejected",reason:a}),t(a)},n}function F3(e){return Math.min(1e3*2**e,3e4)}function I2(e){return(e??"online")==="online"?Wh.isOnline():!0}var L2=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function U2(e){let t=!1,n=0,r;const a=Sv(),i=()=>a.status!=="pending",s=m=>{var b;i()||(p(new L2(m)),(b=e.abort)==null||b.call(e))},o=()=>{t=!0},l=()=>{t=!1},u=()=>Xb.isFocused()&&(e.networkMode==="always"||Wh.isOnline())&&e.canRun(),d=()=>I2(e.networkMode)&&e.canRun(),f=m=>{i()||(r==null||r(),a.resolve(m))},p=m=>{i()||(r==null||r(),a.reject(m))},h=()=>new Promise(m=>{var b;r=g=>{(i()||u())&&m(g)},(b=e.onPause)==null||b.call(e)}).then(()=>{var m;r=void 0,i()||(m=e.onContinue)==null||m.call(e)}),y=()=>{if(i())return;let m;const b=n===0?e.initialPromise:void 0;try{m=b??e.fn()}catch(g){m=Promise.reject(g)}Promise.resolve(m).then(f).catch(g=>{var C;if(i())return;const v=e.retry??(mo?0:3),w=e.retryDelay??F3,S=typeof w=="function"?w(n,g):w,E=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,g);if(t||!E){p(g);return}n++,(C=e.onFail)==null||C.call(e,n,g),D3(S).then(()=>u()?void 0:h()).then(()=>{t?p(g):y()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(r==null||r(),a),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?y():h().then(y),a)}}var q3=e=>setTimeout(e,0);function H3(){let e=[],t=0,n=o=>{o()},r=o=>{o()},a=q3;const i=o=>{t?e.push(o):a(()=>{n(o)})},s=()=>{const o=e;e=[],o.length&&a(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||s()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{a=o}}}var Jt=H3(),Ys,hC,F2=(hC=class{constructor(){xe(this,Ys)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),bv(this.gcTime)&&ue(this,Ys,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(mo?1/0:5*60*1e3))}clearGcTimeout(){z(this,Ys)&&(clearTimeout(z(this,Ys)),ue(this,Ys,void 0))}},Ys=new WeakMap,hC),Ml,Pl,Nr,Xs,sn,cd,Ws,Xr,Fa,pC,B3=(pC=class extends F2{constructor(t){super();xe(this,Xr);xe(this,Ml);xe(this,Pl);xe(this,Nr);xe(this,Xs);xe(this,sn);xe(this,cd);xe(this,Ws);ue(this,Ws,!1),ue(this,cd,t.defaultOptions),this.setOptions(t.options),this.observers=[],ue(this,Xs,t.client),ue(this,Nr,z(this,Xs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ue(this,Ml,V3(this.options)),this.state=t.state??z(this,Ml),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=z(this,sn))==null?void 0:t.promise}setOptions(t){this.options={...z(this,cd),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&z(this,Nr).remove(this)}setData(t,n){const r=wv(this.state.data,t,this.options);return Ie(this,Xr,Fa).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ie(this,Xr,Fa).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,a;const n=(r=z(this,sn))==null?void 0:r.promise;return(a=z(this,sn))==null||a.cancel(t),n?n.then(In).catch(In):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(z(this,Ml))}isActive(){return this.observers.some(t=>Ar(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Yb||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>us(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!M2(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=z(this,sn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=z(this,sn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),z(this,Nr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(z(this,sn)&&(z(this,Ws)?z(this,sn).cancel({revert:!0}):z(this,sn).cancelRetry()),this.scheduleGc()),z(this,Nr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ie(this,Xr,Fa).call(this,{type:"invalidate"})}async fetch(t,n){var l,u,d,f,p,h,y,m,b,g,v,w;if(this.state.fetchStatus!=="idle"&&((l=z(this,sn))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(z(this,sn))return z(this,sn).continueRetry(),z(this,sn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(E=>E.options.queryFn);S&&this.setOptions(S.options)}const r=new AbortController,a=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(ue(this,Ws,!0),r.signal)})},i=()=>{const S=D2(this.options,n),C=(()=>{const T={client:z(this,Xs),queryKey:this.queryKey,meta:this.meta};return a(T),T})();return ue(this,Ws,!1),this.options.persister?this.options.persister(S,C,this):S(C)},o=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:z(this,Xs),state:this.state,fetchFn:i};return a(S),S})();(u=this.options.behavior)==null||u.onFetch(o,this),ue(this,Pl,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&Ie(this,Xr,Fa).call(this,{type:"fetch",meta:(f=o.fetchOptions)==null?void 0:f.meta}),ue(this,sn,U2({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onFail:(S,E)=>{Ie(this,Xr,Fa).call(this,{type:"failed",failureCount:S,error:E})},onPause:()=>{Ie(this,Xr,Fa).call(this,{type:"pause"})},onContinue:()=>{Ie(this,Xr,Fa).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const S=await z(this,sn).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(h=(p=z(this,Nr).config).onSuccess)==null||h.call(p,S,this),(m=(y=z(this,Nr).config).onSettled)==null||m.call(y,S,this.state.error,this),S}catch(S){if(S instanceof L2){if(S.silent)return z(this,sn).promise;if(S.revert){if(this.setState({...z(this,Pl),fetchStatus:"idle"}),this.state.data===void 0)throw S;return this.state.data}}throw Ie(this,Xr,Fa).call(this,{type:"error",error:S}),(g=(b=z(this,Nr).config).onError)==null||g.call(b,S,this),(w=(v=z(this,Nr).config).onSettled)==null||w.call(v,this.state.data,S,this),S}finally{this.scheduleGc()}}},Ml=new WeakMap,Pl=new WeakMap,Nr=new WeakMap,Xs=new WeakMap,sn=new WeakMap,cd=new WeakMap,Ws=new WeakMap,Xr=new WeakSet,Fa=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...q2(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ue(this,Pl,t.manual?a:void 0),a;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Jt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),z(this,Nr).notify({query:this,type:"updated",action:t})})},pC);function q2(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:I2(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function V3(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var ha,mC,Z3=(mC=class extends wc{constructor(t={}){super();xe(this,ha);this.config=t,ue(this,ha,new Map)}build(t,n,r){const a=n.queryKey,i=n.queryHash??Qb(a,n);let s=this.get(i);return s||(s=new B3({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(s)),s}add(t){z(this,ha).has(t.queryHash)||(z(this,ha).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=z(this,ha).get(t.queryHash);n&&(t.destroy(),n===t&&z(this,ha).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Jt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return z(this,ha).get(t)}getAll(){return[...z(this,ha).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>f_(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>f_(t,r)):n}notify(t){Jt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Jt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Jt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ha=new WeakMap,mC),pa,On,Js,ma,ji,gC,K3=(gC=class extends F2{constructor(t){super();xe(this,ma);xe(this,pa);xe(this,On);xe(this,Js);this.mutationId=t.mutationId,ue(this,On,t.mutationCache),ue(this,pa,[]),this.state=t.state||H2(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){z(this,pa).includes(t)||(z(this,pa).push(t),this.clearGcTimeout(),z(this,On).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ue(this,pa,z(this,pa).filter(n=>n!==t)),this.scheduleGc(),z(this,On).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){z(this,pa).length||(this.state.status==="pending"?this.scheduleGc():z(this,On).remove(this))}continue(){var t;return((t=z(this,Js))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,o,l,u,d,f,p,h,y,m,b,g,v,w,S,E,C,T,P;const n=()=>{Ie(this,ma,ji).call(this,{type:"continue"})};ue(this,Js,U2({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(R,$)=>{Ie(this,ma,ji).call(this,{type:"failed",failureCount:R,error:$})},onPause:()=>{Ie(this,ma,ji).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>z(this,On).canRun(this)}));const r=this.state.status==="pending",a=!z(this,Js).canStart();try{if(r)n();else{Ie(this,ma,ji).call(this,{type:"pending",variables:t,isPaused:a}),await((s=(i=z(this,On).config).onMutate)==null?void 0:s.call(i,t,this));const $=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t));$!==this.state.context&&Ie(this,ma,ji).call(this,{type:"pending",context:$,variables:t,isPaused:a})}const R=await z(this,Js).start();return await((d=(u=z(this,On).config).onSuccess)==null?void 0:d.call(u,R,t,this.state.context,this)),await((p=(f=this.options).onSuccess)==null?void 0:p.call(f,R,t,this.state.context)),await((y=(h=z(this,On).config).onSettled)==null?void 0:y.call(h,R,null,this.state.variables,this.state.context,this)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,R,null,t,this.state.context)),Ie(this,ma,ji).call(this,{type:"success",data:R}),R}catch(R){try{throw await((v=(g=z(this,On).config).onError)==null?void 0:v.call(g,R,t,this.state.context,this)),await((S=(w=this.options).onError)==null?void 0:S.call(w,R,t,this.state.context)),await((C=(E=z(this,On).config).onSettled)==null?void 0:C.call(E,void 0,R,this.state.variables,this.state.context,this)),await((P=(T=this.options).onSettled)==null?void 0:P.call(T,void 0,R,t,this.state.context)),R}finally{Ie(this,ma,ji).call(this,{type:"error",error:R})}}finally{z(this,On).runNext(this)}}},pa=new WeakMap,On=new WeakMap,Js=new WeakMap,ma=new WeakSet,ji=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Jt.batch(()=>{z(this,pa).forEach(r=>{r.onMutationUpdate(t)}),z(this,On).notify({mutation:this,type:"updated",action:t})})},gC);function H2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Za,Wr,ud,yC,G3=(yC=class extends wc{constructor(t={}){super();xe(this,Za);xe(this,Wr);xe(this,ud);this.config=t,ue(this,Za,new Set),ue(this,Wr,new Map),ue(this,ud,0)}build(t,n,r){const a=new K3({mutationCache:this,mutationId:++Qd(this,ud)._,options:t.defaultMutationOptions(n),state:r});return this.add(a),a}add(t){z(this,Za).add(t);const n=hf(t);if(typeof n=="string"){const r=z(this,Wr).get(n);r?r.push(t):z(this,Wr).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(z(this,Za).delete(t)){const n=hf(t);if(typeof n=="string"){const r=z(this,Wr).get(n);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&z(this,Wr).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=hf(t);if(typeof n=="string"){const r=z(this,Wr).get(n),a=r==null?void 0:r.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const n=hf(t);if(typeof n=="string"){const a=(r=z(this,Wr).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Jt.batch(()=>{z(this,Za).forEach(t=>{this.notify({type:"removed",mutation:t})}),z(this,Za).clear(),z(this,Wr).clear()})}getAll(){return Array.from(z(this,Za))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>h_(n,r))}findAll(t={}){return this.getAll().filter(n=>h_(t,n))}notify(t){Jt.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Jt.batch(()=>Promise.all(t.map(n=>n.continue().catch(In))))}},Za=new WeakMap,Wr=new WeakMap,ud=new WeakMap,yC);function hf(e){var t;return(t=e.options.scope)==null?void 0:t.id}function g_(e){return{onFetch:(t,n)=>{var d,f,p,h,y;const r=t.options,a=(p=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,i=((h=t.state.data)==null?void 0:h.pages)||[],s=((y=t.state.data)==null?void 0:y.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const b=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},g=D2(t.options,t.fetchOptions),v=async(w,S,E)=>{if(m)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const T=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:S,direction:E?"backward":"forward",meta:t.options.meta};return b(j),j})(),P=await g(T),{maxPages:R}=t.options,$=E?I3:z3;return{pages:$(w.pages,P,R),pageParams:$(w.pageParams,S,R)}};if(a&&i.length){const w=a==="backward",S=w?Q3:y_,E={pages:i,pageParams:s},C=S(r,E);o=await v(E,C,w)}else{const w=e??i.length;do{const S=l===0?s[0]??r.initialPageParam:y_(r,o);if(l>0&&S==null)break;o=await v(o,S),l++}while(l<w)}return o};t.options.persister?t.fetchFn=()=>{var m,b;return(b=(m=t.options).persister)==null?void 0:b.call(m,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function y_(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Q3(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Ut,qi,Hi,Dl,zl,Bi,Il,Ll,vC,Y3=(vC=class{constructor(e={}){xe(this,Ut);xe(this,qi);xe(this,Hi);xe(this,Dl);xe(this,zl);xe(this,Bi);xe(this,Il);xe(this,Ll);ue(this,Ut,e.queryCache||new Z3),ue(this,qi,e.mutationCache||new G3),ue(this,Hi,e.defaultOptions||{}),ue(this,Dl,new Map),ue(this,zl,new Map),ue(this,Bi,0)}mount(){Qd(this,Bi)._++,z(this,Bi)===1&&(ue(this,Il,Xb.subscribe(async e=>{e&&(await this.resumePausedMutations(),z(this,Ut).onFocus())})),ue(this,Ll,Wh.subscribe(async e=>{e&&(await this.resumePausedMutations(),z(this,Ut).onOnline())})))}unmount(){var e,t;Qd(this,Bi)._--,z(this,Bi)===0&&((e=z(this,Il))==null||e.call(this),ue(this,Il,void 0),(t=z(this,Ll))==null||t.call(this),ue(this,Ll,void 0))}isFetching(e){return z(this,Ut).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return z(this,qi).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=z(this,Ut).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=z(this,Ut).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(us(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return z(this,Ut).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=z(this,Ut).get(r.queryHash),i=a==null?void 0:a.state.data,s=P3(t,i);if(s!==void 0)return z(this,Ut).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Jt.batch(()=>z(this,Ut).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=z(this,Ut).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=z(this,Ut);Jt.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=z(this,Ut);return Jt.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Jt.batch(()=>z(this,Ut).findAll(e).map(a=>a.cancel(n)));return Promise.all(r).then(In).catch(In)}invalidateQueries(e,t={}){return Jt.batch(()=>(z(this,Ut).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Jt.batch(()=>z(this,Ut).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(In)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(In)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=z(this,Ut).build(this,t);return n.isStaleByTime(us(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(In).catch(In)}fetchInfiniteQuery(e){return e.behavior=g_(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(In).catch(In)}ensureInfiniteQueryData(e){return e.behavior=g_(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Wh.isOnline()?z(this,qi).resumePausedMutations():Promise.resolve()}getQueryCache(){return z(this,Ut)}getMutationCache(){return z(this,qi)}getDefaultOptions(){return z(this,Hi)}setDefaultOptions(e){ue(this,Hi,e)}setQueryDefaults(e,t){z(this,Dl).set(go(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...z(this,Dl).values()],n={};return t.forEach(r=>{Ju(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){z(this,zl).set(go(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...z(this,zl).values()],n={};return t.forEach(r=>{Ju(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...z(this,Hi).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Qb(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Yb&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...z(this,Hi).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){z(this,Ut).clear(),z(this,qi).clear()}},Ut=new WeakMap,qi=new WeakMap,Hi=new WeakMap,Dl=new WeakMap,zl=new WeakMap,Bi=new WeakMap,Il=new WeakMap,Ll=new WeakMap,vC),Zn,Ge,dd,Mn,eo,Ul,Ka,Vi,fd,Fl,ql,to,no,Zi,Hl,rt,ru,_v,kv,Ev,Cv,Nv,jv,Tv,B2,bC,X3=(bC=class extends wc{constructor(t,n){super();xe(this,rt);xe(this,Zn);xe(this,Ge);xe(this,dd);xe(this,Mn);xe(this,eo);xe(this,Ul);xe(this,Ka);xe(this,Vi);xe(this,fd);xe(this,Fl);xe(this,ql);xe(this,to);xe(this,no);xe(this,Zi);xe(this,Hl,new Set);this.options=n,ue(this,Zn,t),ue(this,Vi,null),ue(this,Ka,Sv()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(z(this,Ge).addObserver(this),v_(z(this,Ge),this.options)?Ie(this,rt,ru).call(this):this.updateResult(),Ie(this,rt,Cv).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Av(z(this,Ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Av(z(this,Ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ie(this,rt,Nv).call(this),Ie(this,rt,jv).call(this),z(this,Ge).removeObserver(this)}setOptions(t){const n=this.options,r=z(this,Ge);if(this.options=z(this,Zn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ar(this.options.enabled,z(this,Ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ie(this,rt,Tv).call(this),z(this,Ge).setOptions(this.options),n._defaulted&&!Xh(this.options,n)&&z(this,Zn).getQueryCache().notify({type:"observerOptionsUpdated",query:z(this,Ge),observer:this});const a=this.hasListeners();a&&b_(z(this,Ge),r,this.options,n)&&Ie(this,rt,ru).call(this),this.updateResult(),a&&(z(this,Ge)!==r||Ar(this.options.enabled,z(this,Ge))!==Ar(n.enabled,z(this,Ge))||us(this.options.staleTime,z(this,Ge))!==us(n.staleTime,z(this,Ge)))&&Ie(this,rt,_v).call(this);const i=Ie(this,rt,kv).call(this);a&&(z(this,Ge)!==r||Ar(this.options.enabled,z(this,Ge))!==Ar(n.enabled,z(this,Ge))||i!==z(this,Zi))&&Ie(this,rt,Ev).call(this,i)}getOptimisticResult(t){const n=z(this,Zn).getQueryCache().build(z(this,Zn),t),r=this.createResult(n,t);return J3(this,r)&&(ue(this,Mn,r),ue(this,Ul,this.options),ue(this,eo,z(this,Ge).state)),r}getCurrentResult(){return z(this,Mn)}trackResult(t,n){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&!this.options.experimental_prefetchInRender&&z(this,Ka).status==="pending"&&z(this,Ka).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(r,a))})}trackProp(t){z(this,Hl).add(t)}getCurrentQuery(){return z(this,Ge)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=z(this,Zn).defaultQueryOptions(t),r=z(this,Zn).getQueryCache().build(z(this,Zn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Ie(this,rt,ru).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),z(this,Mn)))}createResult(t,n){var R;const r=z(this,Ge),a=this.options,i=z(this,Mn),s=z(this,eo),o=z(this,Ul),u=t!==r?t.state:z(this,dd),{state:d}=t;let f={...d},p=!1,h;if(n._optimisticResults){const $=this.hasListeners(),j=!$&&v_(t,n),O=$&&b_(t,r,n,a);(j||O)&&(f={...f,...q2(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:m,status:b}=f;h=f.data;let g=!1;if(n.placeholderData!==void 0&&h===void 0&&b==="pending"){let $;i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?($=i.data,g=!0):$=typeof n.placeholderData=="function"?n.placeholderData((R=z(this,ql))==null?void 0:R.state.data,z(this,ql)):n.placeholderData,$!==void 0&&(b="success",h=wv(i==null?void 0:i.data,$,n),p=!0)}if(n.select&&h!==void 0&&!g)if(i&&h===(s==null?void 0:s.data)&&n.select===z(this,fd))h=z(this,Fl);else try{ue(this,fd,n.select),h=n.select(h),h=wv(i==null?void 0:i.data,h,n),ue(this,Fl,h),ue(this,Vi,null)}catch($){ue(this,Vi,$)}z(this,Vi)&&(y=z(this,Vi),h=z(this,Fl),m=Date.now(),b="error");const v=f.fetchStatus==="fetching",w=b==="pending",S=b==="error",E=w&&v,C=h!==void 0,P={status:b,fetchStatus:f.fetchStatus,isPending:w,isSuccess:b==="success",isError:S,isInitialLoading:E,isLoading:E,data:h,dataUpdatedAt:f.dataUpdatedAt,error:y,errorUpdatedAt:m,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:v,isRefetching:v&&!w,isLoadingError:S&&!C,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:S&&C,isStale:Wb(t,n),refetch:this.refetch,promise:z(this,Ka),isEnabled:Ar(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const $=L=>{P.status==="error"?L.reject(P.error):P.data!==void 0&&L.resolve(P.data)},j=()=>{const L=ue(this,Ka,P.promise=Sv());$(L)},O=z(this,Ka);switch(O.status){case"pending":t.queryHash===r.queryHash&&$(O);break;case"fulfilled":(P.status==="error"||P.data!==O.value)&&j();break;case"rejected":(P.status!=="error"||P.error!==O.reason)&&j();break}}return P}updateResult(){const t=z(this,Mn),n=this.createResult(z(this,Ge),this.options);if(ue(this,eo,z(this,Ge).state),ue(this,Ul,this.options),z(this,eo).data!==void 0&&ue(this,ql,z(this,Ge)),Xh(n,t))return;ue(this,Mn,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!z(this,Hl).size)return!0;const s=new Set(i??z(this,Hl));return this.options.throwOnError&&s.add("error"),Object.keys(z(this,Mn)).some(o=>{const l=o;return z(this,Mn)[l]!==t[l]&&s.has(l)})};Ie(this,rt,B2).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ie(this,rt,Cv).call(this)}},Zn=new WeakMap,Ge=new WeakMap,dd=new WeakMap,Mn=new WeakMap,eo=new WeakMap,Ul=new WeakMap,Ka=new WeakMap,Vi=new WeakMap,fd=new WeakMap,Fl=new WeakMap,ql=new WeakMap,to=new WeakMap,no=new WeakMap,Zi=new WeakMap,Hl=new WeakMap,rt=new WeakSet,ru=function(t){Ie(this,rt,Tv).call(this);let n=z(this,Ge).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(In)),n},_v=function(){Ie(this,rt,Nv).call(this);const t=us(this.options.staleTime,z(this,Ge));if(mo||z(this,Mn).isStale||!bv(t))return;const r=M2(z(this,Mn).dataUpdatedAt,t)+1;ue(this,to,setTimeout(()=>{z(this,Mn).isStale||this.updateResult()},r))},kv=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(z(this,Ge)):this.options.refetchInterval)??!1},Ev=function(t){Ie(this,rt,jv).call(this),ue(this,Zi,t),!(mo||Ar(this.options.enabled,z(this,Ge))===!1||!bv(z(this,Zi))||z(this,Zi)===0)&&ue(this,no,setInterval(()=>{(this.options.refetchIntervalInBackground||Xb.isFocused())&&Ie(this,rt,ru).call(this)},z(this,Zi)))},Cv=function(){Ie(this,rt,_v).call(this),Ie(this,rt,Ev).call(this,Ie(this,rt,kv).call(this))},Nv=function(){z(this,to)&&(clearTimeout(z(this,to)),ue(this,to,void 0))},jv=function(){z(this,no)&&(clearInterval(z(this,no)),ue(this,no,void 0))},Tv=function(){const t=z(this,Zn).getQueryCache().build(z(this,Zn),this.options);if(t===z(this,Ge))return;const n=z(this,Ge);ue(this,Ge,t),ue(this,dd,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},B2=function(t){Jt.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(z(this,Mn))}),z(this,Zn).getQueryCache().notify({query:z(this,Ge),type:"observerResultsUpdated"})})},bC);function W3(e,t){return Ar(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function v_(e,t){return W3(e,t)||e.state.data!==void 0&&Av(e,t,t.refetchOnMount)}function Av(e,t,n){if(Ar(t.enabled,e)!==!1&&us(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Wb(e,t)}return!1}function b_(e,t,n,r){return(e!==t||Ar(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Wb(e,n)}function Wb(e,t){return Ar(t.enabled,e)!==!1&&e.isStaleByTime(us(t.staleTime,e))}function J3(e,t){return!Xh(e.getCurrentResult(),t)}var Ki,Gi,Kn,Ga,oi,nh,Rv,xC,eI=(xC=class extends wc{constructor(n,r){super();xe(this,oi);xe(this,Ki);xe(this,Gi);xe(this,Kn);xe(this,Ga);ue(this,Ki,n),this.setOptions(r),this.bindMethods(),Ie(this,oi,nh).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var a;const r=this.options;this.options=z(this,Ki).defaultMutationOptions(n),Xh(this.options,r)||z(this,Ki).getMutationCache().notify({type:"observerOptionsUpdated",mutation:z(this,Kn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&go(r.mutationKey)!==go(this.options.mutationKey)?this.reset():((a=z(this,Kn))==null?void 0:a.state.status)==="pending"&&z(this,Kn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=z(this,Kn))==null||n.removeObserver(this)}onMutationUpdate(n){Ie(this,oi,nh).call(this),Ie(this,oi,Rv).call(this,n)}getCurrentResult(){return z(this,Gi)}reset(){var n;(n=z(this,Kn))==null||n.removeObserver(this),ue(this,Kn,void 0),Ie(this,oi,nh).call(this),Ie(this,oi,Rv).call(this)}mutate(n,r){var a;return ue(this,Ga,r),(a=z(this,Kn))==null||a.removeObserver(this),ue(this,Kn,z(this,Ki).getMutationCache().build(z(this,Ki),this.options)),z(this,Kn).addObserver(this),z(this,Kn).execute(n)}},Ki=new WeakMap,Gi=new WeakMap,Kn=new WeakMap,Ga=new WeakMap,oi=new WeakSet,nh=function(){var r;const n=((r=z(this,Kn))==null?void 0:r.state)??H2();ue(this,Gi,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Rv=function(n){Jt.batch(()=>{var r,a,i,s,o,l,u,d;if(z(this,Ga)&&this.hasListeners()){const f=z(this,Gi).variables,p=z(this,Gi).context;(n==null?void 0:n.type)==="success"?((a=(r=z(this,Ga)).onSuccess)==null||a.call(r,n.data,f,p),(s=(i=z(this,Ga)).onSettled)==null||s.call(i,n.data,null,f,p)):(n==null?void 0:n.type)==="error"&&((l=(o=z(this,Ga)).onError)==null||l.call(o,n.error,f,p),(d=(u=z(this,Ga)).onSettled)==null||d.call(u,void 0,n.error,f,p))}this.listeners.forEach(f=>{f(z(this,Gi))})})},xC),V2=x.createContext(void 0),un=e=>{const t=x.useContext(V2);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},tI=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(V2.Provider,{value:e,children:t})),Z2=x.createContext(!1),nI=()=>x.useContext(Z2);Z2.Provider;function rI(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var aI=x.createContext(rI()),iI=()=>x.useContext(aI),sI=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},oI=e=>{x.useEffect(()=>{e.clearReset()},[e])},lI=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||z2(n,[e.error,r])),cI=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...r)=>t(n(...r)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},uI=(e,t)=>e.isLoading&&e.isFetching&&!t,dI=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,x_=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function fI(e,t,n){var f,p,h,y,m;const r=nI(),a=iI(),i=un(),s=i.defaultQueryOptions(e);(p=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,s),s._optimisticResults=r?"isRestoring":"optimistic",cI(s),sI(s,a),oI(a);const o=!i.getQueryCache().get(s.queryHash),[l]=x.useState(()=>new t(i,s)),u=l.getOptimisticResult(s),d=!r&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(b=>{const g=d?l.subscribe(Jt.batchCalls(b)):In;return l.updateResult(),g},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),x.useEffect(()=>{l.setOptions(s)},[s,l]),dI(s,u))throw x_(s,l,a);if(lI({result:u,errorResetBoundary:a,throwOnError:s.throwOnError,query:i.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw u.error;if((y=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,s,u),s.experimental_prefetchInRender&&!mo&&uI(u,r)){const b=o?x_(s,l,a):(m=i.getQueryCache().get(s.queryHash))==null?void 0:m.promise;b==null||b.catch(In).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?u:l.trackResult(u)}function St(e,t){return fI(e,X3)}function _t(e,t){const n=un(),[r]=x.useState(()=>new eI(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);const a=x.useSyncExternalStore(x.useCallback(s=>r.subscribe(Jt.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=x.useCallback((s,o)=>{r.mutate(s,o).catch(In)},[r]);if(a.error&&z2(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}async function K2(e){if(e.ok)return;let t=e.statusText;try{const n=await e.text();try{const r=JSON.parse(n);t=r.error||r.message||t}catch{n.trim()&&(t=`${e.status}: ${n}`)}}catch(n){console.warn("Response body parsing failed:",n)}throw new Error(t)}async function we(e,t,n){const r=await fetch(t,{method:e,credentials:"include",headers:{...n?{"Content-Type":"application/json"}:{}},body:n?JSON.stringify(n):void 0});return await K2(r),r}const hI=({on401:e})=>async({queryKey:t})=>{const n=t.join("/"),r=await fetch(n,{credentials:"include"});return await K2(r),await r.json()},pI=new Y3({defaultOptions:{queries:{queryFn:hI({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:10*60*1e3,retry:!1},mutations:{retry:!1}}});async function mI(){const e=new URLSearchParams(window.location.search),t=e.get("bootstrap");if(!t)return;const n=await fetch("/api/dashboard-auth/bootstrap/session",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({nonce:t})});if(!n.ok){console.warn("[agent-deck] Dashboard bootstrap failed:",n.status);return}e.delete("bootstrap");const r=`${window.location.pathname}${e.toString()?`?${e}`:""}${window.location.hash}`;window.history.replaceState({},"",r)}const gI=1,yI=1e6;let Tg=0;function vI(){return Tg=(Tg+1)%Number.MAX_SAFE_INTEGER,Tg.toString()}const Ag=new Map,w_=e=>{if(Ag.has(e))return;const t=setTimeout(()=>{Ag.delete(e),ku({type:"REMOVE_TOAST",toastId:e})},yI);Ag.set(e,t)},bI=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,gI)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?w_(n):e.toasts.forEach(r=>{w_(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},rh=[];let ah={toasts:[]};function ku(e){ah=bI(ah,e),rh.forEach(t=>{t(ah)})}function xI({...e}){const t=vI(),n=a=>ku({type:"UPDATE_TOAST",toast:{...a,id:t}}),r=()=>ku({type:"DISMISS_TOAST",toastId:t});return ku({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||r()}}}),{id:t,dismiss:r,update:n}}function rn(){const[e,t]=x.useState(ah);return x.useEffect(()=>(rh.push(t),()=>{const n=rh.indexOf(t);n>-1&&rh.splice(n,1)}),[e]),{...e,toast:xI,dismiss:n=>ku({type:"DISMISS_TOAST",toastId:n})}}function ve(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function S_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function G2(...e){return t=>{let n=!1;const r=e.map(a=>{const i=S_(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<r.length;a++){const i=r[a];typeof i=="function"?i():S_(e[a],null)}}}}function ut(...e){return x.useCallback(G2(...e),e)}function wI(e,t){const n=x.createContext(t),r=i=>{const{children:s,...o}=i,l=x.useMemo(()=>o,Object.values(o));return c.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function a(i){const s=x.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,a]}function gi(e,t=[]){let n=[];function r(i,s){const o=x.createContext(s),l=n.length;n=[...n,s];const u=f=>{var g;const{scope:p,children:h,...y}=f,m=((g=p==null?void 0:p[e])==null?void 0:g[l])||o,b=x.useMemo(()=>y,Object.values(y));return c.jsx(m.Provider,{value:b,children:h})};u.displayName=i+"Provider";function d(f,p){var m;const h=((m=p==null?void 0:p[e])==null?void 0:m[l])||o,y=x.useContext(h);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const a=()=>{const i=n.map(s=>x.createContext(s));return function(o){const l=(o==null?void 0:o[e])||i;return x.useMemo(()=>({[`__scope${e}`]:{...o,[e]:l}}),[o,l])}};return a.scopeName=e,[r,SI(a,...t)]}function SI(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=r.reduce((o,{useScope:l,scopeName:u})=>{const f=l(i)[`__scope${u}`];return{...o,...f}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function yo(e){const t=kI(e),n=x.forwardRef((r,a)=>{const{children:i,...s}=r,o=x.Children.toArray(i),l=o.find(CI);if(l){const u=l.props.children,d=o.map(f=>f===l?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:f);return c.jsx(t,{...s,ref:a,children:x.isValidElement(u)?x.cloneElement(u,void 0,d):null})}return c.jsx(t,{...s,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}var _I=yo("Slot");function kI(e){const t=x.forwardRef((n,r)=>{const{children:a,...i}=n;if(x.isValidElement(a)){const s=jI(a),o=NI(i,a.props);return a.type!==x.Fragment&&(o.ref=r?G2(r,s):s),x.cloneElement(a,o)}return x.Children.count(a)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Q2=Symbol("radix.slottable");function EI(e){const t=({children:n})=>c.jsx(c.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Q2,t}function CI(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Q2}function NI(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...o)=>{const l=i(...o);return a(...o),l}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function jI(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Jb(e){const t=e+"CollectionProvider",[n,r]=gi(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:b,children:g}=m,v=fa.useRef(null),w=fa.useRef(new Map).current;return c.jsx(a,{scope:b,itemMap:w,collectionRef:v,children:g})};s.displayName=t;const o=e+"CollectionSlot",l=yo(o),u=fa.forwardRef((m,b)=>{const{scope:g,children:v}=m,w=i(o,g),S=ut(b,w.collectionRef);return c.jsx(l,{ref:S,children:v})});u.displayName=o;const d=e+"CollectionItemSlot",f="data-radix-collection-item",p=yo(d),h=fa.forwardRef((m,b)=>{const{scope:g,children:v,...w}=m,S=fa.useRef(null),E=ut(b,S),C=i(d,g);return fa.useEffect(()=>(C.itemMap.set(S,{ref:S,...w}),()=>void C.itemMap.delete(S))),c.jsx(p,{[f]:"",ref:E,children:v})});h.displayName=d;function y(m){const b=i(e+"CollectionConsumer",m);return fa.useCallback(()=>{const v=b.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(b.itemMap.values()).sort((C,T)=>w.indexOf(C.ref.current)-w.indexOf(T.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:u,ItemSlot:h},y,r]}var TI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Me=TI.reduce((e,t)=>{const n=yo(`Primitive.${t}`),r=x.forwardRef((a,i)=>{const{asChild:s,...o}=a,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Y2(e,t){e&&No.flushSync(()=>e.dispatchEvent(t))}function qr(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function AI(e,t=globalThis==null?void 0:globalThis.document){const n=qr(e);x.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var RI="DismissableLayer",$v="dismissableLayer.update",$I="dismissableLayer.pointerDownOutside",OI="dismissableLayer.focusOutside",__,X2=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sc=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:o,...l}=e,u=x.useContext(X2),[d,f]=x.useState(null),p=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=x.useState({}),y=ut(t,T=>f(T)),m=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(b),v=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=g,E=PI(T=>{const P=T.target,R=[...u.branches].some($=>$.contains(P));!S||R||(a==null||a(T),s==null||s(T),T.defaultPrevented||o==null||o())},p),C=DI(T=>{const P=T.target;[...u.branches].some($=>$.contains(P))||(i==null||i(T),s==null||s(T),T.defaultPrevented||o==null||o())},p);return AI(T=>{v===u.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&o&&(T.preventDefault(),o()))},p),x.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(__=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),k_(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=__)}},[d,p,n,u]),x.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),k_())},[d,u]),x.useEffect(()=>{const T=()=>h({});return document.addEventListener($v,T),()=>document.removeEventListener($v,T)},[]),c.jsx(Me.div,{...l,ref:y,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,C.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,E.onPointerDownCapture)})});Sc.displayName=RI;var MI="DismissableLayerBranch",W2=x.forwardRef((e,t)=>{const n=x.useContext(X2),r=x.useRef(null),a=ut(t,r);return x.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(Me.div,{...e,ref:a})});W2.displayName=MI;function PI(e,t=globalThis==null?void 0:globalThis.document){const n=qr(e),r=x.useRef(!1),a=x.useRef(()=>{});return x.useEffect(()=>{const i=o=>{if(o.target&&!r.current){let l=function(){J2($I,n,u,{discrete:!0})};const u={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=l,t.addEventListener("click",a.current,{once:!0})):l()}else t.removeEventListener("click",a.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function DI(e,t=globalThis==null?void 0:globalThis.document){const n=qr(e),r=x.useRef(!1);return x.useEffect(()=>{const a=i=>{i.target&&!r.current&&J2(OI,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function k_(){const e=new CustomEvent($v);document.dispatchEvent(e)}function J2(e,t,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Y2(a,i):a.dispatchEvent(i)}var zI=Sc,II=W2,_n=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},LI="Portal",Nd=x.forwardRef((e,t)=>{var o;const{container:n,...r}=e,[a,i]=x.useState(!1);_n(()=>i(!0),[]);const s=n||a&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return s?TD.createPortal(c.jsx(Me.div,{...r,ref:t}),s):null});Nd.displayName=LI;function UI(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var yi=e=>{const{present:t,children:n}=e,r=FI(t),a=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),i=ut(r.ref,qI(a));return typeof n=="function"||r.isPresent?x.cloneElement(a,{ref:i}):null};yi.displayName="Presence";function FI(e){const[t,n]=x.useState(),r=x.useRef(null),a=x.useRef(e),i=x.useRef("none"),s=e?"mounted":"unmounted",[o,l]=UI(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=pf(r.current);i.current=o==="mounted"?u:"none"},[o]),_n(()=>{const u=r.current,d=a.current;if(d!==e){const p=i.current,h=pf(u);e?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&p!==h?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),_n(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=h=>{const m=pf(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&m&&(l("ANIMATION_END"),!a.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},p=h=>{h.target===t&&(i.current=pf(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:x.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function pf(e){return(e==null?void 0:e.animationName)||"none"}function qI(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var HI=hd[" useInsertionEffect ".trim().toString()]||_n;function vo({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,i,s]=BI({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:a;{const d=x.useRef(e!==void 0);x.useEffect(()=>{const f=d.current;f!==o&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=o},[o,r])}const u=x.useCallback(d=>{var f;if(o){const p=VI(d)?d(e):d;p!==e&&((f=s.current)==null||f.call(s,p))}else i(d)},[o,e,i,s]);return[l,u]}function BI({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),a=x.useRef(n),i=x.useRef(t);return HI(()=>{i.current=t},[t]),x.useEffect(()=>{var s;a.current!==n&&((s=i.current)==null||s.call(i,n),a.current=n)},[n,a]),[n,r,i]}function VI(e){return typeof e=="function"}var eT=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ZI="VisuallyHidden",rm=x.forwardRef((e,t)=>c.jsx(Me.span,{...e,ref:t,style:{...eT,...e.style}}));rm.displayName=ZI;var KI=rm,ex="ToastProvider",[tx,GI,QI]=Jb("Toast"),[tT,Sse]=gi("Toast",[QI]),[YI,am]=tT(ex),nT=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:s}=e,[o,l]=x.useState(null),[u,d]=x.useState(0),f=x.useRef(!1),p=x.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${ex}\`. Expected non-empty \`string\`.`),c.jsx(tx.Provider,{scope:t,children:c.jsx(YI,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:i,toastCount:u,viewport:o,onViewportChange:l,onToastAdd:x.useCallback(()=>d(h=>h+1),[]),onToastRemove:x.useCallback(()=>d(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:p,children:s})})};nT.displayName=ex;var rT="ToastViewport",XI=["F8"],Ov="toast.viewportPause",Mv="toast.viewportResume",aT=x.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=XI,label:a="Notifications ({hotkey})",...i}=e,s=am(rT,n),o=GI(n),l=x.useRef(null),u=x.useRef(null),d=x.useRef(null),f=x.useRef(null),p=ut(t,f,s.onViewportChange),h=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=s.toastCount>0;x.useEffect(()=>{const b=g=>{var w;r.length!==0&&r.every(S=>g[S]||g.code===S)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]),x.useEffect(()=>{const b=l.current,g=f.current;if(y&&b&&g){const v=()=>{if(!s.isClosePausedRef.current){const C=new CustomEvent(Ov);g.dispatchEvent(C),s.isClosePausedRef.current=!0}},w=()=>{if(s.isClosePausedRef.current){const C=new CustomEvent(Mv);g.dispatchEvent(C),s.isClosePausedRef.current=!1}},S=C=>{!b.contains(C.relatedTarget)&&w()},E=()=>{b.contains(document.activeElement)||w()};return b.addEventListener("focusin",v),b.addEventListener("focusout",S),b.addEventListener("pointermove",v),b.addEventListener("pointerleave",E),window.addEventListener("blur",v),window.addEventListener("focus",w),()=>{b.removeEventListener("focusin",v),b.removeEventListener("focusout",S),b.removeEventListener("pointermove",v),b.removeEventListener("pointerleave",E),window.removeEventListener("blur",v),window.removeEventListener("focus",w)}}},[y,s.isClosePausedRef]);const m=x.useCallback(({tabbingDirection:b})=>{const v=o().map(w=>{const S=w.ref.current,E=[S,...uL(S)];return b==="forwards"?E:E.reverse()});return(b==="forwards"?v.reverse():v).flat()},[o]);return x.useEffect(()=>{const b=f.current;if(b){const g=v=>{var E,C,T;const w=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!w){const P=document.activeElement,R=v.shiftKey;if(v.target===b&&R){(E=u.current)==null||E.focus();return}const O=m({tabbingDirection:R?"backwards":"forwards"}),L=O.findIndex(D=>D===P);Rg(O.slice(L+1))?v.preventDefault():R?(C=u.current)==null||C.focus():(T=d.current)==null||T.focus()}};return b.addEventListener("keydown",g),()=>b.removeEventListener("keydown",g)}},[o,m]),c.jsxs(II,{ref:l,role:"region","aria-label":a.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&c.jsx(Pv,{ref:u,onFocusFromOutsideViewport:()=>{const b=m({tabbingDirection:"forwards"});Rg(b)}}),c.jsx(tx.Slot,{scope:n,children:c.jsx(Me.ol,{tabIndex:-1,...i,ref:p})}),y&&c.jsx(Pv,{ref:d,onFocusFromOutsideViewport:()=>{const b=m({tabbingDirection:"backwards"});Rg(b)}})]})});aT.displayName=rT;var iT="ToastFocusProxy",Pv=x.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,i=am(iT,n);return c.jsx(rm,{tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:s=>{var u;const o=s.relatedTarget;!((u=i.viewport)!=null&&u.contains(o))&&r()}})});Pv.displayName=iT;var jd="Toast",WI="toast.swipeStart",JI="toast.swipeMove",eL="toast.swipeCancel",tL="toast.swipeEnd",sT=x.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:i,...s}=e,[o,l]=vo({prop:r,defaultProp:a??!0,onChange:i,caller:jd});return c.jsx(yi,{present:n||o,children:c.jsx(aL,{open:o,...s,ref:t,onClose:()=>l(!1),onPause:qr(e.onPause),onResume:qr(e.onResume),onSwipeStart:ve(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ve(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ve(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ve(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),l(!1)})})})});sT.displayName=jd;var[nL,rL]=tT(jd,{onClose(){}}),aL=x.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:a,open:i,onClose:s,onEscapeKeyDown:o,onPause:l,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:p,onSwipeEnd:h,...y}=e,m=am(jd,n),[b,g]=x.useState(null),v=ut(t,D=>g(D)),w=x.useRef(null),S=x.useRef(null),E=a||m.duration,C=x.useRef(0),T=x.useRef(E),P=x.useRef(0),{onToastAdd:R,onToastRemove:$}=m,j=qr(()=>{var A;(b==null?void 0:b.contains(document.activeElement))&&((A=m.viewport)==null||A.focus()),s()}),O=x.useCallback(D=>{!D||D===1/0||(window.clearTimeout(P.current),C.current=new Date().getTime(),P.current=window.setTimeout(j,D))},[j]);x.useEffect(()=>{const D=m.viewport;if(D){const A=()=>{O(T.current),u==null||u()},H=()=>{const B=new Date().getTime()-C.current;T.current=T.current-B,window.clearTimeout(P.current),l==null||l()};return D.addEventListener(Ov,H),D.addEventListener(Mv,A),()=>{D.removeEventListener(Ov,H),D.removeEventListener(Mv,A)}}},[m.viewport,E,l,u,O]),x.useEffect(()=>{i&&!m.isClosePausedRef.current&&O(E)},[i,E,m.isClosePausedRef,O]),x.useEffect(()=>(R(),()=>$()),[R,$]);const L=x.useMemo(()=>b?hT(b):null,[b]);return m.viewport?c.jsxs(c.Fragment,{children:[L&&c.jsx(iL,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:L}),c.jsx(nL,{scope:n,onClose:j,children:No.createPortal(c.jsx(tx.ItemSlot,{scope:n,children:c.jsx(zI,{asChild:!0,onEscapeKeyDown:ve(o,()=>{m.isFocusedToastEscapeKeyDownRef.current||j(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(Me.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":m.swipeDirection,...y,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ve(e.onKeyDown,D=>{D.key==="Escape"&&(o==null||o(D.nativeEvent),D.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,j()))}),onPointerDown:ve(e.onPointerDown,D=>{D.button===0&&(w.current={x:D.clientX,y:D.clientY})}),onPointerMove:ve(e.onPointerMove,D=>{if(!w.current)return;const A=D.clientX-w.current.x,H=D.clientY-w.current.y,B=!!S.current,U=["left","right"].includes(m.swipeDirection),Y=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,N=U?Y(0,A):0,F=U?0:Y(0,H),V=D.pointerType==="touch"?10:2,_={x:N,y:F},k={originalEvent:D,delta:_};B?(S.current=_,mf(JI,f,k,{discrete:!1})):E_(_,m.swipeDirection,V)?(S.current=_,mf(WI,d,k,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(A)>V||Math.abs(H)>V)&&(w.current=null)}),onPointerUp:ve(e.onPointerUp,D=>{const A=S.current,H=D.target;if(H.hasPointerCapture(D.pointerId)&&H.releasePointerCapture(D.pointerId),S.current=null,w.current=null,A){const B=D.currentTarget,U={originalEvent:D,delta:A};E_(A,m.swipeDirection,m.swipeThreshold)?mf(tL,h,U,{discrete:!0}):mf(eL,p,U,{discrete:!0}),B.addEventListener("click",Y=>Y.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),iL=e=>{const{__scopeToast:t,children:n,...r}=e,a=am(jd,t),[i,s]=x.useState(!1),[o,l]=x.useState(!1);return lL(()=>s(!0)),x.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),o?null:c.jsx(Nd,{asChild:!0,children:c.jsx(rm,{...r,children:i&&c.jsxs(c.Fragment,{children:[a.label," ",n]})})})},sL="ToastTitle",oT=x.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(Me.div,{...r,ref:t})});oT.displayName=sL;var oL="ToastDescription",lT=x.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(Me.div,{...r,ref:t})});lT.displayName=oL;var cT="ToastAction",uT=x.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(fT,{altText:n,asChild:!0,children:c.jsx(nx,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${cT}\`. Expected non-empty \`string\`.`),null)});uT.displayName=cT;var dT="ToastClose",nx=x.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,a=rL(dT,n);return c.jsx(fT,{asChild:!0,children:c.jsx(Me.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,a.onClose)})})});nx.displayName=dT;var fT=x.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return c.jsx(Me.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function hT(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),cL(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const s=r.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...hT(r))}}),t}function mf(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Y2(a,i):a.dispatchEvent(i)}var E_=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),i=r>a;return t==="left"||t==="right"?i&&r>n:!i&&a>n};function lL(e=()=>{}){const t=qr(e);_n(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function cL(e){return e.nodeType===e.ELEMENT_NODE}function uL(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Rg(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var dL=nT,pT=aT,mT=sT,gT=oT,yT=lT,vT=uT,bT=nx;function xT(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=xT(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function wT(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=xT(e))&&(r&&(r+=" "),r+=t);return r}const C_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,N_=wT,im=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return N_(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,s=Object.keys(a).map(u=>{const d=n==null?void 0:n[u],f=i==null?void 0:i[u];if(d===null)return null;const p=C_(d)||C_(f);return a[u][p]}),o=n&&Object.entries(n).reduce((u,d)=>{let[f,p]=d;return p===void 0||(u[f]=p),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:p,...h}=d;return Object.entries(h).every(y=>{let[m,b]=y;return Array.isArray(b)?b.includes({...i,...o}[m]):{...i,...o}[m]===b})?[...u,f,p]:u},[]);return N_(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)};/**
58
- * @license lucide-react v0.453.0 - ISC
59
- *
60
- * This source code is licensed under the ISC license.
61
- * See the LICENSE file in the root directory of this source tree.
62
- */const fL=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ST=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
63
- * @license lucide-react v0.453.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */var hL={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
68
- * @license lucide-react v0.453.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */const pL=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:s,...o},l)=>x.createElement("svg",{ref:l,...hL,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ST("lucide",a),...o},[...s.map(([u,d])=>x.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
73
- * @license lucide-react v0.453.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const Ue=(e,t)=>{const n=x.forwardRef(({className:r,...a},i)=>x.createElement(pL,{ref:i,iconNode:t,className:ST(`lucide-${fL(e)}`,r),...a}));return n.displayName=`${e}`,n};/**
78
- * @license lucide-react v0.453.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */const mL=Ue("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
83
- * @license lucide-react v0.453.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const _T=Ue("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
88
- * @license lucide-react v0.453.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */const kT=Ue("Bolt",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/**
93
- * @license lucide-react v0.453.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const rx=Ue("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
98
- * @license lucide-react v0.453.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const gL=Ue("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
103
- * @license lucide-react v0.453.0 - ISC
104
- *
105
- * This source code is licensed under the ISC license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */const $g=Ue("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
108
- * @license lucide-react v0.453.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */const ET=Ue("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
113
- * @license lucide-react v0.453.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */const sm=Ue("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
118
- * @license lucide-react v0.453.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */const CT=Ue("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
123
- * @license lucide-react v0.453.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */const NT=Ue("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
128
- * @license lucide-react v0.453.0 - ISC
129
- *
130
- * This source code is licensed under the ISC license.
131
- * See the LICENSE file in the root directory of this source tree.
132
- */const yL=Ue("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
133
- * @license lucide-react v0.453.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */const jT=Ue("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
138
- * @license lucide-react v0.453.0 - ISC
139
- *
140
- * This source code is licensed under the ISC license.
141
- * See the LICENSE file in the root directory of this source tree.
142
- */const Dv=Ue("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
143
- * @license lucide-react v0.453.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */const j_=Ue("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
148
- * @license lucide-react v0.453.0 - ISC
149
- *
150
- * This source code is licensed under the ISC license.
151
- * See the LICENSE file in the root directory of this source tree.
152
- */const vL=Ue("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/**
153
- * @license lucide-react v0.453.0 - ISC
154
- *
155
- * This source code is licensed under the ISC license.
156
- * See the LICENSE file in the root directory of this source tree.
157
- */const ax=Ue("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
158
- * @license lucide-react v0.453.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- */const T_=Ue("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
163
- * @license lucide-react v0.453.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */const TT=Ue("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
168
- * @license lucide-react v0.453.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */const ei=Ue("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
173
- * @license lucide-react v0.453.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */const bL=Ue("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
178
- * @license lucide-react v0.453.0 - ISC
179
- *
180
- * This source code is licensed under the ISC license.
181
- * See the LICENSE file in the root directory of this source tree.
182
- */const xL=Ue("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/**
183
- * @license lucide-react v0.453.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const zv=Ue("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
188
- * @license lucide-react v0.453.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const gf=Ue("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
193
- * @license lucide-react v0.453.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const Jh=Ue("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
198
- * @license lucide-react v0.453.0 - ISC
199
- *
200
- * This source code is licensed under the ISC license.
201
- * See the LICENSE file in the root directory of this source tree.
202
- */const wL=Ue("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
203
- * @license lucide-react v0.453.0 - ISC
204
- *
205
- * This source code is licensed under the ISC license.
206
- * See the LICENSE file in the root directory of this source tree.
207
- */const A_=Ue("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
208
- * @license lucide-react v0.453.0 - ISC
209
- *
210
- * This source code is licensed under the ISC license.
211
- * See the LICENSE file in the root directory of this source tree.
212
- */const SL=Ue("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
213
- * @license lucide-react v0.453.0 - ISC
214
- *
215
- * This source code is licensed under the ISC license.
216
- * See the LICENSE file in the root directory of this source tree.
217
- */const Ks=Ue("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
218
- * @license lucide-react v0.453.0 - ISC
219
- *
220
- * This source code is licensed under the ISC license.
221
- * See the LICENSE file in the root directory of this source tree.
222
- */const _L=Ue("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
223
- * @license lucide-react v0.453.0 - ISC
224
- *
225
- * This source code is licensed under the ISC license.
226
- * See the LICENSE file in the root directory of this source tree.
227
- */const AT=Ue("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
228
- * @license lucide-react v0.453.0 - ISC
229
- *
230
- * This source code is licensed under the ISC license.
231
- * See the LICENSE file in the root directory of this source tree.
232
- */const ep=Ue("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
233
- * @license lucide-react v0.453.0 - ISC
234
- *
235
- * This source code is licensed under the ISC license.
236
- * See the LICENSE file in the root directory of this source tree.
237
- */const kL=Ue("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
238
- * @license lucide-react v0.453.0 - ISC
239
- *
240
- * This source code is licensed under the ISC license.
241
- * See the LICENSE file in the root directory of this source tree.
242
- */const EL=Ue("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
243
- * @license lucide-react v0.453.0 - ISC
244
- *
245
- * This source code is licensed under the ISC license.
246
- * See the LICENSE file in the root directory of this source tree.
247
- */const Td=Ue("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
248
- * @license lucide-react v0.453.0 - ISC
249
- *
250
- * This source code is licensed under the ISC license.
251
- * See the LICENSE file in the root directory of this source tree.
252
- */const Mr=Ue("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
253
- * @license lucide-react v0.453.0 - ISC
254
- *
255
- * This source code is licensed under the ISC license.
256
- * See the LICENSE file in the root directory of this source tree.
257
- */const CL=Ue("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
258
- * @license lucide-react v0.453.0 - ISC
259
- *
260
- * This source code is licensed under the ISC license.
261
- * See the LICENSE file in the root directory of this source tree.
262
- */const NL=Ue("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
263
- * @license lucide-react v0.453.0 - ISC
264
- *
265
- * This source code is licensed under the ISC license.
266
- * See the LICENSE file in the root directory of this source tree.
267
- */const ix=Ue("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
268
- * @license lucide-react v0.453.0 - ISC
269
- *
270
- * This source code is licensed under the ISC license.
271
- * See the LICENSE file in the root directory of this source tree.
272
- */const tp=Ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),sx="-",jL=e=>{const t=AL(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const o=s.split(sx);return o[0]===""&&o.length!==1&&o.shift(),RT(o,t)||TL(s)},getConflictingClassGroupIds:(s,o)=>{const l=n[s]||[];return o&&r[s]?[...l,...r[s]]:l}}},RT=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?RT(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(sx);return(s=t.validators.find(({validator:o})=>o(i)))==null?void 0:s.classGroupId},R_=/^\[(.+)\]$/,TL=e=>{if(R_.test(e)){const t=R_.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},AL=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return $L(Object.entries(e.classGroups),n).forEach(([i,s])=>{Iv(s,r,i,t)}),r},Iv=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:$_(t,a);i.classGroupId=n;return}if(typeof a=="function"){if(RL(a)){Iv(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,s])=>{Iv(s,$_(t,i),n,r)})})},$_=(e,t)=>{let n=e;return t.split(sx).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},RL=e=>e.isThemeGetter,$L=(e,t)=>t?e.map(([n,r])=>{const a=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,o])=>[t+s,o])):i);return[n,a]}):e,OL=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return a(i,s),s},set(i,s){n.has(i)?n.set(i,s):a(i,s)}}},$T="!",ML=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,a=t[0],i=t.length,s=o=>{const l=[];let u=0,d=0,f;for(let b=0;b<o.length;b++){let g=o[b];if(u===0){if(g===a&&(r||o.slice(b,b+i)===t)){l.push(o.slice(d,b)),d=b+i;continue}if(g==="/"){f=b;continue}}g==="["?u++:g==="]"&&u--}const p=l.length===0?o:o.substring(d),h=p.startsWith($T),y=h?p.substring(1):p,m=f&&f>d?f-d:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:y,maybePostfixModifierPosition:m}};return n?o=>n({className:o,parseClassName:s}):s},PL=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},DL=e=>({cache:OL(e.cacheSize),parseClassName:ML(e),...jL(e)}),zL=/\s+/,IL=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,i=[],s=e.trim().split(zL);let o="";for(let l=s.length-1;l>=0;l-=1){const u=s[l],{modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:h}=n(u);let y=!!h,m=r(y?p.substring(0,h):p);if(!m){if(!y){o=u+(o.length>0?" "+o:o);continue}if(m=r(p),!m){o=u+(o.length>0?" "+o:o);continue}y=!1}const b=PL(d).join(":"),g=f?b+$T:b,v=g+m;if(i.includes(v))continue;i.push(v);const w=a(m,y);for(let S=0;S<w.length;++S){const E=w[S];i.push(g+E)}o=u+(o.length>0?" "+o:o)}return o};function LL(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=OT(t))&&(r&&(r+=" "),r+=n);return r}const OT=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=OT(e[r]))&&(n&&(n+=" "),n+=t);return n};function UL(e,...t){let n,r,a,i=s;function s(l){const u=t.reduce((d,f)=>f(d),e());return n=DL(u),r=n.cache.get,a=n.cache.set,i=o,o(l)}function o(l){const u=r(l);if(u)return u;const d=IL(l,n);return a(l,d),d}return function(){return i(LL.apply(null,arguments))}}const xt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},MT=/^\[(?:([a-z-]+):)?(.+)\]$/i,FL=/^\d+\/\d+$/,qL=new Set(["px","full","screen"]),HL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,BL=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,VL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,ZL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,KL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,La=e=>kl(e)||qL.has(e)||FL.test(e),_i=e=>_c(e,"length",t5),kl=e=>!!e&&!Number.isNaN(Number(e)),Og=e=>_c(e,"number",kl),qc=e=>!!e&&Number.isInteger(Number(e)),GL=e=>e.endsWith("%")&&kl(e.slice(0,-1)),Pe=e=>MT.test(e),ki=e=>HL.test(e),QL=new Set(["length","size","percentage"]),YL=e=>_c(e,QL,PT),XL=e=>_c(e,"position",PT),WL=new Set(["image","url"]),JL=e=>_c(e,WL,r5),e5=e=>_c(e,"",n5),Hc=()=>!0,_c=(e,t,n)=>{const r=MT.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},t5=e=>BL.test(e)&&!VL.test(e),PT=()=>!1,n5=e=>ZL.test(e),r5=e=>KL.test(e),a5=()=>{const e=xt("colors"),t=xt("spacing"),n=xt("blur"),r=xt("brightness"),a=xt("borderColor"),i=xt("borderRadius"),s=xt("borderSpacing"),o=xt("borderWidth"),l=xt("contrast"),u=xt("grayscale"),d=xt("hueRotate"),f=xt("invert"),p=xt("gap"),h=xt("gradientColorStops"),y=xt("gradientColorStopPositions"),m=xt("inset"),b=xt("margin"),g=xt("opacity"),v=xt("padding"),w=xt("saturate"),S=xt("scale"),E=xt("sepia"),C=xt("skew"),T=xt("space"),P=xt("translate"),R=()=>["auto","contain","none"],$=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",Pe,t],O=()=>[Pe,t],L=()=>["",La,_i],D=()=>["auto",kl,Pe],A=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],U=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",Pe],N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],F=()=>[kl,Pe];return{cacheSize:500,separator:":",theme:{colors:[Hc],spacing:[La,_i],blur:["none","",ki,Pe],brightness:F(),borderColor:[e],borderRadius:["none","","full",ki,Pe],borderSpacing:O(),borderWidth:L(),contrast:F(),grayscale:Y(),hueRotate:F(),invert:Y(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[GL,_i],inset:j(),margin:j(),opacity:F(),padding:O(),saturate:F(),scale:F(),sepia:Y(),skew:F(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Pe]}],container:["container"],columns:[{columns:[ki]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...A(),Pe]}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",qc,Pe]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Pe]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",qc,Pe]}],"grid-cols":[{"grid-cols":[Hc]}],"col-start-end":[{col:["auto",{span:["full",qc,Pe]},Pe]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Hc]}],"row-start-end":[{row:["auto",{span:[qc,Pe]},Pe]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Pe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Pe]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...U()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...U(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...U(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Pe,t]}],"min-w":[{"min-w":[Pe,t,"min","max","fit"]}],"max-w":[{"max-w":[Pe,t,"none","full","min","max","fit","prose",{screen:[ki]},ki]}],h:[{h:[Pe,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Pe,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Pe,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Pe,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ki,_i]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Og]}],"font-family":[{font:[Hc]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Pe]}],"line-clamp":[{"line-clamp":["none",kl,Og]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",La,Pe]}],"list-image":[{"list-image":["none",Pe]}],"list-style-type":[{list:["none","disc","decimal",Pe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",La,_i]}],"underline-offset":[{"underline-offset":["auto",La,Pe]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...A(),XL]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",YL]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},JL]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...H(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:H()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...H()]}],"outline-offset":[{"outline-offset":[La,Pe]}],"outline-w":[{outline:[La,_i]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[La,_i]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ki,e5]}],"shadow-color":[{shadow:[Hc]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...B(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":B()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ki,Pe]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Pe]}],duration:[{duration:F()}],ease:[{ease:["linear","in","out","in-out",Pe]}],delay:[{delay:F()}],animate:[{animate:["none","spin","ping","pulse","bounce",Pe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[qc,Pe]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Pe]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Pe]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Pe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[La,_i,Og]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},i5=UL(a5);function Ce(...e){return i5(wT(e))}const s5=dL,DT=x.forwardRef(({className:e,...t},n)=>c.jsx(pT,{ref:n,className:Ce("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));DT.displayName=pT.displayName;const o5=im("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),zT=x.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(mT,{ref:r,className:Ce(o5({variant:t}),e),...n}));zT.displayName=mT.displayName;const l5=x.forwardRef(({className:e,...t},n)=>c.jsx(vT,{ref:n,className:Ce("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));l5.displayName=vT.displayName;const IT=x.forwardRef(({className:e,...t},n)=>c.jsx(bT,{ref:n,className:Ce("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:c.jsx(tp,{className:"h-4 w-4"})}));IT.displayName=bT.displayName;const LT=x.forwardRef(({className:e,...t},n)=>c.jsx(gT,{ref:n,className:Ce("text-sm font-semibold",e),...t}));LT.displayName=gT.displayName;const UT=x.forwardRef(({className:e,...t},n)=>c.jsx(yT,{ref:n,className:Ce("text-sm opacity-90",e),...t}));UT.displayName=yT.displayName;function c5(){const{toasts:e}=rn();return c.jsxs(s5,{children:[e.map(function({id:t,title:n,description:r,action:a,...i}){return c.jsxs(zT,{...i,children:[c.jsxs("div",{className:"grid gap-1",children:[n&&c.jsx(LT,{children:n}),r&&c.jsx(UT,{children:r})]}),a,c.jsx(IT,{})]},t)}),c.jsx(DT,{})]})}var u5=hd[" useId ".trim().toString()]||(()=>{}),d5=0;function ai(e){const[t,n]=x.useState(u5());return _n(()=>{n(r=>r??String(d5++))},[e]),t?`radix-${t}`:""}const f5=["top","right","bottom","left"],ys=Math.min,ur=Math.max,np=Math.round,yf=Math.floor,Ca=e=>({x:e,y:e}),h5={left:"right",right:"left",bottom:"top",top:"bottom"},p5={start:"end",end:"start"};function Lv(e,t,n){return ur(e,ys(t,n))}function hi(e,t){return typeof e=="function"?e(t):e}function pi(e){return e.split("-")[0]}function kc(e){return e.split("-")[1]}function ox(e){return e==="x"?"y":"x"}function lx(e){return e==="y"?"height":"width"}const m5=new Set(["top","bottom"]);function _a(e){return m5.has(pi(e))?"y":"x"}function cx(e){return ox(_a(e))}function g5(e,t,n){n===void 0&&(n=!1);const r=kc(e),a=cx(e),i=lx(a);let s=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=rp(s)),[s,rp(s)]}function y5(e){const t=rp(e);return[Uv(e),t,Uv(t)]}function Uv(e){return e.replace(/start|end/g,t=>p5[t])}const O_=["left","right"],M_=["right","left"],v5=["top","bottom"],b5=["bottom","top"];function x5(e,t,n){switch(e){case"top":case"bottom":return n?t?M_:O_:t?O_:M_;case"left":case"right":return t?v5:b5;default:return[]}}function w5(e,t,n,r){const a=kc(e);let i=x5(pi(e),n==="start",r);return a&&(i=i.map(s=>s+"-"+a),t&&(i=i.concat(i.map(Uv)))),i}function rp(e){return e.replace(/left|right|bottom|top/g,t=>h5[t])}function S5(e){return{top:0,right:0,bottom:0,left:0,...e}}function FT(e){return typeof e!="number"?S5(e):{top:e,right:e,bottom:e,left:e}}function ap(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function P_(e,t,n){let{reference:r,floating:a}=e;const i=_a(t),s=cx(t),o=lx(s),l=pi(t),u=i==="y",d=r.x+r.width/2-a.width/2,f=r.y+r.height/2-a.height/2,p=r[o]/2-a[o]/2;let h;switch(l){case"top":h={x:d,y:r.y-a.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-a.width,y:f};break;default:h={x:r.x,y:r.y}}switch(kc(t)){case"start":h[s]-=p*(n&&u?-1:1);break;case"end":h[s]+=p*(n&&u?-1:1);break}return h}const _5=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:s}=n,o=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:f}=P_(u,r,l),p=r,h={},y=0;for(let m=0;m<o.length;m++){const{name:b,fn:g}=o[m],{x:v,y:w,data:S,reset:E}=await g({x:d,y:f,initialPlacement:r,placement:p,strategy:a,middlewareData:h,rects:u,platform:s,elements:{reference:e,floating:t}});d=v??d,f=w??f,h={...h,[b]:{...h[b],...S}},E&&y<=50&&(y++,typeof E=="object"&&(E.placement&&(p=E.placement),E.rects&&(u=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:a}):E.rects),{x:d,y:f}=P_(u,p,l)),m=-1)}return{x:d,y:f,placement:p,strategy:a,middlewareData:h}};async function ed(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:i,rects:s,elements:o,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=hi(t,e),y=FT(h),b=o[p?f==="floating"?"reference":"floating":f],g=ap(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:u,rootBoundary:d,strategy:l})),v=f==="floating"?{x:r,y:a,width:s.floating.width,height:s.floating.height}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),S=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},E=ap(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:v,offsetParent:w,strategy:l}):v);return{top:(g.top-E.top+y.top)/S.y,bottom:(E.bottom-g.bottom+y.bottom)/S.y,left:(g.left-E.left+y.left)/S.x,right:(E.right-g.right+y.right)/S.x}}const k5=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:i,platform:s,elements:o,middlewareData:l}=t,{element:u,padding:d=0}=hi(e,t)||{};if(u==null)return{};const f=FT(d),p={x:n,y:r},h=cx(a),y=lx(h),m=await s.getDimensions(u),b=h==="y",g=b?"top":"left",v=b?"bottom":"right",w=b?"clientHeight":"clientWidth",S=i.reference[y]+i.reference[h]-p[h]-i.floating[y],E=p[h]-i.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let T=C?C[w]:0;(!T||!await(s.isElement==null?void 0:s.isElement(C)))&&(T=o.floating[w]||i.floating[y]);const P=S/2-E/2,R=T/2-m[y]/2-1,$=ys(f[g],R),j=ys(f[v],R),O=$,L=T-m[y]-j,D=T/2-m[y]/2+P,A=Lv(O,D,L),H=!l.arrow&&kc(a)!=null&&D!==A&&i.reference[y]/2-(D<O?$:j)-m[y]/2<0,B=H?D<O?D-O:D-L:0;return{[h]:p[h]+B,data:{[h]:A,centerOffset:D-A-B,...H&&{alignmentOffset:B}},reset:H}}}),E5=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:i,rects:s,initialPlacement:o,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...b}=hi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=pi(a),v=_a(o),w=pi(o)===o,S=await(l.isRTL==null?void 0:l.isRTL(u.floating)),E=p||(w||!m?[rp(o)]:y5(o)),C=y!=="none";!p&&C&&E.push(...w5(o,m,y,S));const T=[o,...E],P=await ed(t,b),R=[];let $=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&R.push(P[g]),f){const D=g5(a,s,S);R.push(P[D[0]],P[D[1]])}if($=[...$,{placement:a,overflows:R}],!R.every(D=>D<=0)){var j,O;const D=(((j=i.flip)==null?void 0:j.index)||0)+1,A=T[D];if(A&&(!(f==="alignment"?v!==_a(A):!1)||$.every(U=>_a(U.placement)===v?U.overflows[0]>0:!0)))return{data:{index:D,overflows:$},reset:{placement:A}};let H=(O=$.filter(B=>B.overflows[0]<=0).sort((B,U)=>B.overflows[1]-U.overflows[1])[0])==null?void 0:O.placement;if(!H)switch(h){case"bestFit":{var L;const B=(L=$.filter(U=>{if(C){const Y=_a(U.placement);return Y===v||Y==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(Y=>Y>0).reduce((Y,N)=>Y+N,0)]).sort((U,Y)=>U[1]-Y[1])[0])==null?void 0:L[0];B&&(H=B);break}case"initialPlacement":H=o;break}if(a!==H)return{reset:{placement:H}}}return{}}}};function D_(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function z_(e){return f5.some(t=>e[t]>=0)}const C5=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=hi(e,t);switch(r){case"referenceHidden":{const i=await ed(t,{...a,elementContext:"reference"}),s=D_(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:z_(s)}}}case"escaped":{const i=await ed(t,{...a,altBoundary:!0}),s=D_(i,n.floating);return{data:{escapedOffsets:s,escaped:z_(s)}}}default:return{}}}}},qT=new Set(["left","top"]);async function N5(e,t){const{placement:n,platform:r,elements:a}=e,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),s=pi(n),o=kc(n),l=_a(n)==="y",u=qT.has(s)?-1:1,d=i&&l?-1:1,f=hi(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return o&&typeof y=="number"&&(h=o==="end"?y*-1:y),l?{x:h*d,y:p*u}:{x:p*u,y:h*d}}const j5=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:i,placement:s,middlewareData:o}=t,l=await N5(t,e);return s===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:a+l.x,y:i+l.y,data:{...l,placement:s}}}}},T5=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:o={fn:b=>{let{x:g,y:v}=b;return{x:g,y:v}}},...l}=hi(e,t),u={x:n,y:r},d=await ed(t,l),f=_a(pi(a)),p=ox(f);let h=u[p],y=u[f];if(i){const b=p==="y"?"top":"left",g=p==="y"?"bottom":"right",v=h+d[b],w=h-d[g];h=Lv(v,h,w)}if(s){const b=f==="y"?"top":"left",g=f==="y"?"bottom":"right",v=y+d[b],w=y-d[g];y=Lv(v,y,w)}const m=o.fn({...t,[p]:h,[f]:y});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:i,[f]:s}}}}}},A5=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:i,middlewareData:s}=t,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=hi(e,t),d={x:n,y:r},f=_a(a),p=ox(f);let h=d[p],y=d[f];const m=hi(o,t),b=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const w=p==="y"?"height":"width",S=i.reference[p]-i.floating[w]+b.mainAxis,E=i.reference[p]+i.reference[w]-b.mainAxis;h<S?h=S:h>E&&(h=E)}if(u){var g,v;const w=p==="y"?"width":"height",S=qT.has(pi(a)),E=i.reference[f]-i.floating[w]+(S&&((g=s.offset)==null?void 0:g[f])||0)+(S?0:b.crossAxis),C=i.reference[f]+i.reference[w]+(S?0:((v=s.offset)==null?void 0:v[f])||0)-(S?b.crossAxis:0);y<E?y=E:y>C&&(y=C)}return{[p]:h,[f]:y}}}},R5=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:i,platform:s,elements:o}=t,{apply:l=()=>{},...u}=hi(e,t),d=await ed(t,u),f=pi(a),p=kc(a),h=_a(a)==="y",{width:y,height:m}=i.floating;let b,g;f==="top"||f==="bottom"?(b=f,g=p===(await(s.isRTL==null?void 0:s.isRTL(o.floating))?"start":"end")?"left":"right"):(g=f,b=p==="end"?"top":"bottom");const v=m-d.top-d.bottom,w=y-d.left-d.right,S=ys(m-d[b],v),E=ys(y-d[g],w),C=!t.middlewareData.shift;let T=S,P=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=v),C&&!p){const $=ur(d.left,0),j=ur(d.right,0),O=ur(d.top,0),L=ur(d.bottom,0);h?P=y-2*($!==0||j!==0?$+j:ur(d.left,d.right)):T=m-2*(O!==0||L!==0?O+L:ur(d.top,d.bottom))}await l({...t,availableWidth:P,availableHeight:T});const R=await s.getDimensions(o.floating);return y!==R.width||m!==R.height?{reset:{rects:!0}}:{}}}};function om(){return typeof window<"u"}function Ec(e){return HT(e)?(e.nodeName||"").toLowerCase():"#document"}function vr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Aa(e){var t;return(t=(HT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function HT(e){return om()?e instanceof Node||e instanceof vr(e).Node:!1}function aa(e){return om()?e instanceof Element||e instanceof vr(e).Element:!1}function Na(e){return om()?e instanceof HTMLElement||e instanceof vr(e).HTMLElement:!1}function I_(e){return!om()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof vr(e).ShadowRoot}const $5=new Set(["inline","contents"]);function Ad(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=ia(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!$5.has(a)}const O5=new Set(["table","td","th"]);function M5(e){return O5.has(Ec(e))}const P5=[":popover-open",":modal"];function lm(e){return P5.some(t=>{try{return e.matches(t)}catch{return!1}})}const D5=["transform","translate","scale","rotate","perspective"],z5=["transform","translate","scale","rotate","perspective","filter"],I5=["paint","layout","strict","content"];function ux(e){const t=dx(),n=aa(e)?ia(e):e;return D5.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||z5.some(r=>(n.willChange||"").includes(r))||I5.some(r=>(n.contain||"").includes(r))}function L5(e){let t=vs(e);for(;Na(t)&&!rc(t);){if(ux(t))return t;if(lm(t))return null;t=vs(t)}return null}function dx(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const U5=new Set(["html","body","#document"]);function rc(e){return U5.has(Ec(e))}function ia(e){return vr(e).getComputedStyle(e)}function cm(e){return aa(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function vs(e){if(Ec(e)==="html")return e;const t=e.assignedSlot||e.parentNode||I_(e)&&e.host||Aa(e);return I_(t)?t.host:t}function BT(e){const t=vs(e);return rc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Na(t)&&Ad(t)?t:BT(t)}function td(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=BT(e),i=a===((r=e.ownerDocument)==null?void 0:r.body),s=vr(a);if(i){const o=Fv(s);return t.concat(s,s.visualViewport||[],Ad(a)?a:[],o&&n?td(o):[])}return t.concat(a,td(a,[],n))}function Fv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function VT(e){const t=ia(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Na(e),i=a?e.offsetWidth:n,s=a?e.offsetHeight:r,o=np(n)!==i||np(r)!==s;return o&&(n=i,r=s),{width:n,height:r,$:o}}function fx(e){return aa(e)?e:e.contextElement}function El(e){const t=fx(e);if(!Na(t))return Ca(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:i}=VT(t);let s=(i?np(n.width):n.width)/r,o=(i?np(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!o||!Number.isFinite(o))&&(o=1),{x:s,y:o}}const F5=Ca(0);function ZT(e){const t=vr(e);return!dx()||!t.visualViewport?F5:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function q5(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==vr(e)?!1:t}function bo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=fx(e);let s=Ca(1);t&&(r?aa(r)&&(s=El(r)):s=El(e));const o=q5(i,n,r)?ZT(i):Ca(0);let l=(a.left+o.x)/s.x,u=(a.top+o.y)/s.y,d=a.width/s.x,f=a.height/s.y;if(i){const p=vr(i),h=r&&aa(r)?vr(r):r;let y=p,m=Fv(y);for(;m&&r&&h!==y;){const b=El(m),g=m.getBoundingClientRect(),v=ia(m),w=g.left+(m.clientLeft+parseFloat(v.paddingLeft))*b.x,S=g.top+(m.clientTop+parseFloat(v.paddingTop))*b.y;l*=b.x,u*=b.y,d*=b.x,f*=b.y,l+=w,u+=S,y=vr(m),m=Fv(y)}}return ap({width:d,height:f,x:l,y:u})}function um(e,t){const n=cm(e).scrollLeft;return t?t.left+n:bo(Aa(e)).left+n}function KT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-um(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function H5(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const i=a==="fixed",s=Aa(r),o=t?lm(t.floating):!1;if(r===s||o&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Ca(1);const d=Ca(0),f=Na(r);if((f||!f&&!i)&&((Ec(r)!=="body"||Ad(s))&&(l=cm(r)),Na(r))){const h=bo(r);u=El(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const p=s&&!f&&!i?KT(s,l):Ca(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function B5(e){return Array.from(e.getClientRects())}function V5(e){const t=Aa(e),n=cm(e),r=e.ownerDocument.body,a=ur(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ur(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+um(e);const o=-n.scrollTop;return ia(r).direction==="rtl"&&(s+=ur(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:s,y:o}}const L_=25;function Z5(e,t){const n=vr(e),r=Aa(e),a=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,o=0,l=0;if(a){i=a.width,s=a.height;const d=dx();(!d||d&&t==="fixed")&&(o=a.offsetLeft,l=a.offsetTop)}const u=um(r);if(u<=0){const d=r.ownerDocument,f=d.body,p=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-h);y<=L_&&(i-=y)}else u<=L_&&(i+=u);return{width:i,height:s,x:o,y:l}}const K5=new Set(["absolute","fixed"]);function G5(e,t){const n=bo(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=Na(e)?El(e):Ca(1),s=e.clientWidth*i.x,o=e.clientHeight*i.y,l=a*i.x,u=r*i.y;return{width:s,height:o,x:l,y:u}}function U_(e,t,n){let r;if(t==="viewport")r=Z5(e,n);else if(t==="document")r=V5(Aa(e));else if(aa(t))r=G5(t,n);else{const a=ZT(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return ap(r)}function GT(e,t){const n=vs(e);return n===t||!aa(n)||rc(n)?!1:ia(n).position==="fixed"||GT(n,t)}function Q5(e,t){const n=t.get(e);if(n)return n;let r=td(e,[],!1).filter(o=>aa(o)&&Ec(o)!=="body"),a=null;const i=ia(e).position==="fixed";let s=i?vs(e):e;for(;aa(s)&&!rc(s);){const o=ia(s),l=ux(s);!l&&o.position==="fixed"&&(a=null),(i?!l&&!a:!l&&o.position==="static"&&!!a&&K5.has(a.position)||Ad(s)&&!l&&GT(e,s))?r=r.filter(d=>d!==s):a=o,s=vs(s)}return t.set(e,r),r}function Y5(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const s=[...n==="clippingAncestors"?lm(t)?[]:Q5(t,this._c):[].concat(n),r],o=s[0],l=s.reduce((u,d)=>{const f=U_(t,d,a);return u.top=ur(f.top,u.top),u.right=ys(f.right,u.right),u.bottom=ys(f.bottom,u.bottom),u.left=ur(f.left,u.left),u},U_(t,o,a));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function X5(e){const{width:t,height:n}=VT(e);return{width:t,height:n}}function W5(e,t,n){const r=Na(t),a=Aa(t),i=n==="fixed",s=bo(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const l=Ca(0);function u(){l.x=um(a)}if(r||!r&&!i)if((Ec(t)!=="body"||Ad(a))&&(o=cm(t)),r){const h=bo(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else a&&u();i&&!r&&a&&u();const d=a&&!r&&!i?KT(a,o):Ca(0),f=s.left+o.scrollLeft-l.x-d.x,p=s.top+o.scrollTop-l.y-d.y;return{x:f,y:p,width:s.width,height:s.height}}function Mg(e){return ia(e).position==="static"}function F_(e,t){if(!Na(e)||ia(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Aa(e)===n&&(n=n.ownerDocument.body),n}function QT(e,t){const n=vr(e);if(lm(e))return n;if(!Na(e)){let a=vs(e);for(;a&&!rc(a);){if(aa(a)&&!Mg(a))return a;a=vs(a)}return n}let r=F_(e,t);for(;r&&M5(r)&&Mg(r);)r=F_(r,t);return r&&rc(r)&&Mg(r)&&!ux(r)?n:r||L5(e)||n}const J5=async function(e){const t=this.getOffsetParent||QT,n=this.getDimensions,r=await n(e.floating);return{reference:W5(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function eU(e){return ia(e).direction==="rtl"}const tU={convertOffsetParentRelativeRectToViewportRelativeRect:H5,getDocumentElement:Aa,getClippingRect:Y5,getOffsetParent:QT,getElementRects:J5,getClientRects:B5,getDimensions:X5,getScale:El,isElement:aa,isRTL:eU};function YT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nU(e,t){let n=null,r;const a=Aa(e);function i(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function s(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),i();const u=e.getBoundingClientRect(),{left:d,top:f,width:p,height:h}=u;if(o||t(),!p||!h)return;const y=yf(f),m=yf(a.clientWidth-(d+p)),b=yf(a.clientHeight-(f+h)),g=yf(d),w={rootMargin:-y+"px "+-m+"px "+-b+"px "+-g+"px",threshold:ur(0,ys(1,l))||1};let S=!0;function E(C){const T=C[0].intersectionRatio;if(T!==l){if(!S)return s();T?s(!1,T):r=setTimeout(()=>{s(!1,1e-7)},1e3)}T===1&&!YT(u,e.getBoundingClientRect())&&s(),S=!1}try{n=new IntersectionObserver(E,{...w,root:a.ownerDocument})}catch{n=new IntersectionObserver(E,w)}n.observe(e)}return s(!0),i}function rU(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=fx(e),d=a||i?[...u?td(u):[],...td(t)]:[];d.forEach(g=>{a&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=u&&o?nU(u,n):null;let p=-1,h=null;s&&(h=new ResizeObserver(g=>{let[v]=g;v&&v.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),u&&!l&&h.observe(u),h.observe(t));let y,m=l?bo(e):null;l&&b();function b(){const g=bo(e);m&&!YT(m,g)&&n(),m=g,y=requestAnimationFrame(b)}return n(),()=>{var g;d.forEach(v=>{a&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,l&&cancelAnimationFrame(y)}}const aU=j5,iU=T5,sU=E5,oU=R5,lU=C5,q_=k5,cU=A5,uU=(e,t,n)=>{const r=new Map,a={platform:tU,...n},i={...a.platform,_c:r};return _5(e,t,{...a,platform:i})};var dU=typeof document<"u",fU=function(){},ih=dU?x.useLayoutEffect:fU;function ip(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ip(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&e.$$typeof)&&!ip(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function XT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function H_(e,t){const n=XT(e);return Math.round(t*n)/n}function Pg(e){const t=x.useRef(e);return ih(()=>{t.current=e}),t}function hU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:s}={},transform:o=!0,whileElementsMounted:l,open:u}=e,[d,f]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=x.useState(r);ip(p,r)||h(r);const[y,m]=x.useState(null),[b,g]=x.useState(null),v=x.useCallback(U=>{U!==C.current&&(C.current=U,m(U))},[]),w=x.useCallback(U=>{U!==T.current&&(T.current=U,g(U))},[]),S=i||y,E=s||b,C=x.useRef(null),T=x.useRef(null),P=x.useRef(d),R=l!=null,$=Pg(l),j=Pg(a),O=Pg(u),L=x.useCallback(()=>{if(!C.current||!T.current)return;const U={placement:t,strategy:n,middleware:p};j.current&&(U.platform=j.current),uU(C.current,T.current,U).then(Y=>{const N={...Y,isPositioned:O.current!==!1};D.current&&!ip(P.current,N)&&(P.current=N,No.flushSync(()=>{f(N)}))})},[p,t,n,j,O]);ih(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(U=>({...U,isPositioned:!1})))},[u]);const D=x.useRef(!1);ih(()=>(D.current=!0,()=>{D.current=!1}),[]),ih(()=>{if(S&&(C.current=S),E&&(T.current=E),S&&E){if($.current)return $.current(S,E,L);L()}},[S,E,L,$,R]);const A=x.useMemo(()=>({reference:C,floating:T,setReference:v,setFloating:w}),[v,w]),H=x.useMemo(()=>({reference:S,floating:E}),[S,E]),B=x.useMemo(()=>{const U={position:n,left:0,top:0};if(!H.floating)return U;const Y=H_(H.floating,d.x),N=H_(H.floating,d.y);return o?{...U,transform:"translate("+Y+"px, "+N+"px)",...XT(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:N}},[n,o,H.floating,d.x,d.y]);return x.useMemo(()=>({...d,update:L,refs:A,elements:H,floatingStyles:B}),[d,L,A,H,B])}const pU=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?q_({element:r.current,padding:a}).fn(n):{}:r?q_({element:r,padding:a}).fn(n):{}}}},mU=(e,t)=>({...aU(e),options:[e,t]}),gU=(e,t)=>({...iU(e),options:[e,t]}),yU=(e,t)=>({...cU(e),options:[e,t]}),vU=(e,t)=>({...sU(e),options:[e,t]}),bU=(e,t)=>({...oU(e),options:[e,t]}),xU=(e,t)=>({...lU(e),options:[e,t]}),wU=(e,t)=>({...pU(e),options:[e,t]});var SU="Arrow",WT=x.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...i}=e;return c.jsx(Me.svg,{...i,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});WT.displayName=SU;var _U=WT;function kU(e){const[t,n]=x.useState(void 0);return _n(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let s,o;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,o=u.blockSize}else s=e.offsetWidth,o=e.offsetHeight;n({width:s,height:o})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var hx="Popper",[JT,Cc]=gi(hx),[EU,eA]=JT(hx),tA=e=>{const{__scopePopper:t,children:n}=e,[r,a]=x.useState(null);return c.jsx(EU,{scope:t,anchor:r,onAnchorChange:a,children:n})};tA.displayName=hx;var nA="PopperAnchor",rA=x.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,i=eA(nA,n),s=x.useRef(null),o=ut(t,s),l=x.useRef(null);return x.useEffect(()=>{const u=l.current;l.current=(r==null?void 0:r.current)||s.current,u!==l.current&&i.onAnchorChange(l.current)}),r?null:c.jsx(Me.div,{...a,ref:o})});rA.displayName=nA;var px="PopperContent",[CU,NU]=JT(px),aA=x.forwardRef((e,t)=>{var K,G,re,oe,he,Se;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:s=0,arrowPadding:o=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:y,...m}=e,b=eA(px,n),[g,v]=x.useState(null),w=ut(t,Xe=>v(Xe)),[S,E]=x.useState(null),C=kU(S),T=(C==null?void 0:C.width)??0,P=(C==null?void 0:C.height)??0,R=r+(i!=="center"?"-"+i:""),$=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},j=Array.isArray(u)?u:[u],O=j.length>0,L={padding:$,boundary:j.filter(TU),altBoundary:O},{refs:D,floatingStyles:A,placement:H,isPositioned:B,middlewareData:U}=hU({strategy:"fixed",placement:R,whileElementsMounted:(...Xe)=>rU(...Xe,{animationFrame:h==="always"}),elements:{reference:b.anchor},middleware:[mU({mainAxis:a+P,alignmentAxis:s}),l&&gU({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?yU():void 0,...L}),l&&vU({...L}),bU({...L,apply:({elements:Xe,rects:ot,availableWidth:W,availableHeight:fe})=>{const{width:ne,height:ze}=ot.reference,ce=Xe.floating.style;ce.setProperty("--radix-popper-available-width",`${W}px`),ce.setProperty("--radix-popper-available-height",`${fe}px`),ce.setProperty("--radix-popper-anchor-width",`${ne}px`),ce.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),S&&wU({element:S,padding:o}),AU({arrowWidth:T,arrowHeight:P}),p&&xU({strategy:"referenceHidden",...L})]}),[Y,N]=oA(H),F=qr(y);_n(()=>{B&&(F==null||F())},[B,F]);const V=(K=U.arrow)==null?void 0:K.x,_=(G=U.arrow)==null?void 0:G.y,k=((re=U.arrow)==null?void 0:re.centerOffset)!==0,[M,I]=x.useState();return _n(()=>{g&&I(window.getComputedStyle(g).zIndex)},[g]),c.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...A,transform:B?A.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:M,"--radix-popper-transform-origin":[(oe=U.transformOrigin)==null?void 0:oe.x,(he=U.transformOrigin)==null?void 0:he.y].join(" "),...((Se=U.hide)==null?void 0:Se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(CU,{scope:n,placedSide:Y,onArrowChange:E,arrowX:V,arrowY:_,shouldHideArrow:k,children:c.jsx(Me.div,{"data-side":Y,"data-align":N,...m,ref:w,style:{...m.style,animation:B?void 0:"none"}})})})});aA.displayName=px;var iA="PopperArrow",jU={top:"bottom",right:"left",bottom:"top",left:"right"},sA=x.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,i=NU(iA,r),s=jU[i.placedSide];return c.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:c.jsx(_U,{...a,ref:n,style:{...a.style,display:"block"}})})});sA.displayName=iA;function TU(e){return e!==null}var AU=e=>({name:"transformOrigin",options:e,fn(t){var b,g,v;const{placement:n,rects:r,middlewareData:a}=t,s=((b=a.arrow)==null?void 0:b.centerOffset)!==0,o=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[u,d]=oA(n),f={start:"0%",center:"50%",end:"100%"}[d],p=(((g=a.arrow)==null?void 0:g.x)??0)+o/2,h=(((v=a.arrow)==null?void 0:v.y)??0)+l/2;let y="",m="";return u==="bottom"?(y=s?f:`${p}px`,m=`${-l}px`):u==="top"?(y=s?f:`${p}px`,m=`${r.floating.height+l}px`):u==="right"?(y=`${-l}px`,m=s?f:`${h}px`):u==="left"&&(y=`${r.floating.width+l}px`,m=s?f:`${h}px`),{data:{x:y,y:m}}}});function oA(e){const[t,n="center"]=e.split("-");return[t,n]}var lA=tA,dm=rA,mx=aA,gx=sA,[fm,_se]=gi("Tooltip",[Cc]),yx=Cc(),cA="TooltipProvider",RU=700,B_="tooltip.open",[$U,uA]=fm(cA),dA=e=>{const{__scopeTooltip:t,delayDuration:n=RU,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:i}=e,s=x.useRef(!0),o=x.useRef(!1),l=x.useRef(0);return x.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),c.jsx($U,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(l.current),s.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:o,onPointerInTransitChange:x.useCallback(u=>{o.current=u},[]),disableHoverableContent:a,children:i})};dA.displayName=cA;var fA="Tooltip",[kse,hm]=fm(fA),qv="TooltipTrigger",OU=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=hm(qv,n),i=uA(qv,n),s=yx(n),o=x.useRef(null),l=ut(t,o,a.onTriggerChange),u=x.useRef(!1),d=x.useRef(!1),f=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),c.jsx(dm,{asChild:!0,...s,children:c.jsx(Me.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:l,onPointerMove:ve(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:ve(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:ve(e.onPointerDown,()=>{a.open&&a.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ve(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:ve(e.onBlur,a.onClose),onClick:ve(e.onClick,a.onClose)})})});OU.displayName=qv;var MU="TooltipPortal",[Ese,PU]=fm(MU,{forceMount:void 0}),ac="TooltipContent",hA=x.forwardRef((e,t)=>{const n=PU(ac,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...i}=e,s=hm(ac,e.__scopeTooltip);return c.jsx(yi,{present:r||s.open,children:s.disableHoverableContent?c.jsx(pA,{side:a,...i,ref:t}):c.jsx(DU,{side:a,...i,ref:t})})}),DU=x.forwardRef((e,t)=>{const n=hm(ac,e.__scopeTooltip),r=uA(ac,e.__scopeTooltip),a=x.useRef(null),i=ut(t,a),[s,o]=x.useState(null),{trigger:l,onClose:u}=n,d=a.current,{onPointerInTransitChange:f}=r,p=x.useCallback(()=>{o(null),f(!1)},[f]),h=x.useCallback((y,m)=>{const b=y.currentTarget,g={x:y.clientX,y:y.clientY},v=FU(g,b.getBoundingClientRect()),w=qU(g,v),S=HU(m.getBoundingClientRect()),E=VU([...w,...S]);o(E),f(!0)},[f]);return x.useEffect(()=>()=>p(),[p]),x.useEffect(()=>{if(l&&d){const y=b=>h(b,d),m=b=>h(b,l);return l.addEventListener("pointerleave",y),d.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",m)}}},[l,d,h,p]),x.useEffect(()=>{if(s){const y=m=>{const b=m.target,g={x:m.clientX,y:m.clientY},v=(l==null?void 0:l.contains(b))||(d==null?void 0:d.contains(b)),w=!BU(g,s);v?p():w&&(p(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[l,d,s,u,p]),c.jsx(pA,{...e,ref:i})}),[zU,IU]=fm(fA,{isInside:!1}),LU=EI("TooltipContent"),pA=x.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:s,...o}=e,l=hm(ac,n),u=yx(n),{onClose:d}=l;return x.useEffect(()=>(document.addEventListener(B_,d),()=>document.removeEventListener(B_,d)),[d]),x.useEffect(()=>{if(l.trigger){const f=p=>{const h=p.target;h!=null&&h.contains(l.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,d]),c.jsx(Sc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:c.jsxs(mx,{"data-state":l.stateAttribute,...u,...o,ref:t,style:{...o.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(LU,{children:r}),c.jsx(zU,{scope:n,isInside:!0,children:c.jsx(KI,{id:l.contentId,role:"tooltip",children:a||r})})]})})});hA.displayName=ac;var mA="TooltipArrow",UU=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=yx(n);return IU(mA,n).isInside?null:c.jsx(gx,{...a,...r,ref:t})});UU.displayName=mA;function FU(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,a,i)){case i:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function qU(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function HU(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function BU(e,t){const{x:n,y:r}=e;let a=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const o=t[i],l=t[s],u=o.x,d=o.y,f=l.x,p=l.y;d>r!=p>r&&n<(f-u)*(r-d)/(p-d)+u&&(a=!a)}return a}function VU(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),ZU(t)}function ZU(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const a=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var KU=dA,gA=hA;const GU=KU,QU=x.forwardRef(({className:e,sideOffset:t=4,...n},r)=>c.jsx(gA,{ref:r,sideOffset:t,className:Ce("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n}));QU.displayName=gA.displayName;const YU={total:0,byKind:{oauth_required:0,oauth_expired:0,service_unhealthy:0,credential_missing_secret:0,playbook_missing_deps:0},serviceWarnings:new Map,credentialWarnings:new Map,playbookWarnings:new Map};function XU(e){return e?{total:e.total,byKind:e.byKind,serviceWarnings:new Map(Object.entries(e.services)),credentialWarnings:new Map(Object.entries(e.credentials)),playbookWarnings:new Map(Object.entries(e.playbooks))}:YU}const Dn="#92E4DD",Xn="#F9386D",Yr="#FFFFFF",ga="bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900";function ua(e){return Dn}function ya(e){return{borderColor:e,color:e,boxShadow:`0 0 20px ${e}20`}}const WU=im("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{gold:"bg-[#C4B643] text-[#0A0A07] hover:bg-[#D4C760] border border-[#C4B643] font-medium",default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),te=x.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...a},i)=>{const s=r?_I:"button";return c.jsx(s,{className:Ce(WU({variant:t,size:n,className:e})),ref:i,...a})});te.displayName="Button";function Cl({warnings:e}){if(!(e!=null&&e.length))return null;const t=e.find(r=>r.severity==="error")??e[0],n=t.severity==="error";return c.jsxs("div",{className:`absolute left-1/2 -translate-x-1/2 top-8 z-20 flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[7px] font-semibold uppercase tracking-wide shadow-lg ${n?"bg-red-500/90 text-white border border-red-300/60":"bg-amber-500/90 text-black border border-amber-200/60"}`,title:e.map(r=>r.message).join(" · "),"data-testid":"card-warning-badge",children:[c.jsx(Mr,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"max-w-[72px] truncate",children:t.message})]})}const V_="data:image/svg+xml,%3csvg%20id='eSEM9z84vJh1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20300%20300'%20shape-rendering='geometricPrecision'%20text-rendering='geometricPrecision'%20project-id='c9405aa1bbb44eb388e44d7178ee1932'%20export-id='327eb6bfd5a543cb88b86ffe07ce0c92'%20cached='false'%3e%3crect%20width='63.894524'%20height='34.989858'%20rx='0'%20ry='0'%20transform='translate(71.928217%20125.25355)'%20stroke-width='0'/%3e%3crect%20width='63.894524'%20height='34.989858'%20rx='0'%20ry='0'%20transform='matrix(2.570356%200%200%202.449277%2067.884163%2017.275854)'%20stroke-width='0'/%3e%3crect%20width='63.894524'%20height='34.989858'%20rx='0'%20ry='0'%20transform='translate(163.184592%20125.25355)'%20stroke-width='0'/%3e%3crect%20width='63.894524'%20height='34.989858'%20rx='0'%20ry='0'%20transform='matrix(3.42849%200%200%200.403818%2040.469132%20102.975708)'%20stroke-width='0'/%3e%3cpolygon%20points='0,-42.01893%2030.924539,20.531677%2024.698107,33.994028%20-24.698107,33.994028%20-33.20748,20.12246%200,-42.01893'%20transform='matrix(-.687913%200.002106-.00101-.33%20149.995947%20212.592699)'%20stroke-width='0'/%3e%3cpolygon%20points='0,-42.01893%2036.327051,-24.945112%2016.852287,34.058016%20-19.029679,34.002758%20-36.534138,-25.057317%200,-42.01893'%20transform='matrix(-.466366%200.001428-.002837-.926983%20149.84238%20249.643929)'%20stroke-width='0'/%3e%3c/svg%3e";function JU(e){return e.iconUrl?e.iconUrl:null}function yA({service:e}){const t=ua(),n=JU(e),[r,a]=x.useState(!1);return n&&!r?c.jsx("img",{src:n,alt:"",className:"w-7 h-7 object-contain rounded-sm",draggable:!1,onError:()=>a(!0)}):c.jsx("div",{style:{width:28,height:28,backgroundColor:t,WebkitMask:`url(${V_}) no-repeat center / contain`,mask:`url(${V_}) no-repeat center / contain`},"aria-hidden":!0})}function vx(e){return e?"ring-2 ring-inset ring-yellow-400/90 shadow-[0_0_10px_rgba(250,204,21,0.2)]":""}function bx(){return c.jsx("span",{className:"absolute top-1.5 left-1/2 z-20 -translate-x-1/2 rounded bg-yellow-500 px-1 py-px text-[7px] font-bold uppercase tracking-wide text-black shadow",children:"In deck"})}function e6({service:e,onDragStart:t,onDragEnd:n,isInActiveDeck:r,onCardClick:a,isInCollection:i=!1,onMouseEnter:s,onMouseLeave:o,activeDeck:l,warnings:u}){const d=un(),{toast:f}=rn(),p=ua(),h=_t({mutationFn:async()=>{if(!l)throw new Error("No active deck found");return we("POST",`/api/decks/${l.id}/services`,{serviceId:e.id,position:0})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Service added to deck",description:`${e.name} has been added to your active deck.`})},onError:g=>{f({title:"Failed to add service",description:g.message,variant:"destructive"})}}),y=_t({mutationFn:async()=>we("DELETE",`/api/services/${e.id}`,{}),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/services"]}),d.invalidateQueries({queryKey:["/api/collection/warnings"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Service deleted",description:`${e.name} has been deleted successfully.`})},onError:g=>{f({title:"Failed to delete service",description:g.message,variant:"destructive"})}}),m=g=>{g.stopPropagation(),h.mutate()},b=g=>{g.stopPropagation(),window.confirm(`Are you sure you want to delete ${e.name}? This action cannot be undone.`)&&y.mutate()};return c.jsx("div",{className:"relative group cursor-pointer",draggable:!r,onDragStart:g=>t(g,e),onDragEnd:n,onClick:()=>a==null?void 0:a(e),"data-testid":`card-${e.id}`,onMouseEnter:s,onMouseLeave:o,children:c.jsxs("div",{className:`
273
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
274
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
275
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
276
- relative overflow-hidden
277
- ${vx(r)}
278
- ${i?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
279
- `,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[c.jsx(Cl,{warnings:u}),r&&c.jsx(bx,{}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:p},children:e.type==="mcp"?"RM":e.type==="local-mcp"?"LM":"A"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:p},children:e.type==="mcp"?"RM":e.type==="local-mcp"?"LM":"A"})}),c.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:c.jsx(te,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:b,title:`Delete ${e.name}`,children:c.jsx(Td,{className:"w-3 h-3"})})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:p},children:c.jsx(yA,{service:e})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2","data-testid":`text-service-name-${e.id}`,style:{color:p},children:e.name}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:p,borderColor:p},children:e.type==="mcp"?"Remote MCP":e.type==="local-mcp"?"Local MCP":"A2A"})]}),c.jsx("div",{className:"absolute bottom-6 inset-x-1",children:c.jsx(te,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:p,borderColor:p},onClick:m,disabled:r||h.isPending,"data-testid":`button-add-to-deck-${e.id}`,children:r?"IN DECK":"ADD"})}),c.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-br from-transparent via-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none"})]})})}const t6=x.memo(e6);function n6(e){return e.iconUrl?e.iconUrl:null}function vA({credential:e,color:t}){const n=n6(e);return n?c.jsx("img",{src:n,alt:"",className:"h-7 w-7 object-contain rounded-sm",draggable:!1}):c.jsx(zv,{className:"h-7 w-7",strokeWidth:2.25,style:{color:t}})}function r6({credential:e,isInActiveDeck:t,activeDeck:n,isInCollection:r=!0,onDragStart:a,onDragEnd:i,onMouseEnter:s,onMouseLeave:o,onCardClick:l,warnings:u}){const d=un(),{toast:f}=rn(),p=Xn,h=_t({mutationFn:async()=>{if(!n)throw new Error("No active deck found");return we("POST",`/api/decks/${n.id}/credentials`,{credentialId:e.id})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Added to deck",description:`${e.label} is in your active deck.`})},onError:m=>{f({title:"Failed to add to deck",description:m.message,variant:"destructive"})}}),y=_t({mutationFn:async()=>we("DELETE",`/api/credentials/${e.id}`),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/credentials/vault"]}),d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"API key removed",description:`${e.label} was deleted from your vault.`})},onError:m=>{f({title:"Failed to remove API key",description:m.message,variant:"destructive"})}});return c.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!a,onDragStart:a?m=>a(m,e):void 0,onDragEnd:i,onClick:()=>l==null?void 0:l(e),"data-testid":`card-${e.id}`,onMouseEnter:s,onMouseLeave:o,children:c.jsxs("div",{className:`
280
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
281
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
282
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
283
- relative overflow-hidden
284
- ${vx(t)}
285
- ${r?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
286
- `,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[c.jsx(Cl,{warnings:u}),t&&c.jsx(bx,{}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:p},children:"AK"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:p},children:"AK"})}),c.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:c.jsx(te,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:m=>{m.stopPropagation(),window.confirm(`Remove ${e.label} from your vault?`)&&y.mutate()},title:`Remove ${e.label}`,children:c.jsx(Td,{className:"w-3 h-3"})})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:p},children:c.jsx(vA,{credential:e,color:p})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2","data-testid":`text-credential-name-${e.id}`,style:{color:p},children:e.label}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:p,borderColor:p},children:e.hasSecret?"API Key":"Missing key"})]}),c.jsx("div",{className:"absolute bottom-6 inset-x-1",children:c.jsx(te,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:p,borderColor:p},onClick:m=>{m.stopPropagation(),h.mutate()},disabled:t||h.isPending||!n,"data-testid":`button-add-to-deck-${e.id}`,children:t?"IN DECK":"ADD"})}),c.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-br from-transparent via-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none"})]})})}const a6=x.memo(r6);function i6({playbook:e,isInActiveDeck:t,activeDeck:n,isInCollection:r=!0,onDragStart:a,onDragEnd:i,onMouseEnter:s,onMouseLeave:o,onCardClick:l,warnings:u}){const d=un(),{toast:f}=rn(),p=Yr,h=e.dependsOnCredentialIds.length+e.dependsOnServiceIds.length,y=_t({mutationFn:async()=>{if(!n)throw new Error("No deck selected");return we("POST",`/api/decks/${n.id}/playbooks`,{playbookId:e.id})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Playbook added to deck",description:`${e.title} is on this deck.`})},onError:b=>{f({title:"Failed to add playbook",description:b.message,variant:"destructive"})}}),m=_t({mutationFn:async()=>we("DELETE",`/api/playbooks/${e.id}`),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/playbooks/vault"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Playbook deleted",description:`${e.title} was removed from your collection.`})},onError:b=>{f({title:"Failed to delete playbook",description:b.message,variant:"destructive"})}});return c.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!a,onDragStart:a?b=>a(b,e):void 0,onDragEnd:i,onClick:()=>l==null?void 0:l(e),"data-testid":`card-${e.id}`,onMouseEnter:s,onMouseLeave:o,children:c.jsxs("div",{className:`
287
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
288
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
289
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
290
- relative overflow-hidden
291
- ${vx(t)}
292
- ${r?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
293
- `,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[c.jsx(Cl,{warnings:u}),t&&c.jsx(bx,{}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:p},children:"PB"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:p},children:"PB"})}),c.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:c.jsx(te,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:b=>{b.stopPropagation(),window.confirm(`Delete playbook "${e.title}"?`)&&m.mutate()},title:`Delete ${e.title}`,children:c.jsx(Td,{className:"w-3 h-3"})})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:p},children:c.jsx(rx,{className:"h-7 w-7",strokeWidth:2.25})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:p},children:e.title}),c.jsxs("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:p,borderColor:p},children:["Playbook",h>0?` · ${h} deps`:""]})]}),c.jsx("div",{className:"absolute bottom-6 inset-x-1",children:c.jsx(te,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:p,borderColor:p},onClick:b=>{b.stopPropagation(),y.mutate()},disabled:t||y.isPending||!n,children:t?"IN DECK":"ADD"})}),c.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-br from-transparent via-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none"})]})})}const s6=x.memo(i6),nd=128,bA=192,ic=48,o6=10,sp=12,vf=64,bf=4,Z_=14,xA=12,wA=1.08;function l6(e=xA,t=wA){const n=e*Math.PI/180,r=nd*Math.sin(n)+bA*Math.cos(n);return Math.ceil(r*t)+8}const Hv=l6();function SA(e,t=ic){return e===0?0:nd+Math.max(0,e-1)*(nd-t)}function c6(e=o6,t=ic,n=sp){return SA(e,t)+2*n}function u6(e,t=ic){return SA(e,t)+2*sp}const d6=c6();function f6(e,t,n,r=xA){const a=t+n/2,i=n/2;if(i<=0)return 0;const s=(e-a)/i;return Math.max(-r,Math.min(r,s*r))}function h6(e){return{flexShrink:0,marginLeft:e===0?0:`-${ic}px`}}function p6(e,t,n){return n===e?999999:t-e}function m6({cardCount:e,children:t}){const n=x.useRef(null),r=x.useRef([]),a=x.useRef(0),i=x.useRef(void 0),[s,o]=x.useState(!1),[l,u]=x.useState(!1),[d,f]=x.useState(!1),[p,h]=x.useState(!1),[y,m]=x.useState(!1),b=x.useRef(!1),g=x.useRef(!1),[v,w]=x.useState(null),S=x.useRef(null);S.current=v;const E=x.useCallback(()=>{const j=n.current;if(!j)return;const O=j.getBoundingClientRect(),L=S.current;r.current.forEach((D,A)=>{if(!D)return;const H=D.getBoundingClientRect(),B=H.left+H.width/2,U=L===A?0:f6(B,O.left,O.width),Y=L===A?wA:1;D.style.transform=`rotate(${U}deg) scale(${Y})`,D.style.transformOrigin="center center",D.style.zIndex=String(p6(A,e,L))})},[e]),C=x.useCallback(j=>{const O=n.current;if(!O)return;const L=nd-ic;O.scrollBy({left:j==="left"?-L:L,behavior:"smooth"})},[]),T=x.useCallback(()=>{const j=n.current;if(!j)return;const L=u6(e,ic)>j.clientWidth+2;o(L),u(L&&j.scrollLeft>4),f(L&&j.scrollLeft+j.clientWidth<j.scrollWidth-4),E()},[e,E]);x.useLayoutEffect(()=>{const j=n.current;if(!j)return;T();const O=new ResizeObserver(T);return O.observe(j),j.addEventListener("scroll",T,{passive:!0}),()=>{O.disconnect(),j.removeEventListener("scroll",T)}},[e,T]),x.useEffect(()=>{const j=()=>{const O=n.current,L=a.current;if(O&&L!==0){O.scrollLeft+=L,E();const H=O.scrollLeft>4,B=O.scrollLeft+O.clientWidth<O.scrollWidth-4;u(H),f(B)}const D=L<0,A=L>0;D!==b.current&&(b.current=D,h(D)),A!==g.current&&(g.current=A,m(A)),i.current=requestAnimationFrame(j)};return i.current=requestAnimationFrame(j),()=>{i.current!==void 0&&cancelAnimationFrame(i.current)}},[E]);const P=j=>{const O=n.current;if(!O||!s){a.current=0;return}const L=O.getBoundingClientRect(),D=j.clientX-L.left;if(D<vf&&l){const A=1-D/vf;a.current=-(bf+A*(Z_-bf))}else if(D>L.width-vf&&d){const A=1-(L.width-D)/vf;a.current=bf+A*(Z_-bf)}else a.current=0;E()},R=()=>{a.current=0,b.current=!1,g.current=!1,h(!1),m(!1)};if(x.useLayoutEffect(()=>{r.current.length=e,E()},[e,v,E]),e===0)return c.jsx(c.Fragment,{children:t});const $=(j,O)=>`absolute ${j==="left"?"left-2":"right-2"} top-1/2 z-30 -translate-y-1/2 rounded-full bg-gray-950/90 p-1.5 text-yellow-300 shadow-lg ring-1 ring-black/50 transition-all duration-150 hover:bg-gray-950 hover:ring-yellow-300/40 ${O?"scale-110":"scale-100"}`;return c.jsxs("div",{className:"relative flex h-full w-full min-w-0 max-w-full items-center justify-center overflow-hidden","data-testid":"deck-fan",onMouseMove:P,onMouseLeave:R,children:[s&&l&&c.jsx("button",{type:"button",className:$("left",p),"aria-label":"Scroll deck left","data-testid":"deck-scroll-left",onClick:()=>C("left"),children:c.jsx(CT,{className:"h-6 w-6",strokeWidth:2.5})}),s&&d&&c.jsx("button",{type:"button",className:$("right",y),"aria-label":"Scroll deck right","data-testid":"deck-scroll-right",onClick:()=>C("right"),children:c.jsx(NT,{className:"h-6 w-6",strokeWidth:2.5})}),c.jsx("div",{ref:n,className:"max-w-full overflow-x-auto overflow-y-visible [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:{width:d6,maxWidth:"100%"},children:c.jsx("div",{className:"flex items-center justify-start isolate group/fan",style:{minHeight:Hv,paddingLeft:sp,paddingRight:sp},children:x.Children.map(t,(j,O)=>c.jsx("div",{ref:L=>{r.current[O]=L},className:"relative flex items-center justify-center transition-[transform,box-shadow] duration-500 will-change-transform",style:{...h6(O),minHeight:Hv},onMouseEnter:()=>w(O),onMouseLeave:()=>w(null),children:j},j&&typeof j=="object"&&"key"in j?j.key:O))})})]})}const it=x.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:Ce("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));it.displayName="Input";function g6({deck:e,services:t,credentials:n=[],playbooks:r=[],collectionWarnings:a,onDrop:i,onDragStart:s,onCredentialDragStart:o,onPlaybookDragStart:l,onDragEnd:u,onCardClick:d,onPlaybookClick:f,onCredentialClick:p}){const[h,y]=x.useState(!1),[m,b]=x.useState(e.name),g=x.useRef(null),v=un(),{toast:w}=rn();x.useEffect(()=>{b(e.name),y(!1)},[e.id,e.name]),x.useEffect(()=>{var R,$;h&&((R=g.current)==null||R.focus(),($=g.current)==null||$.select())},[h]);const S=_t({mutationFn:async R=>(await we("PUT",`/api/decks/${e.id}`,{name:R})).json(),onSuccess:R=>{if(!R.success)throw new Error(R.error||"Rename failed");v.invalidateQueries({queryKey:["/api/decks"]}),y(!1)},onError:R=>{b(e.name),y(!1),w({title:"Could not rename deck",description:R.message,variant:"destructive"})}}),E=()=>{const R=m.trim();if(!R||R===e.name){b(e.name),y(!1);return}S.mutate(R)},C=R=>{R.preventDefault(),i(R)},T=R=>{R.preventDefault()},P=t.length+n.length+r.length;return c.jsxs("div",{className:"flex h-full min-w-0 flex-col overflow-hidden",children:[c.jsxs("h3",{className:"mb-4 flex min-w-0 shrink-0 items-center text-lg font-bold",children:[c.jsx("i",{className:"fas fa-layer-group mr-2 text-blue-400"}),"Deck",h?c.jsx(it,{ref:g,value:m,disabled:S.isPending,onChange:R=>b(R.target.value),onBlur:E,onKeyDown:R=>{R.key==="Enter"?(R.preventDefault(),E()):R.key==="Escape"&&(R.preventDefault(),b(e.name),y(!1))},className:"ml-2 h-7 max-w-[12rem] border-white/20 bg-white/10 px-2 text-sm font-normal text-white sm:max-w-[16rem]","data-testid":"input-deck-name","aria-label":"Deck name"}):c.jsx("button",{type:"button",className:"ml-2 min-w-0 truncate text-left text-sm font-normal text-gray-400 hover:text-white hover:underline",title:"Click to rename",onClick:()=>y(!0),"data-testid":"button-rename-deck",children:e.name}),c.jsxs("span",{className:"ml-2 shrink-0 text-sm font-normal text-gray-400",children:["(",P," cards)"]})]}),c.jsx("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden rounded-xl border-2 border-dashed px-4 py-2 min-w-0",onDrop:C,onDragOver:T,style:{background:"linear-gradient(135deg, rgba(196, 182, 67, 0.1), rgba(212, 199, 96, 0.1))",borderColor:"rgba(196, 182, 67, 0.3)"},"data-testid":"deck-drop-zone",children:c.jsx("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden min-w-0",children:P===0?c.jsx("div",{className:"flex items-center justify-center",style:{minHeight:Hv},children:c.jsx("div",{className:"flex items-center justify-center rounded-lg border-2 border-dashed border-gray-500 opacity-50 transition-opacity hover:opacity-75",style:{width:nd,height:bA},"data-testid":"deck-empty-placeholder",children:c.jsx(Ks,{className:"h-8 w-8 text-gray-500"})})}):c.jsxs(m6,{cardCount:P,children:[n.map((R,$)=>c.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transition-shadow duration-500 shadow-lg hover:shadow-2xl bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden cursor-pointer",style:{borderColor:Xn,boxShadow:`0 0 20px ${Xn}20`},draggable:!0,onDragStart:j=>o(j,R,!0),onDragEnd:u,onClick:()=>p==null?void 0:p(R),"data-testid":`deck-card-${R.id}`,children:[c.jsx(Cl,{warnings:a==null?void 0:a.credentialWarnings.get(R.id)}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:Xn},children:"AK"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:Xn},children:"AK"})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:Xn},children:c.jsx(vA,{credential:R,color:Xn})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Xn},children:R.label}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Xn,borderColor:Xn},children:R.hasSecret?"API Key":"Missing key"})]})]},R.id)),r.map((R,$)=>c.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transition-shadow duration-500 shadow-lg hover:shadow-2xl bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden cursor-pointer",style:{borderColor:Yr,boxShadow:`0 0 20px ${Yr}20`},draggable:!0,onDragStart:j=>l(j,R,!0),onDragEnd:u,onClick:()=>f==null?void 0:f(R),"data-testid":`deck-card-${R.id}`,children:[c.jsx(Cl,{warnings:a==null?void 0:a.playbookWarnings.get(R.id)}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:Yr},children:"PB"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:Yr},children:"PB"})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:Yr},children:c.jsx(rx,{className:"h-7 w-7",strokeWidth:2.25})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Yr},children:R.title}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Yr,borderColor:Yr},children:"Playbook"})]})]},R.id)),t.map(R=>c.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transition-shadow duration-500 shadow-lg hover:shadow-2xl bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden cursor-pointer",style:{borderColor:ua(),boxShadow:`0 0 20px ${ua()}20`},draggable:!0,onDragStart:$=>s($,R,!0),onDragEnd:u,onClick:()=>d==null?void 0:d(R),"data-testid":`deck-card-${R.id}`,children:[c.jsx(Cl,{warnings:a==null?void 0:a.serviceWarnings.get(R.id)}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:ua()},children:R.type==="mcp"?"RM":R.type==="local-mcp"?"LM":"A"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:ua()},children:R.type==="mcp"?"RM":R.type==="local-mcp"?"LM":"A"})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:ua()},children:c.jsx(yA,{service:R})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:ua()},children:R.name}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:ua(),borderColor:ua()},children:R.type==="mcp"?"Remote MCP":R.type==="local-mcp"?"Local MCP":"A2A"})]})]},R.id))]})})})]})}var Dg=0;function xx(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??K_()),document.body.insertAdjacentElement("beforeend",e[1]??K_()),Dg++,()=>{Dg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Dg--}},[])}function K_(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var zg="focusScope.autoFocusOnMount",Ig="focusScope.autoFocusOnUnmount",G_={bubbles:!1,cancelable:!0},y6="FocusScope",pm=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...s}=e,[o,l]=x.useState(null),u=qr(a),d=qr(i),f=x.useRef(null),p=ut(t,m=>l(m)),h=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let m=function(w){if(h.paused||!o)return;const S=w.target;o.contains(S)?f.current=S:Ti(f.current,{select:!0})},b=function(w){if(h.paused||!o)return;const S=w.relatedTarget;S!==null&&(o.contains(S)||Ti(f.current,{select:!0}))},g=function(w){if(document.activeElement===document.body)for(const E of w)E.removedNodes.length>0&&Ti(o)};document.addEventListener("focusin",m),document.addEventListener("focusout",b);const v=new MutationObserver(g);return o&&v.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",b),v.disconnect()}}},[r,o,h.paused]),x.useEffect(()=>{if(o){Y_.add(h);const m=document.activeElement;if(!o.contains(m)){const g=new CustomEvent(zg,G_);o.addEventListener(zg,u),o.dispatchEvent(g),g.defaultPrevented||(v6(_6(_A(o)),{select:!0}),document.activeElement===m&&Ti(o))}return()=>{o.removeEventListener(zg,u),setTimeout(()=>{const g=new CustomEvent(Ig,G_);o.addEventListener(Ig,d),o.dispatchEvent(g),g.defaultPrevented||Ti(m??document.body,{select:!0}),o.removeEventListener(Ig,d),Y_.remove(h)},0)}}},[o,u,d,h]);const y=x.useCallback(m=>{if(!n&&!r||h.paused)return;const b=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(b&&g){const v=m.currentTarget,[w,S]=b6(v);w&&S?!m.shiftKey&&g===S?(m.preventDefault(),n&&Ti(w,{select:!0})):m.shiftKey&&g===w&&(m.preventDefault(),n&&Ti(S,{select:!0})):g===v&&m.preventDefault()}},[n,r,h.paused]);return c.jsx(Me.div,{tabIndex:-1,...s,ref:p,onKeyDown:y})});pm.displayName=y6;function v6(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ti(r,{select:t}),document.activeElement!==n)return}function b6(e){const t=_A(e),n=Q_(t,e),r=Q_(t.reverse(),e);return[n,r]}function _A(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Q_(e,t){for(const n of e)if(!x6(n,{upTo:t}))return n}function x6(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function w6(e){return e instanceof HTMLInputElement&&"select"in e}function Ti(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&w6(e)&&t&&e.select()}}var Y_=S6();function S6(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=X_(e,t),e.unshift(t)},remove(t){var n;e=X_(e,t),(n=e[0])==null||n.resume()}}}function X_(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function _6(e){return e.filter(t=>t.tagName!=="A")}var k6=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Io=new WeakMap,xf=new WeakMap,wf={},Lg=0,kA=function(e){return e&&(e.host||kA(e.parentNode))},E6=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=kA(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},C6=function(e,t,n,r){var a=E6(t,Array.isArray(e)?e:[e]);wf[n]||(wf[n]=new WeakMap);var i=wf[n],s=[],o=new Set,l=new Set(a),u=function(f){!f||o.has(f)||(o.add(f),u(f.parentNode))};a.forEach(u);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(p){if(o.has(p))d(p);else try{var h=p.getAttribute(r),y=h!==null&&h!=="false",m=(Io.get(p)||0)+1,b=(i.get(p)||0)+1;Io.set(p,m),i.set(p,b),s.push(p),m===1&&y&&xf.set(p,!0),b===1&&p.setAttribute(n,"true"),y||p.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",p,g)}})};return d(t),o.clear(),Lg++,function(){s.forEach(function(f){var p=Io.get(f)-1,h=i.get(f)-1;Io.set(f,p),i.set(f,h),p||(xf.has(f)||f.removeAttribute(r),xf.delete(f)),h||f.removeAttribute(n)}),Lg--,Lg||(Io=new WeakMap,Io=new WeakMap,xf=new WeakMap,wf={})}},wx=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=k6(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),C6(r,a,n,"aria-hidden")):function(){return null}},va=function(){return va=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},va.apply(this,arguments)};function EA(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function N6(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,i;r<a;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var sh="right-scroll-bar-position",oh="width-before-scroll-bar",j6="with-scroll-bars-hidden",T6="--removed-body-scroll-bar-size";function Ug(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function A6(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var R6=typeof window<"u"?x.useLayoutEffect:x.useEffect,W_=new WeakMap;function $6(e,t){var n=A6(null,function(r){return e.forEach(function(a){return Ug(a,r)})});return R6(function(){var r=W_.get(n);if(r){var a=new Set(r),i=new Set(e),s=n.current;a.forEach(function(o){i.has(o)||Ug(o,null)}),i.forEach(function(o){a.has(o)||Ug(o,s)})}W_.set(n,e)},[e]),n}function O6(e){return e}function M6(e,t){t===void 0&&(t=O6);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(o){return o!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(o){return i(o)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var o=n;n=[],o.forEach(i),s=n}var l=function(){var d=s;s=[],d.forEach(i)},u=function(){return Promise.resolve().then(l)};u(),n={push:function(d){s.push(d),u()},filter:function(d){return s=s.filter(d),n}}}};return a}function P6(e){e===void 0&&(e={});var t=M6(null);return t.options=va({async:!0,ssr:!1},e),t}var CA=function(e){var t=e.sideCar,n=EA(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,va({},n))};CA.isSideCarExport=!0;function D6(e,t){return e.useMedium(t),CA}var NA=P6(),Fg=function(){},mm=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Fg,onWheelCapture:Fg,onTouchMoveCapture:Fg}),a=r[0],i=r[1],s=e.forwardProps,o=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,h=e.noRelative,y=e.noIsolation,m=e.inert,b=e.allowPinchZoom,g=e.as,v=g===void 0?"div":g,w=e.gapMode,S=EA(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=p,C=$6([n,t]),T=va(va({},S),a);return x.createElement(x.Fragment,null,d&&x.createElement(E,{sideCar:NA,removeScrollBar:u,shards:f,noRelative:h,noIsolation:y,inert:m,setCallbacks:i,allowPinchZoom:!!b,lockRef:n,gapMode:w}),s?x.cloneElement(x.Children.only(o),va(va({},T),{ref:C})):x.createElement(v,va({},T,{className:l,ref:C}),o))});mm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};mm.classNames={fullWidth:oh,zeroRight:sh};var z6=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function I6(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=z6();return t&&e.setAttribute("nonce",t),e}function L6(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function U6(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var F6=function(){var e=0,t=null;return{add:function(n){e==0&&(t=I6())&&(L6(t,n),U6(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},q6=function(){var e=F6();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},jA=function(){var e=q6(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},H6={left:0,top:0,right:0,gap:0},qg=function(e){return parseInt(e||"",10)||0},B6=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[qg(n),qg(r),qg(a)]},V6=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return H6;var t=B6(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Z6=jA(),Nl="data-scroll-locked",K6=function(e,t,n,r){var a=e.left,i=e.top,s=e.right,o=e.gap;return n===void 0&&(n="margin"),`
294
- .`.concat(j6,` {
295
- overflow: hidden `).concat(r,`;
296
- padding-right: `).concat(o,"px ").concat(r,`;
297
- }
298
- body[`).concat(Nl,`] {
299
- overflow: hidden `).concat(r,`;
300
- overscroll-behavior: contain;
301
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
302
- padding-left: `.concat(a,`px;
303
- padding-top: `).concat(i,`px;
304
- padding-right: `).concat(s,`px;
305
- margin-left:0;
306
- margin-top:0;
307
- margin-right: `).concat(o,"px ").concat(r,`;
308
- `),n==="padding"&&"padding-right: ".concat(o,"px ").concat(r,";")].filter(Boolean).join(""),`
309
- }
310
-
311
- .`).concat(sh,` {
312
- right: `).concat(o,"px ").concat(r,`;
313
- }
314
-
315
- .`).concat(oh,` {
316
- margin-right: `).concat(o,"px ").concat(r,`;
317
- }
318
-
319
- .`).concat(sh," .").concat(sh,` {
320
- right: 0 `).concat(r,`;
321
- }
322
-
323
- .`).concat(oh," .").concat(oh,` {
324
- margin-right: 0 `).concat(r,`;
325
- }
326
-
327
- body[`).concat(Nl,`] {
328
- `).concat(T6,": ").concat(o,`px;
329
- }
330
- `)},J_=function(){var e=parseInt(document.body.getAttribute(Nl)||"0",10);return isFinite(e)?e:0},G6=function(){x.useEffect(function(){return document.body.setAttribute(Nl,(J_()+1).toString()),function(){var e=J_()-1;e<=0?document.body.removeAttribute(Nl):document.body.setAttribute(Nl,e.toString())}},[])},Q6=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;G6();var i=x.useMemo(function(){return V6(a)},[a]);return x.createElement(Z6,{styles:K6(i,!t,a,n?"":"!important")})},Bv=!1;if(typeof window<"u")try{var Sf=Object.defineProperty({},"passive",{get:function(){return Bv=!0,!0}});window.addEventListener("test",Sf,Sf),window.removeEventListener("test",Sf,Sf)}catch{Bv=!1}var Lo=Bv?{passive:!1}:!1,Y6=function(e){return e.tagName==="TEXTAREA"},TA=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Y6(e)&&n[t]==="visible")},X6=function(e){return TA(e,"overflowY")},W6=function(e){return TA(e,"overflowX")},ek=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=AA(e,r);if(a){var i=RA(e,r),s=i[1],o=i[2];if(s>o)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},J6=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},e9=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},AA=function(e,t){return e==="v"?X6(t):W6(t)},RA=function(e,t){return e==="v"?J6(t):e9(t)},t9=function(e,t){return e==="h"&&t==="rtl"?-1:1},n9=function(e,t,n,r,a){var i=t9(e,window.getComputedStyle(t).direction),s=i*r,o=n.target,l=t.contains(o),u=!1,d=s>0,f=0,p=0;do{if(!o)break;var h=RA(e,o),y=h[0],m=h[1],b=h[2],g=m-b-i*y;(y||g)&&AA(e,o)&&(f+=g,p+=y);var v=o.parentNode;o=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&o!==document.body||l&&(t.contains(o)||t===o));return(d&&Math.abs(f)<1||!d&&Math.abs(p)<1)&&(u=!0),u},_f=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},tk=function(e){return[e.deltaX,e.deltaY]},nk=function(e){return e&&"current"in e?e.current:e},r9=function(e,t){return e[0]===t[0]&&e[1]===t[1]},a9=function(e){return`
331
- .block-interactivity-`.concat(e,` {pointer-events: none;}
332
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
333
- `)},i9=0,Uo=[];function s9(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),a=x.useState(i9++)[0],i=x.useState(jA)[0],s=x.useRef(e);x.useEffect(function(){s.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var m=N6([e.lockRef.current],(e.shards||[]).map(nk),!0).filter(Boolean);return m.forEach(function(b){return b.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),m.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var o=x.useCallback(function(m,b){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var g=_f(m),v=n.current,w="deltaX"in m?m.deltaX:v[0]-g[0],S="deltaY"in m?m.deltaY:v[1]-g[1],E,C=m.target,T=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&T==="h"&&C.type==="range")return!1;var P=ek(T,C);if(!P)return!0;if(P?E=T:(E=T==="v"?"h":"v",P=ek(T,C)),!P)return!1;if(!r.current&&"changedTouches"in m&&(w||S)&&(r.current=E),!E)return!0;var R=r.current||E;return n9(R,b,m,R==="h"?w:S)},[]),l=x.useCallback(function(m){var b=m;if(!(!Uo.length||Uo[Uo.length-1]!==i)){var g="deltaY"in b?tk(b):_f(b),v=t.current.filter(function(E){return E.name===b.type&&(E.target===b.target||b.target===E.shadowParent)&&r9(E.delta,g)})[0];if(v&&v.should){b.cancelable&&b.preventDefault();return}if(!v){var w=(s.current.shards||[]).map(nk).filter(Boolean).filter(function(E){return E.contains(b.target)}),S=w.length>0?o(b,w[0]):!s.current.noIsolation;S&&b.cancelable&&b.preventDefault()}}},[]),u=x.useCallback(function(m,b,g,v){var w={name:m,delta:b,target:g,should:v,shadowParent:o9(g)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),d=x.useCallback(function(m){n.current=_f(m),r.current=void 0},[]),f=x.useCallback(function(m){u(m.type,tk(m),m.target,o(m,e.lockRef.current))},[]),p=x.useCallback(function(m){u(m.type,_f(m),m.target,o(m,e.lockRef.current))},[]);x.useEffect(function(){return Uo.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Lo),document.addEventListener("touchmove",l,Lo),document.addEventListener("touchstart",d,Lo),function(){Uo=Uo.filter(function(m){return m!==i}),document.removeEventListener("wheel",l,Lo),document.removeEventListener("touchmove",l,Lo),document.removeEventListener("touchstart",d,Lo)}},[]);var h=e.removeScrollBar,y=e.inert;return x.createElement(x.Fragment,null,y?x.createElement(i,{styles:a9(a)}):null,h?x.createElement(Q6,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function o9(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const l9=D6(NA,s9);var gm=x.forwardRef(function(e,t){return x.createElement(mm,va({},e,{ref:t,sideCar:l9}))});gm.classNames=mm.classNames;var ym="Popover",[$A,Cse]=gi(ym,[Cc]),Rd=Cc(),[c9,_s]=$A(ym),OA=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:s=!1}=e,o=Rd(t),l=x.useRef(null),[u,d]=x.useState(!1),[f,p]=vo({prop:r,defaultProp:a??!1,onChange:i,caller:ym});return c.jsx(lA,{...o,children:c.jsx(c9,{scope:t,contentId:ai(),triggerRef:l,open:f,onOpenChange:p,onOpenToggle:x.useCallback(()=>p(h=>!h),[p]),hasCustomAnchor:u,onCustomAnchorAdd:x.useCallback(()=>d(!0),[]),onCustomAnchorRemove:x.useCallback(()=>d(!1),[]),modal:s,children:n})})};OA.displayName=ym;var MA="PopoverAnchor",u9=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=_s(MA,n),i=Rd(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:o}=a;return x.useEffect(()=>(s(),()=>o()),[s,o]),c.jsx(dm,{...i,...r,ref:t})});u9.displayName=MA;var PA="PopoverTrigger",DA=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=_s(PA,n),i=Rd(n),s=ut(t,a.triggerRef),o=c.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":FA(a.open),...r,ref:s,onClick:ve(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?o:c.jsx(dm,{asChild:!0,...i,children:o})});DA.displayName=PA;var Sx="PopoverPortal",[d9,f9]=$A(Sx,{forceMount:void 0}),zA=e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,i=_s(Sx,t);return c.jsx(d9,{scope:t,forceMount:n,children:c.jsx(yi,{present:n||i.open,children:c.jsx(Nd,{asChild:!0,container:a,children:r})})})};zA.displayName=Sx;var sc="PopoverContent",IA=x.forwardRef((e,t)=>{const n=f9(sc,e.__scopePopover),{forceMount:r=n.forceMount,...a}=e,i=_s(sc,e.__scopePopover);return c.jsx(yi,{present:r||i.open,children:i.modal?c.jsx(p9,{...a,ref:t}):c.jsx(m9,{...a,ref:t})})});IA.displayName=sc;var h9=yo("PopoverContent.RemoveScroll"),p9=x.forwardRef((e,t)=>{const n=_s(sc,e.__scopePopover),r=x.useRef(null),a=ut(t,r),i=x.useRef(!1);return x.useEffect(()=>{const s=r.current;if(s)return wx(s)},[]),c.jsx(gm,{as:h9,allowPinchZoom:!0,children:c.jsx(LA,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,s=>{var o;s.preventDefault(),i.current||(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,s=>{const o=s.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0,u=o.button===2||l;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:ve(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),m9=x.forwardRef((e,t)=>{const n=_s(sc,e.__scopePopover),r=x.useRef(!1),a=x.useRef(!1);return c.jsx(LA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,o;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),LA=x.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...f}=e,p=_s(sc,n),h=Rd(n);return xx(),c.jsx(pm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:c.jsx(Sc,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>p.onOpenChange(!1),children:c.jsx(mx,{"data-state":FA(p.open),role:"dialog",id:p.contentId,...h,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),UA="PopoverClose",g9=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=_s(UA,n);return c.jsx(Me.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>a.onOpenChange(!1))})});g9.displayName=UA;var y9="PopoverArrow",v9=x.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=Rd(n);return c.jsx(gx,{...a,...r,ref:t})});v9.displayName=y9;function FA(e){return e?"open":"closed"}var b9=OA,x9=DA,w9=zA,qA=IA;const S9=b9,_9=x9,HA=x.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>c.jsx(w9,{children:c.jsx(qA,{ref:a,align:t,sideOffset:n,className:Ce("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...r})}));HA.displayName=qA.displayName;function k9(e,t){const n=new Date(e).getTime();if(Number.isNaN(n))return"";const r=Math.max(0,Math.floor((t.getTime()-n)/1e3));if(r<60)return`${r}s`;const a=Math.floor(r/60);if(a<60)return`${a}m`;const i=Math.floor(a/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function BA(e,t=24){return e.length>t?`${e.slice(0,t-1)}…`:e}function E9(e){const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n>=0?t.slice(n+1):t}function C9(e){const t=new Map;for(const n of e)t.set(n.deckId,(t.get(n.deckId)??0)+1);return t}function N9(e,t){const n=e>0?`${e} cards`:"Empty";if(t<=0)return n;const r=t===1?"1 session":`${t} sessions`;return`${n}, ${r}`}function j9(e){return e==="agent-admin"?"admin":e==="normal"?"normal":"unknown"}function T9(e){return e==="agent-admin"?"bg-amber-500/20 text-amber-200 ring-1 ring-amber-400/40":e==="normal"?"bg-white/10 text-gray-300 ring-1 ring-white/10":"bg-white/10 text-gray-300"}function A9(e){const t=new Map,n=[],r=new Map;for(const i of e){if(i.workspaceRoot){const s=i.workspaceRoot,o=`${E9(i.workspaceRoot)}/`,l=t.get(s)??{label:o,rows:[],deckIds:new Set};l.rows.push(i),l.deckIds.add(i.deckId),t.set(s,l);continue}n.push(i)}for(const i of n){let s=!1;for(const d of t.values())if(d.deckIds.has(i.deckId)){d.rows.push(i),s=!0;break}if(s)continue;const o=`deck:${i.deckId}`,l=`◆ ${BA(i.deckName)}`,u=r.get(o)??{label:l,rows:[]};u.rows.push(i),r.set(o,u)}return[...[...t.entries()].map(([i,{label:s,rows:o}])=>({key:i,label:s,isWorkspaceGroup:!0,rows:[...o].sort((l,u)=>l.lastActivityAt<u.lastActivityAt?1:-1)})),...[...r.entries()].map(([i,{label:s,rows:o}])=>({key:i,label:s,isWorkspaceGroup:!1,rows:[...o].sort((l,u)=>l.lastActivityAt<u.lastActivityAt?1:-1)}))].sort((i,s)=>i.label.localeCompare(s.label))}function R9(e,t){const{isWorkspaceGroup:n,highlighted:r,clientMeta:a}=t;return!e.workspaceRoot&&n?`no folder · ${a}`:n&&r?a:n?`${BA(e.deckName)} · ${a}`:a}const $9="w-[min(22rem,calc(100vw-2rem))]";function O9({bindings:e,now:t=new Date,highlightDeckId:n,showContainmentNote:r=!1,scrollClassName:a="max-h-64 overflow-y-auto"}){const i=n?e.filter(o=>o.deckId===n).length:0,s=x.useMemo(()=>A9(e),[e]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"border-b border-white/10 px-3 py-2.5",children:c.jsxs("p",{className:"text-sm font-semibold leading-snug",style:{color:Dn},children:["Live sessions",c.jsx("span",{className:"ml-1 font-normal text-gray-400",children:"· match ⌘badge to chat opener"})]})}),r?c.jsx("div",{className:"border-b border-white/10 px-3 py-2 text-xs text-gray-400",children:c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(kL,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-gray-400","aria-hidden":!0}),c.jsxs("p",{children:["Agents are bound to one deck per workspace. Cross-deck service calls return"," ",c.jsx("span",{className:"font-mono text-gray-300",children:"RESOURCE_OUT_OF_SCOPE"}),"."]})]})}):null,n&&i>1?c.jsxs("div",{className:"border-b border-[#92E4DD]/20 bg-[#92E4DD]/5 px-3 py-1.5 text-xs text-gray-300",children:[i," sessions on this deck"]}):null,c.jsx("div",{className:Ce(a,"p-2"),children:s.map(({key:o,label:l,isWorkspaceGroup:u,rows:d})=>c.jsxs("div",{className:"mb-2 last:mb-0",children:[c.jsx("p",{className:"px-1 pb-1 text-[10px] uppercase tracking-wide text-gray-500",children:l}),c.jsx("ul",{className:"space-y-1",children:d.map(f=>{const p=f.clientName??"agent",h=k9(f.lastActivityAt,t),y=h?`${p} · ${h}`:p,m=n===f.deckId,b=R9(f,{isWorkspaceGroup:u,highlighted:m,clientMeta:y});return c.jsxs("li",{className:Ce("rounded-md border-l-2 py-1.5 pl-2 pr-2 font-mono text-xs",m?"border-[#92E4DD] bg-[#92E4DD]/5":"border-transparent bg-white/5"),"data-testid":`live-session-row-${f.badge}`,children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("span",{style:{color:Dn},children:["⌘",f.badge]}),c.jsx("span",{className:Ce("rounded px-1.5 py-0.5 font-sans text-[10px] uppercase tracking-wide",T9(f.mode)),children:j9(f.mode)})]}),c.jsx("span",{className:"mt-0.5 block font-sans text-[10px] text-gray-400",children:b})]},f.badge)})})]},o))})]})}function M9({highlightDeckId:e}){const{data:t}=St({queryKey:["/api/scope/bindings"],refetchInterval:3e3}),n=(t==null?void 0:t.data)??[];if(n.length===0)return null;const r=e?n.filter(a=>a.deckId===e).length:0;return c.jsxs(S9,{children:[c.jsx(_9,{asChild:!0,children:c.jsxs(te,{type:"button",variant:"outline",size:"sm",className:"h-7 shrink-0 border-white/20 bg-black/30 px-2 text-xs text-gray-200 hover:bg-white/10 hover:text-white","data-testid":"live-session-badges-trigger",title:"Live MCP session binds — click for badges",children:[c.jsx(_L,{className:"mr-1 h-3 w-3",style:{color:Dn},"aria-hidden":!0}),c.jsxs("span",{className:"font-mono",children:["⌘",n.length]}),r>0&&r<n.length?c.jsxs("span",{className:"ml-1 text-gray-400",children:["(",r," here)"]}):null]})}),c.jsx(HA,{align:"end",className:Ce($9,"border-white/10 bg-gray-950/95 p-0 text-gray-100"),"data-testid":"live-session-badges-panel",children:c.jsx(O9,{bindings:n,highlightDeckId:e})})]})}var vm="Dialog",[VA,Nse]=gi(vm),[P9,oa]=VA(vm),ZA=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:s=!0}=e,o=x.useRef(null),l=x.useRef(null),[u,d]=vo({prop:r,defaultProp:a??!1,onChange:i,caller:vm});return c.jsx(P9,{scope:t,triggerRef:o,contentRef:l,contentId:ai(),titleId:ai(),descriptionId:ai(),open:u,onOpenChange:d,onOpenToggle:x.useCallback(()=>d(f=>!f),[d]),modal:s,children:n})};ZA.displayName=vm;var KA="DialogTrigger",D9=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=oa(KA,n),i=ut(t,a.triggerRef);return c.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Ex(a.open),...r,ref:i,onClick:ve(e.onClick,a.onOpenToggle)})});D9.displayName=KA;var _x="DialogPortal",[z9,GA]=VA(_x,{forceMount:void 0}),QA=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,i=oa(_x,t);return c.jsx(z9,{scope:t,forceMount:n,children:x.Children.map(r,s=>c.jsx(yi,{present:n||i.open,children:c.jsx(Nd,{asChild:!0,container:a,children:s})}))})};QA.displayName=_x;var op="DialogOverlay",YA=x.forwardRef((e,t)=>{const n=GA(op,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=oa(op,e.__scopeDialog);return i.modal?c.jsx(yi,{present:r||i.open,children:c.jsx(L9,{...a,ref:t})}):null});YA.displayName=op;var I9=yo("DialogOverlay.RemoveScroll"),L9=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=oa(op,n);return c.jsx(gm,{as:I9,allowPinchZoom:!0,shards:[a.contentRef],children:c.jsx(Me.div,{"data-state":Ex(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),xo="DialogContent",XA=x.forwardRef((e,t)=>{const n=GA(xo,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,i=oa(xo,e.__scopeDialog);return c.jsx(yi,{present:r||i.open,children:i.modal?c.jsx(U9,{...a,ref:t}):c.jsx(F9,{...a,ref:t})})});XA.displayName=xo;var U9=x.forwardRef((e,t)=>{const n=oa(xo,e.__scopeDialog),r=x.useRef(null),a=ut(t,n.contentRef,r);return x.useEffect(()=>{const i=r.current;if(i)return wx(i)},[]),c.jsx(WA,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,o=s.button===0&&s.ctrlKey===!0;(s.button===2||o)&&i.preventDefault()}),onFocusOutside:ve(e.onFocusOutside,i=>i.preventDefault())})}),F9=x.forwardRef((e,t)=>{const n=oa(xo,e.__scopeDialog),r=x.useRef(!1),a=x.useRef(!1);return c.jsx(WA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,o;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),WA=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...s}=e,o=oa(xo,n),l=x.useRef(null),u=ut(t,l);return xx(),c.jsxs(c.Fragment,{children:[c.jsx(pm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:c.jsx(Sc,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":Ex(o.open),...s,ref:u,onDismiss:()=>o.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(q9,{titleId:o.titleId}),c.jsx(B9,{contentRef:l,descriptionId:o.descriptionId})]})]})}),kx="DialogTitle",JA=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=oa(kx,n);return c.jsx(Me.h2,{id:a.titleId,...r,ref:t})});JA.displayName=kx;var eR="DialogDescription",tR=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=oa(eR,n);return c.jsx(Me.p,{id:a.descriptionId,...r,ref:t})});tR.displayName=eR;var nR="DialogClose",rR=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=oa(nR,n);return c.jsx(Me.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>a.onOpenChange(!1))})});rR.displayName=nR;function Ex(e){return e?"open":"closed"}var aR="DialogTitleWarning",[jse,iR]=wI(aR,{contentName:xo,titleName:kx,docsSlug:"dialog"}),q9=({titleId:e})=>{const t=iR(aR),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
334
-
335
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
336
-
337
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},H9="DialogDescriptionWarning",B9=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${iR(H9).contentName}}.`;return x.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},V9=ZA,Z9=QA,sR=YA,oR=XA,lR=JA,cR=tR,K9=rR;const ks=V9,G9=Z9,uR=x.forwardRef(({className:e,...t},n)=>c.jsx(sR,{ref:n,className:Ce("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));uR.displayName=sR.displayName;const vi=x.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(G9,{children:[c.jsx(uR,{}),c.jsxs(oR,{ref:r,className:Ce("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,c.jsxs(K9,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[c.jsx(tp,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));vi.displayName=oR.displayName;const bi=({className:e,...t})=>c.jsx("div",{className:Ce("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});bi.displayName="DialogHeader";const xi=x.forwardRef(({className:e,...t},n)=>c.jsx(lR,{ref:n,className:Ce("text-lg font-semibold leading-none tracking-tight",e),...t}));xi.displayName=lR.displayName;const Oo=x.forwardRef(({className:e,...t},n)=>c.jsx(cR,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));Oo.displayName=cR.displayName;const Ya=x.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:Ce("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Ya.displayName="Textarea";var Q9="Label",dR=x.forwardRef((e,t)=>c.jsx(Me.label,{...e,ref:t,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));dR.displayName=Q9;var fR=dR;const Y9=im("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Qe=x.forwardRef(({className:e,...t},n)=>c.jsx(fR,{ref:n,className:Ce(Y9(),e),...t}));Qe.displayName=fR.displayName;var X9=x.createContext(void 0);function Cx(e){const t=x.useContext(X9);return e||t||"ltr"}var Hg="rovingFocusGroup.onEntryFocus",W9={bubbles:!1,cancelable:!0},$d="RovingFocusGroup",[Vv,hR,J9]=Jb($d),[eF,pR]=gi($d,[J9]),[tF,nF]=eF($d),mR=x.forwardRef((e,t)=>c.jsx(Vv.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(Vv.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(rF,{...e,ref:t})})}));mR.displayName=$d;var rF=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,p=x.useRef(null),h=ut(t,p),y=Cx(i),[m,b]=vo({prop:s,defaultProp:o??null,onChange:l,caller:$d}),[g,v]=x.useState(!1),w=qr(u),S=hR(n),E=x.useRef(!1),[C,T]=x.useState(0);return x.useEffect(()=>{const P=p.current;if(P)return P.addEventListener(Hg,w),()=>P.removeEventListener(Hg,w)},[w]),c.jsx(tF,{scope:n,orientation:r,dir:y,loop:a,currentTabStopId:m,onItemFocus:x.useCallback(P=>b(P),[b]),onItemShiftTab:x.useCallback(()=>v(!0),[]),onFocusableItemAdd:x.useCallback(()=>T(P=>P+1),[]),onFocusableItemRemove:x.useCallback(()=>T(P=>P-1),[]),children:c.jsx(Me.div,{tabIndex:g||C===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{E.current=!0}),onFocus:ve(e.onFocus,P=>{const R=!E.current;if(P.target===P.currentTarget&&R&&!g){const $=new CustomEvent(Hg,W9);if(P.currentTarget.dispatchEvent($),!$.defaultPrevented){const j=S().filter(H=>H.focusable),O=j.find(H=>H.active),L=j.find(H=>H.id===m),A=[O,L,...j].filter(Boolean).map(H=>H.ref.current);vR(A,d)}}E.current=!1}),onBlur:ve(e.onBlur,()=>v(!1))})})}),gR="RovingFocusGroupItem",yR=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:s,...o}=e,l=ai(),u=i||l,d=nF(gR,n),f=d.currentTabStopId===u,p=hR(n),{onFocusableItemAdd:h,onFocusableItemRemove:y,currentTabStopId:m}=d;return x.useEffect(()=>{if(r)return h(),()=>y()},[r,h,y]),c.jsx(Vv.ItemSlot,{scope:n,id:u,focusable:r,active:a,children:c.jsx(Me.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...o,ref:t,onMouseDown:ve(e.onMouseDown,b=>{r?d.onItemFocus(u):b.preventDefault()}),onFocus:ve(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ve(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){d.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const g=sF(b,d.orientation,d.dir);if(g!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let w=p().filter(S=>S.focusable).map(S=>S.ref.current);if(g==="last")w.reverse();else if(g==="prev"||g==="next"){g==="prev"&&w.reverse();const S=w.indexOf(b.currentTarget);w=d.loop?oF(w,S+1):w.slice(S+1)}setTimeout(()=>vR(w))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:m!=null}):s})})});yR.displayName=gR;var aF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iF(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function sF(e,t,n){const r=iF(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return aF[r]}function vR(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function oF(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var lF=mR,cF=yR,bm="Tabs",[uF,Tse]=gi(bm,[pR]),bR=pR(),[dF,Nx]=uF(bm),xR=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:s="horizontal",dir:o,activationMode:l="automatic",...u}=e,d=Cx(o),[f,p]=vo({prop:r,onChange:a,defaultProp:i??"",caller:bm});return c.jsx(dF,{scope:n,baseId:ai(),value:f,onValueChange:p,orientation:s,dir:d,activationMode:l,children:c.jsx(Me.div,{dir:d,"data-orientation":s,...u,ref:t})})});xR.displayName=bm;var wR="TabsList",SR=x.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...a}=e,i=Nx(wR,n),s=bR(n);return c.jsx(lF,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:c.jsx(Me.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});SR.displayName=wR;var _R="TabsTrigger",kR=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=e,s=Nx(_R,n),o=bR(n),l=NR(s.baseId,r),u=jR(s.baseId,r),d=r===s.value;return c.jsx(cF,{asChild:!0,...o,focusable:!a,active:d,children:c.jsx(Me.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:l,...i,ref:t,onMouseDown:ve(e.onMouseDown,f=>{!a&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:ve(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:ve(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!a&&f&&s.onValueChange(r)})})})});kR.displayName=_R;var ER="TabsContent",CR=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...s}=e,o=Nx(ER,n),l=NR(o.baseId,r),u=jR(o.baseId,r),d=r===o.value,f=x.useRef(d);return x.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),c.jsx(yi,{present:a||d,children:({present:p})=>c.jsx(Me.div,{"data-state":d?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:p&&i})})});CR.displayName=ER;function NR(e,t){return`${e}-trigger-${t}`}function jR(e,t){return`${e}-content-${t}`}var fF=xR,TR=SR,AR=kR,RR=CR;const hF=fF,$R=x.forwardRef(({className:e,...t},n)=>c.jsx(TR,{ref:n,className:Ce("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));$R.displayName=TR.displayName;const Zv=x.forwardRef(({className:e,...t},n)=>c.jsx(AR,{ref:n,className:Ce("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Zv.displayName=AR.displayName;const Kv=x.forwardRef(({className:e,...t},n)=>c.jsx(RR,{ref:n,className:Ce("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Kv.displayName=RR.displayName;function Eu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function OR(e){return Eu(e)&&typeof e.command=="string"}function Bg(e){return!Eu(e)||Object.keys(e).length===0?!1:Object.values(e).every(OR)}function pF(e){let t=e.trim();return t.startsWith("```")?t.replace(/^```(?:json)?\s*\n?/i,"").replace(/\n?```\s*$/,"").trim():t}function mF(e){if(!Eu(e))throw new Error("Configuration must be a JSON object");if(Eu(e.config)&&Bg(e.config.mcpServers))return{mcpServers:e.config.mcpServers};if(Bg(e.mcpServers))return{mcpServers:e.mcpServers};if(Eu(e)&&typeof e.command=="string"){const t=typeof e.name=="string"&&e.name.trim()?e.name.trim():"local-server",{name:n,...r}=e;if(!OR(r))throw new Error("Missing or invalid command");return{mcpServers:{[t]:r}}}if(Bg(e))return{mcpServers:e};throw new Error(`Invalid configuration: expected a top-level "mcpServers" object. Example:
338
- {
339
- "mcpServers": {
340
- "google-drive": {
341
- "command": "npx",
342
- "args": ["-y", "@piotr-agier/google-drive-mcp"]
343
- }
344
- }
345
- }`)}function gF(e){let t;try{t=JSON.parse(pF(e))}catch(n){throw new Error(`Failed to parse JSON: ${n instanceof Error?n.message:"Unknown error"}`)}return mF(t)}function yF({type:e,open:t,onOpenChange:n}){const[r,a]=x.useState("remote"),[i,s]=x.useState("json"),[o,l]=x.useState(`{
346
- "mcpServers": {
347
- "memory": {
348
- "command": "npx",
349
- "args": ["-y", "@modelcontextprotocol/server-memory"],
350
- "env": {
351
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
352
- }
353
- }
354
- }
355
- }`),[u,d]=x.useState(null),[f,p]=x.useState(null),[h,y]=x.useState(null),[m,b]=x.useState({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:Dn}),[g,v]=x.useState(`{
356
-
357
- }`),[w,S]=x.useState(null),[E,C]=x.useState({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:Dn}),[T,P]=x.useState({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:Dn}),R=un(),{toast:$}=rn(),j=()=>{try{p(null);const k=gF(o),M=Object.entries(k.mcpServers);if(M.length===0)throw new Error("No MCP servers found in configuration");if(M.length>1)throw new Error("Multiple servers not supported. Please configure one server at a time.");const[I,K]=M[0],{command:G,args:re,env:oe,description:he}=K;if(!G||typeof G!="string")throw new Error("Missing or invalid command");if(!re||!Array.isArray(re))throw new Error("Missing or invalid args array");const Se={name:I,command:G,args:re.map(String),env:oe&&typeof oe=="object"?oe:void 0,description:he&&typeof he=="string"?he:void 0};d(Se),s("review"),C({name:Se.name,type:"local-mcp",command:Se.command,args:Se.args,env:Se.env||{},description:Se.description||"",cardColor:Dn}),O(I)}catch(k){p(k instanceof Error?k.message:"Failed to parse JSON"),d(null)}},O=async k=>{try{const K=((await we("GET","/api/services")).data||[]).find(G=>G.name===k);y(K?k:null)}catch(M){console.error("Failed to check name conflict:",M)}},L=async k=>{await O(k)},D=_t({mutationFn:async k=>{if(e==="mcp"&&r==="local"){const M={mcpServers:{[k.name]:{command:k.command,args:k.args.filter(I=>I.trim()!==""),...Object.keys(k.env).length>0&&{env:k.env}}}};return console.log("Importing local MCP server:",M),we("POST","/api/local-mcp/import",{config:JSON.stringify(M)})}else{const M={name:k.name,type:e,url:e==="mcp"?k.url:k.manifest_url,description:k.description,cardColor:k.cardColor,...k.headers_enabled&&{headers:k.headers}};return console.log("Sending service data:",M),we("POST","/api/services",M)}},onSuccess:()=>{R.invalidateQueries({queryKey:["/api/services"]}),R.invalidateQueries({queryKey:["/api/collection/warnings"]}),$({title:"Service registered successfully!",description:`${(e==="mcp"?r==="remote"?m:E:T).name} has been added to your collection.`}),H()},onError:k=>{var M;console.error("Registration failed:",k),console.error("Error details:",{message:k==null?void 0:k.message,name:k==null?void 0:k.name,stack:k==null?void 0:k.stack,toString:k==null?void 0:k.toString(),constructor:(M=k==null?void 0:k.constructor)==null?void 0:M.name}),$({title:"Registration failed",description:(k==null?void 0:k.message)||"Failed to register service. Please try again.",variant:"destructive"})}}),A=async()=>{if(e==="mcp"&&r==="local"){if(i==="json")j();else if(i==="review"){if(await L(E.name),h){$({title:"Name Conflict",description:`A service with the name "${E.name}" already exists. Please choose a different name.`,variant:"destructive"});return}D.mutate(E)}}else{const k=e==="mcp"?r==="remote"?m:E:T;if(await L(k.name),h){$({title:"Name Conflict",description:`A service with the name "${k.name}" already exists. Please choose a different name.`,variant:"destructive"});return}if(e==="mcp"&&r==="remote"&&m.headers_enabled){const M=Y();if(M===null)return;D.mutate({...m,headers:M});return}D.mutate(k)}},H=()=>{s("json"),l(`{
358
- "mcpServers": {
359
- "memory": {
360
- "command": "npx",
361
- "args": ["-y", "@modelcontextprotocol/server-memory"],
362
- "env": {
363
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
364
- }
365
- }
366
- }
367
- }`),d(null),p(null),y(null),b({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:Dn}),v(`{
368
-
369
- }`),S(null),C({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:Dn}),P({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:Dn}),n(!1)},B=(k,M)=>{b(I=>({...I,[k]:M}))},U=k=>{B("headers_enabled",k),k&&g.trim()===`{
370
-
371
- }`&&v(`{
372
- "Authorization": "Bearer "
373
- }`),k||S(null)},Y=()=>{const k=g.trim();if(!k||k==="{}")return{};try{const M=JSON.parse(k);if(typeof M!="object"||M===null||Array.isArray(M))return S('Headers must be a JSON object (e.g. {"Authorization": "Bearer token"})'),null;for(const[I,K]of Object.entries(M))if(typeof K!="string")return S(`Header "${I}" must be a string value`),null;return S(null),M}catch{return S("Invalid JSON — fix syntax before registering"),null}},N=(k,M)=>{C(I=>({...I,[k]:M}))},F=(k,M)=>{P(I=>({...I,[k]:M}))},V=()=>{if(e==="mcp"&&r==="local"){if(i==="json")return"Parse Configuration";if(i==="review")return h?"Register Anyway":"Register Service"}return"Register Service"},_=()=>{var k,M;if(e==="mcp"&&r==="local"){if(i==="json")return!o.trim();if(i==="review")return!E.name.trim()||!E.command.trim()}else{const I=e==="mcp"?r==="remote"?m:E:T;return!I.name.trim()||e==="mcp"&&r==="remote"&&!((k=I.url)!=null&&k.trim())||e==="a2a"&&!((M=I.manifest_url)!=null&&M.trim())}return!1};return c.jsx(ks,{open:t,onOpenChange:n,children:c.jsxs(vi,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto bg-black/40 backdrop-blur-md border border-white/10 text-white shadow-2xl",children:[c.jsxs(bi,{children:[c.jsxs(xi,{className:"text-2xl font-bold flex items-center",style:{background:"linear-gradient(to right, #C4B643, #D4C760)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:[e==="mcp"?c.jsx(ep,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}):c.jsx(gL,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}),"Register ",e==="mcp"?"MCP Server":"A2A Agent"]}),c.jsx(Oo,{className:"mt-2",style:{color:"#92E4DD",opacity:.8},children:e==="mcp"?"Add a new Model Context Protocol (MCP) server to your service deck. Configure the server URL and provide details for registration.":"Register a new A2A agent with your service deck. Provide the agent manifest and configuration details."})]}),e==="mcp"?c.jsxs(hF,{value:r,onValueChange:k=>a(k),className:"w-full",children:[c.jsxs($R,{className:"grid w-full grid-cols-2 bg-white/10 border border-white/20",children:[c.jsxs(Zv,{value:"remote",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[c.jsx(ep,{className:"w-4 h-4 mr-2"}),"Remote MCP"]}),c.jsxs(Zv,{value:"local",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[c.jsx(EL,{className:"w-4 h-4 mr-2"}),"Local MCP"]})]}),c.jsxs(Kv,{value:"remote",className:"space-y-4 mt-4",children:[c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),c.jsx(it,{id:"name",placeholder:"e.g., Database Tools",value:m.name,onChange:k=>{B("name",k.target.value),k.target.value.trim()?L(k.target.value):y(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),h&&c.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[c.jsx(Mr,{className:"w-4 h-4"}),c.jsx("span",{children:"A service with this name already exists"})]})]}),c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"MCP URL"}),c.jsx(it,{id:"url",type:"url",placeholder:"http://localhost:8080/mcp or https://mcp.notion.com/mcp",value:m.url,onChange:k=>B("url",k.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-mcp-url"}),c.jsxs("div",{className:"mt-1 text-xs text-gray-400",children:[c.jsx("p",{children:"Supported formats:"}),c.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[c.jsxs("li",{children:["HTTP MCP: ",c.jsx("code",{children:"http://localhost:8080/mcp"})]}),c.jsxs("li",{children:["SSE MCP: ",c.jsx("code",{children:"https://be.omnimcp.ai/api/v1/mcp/.../sse"})]}),c.jsxs("li",{children:["Notion MCP: ",c.jsx("code",{children:"https://mcp.notion.com/mcp"})]})]})]})]}),c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),c.jsx(Ya,{id:"description",placeholder:"Brief description of capabilities...",value:m.description,onChange:k=>B("description",k.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),c.jsxs(Kv,{value:"local",className:"space-y-4 mt-4",children:[i==="json"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"local-json",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Local MCP Configuration (JSON)"}),c.jsx(Ya,{id:"local-json",placeholder:`{
374
- "mcpServers": {
375
- "memory": {
376
- "command": "npx",
377
- "args": ["-y", "@modelcontextprotocol/server-memory"]
378
- }
379
- }
380
- }`,value:o,onChange:k=>l(k.target.value),rows:12,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs","data-testid":"textarea-local-json"}),c.jsxs("div",{className:"mt-2 text-xs text-gray-400",children:[c.jsx("p",{children:"Enter your local MCP server configuration in JSON format."}),c.jsx("p",{children:"Example:"}),c.jsx("pre",{className:"bg-white/10 p-2 rounded-md text-xs text-gray-300",children:`{
381
- "mcpServers": {
382
- "memory": {
383
- "command": "npx",
384
- "args": ["-y", "@modelcontextprotocol/server-memory"],
385
- "env": {
386
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
387
- }
388
- }
389
- }
390
- }`})]})]}),c.jsxs(te,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:j,disabled:!o.trim()||o.trim().length<10,"data-testid":"button-parse-json",children:[c.jsx(Dv,{className:"w-4 h-4 mr-2",style:{color:"#0A0A07"}}),"Parse Configuration"]})]}),i==="review"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"local-name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),c.jsx(it,{id:"local-name",placeholder:"e.g., Memory Server",value:E.name,onChange:k=>{N("name",k.target.value),k.target.value.trim()?L(k.target.value):y(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-local-service-name"}),h&&c.jsxs("div",{className:"mt-2 text-xs text-red-400 flex items-center",children:[c.jsx(Mr,{className:"w-4 h-4 mr-1"}),'A service with the name "',h,'" already exists.']})]}),c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"command",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Command"}),c.jsx(it,{id:"command",placeholder:"e.g., npx, python, node",value:E.command,onChange:k=>N("command",k.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-command"}),c.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"The command to execute (e.g., npx, python, node)"})]}),c.jsxs("div",{children:[c.jsx(Qe,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Arguments"}),E.args.map((k,M)=>c.jsxs("div",{className:"flex gap-2 mb-2",children:[c.jsx(it,{placeholder:`Argument ${M+1}`,value:k,onChange:I=>{const K=[...E.args];K[M]=I.target.value,N("args",K)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-arg-${M}`}),M===E.args.length-1&&c.jsx(te,{type:"button",size:"sm",onClick:()=>N("args",[...E.args,""]),className:"bg-white/20 hover:bg-white/30 text-white",children:c.jsx(Ks,{className:"w-4 h-4"})}),E.args.length>1&&c.jsx(te,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const I=E.args.filter((K,G)=>G!==M);N("args",I)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:c.jsx(tp,{className:"w-4 h-4"})})]},M)),c.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"Command arguments (e.g., -y, @modelcontextprotocol/server-memory)"})]}),c.jsxs("div",{children:[c.jsx(Qe,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Environment Variables"}),Object.entries(E.env).length===0?c.jsx("div",{className:"text-gray-400 text-sm italic",children:"No environment variables configured"}):c.jsx("div",{className:"space-y-2",children:Object.entries(E.env).map(([k,M],I)=>c.jsxs("div",{className:"flex gap-2",children:[c.jsx(it,{placeholder:"Variable name",value:k,onChange:K=>{const G={...E.env};delete G[k],G[K.target.value]=M,N("env",G)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-key-${I}`}),c.jsx(it,{placeholder:"Value",value:M,onChange:K=>{const G={...E.env};G[k]=K.target.value,N("env",G)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-value-${I}`}),c.jsx(te,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const K={...E.env};delete K[k],N("env",K)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:c.jsx(tp,{className:"w-4 h-4"})})]},I))}),c.jsxs(te,{type:"button",size:"sm",onClick:()=>{const k={...E.env};k[""]="",N("env",k)},className:"mt-2 bg-white/20 hover:bg-white/30 text-white",children:[c.jsx(Ks,{className:"w-4 h-4 mr-2"}),"Add Environment Variable"]}),c.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"Environment variables for the MCP server process"})]}),c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"local-description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),c.jsx(Ya,{id:"local-description",placeholder:"Brief description of capabilities...",value:E.description,onChange:k=>N("description",k.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-local-description"})]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx(te,{type:"button",variant:"outline",className:"flex-1 border-white/20 text-white hover:bg-white/10",onClick:()=>s("json"),"data-testid":"button-back-to-json",children:"← Back to JSON"}),c.jsxs(te,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${ga}`,style:ya(Dn),onClick:A,disabled:_(),"data-testid":"button-register",children:[c.jsx(Ks,{className:"w-4 h-4 mr-2"}),D.isPending?"Registering...":V()]})]})]}),i==="complete"&&c.jsxs("div",{className:"text-center py-8",children:[c.jsx(Dv,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),c.jsx("h3",{className:"text-xl font-bold mb-2",style:{color:"#92E4DD"},children:"Local MCP Registered!"}),c.jsx("p",{className:"text-gray-400 mb-4",children:"Your local MCP server has been successfully registered."}),c.jsx(te,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:H,"data-testid":"button-close",children:"Close"})]})]})]}):c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Agent Name"}),c.jsx(it,{id:"name",placeholder:"e.g., Code Assistant",value:T.name,onChange:k=>{F("name",k.target.value),k.target.value.trim()?L(k.target.value):y(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),h&&c.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[c.jsx(Mr,{className:"w-4 h-4"}),c.jsx("span",{children:"A service with this name already exists"})]})]}),c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"manifest_url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Manifest URL"}),c.jsx(it,{id:"manifest_url",type:"url",placeholder:"http://localhost:8001/.well-known/a2a/manifest.json",value:T.manifest_url,onChange:k=>F("manifest_url",k.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-manifest-url"})]}),c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),c.jsx(Ya,{id:"description",placeholder:"Brief description of capabilities...",value:T.description,onChange:k=>F("description",k.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),e==="mcp"&&r==="remote"&&c.jsxs("div",{className:"space-y-4 border border-white/10 rounded-lg p-4",children:[c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx("input",{type:"checkbox",id:"headers_enabled",checked:m.headers_enabled,onChange:k=>U(k.target.checked),className:"rounded border-white/20 bg-white/10"}),c.jsx(Qe,{htmlFor:"headers_enabled",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"🔐 Authentication Required"})]}),c.jsx("div",{className:"text-xs text-gray-400",children:c.jsx("p",{children:"Enable this if your MCP server requires authentication (API keys, tokens, etc.)."})}),m.headers_enabled&&c.jsxs("div",{className:"space-y-3 pl-6",children:[c.jsxs("div",{className:"text-xs text-gray-400 mb-2",children:[c.jsx("p",{children:"Configure HTTP headers for authentication. Common examples:"}),c.jsxs("ul",{className:"list-disc list-inside ml-2 mt-1 space-y-1",children:[c.jsxs("li",{children:[c.jsx("code",{children:"Authorization: Bearer YOUR_TOKEN"})," - For API tokens"]}),c.jsxs("li",{children:[c.jsx("code",{children:"X-API-Key: YOUR_API_KEY"})," - For API keys"]}),c.jsxs("li",{children:[c.jsx("code",{children:"X-Custom-Header: value"})," - For custom headers"]})]})]}),c.jsxs("div",{children:[c.jsx(Qe,{htmlFor:"headers",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"HTTP Headers (JSON)"}),c.jsx(Ya,{id:"headers",placeholder:`{
391
- "Authorization": "Bearer YOUR_TOKEN_HERE",
392
- "X-API-Key": "YOUR_API_KEY_HERE"
393
- }`,value:g,onChange:k=>{v(k.target.value),w&&S(null)},onBlur:()=>{g.trim()&&Y()},rows:6,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs","data-testid":"textarea-headers"}),w&&c.jsxs("p",{className:"text-red-400 text-xs mt-1 flex items-center gap-1",children:[c.jsx(Mr,{className:"w-3 h-3 shrink-0"}),w]}),c.jsx("div",{className:"text-xs text-gray-400 mt-1",children:c.jsx("p",{children:"Enter headers as JSON. Keys are header names, values are header values."})})]})]})]}),f&&c.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[c.jsx(Mr,{className:"w-4 h-4 mr-1"}),f]}),h&&c.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[c.jsx(Mr,{className:"w-4 h-4 mr-1"}),'A service with the name "',h,'" already exists. You can register it anyway, but it might overwrite the existing one.']}),c.jsxs("div",{className:"flex space-x-3 pt-4",children:[c.jsx(te,{type:"button",variant:"secondary",className:"flex-1 border text-white",style:{background:"#ad095e",borderColor:"#ad095e"},onClick:H,"data-testid":"button-cancel",children:"Cancel"}),!(e==="mcp"&&r==="local")&&c.jsxs(te,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${ga}`,style:ya(Dn),disabled:D.isPending||_(),"data-testid":"button-register",onClick:A,children:[c.jsx(Ks,{className:"w-4 h-4 mr-2"}),D.isPending?"Registering...":"Register Service"]})]})]})})}async function MR(e){return(await(await we("POST","/api/export",{scope:e.scope??"collection",...e.deckId?{deckId:e.deckId}:{}})).json()).data}async function vF(e){return(await(await we("POST","/api/import",e)).json()).data}function PR(e,t){const n=new Blob([`${JSON.stringify(e,null,2)}
394
- `],{type:"application/json"}),r=URL.createObjectURL(n),a=document.createElement("a");a.href=r,a.download=t,a.click(),URL.revokeObjectURL(r)}function bF(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"deck"}function rk(e){const{services:t,playbooks:n,decks:r}=e.counts;return`Decks +${r.created} / skipped ${r.reused}. Services +${t.created} / skipped ${t.reused}. Playbooks +${n.created} / skipped ${n.reused}.`}function xF({decks:e,editingDeckId:t,onSelectDeck:n,isLoading:r}){const[a,i]=x.useState(!1),[s,o]=x.useState(""),l=un(),{toast:u}=rn(),{data:d}=St({queryKey:["/api/scope/bindings"],refetchInterval:3e3}),f=x.useMemo(()=>C9((d==null?void 0:d.data)??[]),[d]),p=_t({mutationFn:async S=>we("POST","/api/decks",{name:S,isActive:!1}),onSuccess:async(S,E)=>{var T;const C=await S.json();l.invalidateQueries({queryKey:["/api/decks"]}),(T=C.data)!=null&&T.id&&n(C.data.id),u({title:"Deck created",description:`${E} has been created successfully.`}),i(!1),o("")},onError:S=>{u({title:"Failed to create deck",description:S.message,variant:"destructive"})}}),h=_t({mutationFn:async S=>{const E=await MR({scope:"deck",deckId:S.id});return PR(E,`${bF(S.name)}.agent-deck.json`),E},onSuccess:(S,E)=>{u({title:"Deck exported",description:`${E.name}: ${S.services.length} services, ${S.playbooks.length} playbooks`})},onError:S=>{u({title:"Export failed",description:S.message,variant:"destructive"})}}),y=(S,E)=>{S.stopPropagation(),h.mutate(E)},m=_t({mutationFn:async S=>we("DELETE",`/api/decks/${S}`,{}),onSuccess:()=>{l.invalidateQueries({queryKey:["/api/decks"]}),u({title:"Deck deleted",description:"Your deck has been deleted successfully."})},onError:S=>{S.message.includes("Cannot delete the last deck")?u({title:"Cannot delete deck",description:"You cannot delete the last deck. Please create another deck first.",variant:"destructive"}):u({title:"Failed to delete deck",description:S.message,variant:"destructive"})}}),b=async(S,E)=>{S.stopPropagation();try{await navigator.clipboard.writeText(E.id),u({title:"Copied deck id",description:"Use with bind_workspace({ workspaceRoot, deckId }) in your agent."})}catch(C){u({title:"Failed to copy deck id",description:C instanceof Error?C.message:"Unknown error",variant:"destructive"})}},g=(S,E)=>{S.stopPropagation(),window.confirm("Are you sure you want to delete this deck? This action cannot be undone.")&&m.mutate(E)},v=S=>{S.preventDefault();const E=s.trim();E&&p.mutate(E)},w=S=>{var E,C,T;return(((E=S.services)==null?void 0:E.length)??0)+(((C=S.credentials)==null?void 0:C.length)??0)+(((T=S.playbooks)==null?void 0:T.length)??0)};return r?c.jsx("div",{className:"bg-black/40 backdrop-blur-md rounded-2xl border border-white/10 p-6 shadow-2xl",children:c.jsxs("div",{className:"animate-pulse space-y-4",children:[c.jsx("div",{className:"h-6 bg-white/10 rounded"}),c.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((S,E)=>c.jsx("div",{className:"h-16 bg-white/5 rounded-lg"},E))})]})}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"h-full flex flex-col","data-testid":"deck-management-panel",children:[c.jsxs("h2",{className:"text-lg font-bold mb-3 flex items-center",children:[c.jsx(Jh,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),c.jsx("span",{style:{color:"#92E4DD"},children:"My Decks"})]}),c.jsx("div",{className:"mb-3",children:c.jsxs(te,{onClick:()=>i(!0),className:"w-full border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"create-deck-button",children:[c.jsx(Ks,{className:"w-3 h-3 mr-2"}),"Add Deck"]})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsx("div",{className:"space-y-2",children:e.map(S=>{const E=S.id===t,C=w(S),T=f.get(S.id)??0,P=N9(C,T);return c.jsxs("div",{className:`p-2 rounded-lg border cursor-pointer transition-all relative group ${E?"bg-gradient-to-r from-yellow-500/20 to-yellow-600/20 border-2 border-yellow-500/40 hover:border-yellow-400/60":"bg-white/5 border border-white/10 hover:border-white/20"}`,onClick:()=>n(S.id),"data-testid":`deck-item-${S.id}`,children:[c.jsxs("div",{className:"absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:[c.jsx(te,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:R=>y(R,S),title:"Export this deck","data-testid":`export-deck-${S.id}`,children:c.jsx(TT,{className:"w-2 h-2"})}),c.jsx(te,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:R=>b(R,S),title:"Copy deck id for bind_workspace",children:c.jsx(ax,{className:"w-2 h-2"})}),c.jsx(te,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:R=>g(R,S.id),title:"Delete deck",children:c.jsx(Td,{className:"w-2 h-2"})})]}),c.jsxs("div",{children:[c.jsx("h3",{className:`font-semibold text-sm pr-16 ${E?"text-yellow-300":"text-white"}`,children:S.name}),c.jsx("p",{className:"text-xs text-gray-400 select-none pointer-events-none",children:P})]})]},S.id)})})})]}),c.jsx(ks,{open:a,onOpenChange:i,children:c.jsxs(vi,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsx(bi,{children:c.jsxs(xi,{className:"flex items-center text-xl font-bold",children:[c.jsx(Jh,{className:"mr-2 h-5 w-5",style:{color:"#92E4DD"}}),"Create New Deck"]})}),c.jsxs("form",{onSubmit:v,className:"space-y-4","data-testid":"form-create-deck",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"deckName",children:"Deck Name"}),c.jsx(it,{id:"deckName",placeholder:"e.g., Hiring stack",value:s,onChange:S=>o(S.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#A8C4C0]/60",required:!0,"data-testid":"input-deck-name"})]}),c.jsxs("div",{className:"flex gap-3 pt-2",children:[c.jsx(te,{type:"button",variant:"outline",className:"flex-1 rounded-full border-white/20 text-[#E8F6F4] hover:bg-white/10",onClick:()=>i(!1),"data-testid":"button-cancel-create",children:"Cancel"}),c.jsx(te,{type:"submit",className:"flex-1 rounded-full border px-6 text-sm font-semibold hover:opacity-90",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},disabled:p.isPending,"data-testid":"button-submit-create",children:p.isPending?"Creating…":"Create Deck"})]})]})]})})]})}function wF({open:e,onOpenChange:t}){const[n,r]=x.useState(""),[a,i]=x.useState(""),s=un(),{toast:o}=rn(),l=_t({mutationFn:async()=>we("POST","/api/credentials",{label:n.trim(),value:a}),onSuccess:()=>{s.invalidateQueries({queryKey:["/api/credentials/vault"]}),s.invalidateQueries({queryKey:["/api/decks"]}),o({title:"API key saved",description:`${n.trim()} is stored securely. Your agent can use it from the active deck.`}),t(!1),r(""),i("")},onError:d=>{o({title:"Could not save API key",description:d.message,variant:"destructive"})}}),u=n.trim().length>0&&a.trim().length>0;return c.jsx(ks,{open:e,onOpenChange:t,children:c.jsxs(vi,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(bi,{children:[c.jsx(xi,{className:"text-[#E8F6F4]",children:"Register API key"}),c.jsx(Oo,{className:"text-[#A8C4C0]",children:"Name the service and paste the key. Agent Deck handles the rest — stored in your vault, never shown again."})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"credential-name",className:"text-[#CFEAE6]",children:"Service name"}),c.jsx(it,{id:"credential-name",placeholder:"OpenAI, Linear, Slack…",value:n,onChange:d=>r(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"credential-value",className:"text-[#CFEAE6]",children:"API key"}),c.jsx(it,{id:"credential-value",type:"password",placeholder:"Paste key from the service dashboard",value:a,onChange:d=>i(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),c.jsx(te,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${ga}`,style:ya(Xn),onClick:()=>l.mutate(),disabled:!u||l.isPending,children:"Save to vault"})]})]})})}function SF({open:e,onOpenChange:t}){const[n,r]=x.useState(""),[a,i]=x.useState(""),[s,o]=x.useState(""),[l,u]=x.useState(""),[d,f]=x.useState(""),[p,h]=x.useState([]),[y,m]=x.useState([]),b=un(),{toast:g}=rn(),{data:v}=St({queryKey:["/api/credentials/vault"],enabled:e}),{data:w}=St({queryKey:["/api/services"],enabled:e}),S=(v==null?void 0:v.data)??[],E=(w==null?void 0:w.data)??[],C=_t({mutationFn:async()=>we("POST","/api/playbooks",{title:n.trim(),body:a,triggers:s.split(",").map(R=>R.trim()).filter(Boolean),dependsOnCredentialIds:p,dependsOnServiceIds:y,exec:l.trim()||void 0,skill:d.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{b.invalidateQueries({queryKey:["/api/playbooks/vault"]}),g({title:"Playbook saved",description:`${n.trim()} is in your collection.`}),t(!1),r(""),i(""),o(""),u(""),f(""),h([]),m([])},onError:R=>{g({title:"Could not save playbook",description:R.message,variant:"destructive"})}}),T=(R,$,j)=>{j(R.includes($)?R.filter(O=>O!==$):[...R,$])},P=n.trim().length>0&&a.trim().length>0;return c.jsx(ks,{open:e,onOpenChange:t,children:c.jsxs(vi,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(bi,{children:[c.jsx(xi,{children:"Register Playbook"}),c.jsxs(Oo,{className:"text-[#A8C4C0]",children:["Prefer"," ",c.jsx("span",{className:"font-mono text-xs",children:"register_playbook"})," /"," ",c.jsx("span",{className:"font-mono text-xs",children:"update_playbook"})," from your AI agent. This form also auto-detects API key and MCP dependencies from the content on save."]})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"playbook-title",children:"Title"}),c.jsx(it,{id:"playbook-title",placeholder:"Hiring inbox, Ashby API guide…",value:n,onChange:R=>r(R.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"playbook-triggers",children:"Triggers (comma-separated, max 16)"}),c.jsx(it,{id:"playbook-triggers",placeholder:"check inbox, review applicants",value:s,onChange:R=>o(R.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"playbook-body",children:"Instructions (markdown)"}),c.jsx(Ya,{id:"playbook-body",rows:8,placeholder:`# Steps
395
- 1. …
396
- 2. …`,value:a,onChange:R=>i(R.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-sm"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{children:"Extra API key deps (optional)"}),c.jsx("p",{className:"text-xs text-gray-500",children:"Merged with auto-detected refs from content."}),c.jsx("div",{className:"max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1",children:S.length===0?c.jsx("p",{className:"text-xs text-gray-500",children:"No API keys registered yet."}):S.map(R=>c.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:p.includes(R.id),onChange:()=>T(p,R.id,h)}),R.label]},R.id))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{children:"Extra MCP deps (optional)"}),c.jsx("p",{className:"text-xs text-gray-500",children:"Merged with auto-detected refs from content."}),c.jsx("div",{className:"max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1",children:E.length===0?c.jsx("p",{className:"text-xs text-gray-500",children:"No MCP services registered yet."}):E.map(R=>c.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:y.includes(R.id),onChange:()=>T(y,R.id,m)}),R.name]},R.id))})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"playbook-exec",children:"Suggested exec (optional)"}),c.jsx(it,{id:"playbook-exec",placeholder:"agent-deck exec --connections … -- uv run …",value:l,onChange:R=>u(R.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"playbook-skill",children:"Skill path hint (optional)"}),c.jsx(it,{id:"playbook-skill",placeholder:".cursor/skills/…/SKILL.md",value:d,onChange:R=>f(R.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),c.jsx(te,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${ga}`,style:ya(Yr),onClick:()=>C.mutate(),disabled:!P||C.isPending,children:"Save to collection"})]})]})})}async function Od(e){const t=await e.json();if(!t.success)throw new Error(t.error??"Request failed");return t.data}function ak(e){return e.length===0?null:e.length<=3?e.join(", "):`${e.slice(0,3).join(", ")} and ${e.length-3} more`}async function Gv(e){const t=e?`?status=${encodeURIComponent(e)}`:"",n=await we("GET",`/api/playbook-patches${t}`);return Od(n)}async function _F(e){const t=await we("GET",`/api/playbook-patches/${e}/preview`);return Od(t)}async function kF(e){const t=await we("POST",`/api/playbook-patches/${e}/accept`);return Od(t)}async function EF(e,t){const n=await we("POST",`/api/playbook-patches/${e}/reject`,{});return Od(n)}async function CF(e){const t=await we("GET",`/api/playbooks/${e}/events/count`);return Od(t)}async function jx(e){const t=await e.json();if(!t.success)throw new Error(t.error??"Request failed");return t.data}async function DR(e){const t=new URLSearchParams({available:"1"});e&&t.set("playbookId",e);const n=await we("GET",`/api/feedback-signals/count?${t.toString()}`);return(await jx(n)).open}async function NF(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.playbookId&&t.set("playbookId",e.playbookId),e!=null&&e.deckId&&t.set("deckId",e.deckId),(e==null?void 0:e.excludeInProposal)!==void 0&&t.set("excludeInProposal",e.excludeInProposal?"true":"false");const n=t.toString()?`?${t.toString()}`:"",r=await we("GET",`/api/feedback-signals${n}`);return jx(r)}async function jF(e){const t=await we("POST","/api/feedback-signals/discard",{signalIds:e});return jx(t)}function TF(e){return!!e.linkedPatchId&&e.status==="open"}function lh(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n")}"`}function AF(e){return e==null||e===""?"null":lh(e)}function RF(e){return`Propose playbook updates from these Agent Deck feedback signals (copied from the Feedback table).
397
-
398
- For each coherent pattern:
399
- 1. Call \`propose_playbook_patch\` with consolidated item ops (prefer \`add_item\`) — or kind \`create\` when there is no playbook.
400
- 2. Pass **every** consumed row \`id\` in \`signal_ids\` so we can track which feedback is parked / solved.
401
- 3. Do not invent a list-feedback MCP tool. Discard noise in the dashboard.
402
-
403
- Signals (\`id\` required for tracking):
404
-
405
- \`\`\`yaml
406
- ${e.map(n=>{const r=[`- id: ${n.id}`,` playbook: ${AF(n.candidatePlaybookId)}`,` feedback: ${lh(n.userFeedbackExcerpt)}`,` failure: ${lh(n.failureSummary)}`];return n.correctedOutputHint&&r.push(` hint: ${lh(n.correctedOutputHint)}`),n.candidateDeckId&&r.push(` deck: ${n.candidateDeckId}`),r.join(`
407
- `)}).join(`
408
- `)}
409
- \`\`\``}function $F({playbookId:e,open:t,onOpenChange:n}){const{data:r,isLoading:a}=St({queryKey:e?[`/api/playbooks/${e}`]:["playbook-detail-disabled"],enabled:t&&!!e}),{data:i}=St({queryKey:[`/api/playbooks/${e}/events/count`],queryFn:()=>CF(e),enabled:t&&!!e}),{data:s}=St({queryKey:["/api/feedback-signals/count","available",e],queryFn:()=>DR(e),enabled:t&&!!e}),o=r==null?void 0:r.data,l=((o==null?void 0:o.dependencies.missingCredentialIds.length)??0)+((o==null?void 0:o.dependencies.missingServiceIds.length)??0);return c.jsx(ks,{open:t,onOpenChange:n,children:c.jsxs(vi,{className:"sm:max-w-6xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(bi,{children:[c.jsx(xi,{children:(o==null?void 0:o.title)??"Playbook"}),c.jsx(Oo,{className:"text-[#A8C4C0]",children:(o==null?void 0:o.id)??e})]}),a||!o?c.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):c.jsxs("div",{className:"space-y-4 text-sm",children:[c.jsxs("p",{className:"rounded-md border border-white/10 bg-white/5 px-3 py-2 text-[#A8C4C0]",children:["Agent corrections file as"," ",c.jsx("span",{className:"font-mono text-xs",children:"propose_playbook_patch"})," proposals — review in the queue. Direct"," ",c.jsx("span",{className:"font-mono text-xs",children:"update_playbook"})," is for explicit edits only."]}),typeof i=="number"&&c.jsxs("p",{className:"text-xs text-gray-500",children:["Fetched ",i," time",i===1?"":"s"," (undertriggering signal)",typeof s=="number"&&s>0?` · ${s} open feedback signal${s===1?"":"s"}`:null]}),typeof i!="number"&&typeof s=="number"&&s>0&&c.jsxs("p",{className:"text-xs text-gray-500",children:[s," open feedback signal",s===1?"":"s"]}),o.triggers.length>0&&c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Triggers"}),c.jsx("p",{className:"text-gray-300",children:o.triggers.join(", ")})]}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Dependencies"}),o.dependencies.credentials.length===0&&o.dependencies.services.length===0&&l===0?c.jsx("p",{className:"text-gray-400",children:"None declared."}):c.jsxs("ul",{className:"space-y-1 text-gray-300",children:[o.dependencies.credentials.map(u=>c.jsxs("li",{children:["API key: ",u.label]},u.id)),o.dependencies.services.map(u=>c.jsxs("li",{children:["MCP: ",u.label]},u.id)),o.dependencies.missingCredentialIds.map(u=>c.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[c.jsx(Mr,{className:"w-3 h-3"})," Missing API key: ",u]},u)),o.dependencies.missingServiceIds.map(u=>c.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[c.jsx(Mr,{className:"w-3 h-3"})," Missing MCP: ",u]},u))]})]}),o.exec&&c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Suggested exec"}),c.jsx("pre",{className:"rounded bg-black/40 p-2 text-xs overflow-x-auto",children:o.exec})]}),o.skill&&c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Skill hint"}),c.jsx("p",{className:"font-mono text-xs text-gray-300",children:o.skill})]}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Instructions"}),c.jsx("div",{className:"rounded bg-black/30 p-3 whitespace-pre-wrap text-gray-200",children:o.body})]})]})]})})}function OF({credentialId:e,open:t,onOpenChange:n}){const r=un(),{toast:a}=rn(),[i,s]=x.useState(""),[o,l]=x.useState(""),[u,d]=x.useState(""),{data:f,isLoading:p}=St({queryKey:e?[`/api/credentials/${e}`]:["credential-detail-disabled"],enabled:t&&!!e}),h=f==null?void 0:f.data;x.useEffect(()=>{h&&(s(h.label),l(h.docsUrl??""),d(""))},[h==null?void 0:h.id,h==null?void 0:h.label,h==null?void 0:h.docsUrl]);const y=_t({mutationFn:async()=>{if(!e)throw new Error("No credential selected");const b=i.trim();if(!b)throw new Error("Name is required");const g=o.trim();if(g)try{new URL(g)}catch{throw new Error("Documentation link must be a valid URL")}await we("PUT",`/api/credentials/${e}`,{label:b,docsUrl:g}),u.trim()&&await we("POST",`/api/credentials/${e}/rotate`,{value:u.trim()})},onSuccess:()=>{r.invalidateQueries({queryKey:["/api/credentials/vault"]}),e&&r.invalidateQueries({queryKey:[`/api/credentials/${e}`]}),r.invalidateQueries({queryKey:["/api/collection/warnings"]}),r.invalidateQueries({queryKey:["/api/decks"]}),a({title:u.trim()?"API key updated":"API key saved",description:u.trim()?"Name, docs link, and key value were updated.":"Name and docs link were updated."}),d(""),n(!1)},onError:b=>{a({title:"Could not save API key",description:b.message,variant:"destructive"})}}),m=i.trim().length>0&&(i.trim()!==(h==null?void 0:h.label)||o.trim()!==((h==null?void 0:h.docsUrl)??"")||u.trim().length>0);return c.jsx(ks,{open:t,onOpenChange:n,children:c.jsxs(vi,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(bi,{children:[c.jsx(xi,{className:"text-[#E8F6F4]",children:(h==null?void 0:h.label)??"API key"}),c.jsx(Oo,{className:"font-mono text-xs text-[#A8C4C0]",children:(h==null?void 0:h.id)??e})]}),p||!h?c.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):c.jsxs("div",{className:"space-y-4",children:[!h.hasSecret&&c.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-200",children:[c.jsx(Mr,{className:"mt-0.5 h-4 w-4 shrink-0"}),c.jsx("p",{children:"No key is stored in your vault for this credential. Paste a key below to save it — the value is never shown after saving."})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"credential-detail-name",className:"text-[#CFEAE6]",children:"Name"}),c.jsx(it,{id:"credential-detail-name",value:i,onChange:b=>s(b.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"credential-detail-key",className:"text-[#CFEAE6]",children:h.hasSecret?"Rotate API key":"API key"}),c.jsx(it,{id:"credential-detail-key",type:"password",placeholder:h.hasSecret?"Leave blank to keep current key":"Paste key from the service dashboard",value:u,onChange:b=>d(b.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),h.hasSecret&&c.jsx("p",{className:"text-xs text-[#6B8581]",children:"Stored securely in Keychain. Enter a new value only when rotating."})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"credential-detail-docs",className:"text-[#CFEAE6]",children:"Documentation link"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(it,{id:"credential-detail-docs",type:"url",placeholder:"https://…",value:o,onChange:b=>l(b.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),o.trim()&&c.jsx(te,{type:"button",variant:"outline",size:"icon",className:"shrink-0 border-white/15 bg-[#0F0F0C] text-[#A8C4C0] hover:bg-white/5",onClick:()=>window.open(o.trim(),"_blank","noopener,noreferrer"),title:"Open documentation",children:c.jsx(ei,{className:"h-4 w-4"})})]})]}),c.jsx(te,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${ga}`,style:ya(Xn),onClick:()=>y.mutate(),disabled:!m||y.isPending,children:y.isPending?"Saving…":"Save changes"})]})]})})}const MF=im("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function mn({className:e,variant:t,...n}){return c.jsx("div",{className:Ce(MF({variant:t}),e),...n})}function ik(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function PF(...e){return t=>{let n=!1;const r=e.map(a=>{const i=ik(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<r.length;a++){const i=r[a];typeof i=="function"?i():ik(e[a],null)}}}}function Tx(...e){return x.useCallback(PF(...e),e)}function DF(e,t=[]){let n=[];function r(i,s){const o=x.createContext(s);o.displayName=i+"Context";const l=n.length;n=[...n,s];const u=f=>{var g;const{scope:p,children:h,...y}=f,m=((g=p==null?void 0:p[e])==null?void 0:g[l])||o,b=x.useMemo(()=>y,Object.values(y));return c.jsx(m.Provider,{value:b,children:h})};u.displayName=i+"Provider";function d(f,p,h={}){var g;const{optional:y=!1}=h,m=((g=p==null?void 0:p[e])==null?void 0:g[l])||o,b=x.useContext(m);if(b)return b;if(s!==void 0)return s;if(!y)throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const a=()=>{const i=n.map(s=>x.createContext(s));return function(o){const l=(o==null?void 0:o[e])||i;return x.useMemo(()=>({[`__scope${e}`]:{...o,[e]:l}}),[o,l])}};return a.scopeName=e,[r,zF(a,...t)]}function zF(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=r.reduce((o,{useScope:l,scopeName:u})=>{const f=l(i)[`__scope${u}`];return{...o,...f}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function sk(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a||!a.defaultPrevented)return t==null?void 0:t(a)}}var lp=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},IF=hd[" useInsertionEffect ".trim().toString()]||lp;function LF({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,i,s]=UF({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:a;{const d=x.useRef(e!==void 0);x.useEffect(()=>{const f=d.current;f!==o&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=o},[o,r])}const u=x.useCallback(d=>{var f;if(o){const p=FF(d)?d(e):d;p!==e&&((f=s.current)==null||f.call(s,p))}else i(d)},[o,e,i,s]);return[l,u]}function UF({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),a=x.useRef(n),i=x.useRef(t);return IF(()=>{i.current=t},[t]),x.useEffect(()=>{var s;a.current!==n&&((s=i.current)==null||s.call(i,n),a.current=n)},[n,a]),[n,r,i]}function FF(e){return typeof e=="function"}function qF(e){const t=x.useRef({value:e,previous:e});return x.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function HF(e){const[t,n]=x.useState(void 0);return lp(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let s,o;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,o=u.blockSize}else s=e.offsetWidth,o=e.offsetHeight;n({width:s,height:o})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function BF(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var zR=e=>{const{present:t,children:n}=e,r=VF(t),a=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),i=ZF(r.ref,KF(a));return typeof n=="function"||r.isPresent?x.cloneElement(a,{ref:i}):null};zR.displayName="Presence";function VF(e){const[t,n]=x.useState(),r=x.useRef(null),a=x.useRef(e),i=x.useRef("none"),s=x.useRef(void 0),o=e?"mounted":"unmounted",[l,u]=BF(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{l==="mounted"?(i.current=s.current??Bc(r.current),s.current=void 0):i.current="none"},[l]),lp(()=>{const d=r.current,f=a.current;if(f!==e){const h=i.current,y=Bc(d);e?(s.current=y,u("MOUNT")):y==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&h!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,u]),lp(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,p=y=>{const b=Bc(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&b&&(u("ANIMATION_END"),!a.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=y=>{y.target===t&&(i.current=Bc(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(d=>{if(d){const f=getComputedStyle(d);r.current=f,s.current=Bc(f)}else r.current=null;n(d)},[])}}function ok(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ZF(...e){const t=x.useRef(e);return t.current=e,x.useCallback(n=>{const r=t.current;let a=!1;const i=r.map(s=>{const o=ok(s,n);return!a&&typeof o=="function"&&(a=!0),o});if(a)return()=>{for(let s=0;s<i.length;s++){const o=i[s];typeof o=="function"?o():ok(r[s],null)}}},[])}function Bc(e){return(e==null?void 0:e.animationName)||"none"}function KF(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function GF(e){const t=x.forwardRef((n,r)=>{let{children:a,...i}=n,s=null,o=!1;const l=[];lk(a)&&typeof kf=="function"&&(a=kf(a._payload)),x.Children.forEach(a,p=>{var h;if(JF(p)){o=!0;const y=p;let m="child"in y.props?y.props.child:y.props.children;lk(m)&&typeof kf=="function"&&(m=kf(m._payload)),s=YF(y,m),l.push((h=s==null?void 0:s.props)==null?void 0:h.children)}else l.push(p)}),s?s=x.cloneElement(s,void 0,l):!o&&x.Children.count(a)===1&&x.isValidElement(a)&&(s=a);const u=s?WF(s):void 0,d=Tx(r,u);if(!s){if(a||a===0)throw new Error(o?r8(e):n8(e));return a}const f=XF(i,s.props??{});return s.type!==x.Fragment&&(f.ref=r?d:u),x.cloneElement(s,f)});return t.displayName=`${e}.Slot`,t}var QF=Symbol.for("radix.slottable"),YF=(e,t)=>{if("child"in e.props){const n=e.props.child;return x.isValidElement(n)?x.cloneElement(n,void 0,e.props.children(n.props.children)):null}return x.isValidElement(t)?t:null};function XF(e,t){const n={...t};for(const r in t){const a=e[r],i=t[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...o)=>{const l=i(...o);return a(...o),l}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function WF(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function JF(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QF}var e8=Symbol.for("react.lazy");function lk(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===e8&&"_payload"in e&&t8(e._payload)}function t8(e){return typeof e=="object"&&e!==null&&"then"in e}var n8=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,r8=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,kf=hd[" use ".trim().toString()],a8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ax=a8.reduce((e,t)=>{const n=GF(`Primitive.${t}`),r=x.forwardRef((a,i)=>{const{asChild:s,...o}=a,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...o,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),xm="Checkbox",[i8,Ase]=DF(xm),[s8,Rx]=i8(xm);function o8(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:a,disabled:i,form:s,name:o,onCheckedChange:l,required:u,value:d="on",internal_do_not_use_render:f}=e,[p,h]=LF({prop:n,defaultProp:a??!1,onChange:l,caller:xm}),[y,m]=x.useState(null),[b,g]=x.useState(null),v=x.useRef(!1),w=y?!!s||!!y.closest("form"):!0,S={checked:p,disabled:i,setChecked:h,control:y,setControl:m,name:o,form:s,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:ds(a)?!1:a,isFormControl:w,bubbleInput:b,setBubbleInput:g};return c.jsx(s8,{scope:t,...S,children:l8(f)?f(S):r})}var IR="CheckboxTrigger",LR=x.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},a)=>{const{control:i,value:s,disabled:o,checked:l,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:h,bubbleInput:y}=Rx(IR,e),m=Tx(a,d),b=x.useRef(l);return x.useEffect(()=>{const g=i==null?void 0:i.form;if(g){const v=()=>f(b.current);return g.addEventListener("reset",v),()=>g.removeEventListener("reset",v)}},[i,f]),c.jsx(Ax.button,{type:"button",role:"checkbox","aria-checked":ds(l)?"mixed":l,"aria-required":u,"data-state":BR(l),"data-disabled":o?"":void 0,disabled:o,value:s,...r,ref:m,onKeyDown:sk(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:sk(n,g=>{f(v=>ds(v)?!0:!v),y&&h&&(p.current=g.isPropagationStopped(),p.current||g.stopPropagation())})})});LR.displayName=IR;var $x=x.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:i,required:s,disabled:o,value:l,onCheckedChange:u,form:d,...f}=e;return c.jsx(o8,{__scopeCheckbox:n,checked:a,defaultChecked:i,disabled:o,required:s,onCheckedChange:u,name:r,form:d,value:l,internal_do_not_use_render:({isFormControl:p})=>c.jsxs(c.Fragment,{children:[c.jsx(LR,{...f,ref:t,__scopeCheckbox:n}),p&&c.jsx(HR,{__scopeCheckbox:n})]})})});$x.displayName=xm;var UR="CheckboxIndicator",FR=x.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...a}=e,i=Rx(UR,n);return c.jsx(zR,{present:r||ds(i.checked)||i.checked===!0,children:c.jsx(Ax.span,{"data-state":BR(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});FR.displayName=UR;var qR="CheckboxBubbleInput",HR=x.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:s,required:o,disabled:l,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:h}=Rx(qR,e),y=Tx(n,h),m=qF(i),b=HF(r);x.useEffect(()=>{const v=p;if(!v)return;const w=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(w,"checked").set,C=!a.current;if(m!==i&&E){const T=new Event("click",{bubbles:C});v.indeterminate=ds(i),E.call(v,ds(i)?!1:i),v.dispatchEvent(T)}},[p,m,i,a]);const g=x.useRef(ds(i)?!1:i);return c.jsx(Ax.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??g.current,required:o,disabled:l,name:u,value:d,form:f,...t,tabIndex:-1,ref:y,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});HR.displayName=qR;function l8(e){return typeof e=="function"}function ds(e){return e==="indeterminate"}function BR(e){return ds(e)?"indeterminate":e?"checked":"unchecked"}const cp=x.forwardRef(({className:e,...t},n)=>c.jsx($x,{ref:n,className:Ce("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:c.jsx(FR,{className:Ce("flex items-center justify-center text-current"),children:c.jsx(ET,{className:"h-4 w-4"})})}));cp.displayName=$x.displayName;const VR=x.forwardRef(({className:e,...t},n)=>c.jsx("div",{className:"relative w-full overflow-auto",children:c.jsx("table",{ref:n,className:Ce("w-full caption-bottom text-sm",e),...t})}));VR.displayName="Table";const ZR=x.forwardRef(({className:e,...t},n)=>c.jsx("thead",{ref:n,className:Ce("[&_tr]:border-b",e),...t}));ZR.displayName="TableHeader";const KR=x.forwardRef(({className:e,...t},n)=>c.jsx("tbody",{ref:n,className:Ce("[&_tr:last-child]:border-0",e),...t}));KR.displayName="TableBody";const c8=x.forwardRef(({className:e,...t},n)=>c.jsx("tfoot",{ref:n,className:Ce("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));c8.displayName="TableFooter";const Go=x.forwardRef(({className:e,...t},n)=>c.jsx("tr",{ref:n,className:Ce("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Go.displayName="TableRow";const ch=x.forwardRef(({className:e,...t},n)=>c.jsx("th",{ref:n,className:Ce("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));ch.displayName="TableHead";const Ls=x.forwardRef(({className:e,...t},n)=>c.jsx("td",{ref:n,className:Ce("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Ls.displayName="TableCell";const u8=x.forwardRef(({className:e,...t},n)=>c.jsx("caption",{ref:n,className:Ce("mt-4 text-sm text-muted-foreground",e),...t}));u8.displayName="TableCaption";function d8(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const f8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,h8=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,p8={};function ck(e,t){return(p8.jsx?h8:f8).test(e)}const m8=/[ \t\n\f\r]/g;function g8(e){return typeof e=="object"?e.type==="text"?uk(e.value):!1:uk(e)}function uk(e){return e.replace(m8,"")===""}class Md{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Md.prototype.normal={};Md.prototype.property={};Md.prototype.space=void 0;function GR(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Md(n,r,t)}function Qv(e){return e.toLowerCase()}class ar{constructor(t,n){this.attribute=n,this.property=t}}ar.prototype.attribute="";ar.prototype.booleanish=!1;ar.prototype.boolean=!1;ar.prototype.commaOrSpaceSeparated=!1;ar.prototype.commaSeparated=!1;ar.prototype.defined=!1;ar.prototype.mustUseProperty=!1;ar.prototype.number=!1;ar.prototype.overloadedBoolean=!1;ar.prototype.property="";ar.prototype.spaceSeparated=!1;ar.prototype.space=void 0;let y8=0;const Te=Mo(),Vt=Mo(),Yv=Mo(),J=Mo(),dt=Mo(),lo=Mo(),or=Mo();function Mo(){return 2**++y8}const Xv=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:Vt,commaOrSpaceSeparated:or,commaSeparated:lo,number:J,overloadedBoolean:Yv,spaceSeparated:dt},Symbol.toStringTag,{value:"Module"})),Vg=Object.keys(Xv);class Ox extends ar{constructor(t,n,r,a){let i=-1;if(super(t,n),dk(this,"space",a),typeof r=="number")for(;++i<Vg.length;){const s=Vg[i];dk(this,Vg[i],(r&Xv[s])===Xv[s])}}}Ox.prototype.defined=!0;function dk(e,t,n){n&&(e[t]=n)}function Nc(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const i=new Ox(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Qv(r)]=r,n[Qv(i.attribute)]=r}return new Md(t,n,e.space)}const QR=Nc({properties:{ariaActiveDescendant:null,ariaAtomic:Vt,ariaAutoComplete:null,ariaBusy:Vt,ariaChecked:Vt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:dt,ariaCurrent:null,ariaDescribedBy:dt,ariaDetails:null,ariaDisabled:Vt,ariaDropEffect:dt,ariaErrorMessage:null,ariaExpanded:Vt,ariaFlowTo:dt,ariaGrabbed:Vt,ariaHasPopup:null,ariaHidden:Vt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:dt,ariaLevel:J,ariaLive:null,ariaModal:Vt,ariaMultiLine:Vt,ariaMultiSelectable:Vt,ariaOrientation:null,ariaOwns:dt,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:Vt,ariaReadOnly:Vt,ariaRelevant:null,ariaRequired:Vt,ariaRoleDescription:dt,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:Vt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function YR(e,t){return t in e?e[t]:t}function XR(e,t){return YR(e,t.toLowerCase())}const v8=Nc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:lo,acceptCharset:dt,accessKey:dt,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alpha:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:dt,autoFocus:Te,autoPlay:Te,blocking:dt,capture:null,charSet:null,checked:Te,cite:null,className:dt,closedBy:null,colorSpace:null,cols:J,colSpan:J,command:null,commandFor:null,content:null,contentEditable:Vt,controls:Te,controlsList:dt,coords:J|lo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:Yv,draggable:Vt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:dt,height:J,hidden:Yv,high:J,href:null,hrefLang:null,htmlFor:dt,httpEquiv:dt,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:dt,itemRef:dt,itemScope:Te,itemType:dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,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:Te,optimum:J,pattern:null,ping:dt,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:dt,required:Te,reversed:Te,rows:J,rowSpan:J,sandbox:dt,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootCustomElementRegistry:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shadowRootSerializable:Te,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:Vt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:Vt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:dt,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:Vt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Te,disablePictureInPicture:Te,disableRemotePlayback:Te,exportParts:lo,part:dt,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:XR}),b8=Nc({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",maskType:"mask-type",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:or,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:dt,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:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,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:lo,g2:lo,glyphName:lo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:or,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,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:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:or,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:or,rev:or,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:or,requiredFeatures:or,requiredFonts:or,requiredFormats:or,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:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:or,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:or,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:or,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:YR}),WR=Nc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),JR=Nc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:XR}),e$=Nc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),x8={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"},w8=/[A-Z]/g,fk=/-[a-z]/g,S8=/^data[-\w.:]+$/i;function _8(e,t){const n=Qv(t);let r=t,a=ar;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&S8.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(fk,E8);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!fk.test(i)){let s=i.replace(w8,k8);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}a=Ox}return new a(r,t)}function k8(e){return"-"+e.toLowerCase()}function E8(e){return e.charAt(1).toUpperCase()}const C8=GR([QR,v8,WR,JR,e$],"html"),Mx=GR([QR,b8,WR,JR,e$],"svg");function N8(e){return e.join(" ").trim()}var Px={},hk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,j8=/\n/g,T8=/^\s*/,A8=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,R8=/^:\s*/,$8=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,O8=/^[;\s]*/,M8=/^\s+|\s+$/g,P8=`
410
- `,pk="/",mk="*",Fs="",D8="comment",z8="declaration";function I8(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function a(y){var m=y.match(j8);m&&(n+=m.length);var b=y.lastIndexOf(P8);r=~b?y.length-b:r+y.length}function i(){var y={line:n,column:r};return function(m){return m.position=new s(y),u(),m}}function s(y){this.start=y,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function o(y){var m=new Error(t.source+":"+n+":"+r+": "+y);if(m.reason=y,m.filename=t.source,m.line=n,m.column=r,m.source=e,!t.silent)throw m}function l(y){var m=y.exec(e);if(m){var b=m[0];return a(b),e=e.slice(b.length),m}}function u(){l(T8)}function d(y){var m;for(y=y||[];m=f();)m!==!1&&y.push(m);return y}function f(){var y=i();if(!(pk!=e.charAt(0)||mk!=e.charAt(1))){for(var m=2;Fs!=e.charAt(m)&&(mk!=e.charAt(m)||pk!=e.charAt(m+1));)++m;if(m+=2,Fs===e.charAt(m-1))return o("End of comment missing");var b=e.slice(2,m-2);return r+=2,a(b),e=e.slice(m),r+=2,y({type:D8,comment:b})}}function p(){var y=i(),m=l(A8);if(m){if(f(),!l(R8))return o("property missing ':'");var b=l($8),g=y({type:z8,property:gk(m[0].replace(hk,Fs)),value:b?gk(b[0].replace(hk,Fs)):Fs});return l(O8),g}}function h(){var y=[];d(y);for(var m;m=p();)m!==!1&&(y.push(m),d(y));return y}return u(),h()}function gk(e){return e?e.replace(M8,Fs):Fs}var L8=I8,U8=wh&&wh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Px,"__esModule",{value:!0});Px.default=q8;const F8=U8(L8);function q8(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,F8.default)(e),a=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:s,value:o}=i;a?t(s,o,i):o&&(n=n||{},n[s]=o)}),n}var wm={};Object.defineProperty(wm,"__esModule",{value:!0});wm.camelCase=void 0;var H8=/^--[a-zA-Z0-9_-]+$/,B8=/-([a-z])/g,V8=/^[^-]+$/,Z8=/^-(webkit|moz|ms|o|khtml)-/,K8=/^-(ms)-/,G8=function(e){return!e||V8.test(e)||H8.test(e)},Q8=function(e,t){return t.toUpperCase()},yk=function(e,t){return"".concat(t,"-")},Y8=function(e,t){return t===void 0&&(t={}),G8(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(K8,yk):e=e.replace(Z8,yk),e.replace(B8,Q8))};wm.camelCase=Y8;var X8=wh&&wh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},W8=X8(Px),J8=wm;function Wv(e,t){var n={};return!e||typeof e!="string"||(0,W8.default)(e,function(r,a){r&&a&&(n[(0,J8.camelCase)(r,t)]=a)}),n}Wv.default=Wv;var eq=Wv;const tq=fc(eq),t$=n$("end"),Dx=n$("start");function n$(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function nq(e){const t=Dx(e),n=t$(e);if(t&&n)return{start:t,end:n}}function Cu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?vk(e.position):"start"in e||"end"in e?vk(e):"line"in e||"column"in e?Jv(e):""}function Jv(e){return bk(e&&e.line)+":"+bk(e&&e.column)}function vk(e){return Jv(e&&e.start)+"-"+Jv(e&&e.end)}function bk(e){return e&&typeof e=="number"?e:1}class An extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=Cu(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}An.prototype.file="";An.prototype.name="";An.prototype.reason="";An.prototype.message="";An.prototype.stack="";An.prototype.column=void 0;An.prototype.line=void 0;An.prototype.ancestors=void 0;An.prototype.cause=void 0;An.prototype.fatal=void 0;An.prototype.place=void 0;An.prototype.ruleId=void 0;An.prototype.source=void 0;const zx={}.hasOwnProperty,rq=new Map,aq=/[A-Z]/g,iq=new Set(["table","tbody","thead","tfoot","tr"]),sq=new Set(["td","th"]),r$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function oq(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=mq(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=pq(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Mx:C8,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=a$(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function a$(e,t,n){if(t.type==="element")return lq(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return cq(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return dq(e,t,n);if(t.type==="mdxjsEsm")return uq(e,t);if(t.type==="root")return fq(e,t,n);if(t.type==="text")return hq(e,t)}function lq(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Mx,e.schema=a),e.ancestors.push(t);const i=s$(e,t.tagName,!1),s=gq(e,t);let o=Lx(e,t);return iq.has(t.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!g8(l):!0})),i$(e,s,i,t),Ix(s,o),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function cq(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}rd(e,t.position)}function uq(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);rd(e,t.position)}function dq(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Mx,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:s$(e,t.name,!0),s=yq(e,t),o=Lx(e,t);return i$(e,s,i,t),Ix(s,o),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function fq(e,t,n){const r={};return Ix(r,Lx(e,t)),e.create(t,e.Fragment,r,n)}function hq(e,t){return t.value}function i$(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ix(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function pq(e,t,n){return r;function r(a,i,s,o){const u=Array.isArray(s.children)?n:t;return o?u(i,s,o):u(i,s)}}function mq(e,t){return n;function n(r,a,i,s){const o=Array.isArray(i.children),l=Dx(r);return t(a,i,s,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function gq(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&zx.call(t.properties,a)){const i=vq(e,a,t.properties[a]);if(i){const[s,o]=i;e.tableCellAlignToStyle&&s==="align"&&typeof o=="string"&&sq.has(t.tagName)?r=o:n[s]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function yq(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const s=i.expression;s.type;const o=s.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else rd(e,t.position);else{const a=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else rd(e,t.position);else i=r.value===null?!0:r.value;n[a]=i}return n}function Lx(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:rq;for(;++r<t.children.length;){const i=t.children[r];let s;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const u=a.get(l)||0;s=l+"-"+u,a.set(l,u+1)}}const o=a$(e,i,s);o!==void 0&&n.push(o)}return n}function vq(e,t,n){const r=_8(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?d8(n):N8(n)),r.property==="style"){let a=typeof n=="object"?n:bq(e,String(n));return e.stylePropertyNameCase==="css"&&(a=xq(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?x8[r.property]||r.property:r.attribute,n]}}function bq(e,t){try{return tq(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new An("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=r$+"#cannot-parse-style-attribute",a}}function s$(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,s;for(;++i<a.length;){const o=ck(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};s=s?{type:"MemberExpression",object:s,property:o,computed:!!(i&&o.type==="Literal"),optional:!1}:o}r=s}else r=ck(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return zx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);rd(e)}function rd(e,t){const n=new An("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=r$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function xq(e){const t={};let n;for(n in e)zx.call(e,n)&&(t[wq(n)]=e[n]);return t}function wq(e){let t=e.replace(aq,Sq);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Sq(e){return"-"+e.toLowerCase()}const Zg={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"]},_q={};function Ux(e,t){const n=_q,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return o$(e,r,a)}function o$(e,t,n){if(kq(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return xk(e.children,t,n)}return Array.isArray(e)?xk(e,t,n):""}function xk(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=o$(e[a],t,n);return r.join("")}function kq(e){return!!(e&&typeof e=="object")}const wk=document.createElement("i");function Fx(e){const t="&"+e+";";wk.innerHTML=t;const n=wk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function br(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Pr(e,t){return e.length>0?(br(e,e.length,0,t),e):t}const Sk={}.hasOwnProperty;function l$(e){const t={};let n=-1;for(;++n<e.length;)Eq(t,e[n]);return t}function Eq(e,t){let n;for(n in t){const a=(Sk.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Sk.call(a,s)||(a[s]=[]);const o=i[s];Cq(a[s],Array.isArray(o)?o:o?[o]:[])}}}function Cq(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);br(e,0,0,r)}function c$(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function na(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ln=Es(/[A-Za-z]/),jn=Es(/[\dA-Za-z]/),Nq=Es(/[#-'*+\--9=?A-Z^-~]/);function up(e){return e!==null&&(e<32||e===127)}const e0=Es(/\d/),jq=Es(/[\dA-Fa-f]/),Tq=Es(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function pt(e){return e!==null&&(e<0||e===32)}function Ze(e){return e===-2||e===-1||e===32}const Sm=Es(new RegExp("\\p{P}|\\p{S}","u")),wo=Es(/\s/);function Es(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function jc(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&jn(e.charCodeAt(n+1))&&jn(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(s=String.fromCharCode(i,o),a=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+a+1,s=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Je(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Ze(l)?(e.enter(n),o(l)):t(l)}function o(l){return Ze(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const Aq={tokenize:Rq};function Rq(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Je(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return _e(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const $q={tokenize:Oq},_k={tokenize:Mq};function Oq(e){const t=this,n=[];let r=0,a,i,s;return o;function o(w){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&v();const S=t.events.length;let E=S,C;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){C=t.events[E][1].end;break}g(r);let T=S;for(;T<t.events.length;)t.events[T][1].end={...C},T++;return br(t.events,E+1,0,t.events.slice(S)),t.events.length=T,u(w)}return o(w)}function u(w){if(r===n.length){if(!a)return p(w);if(a.currentConstruct&&a.currentConstruct.concrete)return y(w);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_k,d,f)(w)}function d(w){return a&&v(),g(r),p(w)}function f(w){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,y(w)}function p(w){return t.containerState={},e.attempt(_k,h,y)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function y(w){if(w===null){a&&v(),g(0),e.consume(w);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),m(w)}function m(w){if(w===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(w);return}return _e(w)?(e.consume(w),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(w),m)}function b(w,S){const E=t.sliceStream(w);if(S&&E.push(null),w.previous=i,i&&(i.next=w),i=w,a.defineSkip(w.start),a.write(E),t.parser.lazy[w.start.line]){let C=a.events.length;for(;C--;)if(a.events[C][1].start.offset<s&&(!a.events[C][1].end||a.events[C][1].end.offset>s))return;const T=t.events.length;let P=T,R,$;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(R){$=t.events[P][1].end;break}R=!0}for(g(r),C=T;C<t.events.length;)t.events[C][1].end={...$},C++;br(t.events,P+1,0,t.events.slice(T)),t.events.length=C}}function g(w){let S=n.length;for(;S-- >w;){const E=n[S];t.containerState=E[1],E[0].exit.call(t,e)}n.length=w}function v(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Mq(e,t,n){return Je(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oc(e){if(e===null||pt(e)||wo(e))return 1;if(Sm(e))return 2}function _m(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const t0={name:"attention",resolveAll:Pq,tokenize:Dq};function Pq(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},p={...e[n][1].start};kk(f,-l),kk(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:l>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},e[r][1].end={...s.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Pr(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Pr(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Pr(u,_m(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Pr(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Pr(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,br(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Dq(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=oc(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),d=oc(l),f=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?f:f&&(a||!p)),u._close=!!(i===42?p:p&&(d||!f)),t(l)}}function kk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const zq={name:"autolink",tokenize:Iq};function Iq(e,t,n){let r=0;return a;function a(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return Ln(h)?(e.consume(h),s):h===64?n(h):u(h)}function s(h){return h===43||h===45||h===46||jn(h)?(r=1,o(h)):u(h)}function o(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||jn(h))&&r++<32?(e.consume(h),o):(r=0,u(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||up(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),d):Nq(h)?(e.consume(h),u):n(h)}function d(h){return jn(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,d):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||jn(h))&&r++<63){const y=h===45?p:f;return e.consume(h),y}return n(h)}}const Pd={partial:!0,tokenize:Lq};function Lq(e,t,n){return r;function r(i){return Ze(i)?Je(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||_e(i)?t(i):n(i)}}const u$={continuation:{tokenize:Fq},exit:qq,name:"blockQuote",tokenize:Uq};function Uq(e,t,n){const r=this;return a;function a(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Ze(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function Fq(e,t,n){const r=this;return a;function a(s){return Ze(s)?Je(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(u$,t,n)(s)}}function qq(e){e.exit("blockQuote")}const d$={name:"characterEscape",tokenize:Hq};function Hq(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return Tq(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const f$={name:"characterReference",tokenize:Bq};function Bq(e,t,n){const r=this;let a=0,i,s;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=jn,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=jq,d):(e.enter("characterReferenceValue"),i=7,s=e0,d(f))}function d(f){if(f===59&&a){const p=e.exit("characterReferenceValue");return s===jn&&!Fx(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&a++<i?(e.consume(f),d):n(f)}}const Ek={partial:!0,tokenize:Zq},Ck={concrete:!0,name:"codeFenced",tokenize:Vq};function Vq(e,t,n){const r=this,a={partial:!0,tokenize:E};let i=0,s=0,o;return l;function l(C){return u(C)}function u(C){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,o=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===o?(s++,e.consume(C),d):s<3?n(C):(e.exit("codeFencedFenceSequence"),Ze(C)?Je(e,f,"whitespace")(C):f(C))}function f(C){return C===null||_e(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(Ek,m,S)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(C))}function p(C){return C===null||_e(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(C)):Ze(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Je(e,h,"whitespace")(C)):C===96&&C===o?n(C):(e.consume(C),p)}function h(C){return C===null||_e(C)?f(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||_e(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(C)):C===96&&C===o?n(C):(e.consume(C),y)}function m(C){return e.attempt(a,S,b)(C)}function b(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),g}function g(C){return i>0&&Ze(C)?Je(e,v,"linePrefix",i+1)(C):v(C)}function v(C){return C===null||_e(C)?e.check(Ek,m,S)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||_e(C)?(e.exit("codeFlowValue"),v(C)):(e.consume(C),w)}function S(C){return e.exit("codeFenced"),t(C)}function E(C,T,P){let R=0;return $;function $(A){return C.enter("lineEnding"),C.consume(A),C.exit("lineEnding"),j}function j(A){return C.enter("codeFencedFence"),Ze(A)?Je(C,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):O(A)}function O(A){return A===o?(C.enter("codeFencedFenceSequence"),L(A)):P(A)}function L(A){return A===o?(R++,C.consume(A),L):R>=s?(C.exit("codeFencedFenceSequence"),Ze(A)?Je(C,D,"whitespace")(A):D(A)):P(A)}function D(A){return A===null||_e(A)?(C.exit("codeFencedFence"),T(A)):P(A)}}}function Zq(e,t,n){const r=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Kg={name:"codeIndented",tokenize:Gq},Kq={partial:!0,tokenize:Qq};function Gq(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Je(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):_e(u)?e.attempt(Kq,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||_e(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function Qq(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):_e(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Je(e,i,"linePrefix",5)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):_e(s)?a(s):n(s)}}const Yq={name:"codeText",previous:Wq,resolve:Xq,tokenize:Jq};function Xq(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function Wq(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Jq(e,t,n){let r=0,a,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),a=0,d(f)):_e(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||_e(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class eH{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Vc(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Vc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Vc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Vc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Vc(this.left,n.reverse())}}}function Vc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function h$(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new eH(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,tH(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--;)if(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;a&&(r[1].end={...d.get(a)[1].start},o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return br(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function tH(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const o=s.events,l=[],u={};let d,f,p=-1,h=n,y=0,m=0;const b=[m];for(;h;){for(;e.get(++a)[1]!==h;);i.push(a),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),f&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(m=p+1,b.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),p=b.length;p--;){const g=o.slice(b[p],b[p+1]),v=i.pop();l.push([v,v+g.length-1]),e.splice(v,2,g)}for(l.reverse(),p=-1;++p<l.length;)u[y+l[p][0]]=y+l[p][1],y+=l[p][1]-l[p][0]-1;return u}const nH={resolve:aH,tokenize:iH},rH={partial:!0,tokenize:sH};function aH(e){return h$(e),e}function iH(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):_e(o)?e.check(rH,s,i)(o):(e.consume(o),a)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function s(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function sH(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Je(e,i,"linePrefix")}function i(s){if(s===null||_e(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function p$(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(g),e.exit(i),p):g===null||g===32||g===41||up(g)?n(g):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),m(g))}function p(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(o),p(g)):g===null||g===60||_e(g)?n(g):(e.consume(g),g===92?y:h)}function y(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function m(g){return!d&&(g===null||g===41||pt(g))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(g)):d<u&&g===40?(e.consume(g),d++,m):g===41?(e.consume(g),d--,m):g===null||g===32||g===40||up(g)?n(g):(e.consume(g),g===92?b:m)}function b(g){return g===40||g===41||g===92?(e.consume(g),m):m(g)}}function m$(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(h){return e.enter(r),e.enter(a),e.consume(h),e.exit(a),e.enter(i),d}function d(h){return o>999||h===null||h===91||h===93&&!l||h===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(e.exit(i),e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):_e(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||_e(h)||o++>999?(e.exit("chunkString"),d(h)):(e.consume(h),l||(l=!Ze(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,f):f(h)}}function g$(e,t,n,r,a,i){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),l(s)):p===null?n(p):_e(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Je(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||_e(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:d)}function f(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Nu(e,t){let n;return r;function r(a){return _e(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Ze(a)?Je(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const oH={name:"definition",tokenize:cH},lH={partial:!0,tokenize:uH};function cH(e,t,n){const r=this;let a;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return m$.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function o(h){return a=na(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return pt(h)?Nu(e,u)(h):u(h)}function u(h){return p$(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(lH,f,f)(h)}function f(h){return Ze(h)?Je(e,p,"whitespace")(h):p(h)}function p(h){return h===null||_e(h)?(e.exit("definition"),r.parser.defined.push(a),t(h)):n(h)}}function uH(e,t,n){return r;function r(o){return pt(o)?Nu(e,a)(o):n(o)}function a(o){return g$(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Ze(o)?Je(e,s,"whitespace")(o):s(o)}function s(o){return o===null||_e(o)?t(o):n(o)}}const dH={name:"hardBreakEscape",tokenize:fH};function fH(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return _e(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const hH={name:"headingAtx",resolve:pH,tokenize:mH};function pH(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},br(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function mH(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||pt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||_e(d)?(e.exit("atxHeading"),t(d)):Ze(d)?Je(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||pt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const gH=["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"],Nk=["pre","script","style","textarea"],yH={concrete:!0,name:"htmlFlow",resolveTo:xH,tokenize:wH},vH={partial:!0,tokenize:_H},bH={partial:!0,tokenize:SH};function xH(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function wH(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return d(_)}function d(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),f}function f(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),i=!0,m):_===63?(e.consume(_),a=3,r.interrupt?t:N):Ln(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function p(_){return _===45?(e.consume(_),a=2,h):_===91?(e.consume(_),a=5,o=0,y):Ln(_)?(e.consume(_),a=4,r.interrupt?t:N):n(_)}function h(_){return _===45?(e.consume(_),r.interrupt?t:N):n(_)}function y(_){const k="CDATA[";return _===k.charCodeAt(o++)?(e.consume(_),o===k.length?r.interrupt?t:O:y):n(_)}function m(_){return Ln(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||pt(_)){const k=_===47,M=s.toLowerCase();return!k&&!i&&Nk.includes(M)?(a=1,r.interrupt?t(_):O(_)):gH.includes(s.toLowerCase())?(a=6,k?(e.consume(_),g):r.interrupt?t(_):O(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?v(_):w(_))}return _===45||jn(_)?(e.consume(_),s+=String.fromCharCode(_),b):n(_)}function g(_){return _===62?(e.consume(_),r.interrupt?t:O):n(_)}function v(_){return Ze(_)?(e.consume(_),v):$(_)}function w(_){return _===47?(e.consume(_),$):_===58||_===95||Ln(_)?(e.consume(_),S):Ze(_)?(e.consume(_),w):$(_)}function S(_){return _===45||_===46||_===58||_===95||jn(_)?(e.consume(_),S):E(_)}function E(_){return _===61?(e.consume(_),C):Ze(_)?(e.consume(_),E):w(_)}function C(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,T):Ze(_)?(e.consume(_),C):P(_)}function T(_){return _===l?(e.consume(_),l=null,R):_===null||_e(_)?n(_):(e.consume(_),T)}function P(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||pt(_)?E(_):(e.consume(_),P)}function R(_){return _===47||_===62||Ze(_)?w(_):n(_)}function $(_){return _===62?(e.consume(_),j):n(_)}function j(_){return _===null||_e(_)?O(_):Ze(_)?(e.consume(_),j):n(_)}function O(_){return _===45&&a===2?(e.consume(_),H):_===60&&a===1?(e.consume(_),B):_===62&&a===4?(e.consume(_),F):_===63&&a===3?(e.consume(_),N):_===93&&a===5?(e.consume(_),Y):_e(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(vH,V,L)(_)):_===null||_e(_)?(e.exit("htmlFlowData"),L(_)):(e.consume(_),O)}function L(_){return e.check(bH,D,V)(_)}function D(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),A}function A(_){return _===null||_e(_)?L(_):(e.enter("htmlFlowData"),O(_))}function H(_){return _===45?(e.consume(_),N):O(_)}function B(_){return _===47?(e.consume(_),s="",U):O(_)}function U(_){if(_===62){const k=s.toLowerCase();return Nk.includes(k)?(e.consume(_),F):O(_)}return Ln(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),U):O(_)}function Y(_){return _===93?(e.consume(_),N):O(_)}function N(_){return _===62?(e.consume(_),F):_===45&&a===2?(e.consume(_),N):O(_)}function F(_){return _===null||_e(_)?(e.exit("htmlFlowData"),V(_)):(e.consume(_),F)}function V(_){return e.exit("htmlFlow"),t(_)}}function SH(e,t,n){const r=this;return a;function a(s){return _e(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function _H(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Pd,t,n)}}const kH={name:"htmlText",tokenize:EH};function EH(e,t,n){const r=this;let a,i,s;return o;function o(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),l}function l(N){return N===33?(e.consume(N),u):N===47?(e.consume(N),E):N===63?(e.consume(N),w):Ln(N)?(e.consume(N),P):n(N)}function u(N){return N===45?(e.consume(N),d):N===91?(e.consume(N),i=0,y):Ln(N)?(e.consume(N),v):n(N)}function d(N){return N===45?(e.consume(N),h):n(N)}function f(N){return N===null?n(N):N===45?(e.consume(N),p):_e(N)?(s=f,B(N)):(e.consume(N),f)}function p(N){return N===45?(e.consume(N),h):f(N)}function h(N){return N===62?H(N):N===45?p(N):f(N)}function y(N){const F="CDATA[";return N===F.charCodeAt(i++)?(e.consume(N),i===F.length?m:y):n(N)}function m(N){return N===null?n(N):N===93?(e.consume(N),b):_e(N)?(s=m,B(N)):(e.consume(N),m)}function b(N){return N===93?(e.consume(N),g):m(N)}function g(N){return N===62?H(N):N===93?(e.consume(N),g):m(N)}function v(N){return N===null||N===62?H(N):_e(N)?(s=v,B(N)):(e.consume(N),v)}function w(N){return N===null?n(N):N===63?(e.consume(N),S):_e(N)?(s=w,B(N)):(e.consume(N),w)}function S(N){return N===62?H(N):w(N)}function E(N){return Ln(N)?(e.consume(N),C):n(N)}function C(N){return N===45||jn(N)?(e.consume(N),C):T(N)}function T(N){return _e(N)?(s=T,B(N)):Ze(N)?(e.consume(N),T):H(N)}function P(N){return N===45||jn(N)?(e.consume(N),P):N===47||N===62||pt(N)?R(N):n(N)}function R(N){return N===47?(e.consume(N),H):N===58||N===95||Ln(N)?(e.consume(N),$):_e(N)?(s=R,B(N)):Ze(N)?(e.consume(N),R):H(N)}function $(N){return N===45||N===46||N===58||N===95||jn(N)?(e.consume(N),$):j(N)}function j(N){return N===61?(e.consume(N),O):_e(N)?(s=j,B(N)):Ze(N)?(e.consume(N),j):R(N)}function O(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),a=N,L):_e(N)?(s=O,B(N)):Ze(N)?(e.consume(N),O):(e.consume(N),D)}function L(N){return N===a?(e.consume(N),a=void 0,A):N===null?n(N):_e(N)?(s=L,B(N)):(e.consume(N),L)}function D(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||pt(N)?R(N):(e.consume(N),D)}function A(N){return N===47||N===62||pt(N)?R(N):n(N)}function H(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function B(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),U}function U(N){return Ze(N)?Je(e,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):Y(N)}function Y(N){return e.enter("htmlTextData"),s(N)}}const qx={name:"labelEnd",resolveAll:TH,resolveTo:AH,tokenize:RH},CH={tokenize:$H},NH={tokenize:OH},jH={tokenize:MH};function TH(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&br(e,0,e.length,n),e}function AH(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[s][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[s-2][1].start}};return o=[["enter",l,t],["enter",u,t]],o=Pr(o,e.slice(i+1,i+r+3)),o=Pr(o,[["enter",d,t]]),o=Pr(o,_m(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Pr(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=Pr(o,e.slice(s+1)),o=Pr(o,[["exit",l,t]]),br(e,i,e.length,o),e}function RH(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(p){return i?i._inactive?f(p):(s=r.parser.defined.includes(na(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(CH,d,s?d:f)(p):p===91?e.attempt(NH,d,s?u:f)(p):s?d(p):f(p)}function u(p){return e.attempt(jH,d,f)(p)}function d(p){return t(p)}function f(p){return i._balanced=!0,n(p)}}function $H(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return pt(f)?Nu(e,i)(f):i(f)}function i(f){return f===41?d(f):p$(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return pt(f)?Nu(e,l)(f):d(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?g$(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return pt(f)?Nu(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function OH(e,t,n){const r=this;return a;function a(o){return m$.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(na(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function MH(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const PH={name:"labelStartImage",resolveAll:qx.resolveAll,tokenize:DH};function DH(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const zH={name:"labelStartLink",resolveAll:qx.resolveAll,tokenize:IH};function IH(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Gg={name:"lineEnding",tokenize:LH};function LH(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Je(e,t,"linePrefix")}}const uh={name:"thematicBreak",tokenize:UH};function UH(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||_e(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Ze(u)?Je(e,o,"whitespace")(u):o(u))}}const Vn={continuation:{tokenize:BH},exit:ZH,name:"list",tokenize:HH},FH={partial:!0,tokenize:KH},qH={partial:!0,tokenize:VH};function HH(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(h){const y=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:e0(h)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(uh,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return e0(h)&&++s<10?(e.consume(h),l):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Pd,r.interrupt?n:d,e.attempt(FH,p,f))}function d(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function f(h){return Ze(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function BH(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Pd,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Je(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Ze(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(qH,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Je(e,e.attempt(Vn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function VH(e,t,n){const r=this;return Je(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function ZH(e){e.exit(this.containerState.type)}function KH(e,t,n){const r=this;return Je(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const s=r.events[r.events.length-1];return!Ze(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const jk={name:"setextUnderline",resolveTo:GH,tokenize:QH};function GH(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function QH(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Ze(u)?Je(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||_e(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const YH={tokenize:XH};function XH(e){const t=this,n=e.attempt(Pd,r,e.attempt(this.parser.constructs.flowInitial,a,Je(e,e.attempt(this.parser.constructs.flow,a,e.attempt(nH,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const WH={resolveAll:v$()},JH=y$("string"),eB=y$("text");function y$(e){return{resolveAll:v$(e==="text"?tB:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const f=a[d];let p=-1;if(f)for(;++p<f.length;){const h=f[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function v$(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function tB(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,s=-1,o=0,l;for(;i--;){const u=a[i];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(u===-2)l=!0,o++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(o=0),o){const u={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:r.start._bufferIndex+s,_index:r.start._index+i,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const nB={42:Vn,43:Vn,45:Vn,48:Vn,49:Vn,50:Vn,51:Vn,52:Vn,53:Vn,54:Vn,55:Vn,56:Vn,57:Vn,62:u$},rB={91:oH},aB={[-2]:Kg,[-1]:Kg,32:Kg},iB={35:hH,42:uh,45:[jk,uh],60:yH,61:jk,95:uh,96:Ck,126:Ck},sB={38:f$,92:d$},oB={[-5]:Gg,[-4]:Gg,[-3]:Gg,33:PH,38:f$,42:t0,60:[zq,kH],91:zH,92:[dH,d$],93:qx,95:t0,96:Yq},lB={null:[t0,WH]},cB={null:[42,95]},uB={null:[]},dB=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:cB,contentInitial:rB,disable:uB,document:nB,flow:iB,flowInitial:aB,insideSpan:lB,string:sB,text:oB},Symbol.toStringTag,{value:"Module"}));function fB(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let s=[],o=[];const l={attempt:T(E),check:T(C),consume:v,enter:w,exit:S,interrupt:T(C,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:y,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:f};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(j){return s=Pr(s,j),b(),s[s.length-1]!==null?[]:(P(t,0),u.events=_m(i,u.events,u),u.events)}function p(j,O){return pB(h(j),O)}function h(j){return hB(s,j)}function y(){const{_bufferIndex:j,_index:O,line:L,column:D,offset:A}=r;return{_bufferIndex:j,_index:O,line:L,column:D,offset:A}}function m(j){a[j.line]=j.column,$()}function b(){let j;for(;r._index<s.length;){const O=s[r._index];if(typeof O=="string")for(j=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===j&&r._bufferIndex<O.length;)g(O.charCodeAt(r._bufferIndex));else g(O)}}function g(j){d=d(j)}function v(j){_e(j)?(r.line++,r.column=1,r.offset+=j===-3?2:1,$()):j!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=j}function w(j,O){const L=O||{};return L.type=j,L.start=y(),u.events.push(["enter",L,u]),o.push(L),L}function S(j){const O=o.pop();return O.end=y(),u.events.push(["exit",O,u]),O}function E(j,O){P(j,O.from)}function C(j,O){O.restore()}function T(j,O){return L;function L(D,A,H){let B,U,Y,N;return Array.isArray(D)?V(D):"tokenize"in D?V([D]):F(D);function F(I){return K;function K(G){const re=G!==null&&I[G],oe=G!==null&&I.null,he=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return V(he)(G)}}function V(I){return B=I,U=0,I.length===0?H:_(I[U])}function _(I){return K;function K(G){return N=R(),Y=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?M():I.tokenize.call(O?Object.assign(Object.create(u),O):u,l,k,M)(G)}}function k(I){return j(Y,N),A}function M(I){return N.restore(),++U<B.length?_(B[U]):H}}}function P(j,O){j.resolveAll&&!i.includes(j)&&i.push(j),j.resolve&&br(u.events,O,u.events.length-O,j.resolve(u.events.slice(O),u)),j.resolveTo&&(u.events=j.resolveTo(u.events,u))}function R(){const j=y(),O=u.previous,L=u.currentConstruct,D=u.events.length,A=Array.from(o);return{from:D,restore:H};function H(){r=j,u.previous=O,u.currentConstruct=L,u.events.length=D,o=A,$()}}function $(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function hB(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let s;if(n===a)s=[e[n].slice(r,i)];else{if(s=e.slice(n,a),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}i>0&&s.push(e[a].slice(0,i))}return s}function pB(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
411
- `;break}case-3:{s=`\r
412
- `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}function mB(e){const r={constructs:l$([dB,...(e||{}).extensions||[]]),content:a(Aq),defined:[],document:a($q),flow:a(YH),lazy:{},string:a(JH),text:a(eB)};return r;function a(i){return s;function s(o){return fB(r,i,o)}}}function gB(e){for(;!h$(e););return e}const Tk=/[\0\t\n\r]/g;function yB(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,f,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(Tk.lastIndex=f,u=Tk.exec(i),p=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(p),!u){t=i.slice(f);break}if(h===10&&f===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<p&&(l.push(i.slice(f,p)),e+=p-f),h){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const vB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bB(e){return e.replace(vB,xB)}function xB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return c$(n.slice(i?2:1),i?16:10)}return Fx(n)||e}const b$={}.hasOwnProperty;function wB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),SB(n)(gB(mB(n).document().write(yB()(e,t,!0))))}function SB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ce),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(W),blockQuote:i(oe),characterEscape:R,characterReference:R,codeFenced:i(he),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(he,s),codeText:i(Se,s),codeTextData:R,data:R,codeFlowValue:R,definition:i(Xe),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ot),hardBreakEscape:i(fe),hardBreakTrailing:i(fe),htmlFlow:i(ne,s),htmlFlowData:R,htmlText:i(ne,s),htmlTextData:R,image:i(ze),label:s,link:i(ce),listItem:i(qe),listItemValue:p,listOrdered:i($e,f),listUnordered:i($e),paragraph:i(Pt),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(W),strong:i(kr),thematicBreak:i(sr)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:re,autolinkProtocol:G,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:M,characterReferenceMarkerNumeric:M,characterReferenceValue:I,characterReference:K,codeFenced:l(b),codeFencedFence:m,codeFencedFenceInfo:h,codeFencedFenceMeta:y,codeFlowValue:$,codeIndented:l(g),codeText:l(A),codeTextData:$,data:$,definition:l(),definitionDestinationString:S,definitionLabelString:v,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(L),htmlFlowData:$,htmlText:l(D),htmlTextData:$,image:l(B),label:Y,labelText:U,lineEnding:j,link:l(H),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:k,resourceDestinationString:N,resourceTitleString:F,resource:V,setextHeading:l(P),setextHeadingLineSequence:T,setextHeadingText:C,strong:l(),thematicBreak:l()}};x$(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let ee={type:"root",children:[]};const be={stack:[ee],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},Ee=[];let We=-1;for(;++We<Z.length;)if(Z[We][1].type==="listOrdered"||Z[We][1].type==="listUnordered")if(Z[We][0]==="enter")Ee.push(We);else{const fn=Ee.pop();We=a(Z,fn,We)}for(We=-1;++We<Z.length;){const fn=t[Z[We][0]];b$.call(fn,Z[We][1].type)&&fn[Z[We][1].type].call(Object.assign({sliceSerialize:Z[We][2].sliceSerialize},be),Z[We][1])}if(be.tokenStack.length>0){const fn=be.tokenStack[be.tokenStack.length-1];(fn[1]||Ak).call(be,void 0,fn[0])}for(ee.position={start:Ei(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:Ei(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},We=-1;++We<t.transforms.length;)ee=t.transforms[We](ee)||ee;return ee}function a(Z,ee,be){let Ee=ee-1,We=-1,fn=!1,Er,qn,la,ca;for(;++Ee<=be;){const Yt=Z[Ee];switch(Yt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Yt[0]==="enter"?We++:We--,ca=void 0;break}case"lineEndingBlank":{Yt[0]==="enter"&&(Er&&!ca&&!We&&!la&&(la=Ee),ca=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ca=void 0}if(!We&&Yt[0]==="enter"&&Yt[1].type==="listItemPrefix"||We===-1&&Yt[0]==="exit"&&(Yt[1].type==="listUnordered"||Yt[1].type==="listOrdered")){if(Er){let Cr=Ee;for(qn=void 0;Cr--;){const Rn=Z[Cr];if(Rn[1].type==="lineEnding"||Rn[1].type==="lineEndingBlank"){if(Rn[0]==="exit")continue;qn&&(Z[qn][1].type="lineEndingBlank",fn=!0),Rn[1].type="lineEnding",qn=Cr}else if(!(Rn[1].type==="linePrefix"||Rn[1].type==="blockQuotePrefix"||Rn[1].type==="blockQuotePrefixWhitespace"||Rn[1].type==="blockQuoteMarker"||Rn[1].type==="listItemIndent"))break}la&&(!qn||la<qn)&&(Er._spread=!0),Er.end=Object.assign({},qn?Z[qn][1].start:Yt[1].end),Z.splice(qn||Ee,0,["exit",Er,Yt[2]]),Ee++,be++}if(Yt[1].type==="listItemPrefix"){const Cr={type:"listItem",_spread:!1,start:Object.assign({},Yt[1].start),end:void 0};Er=Cr,Z.splice(Ee,0,["enter",Cr,Yt[2]]),Ee++,be++,la=void 0,ca=!0}}}return Z[ee][1]._spread=fn,be}function i(Z,ee){return be;function be(Ee){o.call(this,Z(Ee),Ee),ee&&ee.call(this,Ee)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(Z,ee,be){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([ee,be||void 0]),Z.position={start:Ei(ee.start),end:void 0}}function l(Z){return ee;function ee(be){Z&&Z.call(this,be),u.call(this,be)}}function u(Z,ee){const be=this.stack.pop(),Ee=this.tokenStack.pop();if(Ee)Ee[0].type!==Z.type&&(ee?ee.call(this,Z,Ee[0]):(Ee[1]||Ak).call(this,Z,Ee[0]));else throw new Error("Cannot close `"+Z.type+"` ("+Cu({start:Z.start,end:Z.end})+"): it’s not open");be.position.end=Ei(Z.end)}function d(){return Ux(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(Z){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function h(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=Z}function y(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=Z}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.value=Z.replace(/(\r?\n|\r)$/g,"")}function v(Z){const ee=this.resume(),be=this.stack[this.stack.length-1];be.label=ee,be.identifier=na(this.sliceSerialize(Z)).toLowerCase()}function w(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.title=Z}function S(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.url=Z}function E(Z){const ee=this.stack[this.stack.length-1];if(!ee.depth){const be=this.sliceSerialize(Z).length;ee.depth=be}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function T(Z){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function R(Z){const be=this.stack[this.stack.length-1].children;let Ee=be[be.length-1];(!Ee||Ee.type!=="text")&&(Ee=yt(),Ee.position={start:Ei(Z.start),end:void 0},be.push(Ee)),this.stack.push(Ee)}function $(Z){const ee=this.stack.pop();ee.value+=this.sliceSerialize(Z),ee.position.end=Ei(Z.end)}function j(Z){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=ee.children[ee.children.length-1];be.position.end=Ei(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&(R.call(this,Z),$.call(this,Z))}function O(){this.data.atHardBreak=!0}function L(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.value=Z}function D(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.value=Z}function A(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.value=Z}function H(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=ee,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function B(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=ee,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function U(Z){const ee=this.sliceSerialize(Z),be=this.stack[this.stack.length-2];be.label=bB(ee),be.identifier=na(ee).toLowerCase()}function Y(){const Z=this.stack[this.stack.length-1],ee=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const Ee=Z.children;be.children=Ee}else be.alt=ee}function N(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.url=Z}function F(){const Z=this.resume(),ee=this.stack[this.stack.length-1];ee.title=Z}function V(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function k(Z){const ee=this.resume(),be=this.stack[this.stack.length-1];be.label=ee,be.identifier=na(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function M(Z){this.data.characterReferenceType=Z.type}function I(Z){const ee=this.sliceSerialize(Z),be=this.data.characterReferenceType;let Ee;be?(Ee=c$(ee,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ee=Fx(ee);const We=this.stack[this.stack.length-1];We.value+=Ee}function K(Z){const ee=this.stack.pop();ee.position.end=Ei(Z.end)}function G(Z){$.call(this,Z);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(Z)}function re(Z){$.call(this,Z);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(Z)}function oe(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function Xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ot(){return{type:"emphasis",children:[]}}function W(){return{type:"heading",depth:0,children:[]}}function fe(){return{type:"break"}}function ne(){return{type:"html",value:""}}function ze(){return{type:"image",title:null,url:"",alt:null}}function ce(){return{type:"link",title:null,url:"",children:[]}}function $e(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function qe(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Pt(){return{type:"paragraph",children:[]}}function kr(){return{type:"strong",children:[]}}function yt(){return{type:"text",value:""}}function sr(){return{type:"thematicBreak"}}}function Ei(e){return{line:e.line,column:e.column,offset:e.offset}}function x$(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?x$(e,r):_B(e,r)}}function _B(e,t){let n;for(n in t)if(b$.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Ak(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Cu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Cu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Cu({start:t.start,end:t.end})+") is still open")}function kB(e){const t=this;t.parser=n;function n(r){return wB(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function EB(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function CB(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
413
- `}]}function NB(e,t){const n=t.value?t.value+`
414
- `:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function jB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=jc(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let s,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=i+1,o+=1,e.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function RB(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $B(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function w$(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const s=a[a.length-1];return s&&s.type==="text"?s.value+=r:a.push({type:"text",value:r}),a}function OB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return w$(e,t);const a={src:jc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)}function MB(e,t){const n={src:jc(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function PB(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function DB(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return w$(e,t);const a={href:jc(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function zB(e,t){const n={href:jc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function IB(e,t,n){const r=e.all(t),a=n?LB(n):S$(t),i={},s=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const d=r[o];(a||o!==0||d.type!=="element"||d.tagName!=="p")&&s.push({type:"text",value:`
415
- `}),d.type==="element"&&d.tagName==="p"&&!a?s.push(...d.children):s.push(d)}const l=r[r.length-1];l&&(a||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
416
- `});const u={type:"element",tagName:"li",properties:i,children:s};return e.patch(t,u),e.applyData(t,u)}function LB(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=S$(n[r])}return t}function S$(e){const t=e.spread;return t??e.children.length>1}function UB(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const s=r[a];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function FB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function HB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BB(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],s),a.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Dx(t.children[1]),l=t$(t.children[t.children.length-1]);o&&l&&(s.position={start:o,end:l}),a.push(s)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)}function VB(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,o=s?s.length:t.children.length;let l=-1;const u=[];for(;++l<o;){const f=t.children[l],p={},h=s?s[l]:void 0;h&&(p.align=h);let y={type:"element",tagName:i,properties:p,children:[]};f&&(y.children=e.all(f),e.patch(f,y),y=e.applyData(f,y)),u.push(y)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function ZB(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Rk=9,$k=32;function KB(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const i=[];for(;r;)i.push(Ok(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return i.push(Ok(t.slice(a),a>0,!1)),i.join("")}function Ok(e,t,n){let r=0,a=e.length;if(t){let i=e.codePointAt(r);for(;i===Rk||i===$k;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(a-1);for(;i===Rk||i===$k;)a--,i=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function GB(e,t){const n={type:"text",value:KB(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function QB(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const YB={blockquote:EB,break:CB,code:NB,delete:jB,emphasis:TB,footnoteReference:AB,heading:RB,html:$B,imageReference:OB,image:MB,inlineCode:PB,linkReference:DB,link:zB,listItem:IB,list:UB,paragraph:FB,root:qB,strong:HB,table:BB,tableCell:ZB,tableRow:VB,text:GB,thematicBreak:QB,toml:Ef,yaml:Ef,definition:Ef,footnoteDefinition:Ef};function Ef(){}const _$=-1,km=0,ju=1,dp=2,Hx=3,Bx=4,Vx=5,Zx=6,k$=7,E$=8,Mk=typeof self=="object"?self:globalThis,XB=(e,t)=>{const n=(a,i)=>(e.set(i,a),a),r=a=>{if(e.has(a))return e.get(a);const[i,s]=t[a];switch(i){case km:case _$:return n(s,a);case ju:{const o=n([],a);for(const l of s)o.push(r(l));return o}case dp:{const o=n({},a);for(const[l,u]of s)o[r(l)]=r(u);return o}case Hx:return n(new Date(s),a);case Bx:{const{source:o,flags:l}=s;return n(new RegExp(o,l),a)}case Vx:{const o=n(new Map,a);for(const[l,u]of s)o.set(r(l),r(u));return o}case Zx:{const o=n(new Set,a);for(const l of s)o.add(r(l));return o}case k$:{const{name:o,message:l}=s;return n(new Mk[o](l),a)}case E$:return n(BigInt(s),a);case"BigInt":return n(Object(BigInt(s)),a);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:o}=new Uint8Array(s);return n(new DataView(o),s)}}return n(new Mk[i](s),a)};return r},Pk=e=>XB(new Map,e)(0),Fo="",{toString:WB}={},{keys:JB}=Object,Zc=e=>{const t=typeof e;if(t!=="object"||!e)return[km,t];const n=WB.call(e).slice(8,-1);switch(n){case"Array":return[ju,Fo];case"Object":return[dp,Fo];case"Date":return[Hx,Fo];case"RegExp":return[Bx,Fo];case"Map":return[Vx,Fo];case"Set":return[Zx,Fo];case"DataView":return[ju,n]}return n.includes("Array")?[ju,n]:n.includes("Error")?[k$,n]:[dp,n]},Cf=([e,t])=>e===km&&(t==="function"||t==="symbol"),eV=(e,t,n,r)=>{const a=(s,o)=>{const l=r.push(s)-1;return n.set(o,l),l},i=s=>{if(n.has(s))return n.get(s);let[o,l]=Zc(s);switch(o){case km:{let d=s;switch(l){case"bigint":o=E$,d=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return a([_$],s)}return a([o,d],s)}case ju:{if(l){let p=s;return l==="DataView"?p=new Uint8Array(s.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(s)),a([l,[...p]],s)}const d=[],f=a([o,d],s);for(const p of s)d.push(i(p));return f}case dp:{if(l)switch(l){case"BigInt":return a([l,s.toString()],s);case"Boolean":case"Number":case"String":return a([l,s.valueOf()],s)}if(t&&"toJSON"in s)return i(s.toJSON());const d=[],f=a([o,d],s);for(const p of JB(s))(e||!Cf(Zc(s[p])))&&d.push([i(p),i(s[p])]);return f}case Hx:return a([o,s.toISOString()],s);case Bx:{const{source:d,flags:f}=s;return a([o,{source:d,flags:f}],s)}case Vx:{const d=[],f=a([o,d],s);for(const[p,h]of s)(e||!(Cf(Zc(p))||Cf(Zc(h))))&&d.push([i(p),i(h)]);return f}case Zx:{const d=[],f=a([o,d],s);for(const p of s)(e||!Cf(Zc(p)))&&d.push(i(p));return f}}const{message:u}=s;return a([o,{name:l,message:u}],s)};return i},Dk=(e,{json:t,lossy:n}={})=>{const r=[];return eV(!(t||n),!!t,new Map,r)(e),r},fp=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Pk(Dk(e,t)):structuredClone(e):(e,t)=>Pk(Dk(e,t));function tV(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function nV(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function rV(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||tV,r=e.options.footnoteBackLabel||nV,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),p=jc(f.toLowerCase());let h=0;const y=[],m=e.footnoteCounts.get(f);for(;m!==void 0&&++h<=m;){y.length>0&&y.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,h);typeof v=="string"&&(v={type:"text",value:v}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,h),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const b=d[d.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const v=b.children[b.children.length-1];v&&v.type==="text"?v.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...y)}else d.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,g),o.push(g)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...fp(s),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
417
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
418
- `}]}}const Em=function(e){if(e==null)return oV;if(typeof e=="function")return Cm(e);if(typeof e=="object")return Array.isArray(e)?aV(e):iV(e);if(typeof e=="string")return sV(e);throw new Error("Expected function, string, or object as test")};function aV(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Em(e[n]);return Cm(r);function r(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function iV(e){const t=e;return Cm(n);function n(r){const a=r;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function sV(e){return Cm(t);function t(n){return n&&n.type===e}}function Cm(e){return t;function t(n,r,a){return!!(lV(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function oV(){return!0}function lV(e){return e!==null&&typeof e=="object"&&"type"in e}const C$=[],cV=!0,n0=!1,uV="skip";function N$(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const i=Em(a),s=r?-1:1;o(e,void 0,[])();function o(l,u,d){const f=l&&typeof l=="object"?l:{};if(typeof f.type=="string"){const h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(h?"<"+h+">":""))+")"})}return p;function p(){let h=C$,y,m,b;if((!t||i(l,u,d[d.length-1]||void 0))&&(h=dV(n(l,d)),h[0]===n0))return h;if("children"in l&&l.children){const g=l;if(g.children&&h[0]!==uV)for(m=(r?g.children.length:-1)+s,b=d.concat(g);m>-1&&m<g.children.length;){const v=g.children[m];if(y=o(v,m,b)(),y[0]===n0)return y;m=typeof y[1]=="number"?y[1]:m+s}}return h}}}function dV(e){return Array.isArray(e)?e:typeof e=="number"?[cV,e]:e==null?C$:[e]}function Kx(e,t,n,r){let a,i,s;typeof t=="function"&&typeof n!="function"?(i=void 0,s=t,a=n):(i=t,s=n,a=r),N$(e,i,o,a);function o(l,u){const d=u[u.length-1],f=d?d.children.indexOf(l):void 0;return s(l,f,d)}}const r0={}.hasOwnProperty,fV={};function hV(e,t){const n=t||fV,r=new Map,a=new Map,i=new Map,s={...YB,...n.handlers},o={all:u,applyData:mV,definitionById:r,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:s,one:l,options:n,patch:pV,wrap:yV};return Kx(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:a,p=String(d.identifier).toUpperCase();f.has(p)||f.set(p,d)}}),o;function l(d,f){const p=d.type,h=o.handlers[p];if(r0.call(o.handlers,p)&&h)return h(o,d,f);if(o.options.passThrough&&o.options.passThrough.includes(p)){if("children"in d){const{children:m,...b}=d,g=fp(b);return g.children=o.all(d),g}return fp(d)}return(o.options.unknownHandler||gV)(o,d,f)}function u(d){const f=[];if("children"in d){const p=d.children;let h=-1;for(;++h<p.length;){const y=o.one(p[h],d);if(y){if(h&&p[h-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=zk(y.value)),!Array.isArray(y)&&y.type==="element")){const m=y.children[0];m&&m.type==="text"&&(m.value=zk(m.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function pV(e,t){e.position&&(t.position=nq(e))}function mV(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&i&&Object.assign(n.properties,fp(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function gV(e,t){const n=t.data||{},r="value"in t&&!(r0.call(n,"hProperties")||r0.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function yV(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
419
- `});++r<e.length;)r&&n.push({type:"text",value:`
420
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
421
- `}),n}function zk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ik(e,t){const n=hV(e,t),r=n.one(e,void 0),a=rV(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
422
- `},a),i}function vV(e,t){return e&&"run"in e?async function(n,r){const a=Ik(n,{file:r,...t});await e.run(a,r)}:function(n,r){return Ik(n,{file:r,...e||t})}}function Lk(e){if(e)throw e}var dh=Object.prototype.hasOwnProperty,j$=Object.prototype.toString,Uk=Object.defineProperty,Fk=Object.getOwnPropertyDescriptor,qk=function(t){return typeof Array.isArray=="function"?Array.isArray(t):j$.call(t)==="[object Array]"},Hk=function(t){if(!t||j$.call(t)!=="[object Object]")return!1;var n=dh.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&dh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||dh.call(t,a)},Bk=function(t,n){Uk&&n.name==="__proto__"?Uk(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Vk=function(t,n){if(n==="__proto__")if(dh.call(t,n)){if(Fk)return Fk(t,n).value}else return;return t[n]},bV=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=Vk(o,n),a=Vk(t,n),o!==a&&(d&&a&&(Hk(a)||(i=qk(a)))?(i?(i=!1,s=r&&qk(r)?r:[]):s=r&&Hk(r)?r:{},Bk(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&Bk(o,{name:n,newValue:a}));return o};const Qg=fc(bV);function a0(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function xV(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let f=-1;if(l){s(l);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);a=u,d?wV(d,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function wV(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return a(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}const da={basename:SV,dirname:_V,extname:kV,join:EV,sep:"/"};function SV(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Dd(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function _V(e){if(Dd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function kV(e){Dd(e);let t=e.length,n=-1,r=0,a=-1,i=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function EV(...e){let t=-1,n;for(;++t<e.length;)Dd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":CV(n)}function CV(e){Dd(e);const t=e.codePointAt(0)===47;let n=NV(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function NV(e,t){let n="",r=0,a=-1,i=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else o===46&&i>-1?i++:i=-1}return n}function Dd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const jV={cwd:TV};function TV(){return"/"}function i0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function AV(e){if(typeof e=="string")e=new URL(e);else if(!i0(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return RV(e)}function RV(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Yg=["history","path","basename","stem","extname","dirname"];class T${constructor(t){let n;t?i0(t)?n={path:t}:typeof t=="string"||$V(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":jV.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Yg.length;){const i=Yg[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Yg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?da.basename(this.path):void 0}set basename(t){Wg(t,"basename"),Xg(t,"basename"),this.path=da.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?da.dirname(this.path):void 0}set dirname(t){Zk(this.basename,"dirname"),this.path=da.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?da.extname(this.path):void 0}set extname(t){if(Xg(t,"extname"),Zk(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=da.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){i0(t)&&(t=AV(t)),Wg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?da.basename(this.path,this.extname):void 0}set stem(t){Wg(t,"stem"),Xg(t,"stem"),this.path=da.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new An(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Xg(e,t){if(e&&e.includes(da.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+da.sep+"`")}function Wg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Zk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function $V(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const OV=function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},MV={}.hasOwnProperty;class Gx extends OV{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=xV()}copy(){const t=new Gx;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Qg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ty("data",this.frozen),this.namespace[t]=n,this):MV.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ty("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Nf(t),r=this.parser||this.Parser;return Jg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Jg("process",this.parser||this.Parser),ey("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Nf(t),l=r.parse(o);r.run(l,o,function(d,f,p){if(d||!f||!p)return u(d);const h=f,y=r.stringify(h,p);zV(y)?p.value=y:p.result=y,u(d,p)});function u(d,f){d||!f?s(d):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Jg("processSync",this.parser||this.Parser),ey("processSync",this.compiler||this.Compiler),this.process(t,a),Gk("processSync","process",n),r;function a(i,s){n=!0,Lk(i),r=s}}run(t,n,r){Kk(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,o){const l=Nf(n);a.run(t,l,u);function u(d,f,p){const h=f||t;d?o(d):s?s(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Gk("runSync","run",r),a;function i(s,o){Lk(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Nf(n),a=this.compiler||this.Compiler;return ey("stringify",a),Kk(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(ty("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;l(d,f)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))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");o(u.plugins),u.settings&&(a.settings=Qg(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[h,...y]=d;const m=r[p][1];a0(m)&&a0(h)&&(h=Qg(!0,m,h)),r[p]=[u,h,...y]}}}}const PV=new Gx().freeze();function Jg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ey(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ty(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Kk(e){if(!a0(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Gk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Nf(e){return DV(e)?e:new T$(e)}function DV(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function zV(e){return typeof e=="string"||IV(e)}function IV(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const LV="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Qk=[],Yk={allowDangerousHtml:!0},UV=/^(https?|ircs?|mailto|xmpp)$/i,FV=[{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 qV(e){const t=HV(e),n=BV(e);return VV(t.runSync(t.parse(n),n),e)}function HV(e){const t=e.rehypePlugins||Qk,n=e.remarkPlugins||Qk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Yk}:Yk;return PV().use(kB).use(n).use(vV,r).use(t)}function BV(e){const t=e.children||"",n=new T$;return typeof t=="string"&&(n.value=t),n}function VV(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,i=t.disallowedElements,s=t.skipHtml,o=t.unwrapDisallowed,l=t.urlTransform||ZV;for(const d of FV)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+LV+d.id,void 0);return Kx(e,u),oq(e,{Fragment:c.Fragment,components:a,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function u(d,f,p){if(d.type==="raw"&&p&&typeof f=="number")return s?p.children.splice(f,1):p.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let h;for(h in Zg)if(Object.hasOwn(Zg,h)&&Object.hasOwn(d.properties,h)){const y=d.properties[h],m=Zg[h];(m===null||m.includes(d.tagName))&&(d.properties[h]=l(String(y||""),h,d))}}if(d.type==="element"){let h=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(d,f,p)),h&&p&&typeof f=="number")return o&&d.children?p.children.splice(f,1,...d.children):p.children.splice(f,1),f}}}function ZV(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||UV.test(e.slice(0,t))?e:""}function Xk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function KV(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function GV(e,t,n){const a=Em((n||{}).ignore||[]),i=QV(t);let s=-1;for(;++s<i.length;)N$(e,"text",o);function o(u,d){let f=-1,p;for(;++f<d.length;){const h=d[f],y=p?p.children:void 0;if(a(h,y?y.indexOf(h):void 0,p))return;p=h}if(p)return l(u,d)}function l(u,d){const f=d[d.length-1],p=i[s][0],h=i[s][1];let y=0;const b=f.children.indexOf(u);let g=!1,v=[];p.lastIndex=0;let w=p.exec(u.value);for(;w;){const S=w.index,E={index:w.index,input:w.input,stack:[...d,u]};let C=h(...w,E);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?p.lastIndex=S+1:(y!==S&&v.push({type:"text",value:u.value.slice(y,S)}),Array.isArray(C)?v.push(...C):C&&v.push(C),y=S+w[0].length,g=!0),!p.global)break;w=p.exec(u.value)}return g?(y<u.value.length&&v.push({type:"text",value:u.value.slice(y)}),f.children.splice(b,1,...v)):v=[u],b+v.length}}function QV(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([YV(a[0]),XV(a[1])])}return t}function YV(e){return typeof e=="string"?new RegExp(KV(e),"g"):e}function XV(e){return typeof e=="function"?e:function(){return e}}const ny="phrasing",ry=["autolink","link","image","label"];function WV(){return{transforms:[i7],enter:{literalAutolink:e7,literalAutolinkEmail:ay,literalAutolinkHttp:ay,literalAutolinkWww:ay},exit:{literalAutolink:a7,literalAutolinkEmail:r7,literalAutolinkHttp:t7,literalAutolinkWww:n7}}}function JV(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ny,notInConstruct:ry},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ny,notInConstruct:ry},{character:":",before:"[ps]",after:"\\/",inConstruct:ny,notInConstruct:ry}]}}function e7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ay(e){this.config.enter.autolinkProtocol.call(this,e)}function t7(e){this.config.exit.autolinkProtocol.call(this,e)}function n7(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function r7(e){this.config.exit.autolinkEmail.call(this,e)}function a7(e){this.exit(e)}function i7(e){GV(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,s7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),o7]],{ignore:["link","linkReference"]})}function s7(e,t,n,r,a){let i="";if(!A$(a)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!l7(n)))return!1;const s=c7(n+r);if(!s[0])return!1;const o={type:"link",title:null,url:i+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[o,{type:"text",value:s[1]}]:o}function o7(e,t,n,r){return!A$(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function l7(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function c7(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=Xk(e,"(");let i=Xk(e,")");for(;r!==-1&&a>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function A$(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||wo(n)||Sm(n))&&(!t||n!==47)}R$.peek=v7;function u7(){this.buffer()}function d7(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function f7(){this.buffer()}function h7(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function p7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=na(this.sliceSerialize(e)).toLowerCase(),n.label=t}function m7(e){this.exit(e)}function g7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=na(this.sliceSerialize(e)).toLowerCase(),n.label=t}function y7(e){this.exit(e)}function v7(){return"["}function R$(e,t,n,r){const a=n.createTracker(r);let i=a.move("[^");const s=n.enter("footnoteReference"),o=n.enter("reference");return i+=a.move(n.safe(n.associationId(e),{after:"]",before:i})),o(),s(),i+=a.move("]"),i}function b7(){return{enter:{gfmFootnoteCallString:u7,gfmFootnoteCall:d7,gfmFootnoteDefinitionLabelString:f7,gfmFootnoteDefinition:h7},exit:{gfmFootnoteCallString:p7,gfmFootnoteCall:m7,gfmFootnoteDefinitionLabelString:g7,gfmFootnoteDefinition:y7}}}function x7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:R$},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,i,s){const o=i.createTracker(s);let l=o.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return l+=o.move(i.safe(i.associationId(r),{before:l,after:"]"})),d(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((t?`
423
- `:" ")+i.indentLines(i.containerFlow(r,o.current()),t?$$:w7))),u(),l}}function w7(e,t,n){return t===0?e:$$(e,t,n)}function $$(e,t,n){return(n?"":" ")+e}const S7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];O$.peek=N7;function _7(){return{canContainEols:["delete"],enter:{strikethrough:E7},exit:{strikethrough:C7}}}function k7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:S7}],handlers:{delete:O$}}}function E7(e){this.enter({type:"delete",children:[]},e)}function C7(e){this.exit(e)}function O$(e,t,n,r){const a=n.createTracker(r),i=n.enter("strikethrough");let s=a.move("~~");return s+=n.containerPhrasing(e,{...a.current(),before:s,after:"~"}),s+=a.move("~~"),i(),s}function N7(){return"~"}function j7(e){return e.length}function T7(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||j7,i=[],s=[],o=[],l=[];let u=0,d=-1;for(;++d<e.length;){const m=[],b=[];let g=-1;for(e[d].length>u&&(u=e[d].length);++g<e[d].length;){const v=A7(e[d][g]);if(n.alignDelimiters!==!1){const w=a(v);b[g]=w,(l[g]===void 0||w>l[g])&&(l[g]=w)}m.push(v)}s[d]=m,o[d]=b}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)i[f]=Wk(r[f]);else{const m=Wk(r);for(;++f<u;)i[f]=m}f=-1;const p=[],h=[];for(;++f<u;){const m=i[f];let b="",g="";m===99?(b=":",g=":"):m===108?b=":":m===114&&(g=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[f]-b.length-g.length);const w=b+"-".repeat(v)+g;n.alignDelimiters!==!1&&(v=b.length+v+g.length,v>l[f]&&(l[f]=v),h[f]=v),p[f]=w}s.splice(1,0,p),o.splice(1,0,h),d=-1;const y=[];for(;++d<s.length;){const m=s[d],b=o[d];f=-1;const g=[];for(;++f<u;){const v=m[f]||"";let w="",S="";if(n.alignDelimiters!==!1){const E=l[f]-(b[f]||0),C=i[f];C===114?w=" ".repeat(E):C===99?E%2?(w=" ".repeat(E/2+.5),S=" ".repeat(E/2-.5)):(w=" ".repeat(E/2),S=w):S=" ".repeat(E)}n.delimiterStart!==!1&&!f&&g.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||f)&&g.push(" "),n.alignDelimiters!==!1&&g.push(w),g.push(v),n.alignDelimiters!==!1&&g.push(S),n.padding!==!1&&g.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&g.push("|")}y.push(n.delimiterEnd===!1?g.join("").replace(/ +$/,""):g.join(""))}return y.join(`
424
- `)}function A7(e){return e==null?"":String(e)}function Wk(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function R7(e,t,n,r){const a=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const s=n.indentLines(n.containerFlow(e,i.current()),$7);return a(),s}function $7(e,t,n){return">"+(n?"":" ")+e}function O7(e,t){return Jk(e,t.inConstruct,!0)&&!Jk(e,t.notInConstruct,!1)}function Jk(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function eE(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
425
- `&&O7(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return`\\
426
- `}function M7(e,t){const n=String(e);let r=n.indexOf(t),a=r,i=0,s=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++i>s&&(s=i):i=1,a=r+t.length,r=n.indexOf(t,a);return s}function P7(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function D7(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function z7(e,t,n,r){const a=D7(n),i=e.value||"",s=a==="`"?"GraveAccent":"Tilde";if(P7(e,n)){const f=n.enter("codeIndented"),p=n.indentLines(i,I7);return f(),p}const o=n.createTracker(r),l=a.repeat(Math.max(M7(i,a)+1,3)),u=n.enter("codeFenced");let d=o.move(l);if(e.lang){const f=n.enter(`codeFencedLang${s}`);d+=o.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${s}`);d+=o.move(" "),d+=o.move(n.safe(e.meta,{before:d,after:`
427
- `,encode:["`"],...o.current()})),f()}return d+=o.move(`
428
- `),i&&(d+=o.move(i+`
429
- `)),d+=o.move(l),u(),d}function I7(e,t,n){return(n?"":" ")+e}function Qx(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function L7(e,t,n,r){const a=Qx(n),i=a==='"'?"Quote":"Apostrophe",s=n.enter("definition");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
430
- `,...l.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=l.move(" "+a),u+=l.move(n.safe(e.title,{before:u,after:a,...l.current()})),u+=l.move(a),o()),s(),u}function U7(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ad(e){return"&#x"+e.toString(16).toUpperCase()+";"}function hp(e,t,n){const r=oc(e),a=oc(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}M$.peek=F7;function M$(e,t,n,r){const a=U7(n),i=n.enter("emphasis"),s=n.createTracker(r),o=s.move(a);let l=s.move(n.containerPhrasing(e,{after:a,before:o,...s.current()}));const u=l.charCodeAt(0),d=hp(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(l=ad(u)+l.slice(1));const f=l.charCodeAt(l.length-1),p=hp(r.after.charCodeAt(0),f,a);p.inside&&(l=l.slice(0,-1)+ad(f));const h=s.move(a);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},o+l+h}function F7(e,t,n){return n.options.emphasis||"*"}function q7(e,t){let n=!1;return Kx(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,n0}),!!((!e.depth||e.depth<3)&&Ux(e)&&(t.options.setext||n))}function H7(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(q7(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),p=n.containerPhrasing(e,{...i.current(),before:`
431
- `,after:`
432
- `});return f(),d(),p+`
433
- `+(a===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
434
- `))+1))}const s="#".repeat(a),o=n.enter("headingAtx"),l=n.enter("phrasing");i.move(s+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
435
- `,...i.current()});return/^[\t ]/.test(u)&&(u=ad(u.charCodeAt(0))+u.slice(1)),u=u?s+" "+u:s,n.options.closeAtx&&(u+=" "+s),l(),o(),u}P$.peek=B7;function P$(e){return e.value||""}function B7(){return"<"}D$.peek=V7;function D$(e,t,n,r){const a=Qx(n),i=a==='"'?"Quote":"Apostrophe",s=n.enter("image");let o=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=l.move(" "+a),u+=l.move(n.safe(e.title,{before:u,after:a,...l.current()})),u+=l.move(a),o()),u+=l.move(")"),s(),u}function V7(){return"!"}z$.peek=Z7;function z$(e,t,n,r){const a=e.referenceType,i=n.enter("imageReference");let s=n.enter("label");const o=n.createTracker(r);let l=o.move("![");const u=n.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),s();const d=n.stack;n.stack=[],s=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return s(),n.stack=d,i(),a==="full"||!u||u!==f?l+=o.move(f+"]"):a==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function Z7(){return"!"}I$.peek=K7;function I$(e,t,n){let r=e.value||"",a="`",i=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const s=n.unsafe[i],o=n.compilePattern(s);let l;if(s.atBreak)for(;l=o.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return a+r+a}function K7(){return"`"}function L$(e,t){const n=Ux(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}U$.peek=G7;function U$(e,t,n,r){const a=Qx(n),i=a==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let o,l;if(L$(e,n)){const d=n.stack;n.stack=[],o=n.enter("autolink");let f=s.move("<");return f+=s.move(n.containerPhrasing(e,{before:f,after:">",...s.current()})),f+=s.move(">"),o(),n.stack=d,f}o=n.enter("link"),l=n.enter("label");let u=s.move("[");return u+=s.move(n.containerPhrasing(e,{before:u,after:"](",...s.current()})),u+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(n.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(l=n.enter("destinationRaw"),u+=s.move(n.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=s.move(" "+a),u+=s.move(n.safe(e.title,{before:u,after:a,...s.current()})),u+=s.move(a),l()),u+=s.move(")"),o(),u}function G7(e,t,n){return L$(e,n)?"<":"["}F$.peek=Q7;function F$(e,t,n,r){const a=e.referenceType,i=n.enter("linkReference");let s=n.enter("label");const o=n.createTracker(r);let l=o.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),s();const d=n.stack;n.stack=[],s=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...o.current()});return s(),n.stack=d,i(),a==="full"||!u||u!==f?l+=o.move(f+"]"):a==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function Q7(){return"["}function Yx(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Y7(e){const t=Yx(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function X7(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function q$(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function W7(e,t,n,r){const a=n.enter("list"),i=n.bulletCurrent;let s=e.ordered?X7(n):Yx(n);const o=e.ordered?s==="."?")":".":Y7(n);let l=t&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),q$(n)===s&&d){let f=-1;for(;++f<e.children.length;){const p=e.children[f];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(s=o),n.bulletCurrent=s;const u=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=i,a(),u}function J7(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function eZ(e,t,n,r){const a=J7(n);let i=n.bulletCurrent||Yx(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let s=i.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(s-i.length)),o.shift(s);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),d);return l(),u;function d(f,p,h){return p?(h?"":" ".repeat(s))+f:(h?i:i+" ".repeat(s-i.length))+f}}function tZ(e,t,n,r){const a=n.enter("paragraph"),i=n.enter("phrasing"),s=n.containerPhrasing(e,r);return i(),a(),s}const nZ=Em(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function rZ(e,t,n,r){return(e.children.some(function(s){return nZ(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function aZ(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}H$.peek=iZ;function H$(e,t,n,r){const a=aZ(n),i=n.enter("strong"),s=n.createTracker(r),o=s.move(a+a);let l=s.move(n.containerPhrasing(e,{after:a,before:o,...s.current()}));const u=l.charCodeAt(0),d=hp(r.before.charCodeAt(r.before.length-1),u,a);d.inside&&(l=ad(u)+l.slice(1));const f=l.charCodeAt(l.length-1),p=hp(r.after.charCodeAt(0),f,a);p.inside&&(l=l.slice(0,-1)+ad(f));const h=s.move(a+a);return i(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},o+l+h}function iZ(e,t,n){return n.options.strong||"*"}function sZ(e,t,n,r){return n.safe(e.value,r)}function oZ(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function lZ(e,t,n){const r=(q$(n)+(n.options.ruleSpaces?" ":"")).repeat(oZ(n));return n.options.ruleSpaces?r.slice(0,-1):r}const B$={blockquote:R7,break:eE,code:z7,definition:L7,emphasis:M$,hardBreak:eE,heading:H7,html:P$,image:D$,imageReference:z$,inlineCode:I$,link:U$,linkReference:F$,list:W7,listItem:eZ,paragraph:tZ,root:rZ,strong:H$,text:sZ,thematicBreak:lZ};function cZ(){return{enter:{table:uZ,tableData:tE,tableHeader:tE,tableRow:fZ},exit:{codeText:hZ,table:dZ,tableData:iy,tableHeader:iy,tableRow:iy}}}function uZ(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function dZ(e){this.exit(e),this.data.inTable=void 0}function fZ(e){this.enter({type:"tableRow",children:[]},e)}function iy(e){this.exit(e)}function tE(e){this.enter({type:"tableCell",children:[]},e)}function hZ(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,pZ));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function pZ(e,t){return t==="|"?t:e}function mZ(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
436
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:s,tableCell:l,tableRow:o}};function s(h,y,m,b){return u(d(h,m,b),h.align)}function o(h,y,m,b){const g=f(h,m,b),v=u([g]);return v.slice(0,v.indexOf(`
437
- `))}function l(h,y,m,b){const g=m.enter("tableCell"),v=m.enter("phrasing"),w=m.containerPhrasing(h,{...b,before:i,after:i});return v(),g(),w}function u(h,y){return T7(h,{align:y,alignDelimiters:r,padding:n,stringLength:a})}function d(h,y,m){const b=h.children;let g=-1;const v=[],w=y.enter("table");for(;++g<b.length;)v[g]=f(b[g],y,m);return w(),v}function f(h,y,m){const b=h.children;let g=-1;const v=[],w=y.enter("tableRow");for(;++g<b.length;)v[g]=l(b[g],h,y,m);return w(),v}function p(h,y,m){let b=B$.inlineCode(h,y,m);return m.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function gZ(){return{exit:{taskListCheckValueChecked:nE,taskListCheckValueUnchecked:nE,paragraph:vZ}}}function yZ(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:bZ}}}function nE(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function vZ(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let i=-1,s;for(;++i<a.length;){const o=a[i];if(o.type==="paragraph"){s=o;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function bZ(e,t,n,r){const a=e.children[0],i=typeof e.checked=="boolean"&&a&&a.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);i&&o.move(s);let l=B$.listItem(e,t,n,{...r,...o.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(d){return d+s}}function xZ(){return[WV(),b7(),_7(),cZ(),gZ()]}function wZ(e){return{extensions:[JV(),x7(e),k7(),mZ(e),yZ()]}}const SZ={tokenize:jZ,partial:!0},V$={tokenize:TZ,partial:!0},Z$={tokenize:AZ,partial:!0},K$={tokenize:RZ,partial:!0},_Z={tokenize:$Z,partial:!0},G$={name:"wwwAutolink",tokenize:CZ,previous:Y$},Q$={name:"protocolAutolink",tokenize:NZ,previous:X$},wi={name:"emailAutolink",tokenize:EZ,previous:W$},Ra={};function kZ(){return{text:Ra}}let $s=48;for(;$s<123;)Ra[$s]=wi,$s++,$s===58?$s=65:$s===91&&($s=97);Ra[43]=wi;Ra[45]=wi;Ra[46]=wi;Ra[95]=wi;Ra[72]=[wi,Q$];Ra[104]=[wi,Q$];Ra[87]=[wi,G$];Ra[119]=[wi,G$];function EZ(e,t,n){const r=this;let a,i;return s;function s(f){return!s0(f)||!W$.call(r,r.previous)||Xx(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(f))}function o(f){return s0(f)?(e.consume(f),o):f===64?(e.consume(f),l):n(f)}function l(f){return f===46?e.check(_Z,d,u)(f):f===45||f===95||jn(f)?(i=!0,e.consume(f),l):d(f)}function u(f){return e.consume(f),a=!0,l}function d(f){return i&&a&&Ln(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function CZ(e,t,n){const r=this;return a;function a(s){return s!==87&&s!==119||!Y$.call(r,r.previous)||Xx(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(SZ,e.attempt(V$,e.attempt(Z$,i),n),n)(s))}function i(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function NZ(e,t,n){const r=this;let a="",i=!1;return s;function s(f){return(f===72||f===104)&&X$.call(r,r.previous)&&!Xx(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(f),e.consume(f),o):n(f)}function o(f){if(Ln(f)&&a.length<5)return a+=String.fromCodePoint(f),e.consume(f),o;if(f===58){const p=a.toLowerCase();if(p==="http"||p==="https")return e.consume(f),l}return n(f)}function l(f){return f===47?(e.consume(f),i?u:(i=!0,l)):n(f)}function u(f){return f===null||up(f)||pt(f)||wo(f)||Sm(f)?n(f):e.attempt(V$,e.attempt(Z$,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function jZ(e,t,n){let r=0;return a;function a(s){return(s===87||s===119)&&r<3?(r++,e.consume(s),a):s===46&&r===3?(e.consume(s),i):n(s)}function i(s){return s===null?n(s):t(s)}}function TZ(e,t,n){let r,a,i;return s;function s(u){return u===46||u===95?e.check(K$,l,o)(u):u===null||pt(u)||wo(u)||u!==45&&Sm(u)?l(u):(i=!0,e.consume(u),s)}function o(u){return u===95?r=!0:(a=r,r=void 0),e.consume(u),s}function l(u){return a||r||!i?n(u):t(u)}}function AZ(e,t){let n=0,r=0;return a;function a(s){return s===40?(n++,e.consume(s),a):s===41&&r<n?i(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(K$,t,i)(s):s===null||pt(s)||wo(s)?t(s):(e.consume(s),a)}function i(s){return s===41&&r++,e.consume(s),a}}function RZ(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),i):o===93?(e.consume(o),a):o===60||o===null||pt(o)||wo(o)?t(o):n(o)}function a(o){return o===null||o===40||o===91||pt(o)||wo(o)?t(o):r(o)}function i(o){return Ln(o)?s(o):n(o)}function s(o){return o===59?(e.consume(o),r):Ln(o)?(e.consume(o),s):n(o)}}function $Z(e,t,n){return r;function r(i){return e.consume(i),a}function a(i){return jn(i)?n(i):t(i)}}function Y$(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||pt(e)}function X$(e){return!Ln(e)}function W$(e){return!(e===47||s0(e))}function s0(e){return e===43||e===45||e===46||e===95||jn(e)}function Xx(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const OZ={tokenize:FZ,partial:!0};function MZ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:IZ,continuation:{tokenize:LZ},exit:UZ}},text:{91:{name:"gfmFootnoteCall",tokenize:zZ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:PZ,resolveTo:DZ}}}}function PZ(e,t,n){const r=this;let a=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;a--;){const l=r.events[a][1];if(l.type==="labelImage"){s=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!s||!s._balanced)return n(l);const u=na(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function DZ(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function zZ(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,s;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!s||f===null||f===91||pt(f))return n(f);if(f===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return a.includes(na(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return pt(f)||(s=!0),i++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function IZ(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,s=0,o;return l;function l(y){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(y){return y===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(y)}function d(y){if(s>999||y===93&&!o||y===null||y===91||pt(y))return n(y);if(y===93){e.exit("chunkString");const m=e.exit("gfmFootnoteDefinitionLabelString");return i=na(r.sliceSerialize(m)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return pt(y)||(o=!0),s++,e.consume(y),y===92?f:d}function f(y){return y===91||y===92||y===93?(e.consume(y),s++,d):d(y)}function p(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),a.includes(i)||a.push(i),Je(e,h,"gfmFootnoteDefinitionWhitespace")):n(y)}function h(y){return t(y)}}function LZ(e,t,n){return e.check(Pd,t,e.attempt(OZ,t,n))}function UZ(e){e.exit("gfmFootnoteDefinition")}function FZ(e,t,n){const r=this;return Je(e,a,"gfmFootnoteDefinitionIndent",5);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(i):n(i)}}function qZ(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(s,o){let l=-1;for(;++l<s.length;)if(s[l][0]==="enter"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._close){let u=l;for(;u--;)if(s[u][0]==="exit"&&s[u][1].type==="strikethroughSequenceTemporary"&&s[u][1]._open&&s[l][1].end.offset-s[l][1].start.offset===s[u][1].end.offset-s[u][1].start.offset){s[l][1].type="strikethroughSequence",s[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},s[u][1].start),end:Object.assign({},s[l][1].end)},f={type:"strikethroughText",start:Object.assign({},s[u][1].end),end:Object.assign({},s[l][1].start)},p=[["enter",d,o],["enter",s[u][1],o],["exit",s[u][1],o],["enter",f,o]],h=o.parser.constructs.insideSpan.null;h&&br(p,p.length,0,_m(h,s.slice(u+1,l),o)),br(p,p.length,0,[["exit",f,o],["enter",s[l][1],o],["exit",s[l][1],o],["exit",d,o]]),br(s,u-1,l-u+3,p),l=u+p.length-2;break}}for(l=-1;++l<s.length;)s[l][1].type==="strikethroughSequenceTemporary"&&(s[l][1].type="data");return s}function i(s,o,l){const u=this.previous,d=this.events;let f=0;return p;function p(y){return u===126&&d[d.length-1][1].type!=="characterEscape"?l(y):(s.enter("strikethroughSequenceTemporary"),h(y))}function h(y){const m=oc(u);if(y===126)return f>1?l(y):(s.consume(y),f++,h);if(f<2&&!n)return l(y);const b=s.exit("strikethroughSequenceTemporary"),g=oc(y);return b._open=!g||g===2&&!!m,b._close=!m||m===2&&!!g,o(y)}}}class HZ{constructor(){this.map=[]}add(t,n,r){BZ(this,t,n,r)}consume(t){if(this.map.sort(function(i,s){return i[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const i of a)t.push(i);a=r.pop()}this.map.length=0}}function BZ(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function VZ(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function ZZ(){return{flow:{null:{name:"table",tokenize:KZ,resolveAll:GZ}}}}function KZ(e,t,n){const r=this;let a=0,i=0,s;return o;function o($){let j=r.events.length-1;for(;j>-1;){const D=r.events[j][1].type;if(D==="lineEnding"||D==="linePrefix")j--;else break}const O=j>-1?r.events[j][1].type:null,L=O==="tableHead"||O==="tableRow"?C:l;return L===C&&r.parser.lazy[r.now().line]?n($):L($)}function l($){return e.enter("tableHead"),e.enter("tableRow"),u($)}function u($){return $===124||(s=!0,i+=1),d($)}function d($){return $===null?n($):_e($)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),h):n($):Ze($)?Je(e,d,"whitespace")($):(i+=1,s&&(s=!1,a+=1),$===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),s=!0,d):(e.enter("data"),f($)))}function f($){return $===null||$===124||pt($)?(e.exit("data"),d($)):(e.consume($),$===92?p:f)}function p($){return $===92||$===124?(e.consume($),f):f($)}function h($){return r.interrupt=!1,r.parser.lazy[r.now().line]?n($):(e.enter("tableDelimiterRow"),s=!1,Ze($)?Je(e,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):y($))}function y($){return $===45||$===58?b($):$===124?(s=!0,e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),m):E($)}function m($){return Ze($)?Je(e,b,"whitespace")($):b($)}function b($){return $===58?(i+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),g):$===45?(i+=1,g($)):$===null||_e($)?S($):E($)}function g($){return $===45?(e.enter("tableDelimiterFiller"),v($)):E($)}function v($){return $===45?(e.consume($),v):$===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w($))}function w($){return Ze($)?Je(e,S,"whitespace")($):S($)}function S($){return $===124?y($):$===null||_e($)?!s||a!==i?E($):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t($)):E($)}function E($){return n($)}function C($){return e.enter("tableRow"),T($)}function T($){return $===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),T):$===null||_e($)?(e.exit("tableRow"),t($)):Ze($)?Je(e,T,"whitespace")($):(e.enter("data"),P($))}function P($){return $===null||$===124||pt($)?(e.exit("data"),T($)):(e.consume($),$===92?R:P)}function R($){return $===92||$===124?(e.consume($),P):P($)}}function GZ(e,t){let n=-1,r=!0,a=0,i=[0,0,0,0],s=[0,0,0,0],o=!1,l=0,u,d,f;const p=new HZ;for(;++n<e.length;){const h=e[n],y=h[1];h[0]==="enter"?y.type==="tableHead"?(o=!1,l!==0&&(rE(p,t,l,u,d),d=void 0,l=0),u={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},p.add(n,0,[["enter",u,t]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(r=!0,f=void 0,i=[0,0,0,0],s=[0,n+1,0,0],o&&(o=!1,d={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},p.add(n,0,[["enter",d,t]])),a=y.type==="tableDelimiterRow"?2:d?3:1):a&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(i[1]!==0&&(s[0]=s[1],f=jf(p,t,i,a,void 0,f),i=[0,0,0,0]),s[2]=n)):y.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(s[0]=s[1],f=jf(p,t,i,a,void 0,f)),i=s,s=[i[1],n,0,0])):y.type==="tableHead"?(o=!0,l=n):y.type==="tableRow"||y.type==="tableDelimiterRow"?(l=n,i[1]!==0?(s[0]=s[1],f=jf(p,t,i,a,n,f)):s[1]!==0&&(f=jf(p,t,s,a,n,f)),a=0):a&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(s[3]=n)}for(l!==0&&rE(p,t,l,u,d),p.consume(t.events),n=-1;++n<t.events.length;){const h=t.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=VZ(t.events,n))}return e}function jf(e,t,n,r,a,i){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(i.end=Object.assign({},Qo(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=Qo(t.events,n[1]);if(i={type:s,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=Qo(t.events,n[2]),d=Qo(t.events,n[3]),f={type:o,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const p=t.events[n[2]],h=t.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const y=n[2]+1,m=n[3]-n[2]-1;e.add(y,m,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return a!==void 0&&(i.end=Object.assign({},Qo(t.events,a)),e.add(a,0,[["exit",i,t]]),i=void 0),i}function rE(e,t,n,r,a){const i=[],s=Qo(t.events,n);a&&(a.end=Object.assign({},s),i.push(["exit",a,t])),r.end=Object.assign({},s),i.push(["exit",r,t]),e.add(n+1,0,i)}function Qo(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const QZ={name:"tasklistCheck",tokenize:XZ};function YZ(){return{text:{91:QZ}}}function XZ(e,t,n){const r=this;return a;function a(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return pt(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),s):n(l)}function s(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(l)}function o(l){return _e(l)?t(l):Ze(l)?e.check({tokenize:WZ},t,n)(l):n(l)}}function WZ(e,t,n){return Je(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function JZ(e){return l$([kZ(),MZ(),qZ(e),ZZ(),YZ()])}const eK={};function tK(e){const t=this,n=e||eK,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(JZ(n)),i.push(xZ()),s.push(wZ(n))}const pp=180;function nK(e){return e.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^#+\s+/gm,"").replace(/\s+/g," ").trim()}function rK(e,t){var a;if(t!=null&&t.trim())return t.trim();const n=((a=e.split(/\n\n+/)[0])==null?void 0:a.replace(/\n/g," "))??e,r=nK(n);return r.length<=pp?r:`${r.slice(0,pp-1).trimEnd()}…`}function aK(e,t){return t!=null&&t.trim()&&e.length>pp?!0:e.length>pp||/\n/.test(e)}function iK({description:e,title:t,expanded:n,onToggle:r}){const a=rK(e,t),i=aK(e,t);return e?i?c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"line-clamp-3 text-sm leading-relaxed",children:a}),c.jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 text-xs text-[#92E4DD] hover:text-white",children:[c.jsx(sm,{className:`h-3.5 w-3.5 transition-transform ${n?"rotate-180":""}`}),n?"Hide full description":"Show full description"]})]}):c.jsx("span",{children:a}):c.jsx("span",{className:"text-gray-500",children:"—"})}function sK({description:e}){return c.jsx("div",{className:"max-h-64 overflow-auto rounded border border-white/10 bg-[#0F0F0C] p-3",children:c.jsx("div",{className:"prose prose-sm prose-invert max-w-none prose-headings:text-gray-100 prose-p:text-gray-300 prose-li:text-gray-300 prose-strong:text-gray-100 prose-code:text-[#92E4DD] prose-code:before:content-none prose-code:after:content-none",children:c.jsx(qV,{remarkPlugins:[tK],children:e})})})}function oK(){const[e,t]=x.useState(null);return{expandedDescription:e,toggleDescription:r=>{t(a=>a===r?null:r)}}}function sy(e){return new Set(e.filter(t=>t.enabled===!1).map(t=>t.name))}function lK({serviceId:e,tools:t,isLoading:n}){const[r,a]=x.useState(""),[i,s]=x.useState(null),{expandedDescription:o,toggleDescription:l}=oK(),[u,d]=x.useState(()=>sy(t)),f=un(),{toast:p}=rn(),h=x.useMemo(()=>t.map(S=>`${S.name}:${S.enabled===!1?"0":"1"}`).sort().join("\0"),[t]);x.useEffect(()=>{d(sy(t))},[e,h]);const y=_t({mutationFn:async S=>{await we("PUT",`/api/services/${e}/tool-settings`,{disabledTools:S})},onSuccess:()=>{f.invalidateQueries({queryKey:["/api/services",e,"tools"]}),f.invalidateQueries({queryKey:["/api/services"]})},onError:S=>{p({title:"Could not save tool settings",description:S.message,variant:"destructive"}),d(sy(t))}}),m=S=>{d(S),y.mutate([...S])},b=(S,E)=>{const C=new Set(u);E?C.delete(S):C.add(S),m(C)},g=S=>{if(S){m(new Set);return}m(new Set(t.map(E=>E.name)))},v=x.useMemo(()=>{const S=r.trim().toLowerCase();return S?t.filter(E=>{var C;return E.name.toLowerCase().includes(S)||(((C=E.title)==null?void 0:C.toLowerCase().includes(S))??!1)||E.description.toLowerCase().includes(S)}):t},[t,r]),w=t.length-u.size;return n?c.jsx("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:c.jsx("p",{className:"text-sm text-gray-400",children:"Loading tools…"})}):t.length===0?null:c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("h3",{className:"text-lg font-semibold flex items-center",children:[c.jsx(ix,{className:"w-5 h-5 mr-2"}),"Tools",c.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:[w," of ",t.length," enabled"]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(te,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>g(!0),disabled:u.size===0||y.isPending,children:"Enable all"}),c.jsx(te,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>g(!1),disabled:w===0||y.isPending,children:"Disable all"})]})]}),c.jsx("p",{className:"mb-3 text-xs text-[#A8C4C0]",children:"Choose which tools your agent can use from this MCP. Disabled tools are hidden from the agent but stay registered on the server."}),c.jsxs("div",{className:"relative mb-3",children:[c.jsx(AT,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),c.jsx(it,{value:r,onChange:S=>a(S.target.value),placeholder:"Search tools…",className:"border-white/15 bg-[#0F0F0C] pl-9 text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),c.jsx("div",{className:"rounded-md border border-white/10 overflow-hidden",children:c.jsxs(VR,{children:[c.jsx(ZR,{children:c.jsxs(Go,{className:"border-white/10 hover:bg-transparent",children:[c.jsx(ch,{className:"w-[72px] text-center text-[#A8C4C0]",children:"Enabled"}),c.jsx(ch,{className:"w-[220px] text-[#A8C4C0]",children:"Tool"}),c.jsx(ch,{className:"text-[#A8C4C0]",children:"Description"})]})}),c.jsx(KR,{children:v.length===0?c.jsx(Go,{className:"border-white/10 hover:bg-transparent",children:c.jsx(Ls,{colSpan:3,className:"py-8 text-center text-sm text-gray-400",children:"No tools match your search."})}):v.map(S=>{const E=!u.has(S.name),C=i===S.name,T=o===S.name,P=S.inputSchema&&Object.keys(S.inputSchema).length>0;return c.jsxs(x.Fragment,{children:[c.jsxs(Go,{className:`border-white/10 ${E?"hover:bg-white/5":"opacity-60 hover:bg-white/5"}`,children:[c.jsx(Ls,{className:"text-center",children:c.jsx("div",{className:"flex justify-center",children:c.jsx(cp,{checked:E,onCheckedChange:R=>b(S.name,R===!0),disabled:y.isPending,"aria-label":`${E?"Disable":"Enable"} ${S.name}`,className:"h-[18px] w-[18px] border-white/40 bg-[#0F0F0C] data-[state=checked]:border-[#92E4DD] data-[state=checked]:bg-[#92E4DD] data-[state=checked]:text-[#0F0F0C]"})})}),c.jsx(Ls,{children:P?c.jsxs("button",{type:"button",onClick:()=>s(C?null:S.name),className:"flex w-full items-center gap-1 text-left font-mono text-sm text-[#92E4DD] hover:text-white",children:[c.jsx(sm,{className:`h-4 w-4 shrink-0 transition-transform ${C?"rotate-180":""}`}),S.name]}):c.jsx("span",{className:"font-mono text-sm text-[#92E4DD]",children:S.name})}),c.jsx(Ls,{className:"max-w-0 text-sm text-gray-300",children:c.jsx(iK,{description:S.description,title:S.title,expanded:T,onToggle:()=>l(S.name)})})]}),T&&c.jsx(Go,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:c.jsx(Ls,{colSpan:3,className:"py-3",children:c.jsx(sK,{description:S.description})})}),P&&C&&c.jsx(Go,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:c.jsx(Ls,{colSpan:3,className:"py-3",children:c.jsx("pre",{className:"max-h-48 overflow-auto rounded border border-white/10 bg-[#0F0F0C] p-3 text-xs text-gray-300",children:JSON.stringify(S.inputSchema,null,2)})})})]},S.name)})})]})})]})}function oy({items:e,className:t}){return e.length===0?null:c.jsx("ol",{className:`list-decimal list-inside space-y-1 text-xs ${t??""}`,children:e.map((n,r)=>c.jsx("li",{children:n},`${r}-${n.slice(0,24)}`))})}function aE({serviceId:e,onConnected:t}){const{toast:n}=rn(),[r,a]=x.useState(""),[i,s]=x.useState(""),[o,l]=x.useState(!1),[u,d]=x.useState(!1),[f,p]=x.useState(!1),{data:h,isLoading:y}=St({queryKey:["/api/oauth",e,"setup"],queryFn:async()=>{const E=await we("GET",`/api/oauth/${e}/setup`),C=await E.json();if(!E.ok||!C.success)throw new Error(C.error||"Failed to load OAuth setup");return C.data},enabled:!!e}),m=h==null?void 0:h.guide,b=!!(h!=null&&h.hasSavedCredentials),g=()=>{if(!u||(m==null?void 0:m.setupMode)!=="manual")return;const E={};return r.trim()&&(E.clientId=r.trim()),i.trim()&&(E.clientSecret=i.trim()),E},v=async(E,C)=>{try{await navigator.clipboard.writeText(C),n({title:"Copied",description:`${E} copied to clipboard.`})}catch{n({title:"Copy failed",description:"Select and copy manually.",variant:"destructive"})}};x.useEffect(()=>{(m==null?void 0:m.setupMode)==="manual"?d(!0):d(!1),p(!b)},[m==null?void 0:m.setupMode,b]),x.useEffect(()=>{h!=null&&h.savedOAuthClientId&&!r&&a(h.savedOAuthClientId)},[h==null?void 0:h.savedOAuthClientId,r]);const w=async E=>{var C,T,P;l(!0);try{const R=await we("POST",`/api/oauth/${e}/connect`,E??{}),$=await R.json();if(!R.ok||!$.success){((C=$.data)!=null&&C.needsCredentials||((T=$.data)==null?void 0:T.setupMode)==="manual")&&d(!0),n({title:"OAuth setup",description:$.error||"Could not start OAuth flow.",variant:"destructive"});return}(P=$.data)!=null&&P.authorizationUrl&&(window.open($.data.authorizationUrl,"_blank"),n({title:"Continue in browser",description:"Complete sign-in in the new tab, then return here."}),t==null||t())}catch(R){n({title:"OAuth setup failed",description:R instanceof Error?R.message:"Unknown error",variant:"destructive"})}finally{l(!1)}};if(y)return c.jsx("p",{className:"text-sm text-orange-200",children:"Loading setup guide…"});if(!m)return null;if(m.setupMode==="unavailable")return c.jsxs("div",{className:"space-y-3 text-sm text-orange-100",children:[c.jsx("p",{children:m.unavailableReason}),m.docsUrl&&c.jsxs(te,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[c.jsx(ei,{className:"w-4 h-4 mr-1"}),"Provider docs"]})]});const S=m.setupMode==="dynamic"||m.setupMode==="managed"||m.setupMode==="manual";return c.jsxs("div",{className:"space-y-4 text-sm text-orange-100",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-medium text-orange-200",children:m.title}),m.summary&&c.jsx("p",{className:"mt-1 text-xs text-orange-100/90",children:m.summary}),S&&c.jsxs("p",{className:"mt-2 text-xs text-orange-100/80",children:["Redirect URI:"," ",c.jsx("code",{className:"text-orange-50",children:m.redirectUri})]}),m.easierAlternative&&c.jsx("p",{className:"mt-2 text-xs text-orange-100/70 border-l-2 border-orange-500/30 pl-2",children:m.easierAlternative})]}),b&&m.setupMode==="manual"&&c.jsxs("div",{className:"rounded-lg border border-green-500/30 bg-green-500/10 p-3 text-xs text-green-100",children:[c.jsx("p",{className:"font-medium text-green-200",children:"OAuth credentials saved"}),c.jsx("p",{className:"mt-1 text-green-100/90",children:"Client ID is prefilled and your secret is remembered. Click Reconnect — no need to paste the secret again unless Slack rejects the flow."})]}),m.prerequisites&&m.prerequisites.length>0&&!b&&c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"Before you start"}),c.jsx("ul",{className:"list-disc list-inside space-y-1 text-xs text-orange-100/90",children:m.prerequisites.map(E=>c.jsx("li",{children:E},E))})]}),(m.manifestJson||m.createAppUrl||S)&&c.jsxs("div",{className:"flex flex-wrap gap-2",children:[m.manifestJson&&c.jsxs(te,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void v("App manifest",m.manifestJson),children:[c.jsx(vL,{className:"w-4 h-4 mr-1"}),"Copy manifest"]}),S&&c.jsxs(te,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void v("Redirect URI",m.redirectUri),children:[c.jsx(ax,{className:"w-4 h-4 mr-1"}),"Copy redirect URI"]}),m.createAppUrl&&c.jsxs(te,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.createAppUrl,"_blank"),children:[c.jsx(ei,{className:"w-4 h-4 mr-1"}),m.createAppLabel??"Open app creator"]})]}),m.steps.length>0&&c.jsx("div",{children:b&&m.setupMode==="manual"?c.jsxs("details",{className:"rounded-lg border border-orange-500/20 bg-orange-500/5 p-3",children:[c.jsx("summary",{className:"cursor-pointer text-xs font-medium text-orange-200",children:"First-time Slack app setup"}),c.jsx("div",{className:"mt-2",children:c.jsx(oy,{items:m.steps})})]}):c.jsxs(c.Fragment,{children:[m.setupMode==="informational"?c.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"What to do"}):null,c.jsx(oy,{items:m.steps})]})}),m.tokenAlternative&&c.jsxs("p",{className:"text-xs text-orange-100/80 border-l-2 border-orange-500/30 pl-2",children:[c.jsx("span",{className:"font-medium text-orange-200",children:"Alternative: "}),m.tokenAlternative]}),u&&m.setupMode==="manual"&&c.jsxs("div",{className:"space-y-3 rounded-lg border border-orange-500/20 bg-orange-500/5 p-3",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx(Qe,{htmlFor:`oauth-client-id-${e}`,className:"text-orange-200",children:"Client ID"}),c.jsx(it,{id:`oauth-client-id-${e}`,value:r,onChange:E=>a(E.target.value),placeholder:"OAuth Client ID",className:"bg-black/20 border-orange-500/30"})]}),f?c.jsxs("div",{className:"space-y-1",children:[c.jsx(Qe,{htmlFor:`oauth-client-secret-${e}`,className:"text-orange-200",children:"Client Secret"}),c.jsx(it,{id:`oauth-client-secret-${e}`,type:"password",value:i,onChange:E=>s(E.target.value),placeholder:"OAuth Client Secret",className:"bg-black/20 border-orange-500/30"})]}):c.jsx("p",{className:"text-xs text-orange-200/80",children:"Client secret is saved locally for this service."}),b&&c.jsx(te,{type:"button",size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>p(E=>!E),children:f?"Hide client secret field":"Update client secret"}),(h==null?void 0:h.hasStoredClientSecret)&&f&&c.jsx("p",{className:"text-xs text-orange-200/80",children:"Leave blank to keep the saved secret. Enter a new value only if Slack rejected the last connect attempt."})]}),m.afterConnect&&m.afterConnect.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"After connect"}),c.jsx(oy,{items:m.afterConnect,className:"text-orange-100/80"})]}),S&&c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx(te,{size:"sm",className:"bg-orange-600 hover:bg-orange-700",disabled:o||u&&m.setupMode==="manual"&&!b&&(!r.trim()||!i.trim()),onClick:()=>w(g()),children:o?"Connecting…":b&&m.setupMode==="manual"?"Reconnect":m.setupMode==="dynamic"||m.setupMode==="managed"?"Connect":"Connect with credentials"}),m.docsUrl&&c.jsxs(te,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[c.jsx(ei,{className:"w-4 h-4 mr-1"}),"Docs"]})]}),m.setupMode==="informational"&&m.docsUrl&&c.jsxs(te,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[c.jsx(ei,{className:"w-4 h-4 mr-1"}),"Docs"]})]})}function Tu(e,t){e.invalidateQueries({queryKey:["/api/services"]}),e.invalidateQueries({queryKey:["/api/collection/warnings"]}),t&&(e.invalidateQueries({queryKey:["/api/services",t]}),e.invalidateQueries({queryKey:["/api/services",t,"tools"]}))}const J$="agent-deck:oauth-complete";function cK(e){return typeof e=="object"&&e!==null&&e.type===J$}function qs(e){return!!(e&&typeof e=="object"&&Object.keys(e).length>0)}function iE(e){return qs(e)?JSON.stringify(e,null,2):`{
438
-
439
- }`}function uK(e){const t=e.trim();if(!t||t==="{}")return{ok:!0,headers:{}};try{const n=JSON.parse(t);if(typeof n!="object"||n===null||Array.isArray(n))return{ok:!1,error:'Headers must be a JSON object (e.g. {"Authorization": "Bearer token"})'};for(const[r,a]of Object.entries(n))if(typeof a!="string")return{ok:!1,error:`Header "${r}" must be a string value`};return{ok:!0,headers:n}}catch{return{ok:!1,error:"Invalid JSON — fix syntax before saving"}}}function dK(e){return/^bearer\s+/i.test(e)?"Bearer ••••":e.length>0?"••••":""}function Tf(e){return qs(e)?Object.entries(e).map(([t,n])=>({name:t,masked:dK(n)})):[]}function Af(e){return e==="not_required"||e==="authenticated"||e==="authenticated_refreshable"}function fK(e){if(!e)return"unknown";const t=new Date(e).getTime()-Date.now();if(t<=0)return"soon";const n=Math.round(t/6e4);if(n<60)return`in ${n} minute${n===1?"":"s"}`;const r=Math.round(n/60);if(r<48)return`in ${r} hour${r===1?"":"s"}`;const a=Math.round(r/24);return`in ${a} day${a===1?"":"s"}`}function hK(e){if(!e||e.type!=="local-mcp")return!1;const t=[e.localCommand,...e.localArgs??[],e.url,e.name].filter(Boolean).join(" ").toLowerCase();return t.includes("google-drive")||t.includes("google_drive")}function pK({service:e,isOpen:t,onClose:n}){var Ee,We,fn,Er,qn,la,ca,Yt,Cr,Rn,Oa,Hm,ie,an,js,Ts,C1,N1,j1,T1,A1,R1;const[r,a]=x.useState(null),[i,s]=x.useState(!1),[o,l]=x.useState(!1),[u,d]=x.useState(""),[f,p]=x.useState(""),[h,y]=x.useState(!1),[m,b]=x.useState(!1),[g,v]=x.useState(!1),[w,S]=x.useState(`{
440
-
441
- }`),[E,C]=x.useState(null),[T,P]=x.useState(!1),[R,$]=x.useState(null),j=x.useRef(null),O=un(),{toast:L}=rn(),D=e&&(R==null?void 0:R.id)===e.id?R:e,A=D,H=A!=null&&A.headers&&typeof A.headers=="object"?A.headers:null,B=!!(A&&A.id&&A.url),{data:U,isLoading:Y,error:N,refetch:F}=St({queryKey:["/api/mcp/discover",A==null?void 0:A.url],queryFn:async()=>{if(!A||A.type!=="mcp")return null;console.log(`🔍 Attempting MCP discovery for: ${A.url}`);try{const me=await(await we("POST","/api/mcp/discover",{url:A.url})).json();return console.log(`✅ MCP discovery successful for ${A.url}:`,me),me}catch(ae){throw console.log(`❌ MCP discovery failed for ${A.url}:`,ae),ae}},enabled:B&&A.type==="mcp"&&t,staleTime:0,gcTime:2*60*1e3}),V=((We=(Ee=U==null?void 0:U.data)==null?void 0:Ee.oauth)==null?void 0:We.required)===!0,{data:_,refetch:k}=St({queryKey:["/api/oauth",A==null?void 0:A.id,"status"],queryFn:async()=>{const ae=await we("GET",`/api/oauth/${A.id}/status`),me=await ae.json();if(!ae.ok||!me.success)throw new Error(me.error||"Failed to load OAuth status");return me.data},enabled:B&&A.type==="mcp"&&t&&V,refetchInterval:ae=>{const me=ae.state.data;return me!=null&&me.authenticated||me!=null&&me.refreshFailed?!1:2e3}}),I=V?_!=null&&_.refreshFailed?{status:"refresh_failed",message:"OAuth renewal failed — please re-authenticate"}:_!=null&&_.authenticated?_.hasRefreshToken&&_.expiresAt?{status:"authenticated_refreshable",message:`Access expires ${fK(_.expiresAt)} · renews automatically`}:{status:"authenticated",message:null}:_!=null&&_.hasToken&&(_!=null&&_.isExpired)?{status:"expired",message:"OAuth Token Expired - Please re-authenticate"}:{status:"required",message:"OAuth 2.0 Authentication Required"}:{status:"not_required",message:null};console.log("MCP Discovery Query Debug:",{apiService:A==null?void 0:A.id,apiServiceType:A==null?void 0:A.type,apiServiceUrl:A==null?void 0:A.url,isOpen:t,hasValidService:B,enabled:B&&A.type==="mcp"&&t,mcpDiscoveryLoading:Y,mcpDiscoveryData:U?JSON.stringify(U,null,2):null,mcpDiscoveryDataKeys:U?Object.keys(U):null,oauthRequired:(Er=(fn=U==null?void 0:U.data)==null?void 0:fn.oauth)==null?void 0:Er.required,oauthData:(qn=U==null?void 0:U.data)!=null&&qn.oauth?JSON.stringify(U.data.oauth,null,2):null,toolsQueryEnabled:B&&A.type==="mcp"&&t&&!((ca=(la=U==null?void 0:U.data)==null?void 0:la.oauth)!=null&&ca.required)});const{data:K,isLoading:G,error:re,refetch:oe}=St({queryKey:["/api/services",A==null?void 0:A.id,"tools"],queryFn:async()=>{if(!A||A.type!=="mcp"&&A.type!=="local-mcp")return{data:[]};console.log(`🔍 Attempting to discover tools for MCP service: ${A.id} at ${A.url}`);try{const me=await(await we("GET",`/api/services/${A.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${A.id}:`,me),me}catch(ae){throw console.log(`❌ MCP tools discovery failed for ${A.id}:`,ae),ae}},enabled:B&&(A.type==="mcp"||A.type==="local-mcp")&&t&&(A.type==="local-mcp"||Af(I.status)),staleTime:0,gcTime:2*60*1e3});x.useEffect(()=>{if(!t||!(A!=null&&A.id)||A.type!=="mcp"&&A.type!=="local-mcp"||!(A.type==="local-mcp"||Af(I.status)||I.status==="not_required")||G||re)return;let me=!1;return(async()=>{try{const $n=await(await we("GET",`/api/services/${A.id}`)).json();!me&&($n!=null&&$n.success)&&$n.data&&$($n.data),O.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{me=!0}},[t,A==null?void 0:A.id,A==null?void 0:A.type,G,re,I.status,O]),x.useEffect(()=>{if(!t||!(A!=null&&A.id)||A.type!=="a2a")return;let ae=!1;return(async()=>{try{await we("GET",`/api/services/${A.id}/health`);const Cn=await(await we("GET",`/api/services/${A.id}`)).json();!ae&&(Cn!=null&&Cn.success)&&Cn.data&&$(Cn.data),O.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{ae=!0}},[t,A==null?void 0:A.id,A==null?void 0:A.type,O]),console.log("MCP Tools Query Debug:",{hasValidService:B,apiServiceType:A==null?void 0:A.type,isOpen:t,oauthRequired:(Cr=(Yt=U==null?void 0:U.data)==null?void 0:Yt.oauth)==null?void 0:Cr.required,oauthStatus:I.status,toolsQueryEnabled:B&&(A.type==="mcp"||A.type==="local-mcp")&&t&&(A.type==="local-mcp"||Af(I.status)),mcpToolsLoading:G});const{data:he,isLoading:Se,error:Xe}=St({queryKey:["/api/proxy/a2a",A==null?void 0:A.id,"manifest"],queryFn:async()=>{if(!A||A.type!=="a2a")return null;const me=await(await we("GET",`/api/proxy/a2a/${A.id}/manifest`)).text();return JSON.parse(me)},enabled:B&&A.type==="a2a"&&t,staleTime:0,gcTime:2*60*1e3}),ot=(K==null?void 0:K.data)||[],W=he,fe=G||Se;console.log("ServiceDetailsModal Debug:",{service:e==null?void 0:e.id,serviceType:e==null?void 0:e.type,isOpen:t,mcpDiscoveryLoading:Y,mcpDiscoveryData:U,mcpDiscoveryError:N?String(N):null,mcpToolsLoading:G,a2aManifestLoading:Se,mcpToolsError:re?String(re):null,a2aManifestError:Xe?String(Xe):null,mcpToolsCount:ot.length,mcpToolsData:K,hasA2aManifest:!!W,isLoading:fe,oauthRequired:(Oa=(Rn=U==null?void 0:U.data)==null?void 0:Rn.oauth)==null?void 0:Oa.required,oauthStatus:I.status,oauthMessage:I.message,oauthAuthenticated:_==null?void 0:_.authenticated,expiresAt:_==null?void 0:_.expiresAt}),x.useEffect(()=>{if(!t){$(null),v(!1),C(null),ze.current=!1,ne.current=!1;return}e&&($(e),d(e.name||""),p(e.description||""),v(!1),C(null))},[e,t]);const ne=x.useRef(!1),ze=x.useRef(!1);x.useEffect(()=>{if(!t||!(A!=null&&A.id)){ne.current=!1;return}if(!(_!=null&&_.authenticated)){ne.current=!1;return}if(ne.current)return;ne.current=!0,ze.current=!0,(async()=>{L({title:"OAuth completed",description:"Authentication successful! Refreshing service status..."}),Tu(O,A.id),O.invalidateQueries({queryKey:["/api/mcp/discover",A.url]});try{const me=await we("GET",`/api/services/${A.id}`);if(me.ok){const vt=await me.json();$(vt.data??vt)}}catch{}await F(),O.invalidateQueries({queryKey:["/api/services",A.id,"tools"]}),await oe(),ze.current=!1})()},[_==null?void 0:_.authenticated,t,A==null?void 0:A.id]);const ce=()=>(e==null?void 0:e.type)==="mcp"?c.jsx(T_,{className:"w-6 h-6"}):c.jsx($g,{className:"w-6 h-6"}),$e=()=>(e==null?void 0:e.type)==="mcp"?"text-blue-400":"text-purple-400",qe=()=>(e==null?void 0:e.type)==="mcp"?"bg-blue-500/20":"bg-purple-500/20",Pt=ae=>new Date(ae).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});x.useEffect(()=>{var ae,me;i&&((ae=j.current)==null||ae.focus(),(me=j.current)==null||me.select())},[i]);const kr=async()=>{const ae=(D==null?void 0:D.name)||"",me=u.trim();if(!D||!me||me===ae){d(ae),s(!1);return}y(!0);try{await we("PUT",`/api/services/${D.id}`,{name:me}),$({...D,name:me}),O.invalidateQueries({queryKey:["/api/services"]}),O.invalidateQueries({queryKey:["/api/collection/warnings"]}),O.invalidateQueries({queryKey:["/api/decks"]}),s(!1)}catch(vt){d(ae),s(!1),L({title:"Could not rename service",description:vt instanceof Error?vt.message:"Failed to update name",variant:"destructive"})}finally{y(!1)}},yt=async()=>{if(e){b(!0);try{if((await we("PUT",`/api/services/${e.id}`,{description:f.trim()})).ok){if(R){const me={...R,description:f.trim()};$(me)}O.invalidateQueries({queryKey:["/api/services"]}),O.invalidateQueries({queryKey:["/api/collection/warnings"]}),O.invalidateQueries({queryKey:["/api/decks"]}),O.invalidateQueries({queryKey:["/api/decks"]}),L({title:"Description updated",description:"Service description has been updated successfully."}),l(!1)}else throw new Error("Failed to update description")}catch{L({title:"Update failed",description:"Failed to update service description. Please try again.",variant:"destructive"})}finally{b(!1)}}},sr=()=>{S(iE(H)),C(null),v(!0)},Z=()=>{v(!1),C(null),S(iE(H))},ee=async()=>{if(!D)return;const ae=uK(w);if(!ae.ok){C(ae.error);return}P(!0);try{if(!(await we("PUT",`/api/services/${D.id}`,{headers:ae.headers})).ok)throw new Error("Failed to update headers");const vt=Object.keys(ae.headers).length>0?ae.headers:void 0;$({...D,headers:vt}),v(!1),C(null),Tu(O,D.id),O.invalidateQueries({queryKey:["/api/decks"]}),L({title:"Headers updated",description:"Custom headers saved. Reconnecting with the new values."})}catch(me){L({title:"Update failed",description:me instanceof Error?me.message:"Failed to update headers. Please try again.",variant:"destructive"})}finally{P(!1)}},be=ae=>{ae||(ze.current&&(Tu(O,(A==null?void 0:A.id)??(e==null?void 0:e.id)),ze.current=!1),ne.current=!1,n())};return c.jsx(ks,{open:t,onOpenChange:be,children:c.jsxs(vi,{className:"sm:max-w-6xl bg-gradient-to-br from-cosmic-900 to-cosmic-800 border border-white/20 text-white max-h-[90vh] overflow-y-auto",children:[c.jsx(bi,{children:c.jsxs(xi,{className:"text-2xl font-bold flex items-center",children:[ce(),c.jsx("div",{className:"ml-3 flex min-w-0 items-center",children:i?c.jsx("input",{ref:j,type:"text",value:u,disabled:h,onChange:ae=>d(ae.target.value),onBlur:()=>{kr()},onKeyDown:ae=>{ae.key==="Enter"?(ae.preventDefault(),kr()):ae.key==="Escape"&&(ae.preventDefault(),d((D==null?void 0:D.name)||""),s(!1))},className:"max-w-[16rem] rounded border border-white/20 bg-white/10 px-2 py-1 text-2xl font-bold text-white focus:border-white/40 focus:outline-none sm:max-w-[20rem]","aria-label":"Service name","data-testid":"input-service-name"}):c.jsx("button",{type:"button",className:"min-w-0 truncate text-left hover:underline",title:"Click to rename",onClick:()=>{d((D==null?void 0:D.name)||""),s(!0)},"data-testid":"button-rename-service",children:D==null?void 0:D.name})}),c.jsx(mn,{className:`ml-3 ${qe()} ${$e()}`,children:(Hm=e==null?void 0:e.type)==null?void 0:Hm.toUpperCase()})]})}),e&&c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsx("div",{className:"mb-3",children:c.jsxs("h3",{className:"text-lg font-semibold flex items-center",children:[c.jsx(mL,{className:"w-5 h-5 mr-2"}),"Service Overview"]})}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("p",{className:"text-gray-300 text-sm",children:"Description"}),!o&&c.jsx(te,{size:"sm",variant:"ghost",onClick:()=>l(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit description",children:c.jsx(ix,{className:"w-3 h-3"})})]}),o?c.jsxs("div",{className:"space-y-2",children:[c.jsx("textarea",{value:f,onChange:ae=>p(ae.target.value),className:"w-full bg-black/30 border border-white/20 rounded px-2 py-1 text-white focus:outline-none focus:border-white/40 resize-none",rows:3,placeholder:"Enter description...",autoFocus:!0}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(te,{size:"sm",onClick:yt,disabled:m,className:"h-6 px-2 text-xs",children:m?"Saving...":"Save"}),c.jsx(te,{size:"sm",variant:"outline",onClick:()=>{l(!1),p((D==null?void 0:D.description)||"")},className:"h-6 px-2 text-xs",children:"Cancel"})]})]}):c.jsx("p",{className:"text-white cursor-pointer hover:bg-white/10 px-2 py-1 rounded transition-colors",onClick:()=>l(!0),title:"Click to edit description",children:(D==null?void 0:D.description)||"No description"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Endpoint"}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx(mn,{variant:"outline",className:"border-blue-500/30 text-blue-300",children:A.type.toUpperCase()}),qs(H)&&c.jsx(mn,{variant:"outline",className:"border-green-500/30 text-green-300",children:"Custom Headers"})]}),c.jsx(te,{size:"sm",variant:"ghost",onClick:()=>window.open(A.url,"_blank"),className:"p-1 h-auto",children:c.jsx(ei,{className:"w-4 h-4"})})]}),c.jsx("div",{className:"text-xs text-gray-400 break-all bg-black/20 p-2 rounded border border-white/10",children:A.url||"No URL available"}),A.type==="mcp"?c.jsxs("div",{className:"text-xs text-gray-400 bg-black/20 p-2 rounded border border-white/10","data-testid":"custom-headers-section",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[c.jsx("p",{className:"font-semibold text-gray-300",children:"Custom Headers"}),!g&&c.jsx(te,{size:"sm",variant:"ghost",className:"h-6 px-2 text-xs text-teal-300 hover:text-teal-200",onClick:sr,"data-testid":"button-edit-headers",children:"Edit"})]}),g?c.jsxs("div",{className:"space-y-2",children:[c.jsx(Ya,{value:w,onChange:ae=>{S(ae.target.value),E&&C(null)},rows:6,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs","data-testid":"textarea-edit-headers",disabled:T}),E&&c.jsxs("p",{className:"text-red-400 text-xs flex items-center gap-1","data-testid":"headers-json-error",children:[c.jsx(Mr,{className:"w-3 h-3 shrink-0"}),E]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(te,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:Z,disabled:T,"data-testid":"button-cancel-headers",children:"Cancel"}),c.jsx(te,{size:"sm",className:"h-7 px-3 text-xs bg-teal-600 hover:bg-teal-500",onClick:ee,disabled:T,"data-testid":"button-save-headers",children:T?"Saving…":"Save"})]})]}):qs(H)?c.jsx("ul",{className:"space-y-1 font-mono","data-testid":"headers-masked-list",children:Tf(H).map(({name:ae,masked:me})=>c.jsxs("li",{children:[c.jsx("span",{className:"text-gray-300",children:ae}),c.jsx("span",{className:"text-gray-500",children:": "}),c.jsx("span",{children:me})]},ae))}):c.jsx("p",{className:"text-gray-500","data-testid":"headers-empty-state",children:"No custom headers. Add Bearer or API key headers to authenticate."})]}):qs(H)&&c.jsxs("div",{className:"text-xs text-gray-400 bg-black/20 p-2 rounded border border-white/10",children:[c.jsx("p",{className:"font-semibold mb-1",children:"Custom Headers:"}),c.jsx("ul",{className:"space-y-1 font-mono",children:Tf(H).map(({name:ae,masked:me})=>c.jsxs("li",{children:[c.jsx("span",{className:"text-gray-300",children:ae}),c.jsx("span",{className:"text-gray-500",children:": "}),c.jsx("span",{children:me})]},ae))})]})]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Health Status"}),c.jsx(mn,{className:A.health==="healthy"?"bg-green-500/20 text-green-300":A.health==="unhealthy"?"bg-red-500/20 text-red-300":"bg-amber-500/20 text-amber-200",children:A.health==="healthy"?"Healthy":A.health==="unhealthy"?"Unreachable":I.status==="required"||I.status==="expired"||I.status==="refresh_failed"?"Auth required":"Unknown"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Registered"}),c.jsx("p",{className:"text-white text-sm",children:Pt(A.registeredAt)})]})]})]}),fe&&c.jsxs("div",{className:"text-center py-8",children:[c.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4"}),c.jsx("p",{className:"text-gray-400",children:"Fetching service details..."})]}),r&&c.jsx("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:c.jsx("p",{className:"text-red-300",children:r})}),(e.type==="mcp"||e.type==="local-mcp")&&c.jsxs(c.Fragment,{children:[e.type==="local-mcp"&&c.jsxs("div",{className:"bg-cyan-500/15 border border-cyan-500/30 rounded-lg p-4 mb-4",children:[c.jsx("h3",{className:"text-cyan-200 font-semibold mb-2",children:"Local MCP — auth happens outside Agent Deck"}),c.jsx("div",{className:"text-cyan-100/90 text-sm space-y-2",children:hK(A)?c.jsxs(c.Fragment,{children:[c.jsxs("p",{children:["This card runs ",c.jsx("code",{className:"text-xs",children:"@piotr-agier/google-drive-mcp"})," on your machine. Agent Deck does ",c.jsx("strong",{children:"not"}),' handle Google OAuth for it. If Google shows "app not verified", that is ',c.jsx("strong",{children:"your Google Cloud project"}),", not Agent Deck."]}),c.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-1",children:[c.jsxs("li",{children:["Create a GCP OAuth client type ",c.jsx("strong",{children:"Desktop app"})," (not Web)."]}),c.jsxs("li",{children:["Add yourself as a ",c.jsx("strong",{children:"Test user"})," on the consent screen."]}),c.jsxs("li",{children:["Run in terminal first:"," ",c.jsx("code",{className:"text-xs block mt-1 bg-black/30 p-2 rounded whitespace-pre-wrap",children:`export GOOGLE_DRIVE_OAUTH_CREDENTIALS="/path/to/gcp-oauth.keys.json"
442
- export GOOGLE_DRIVE_MCP_AUTH_PORT=3100
443
- npx @piotr-agier/google-drive-mcp auth`})]}),c.jsxs("li",{children:["Set ",c.jsx("code",{className:"text-xs",children:"GOOGLE_DRIVE_MCP_TOKEN_PATH"})," in the card env to the same token file (",c.jsx("code",{className:"text-xs",children:"~/.config/google-drive-mcp/tokens.json"}),")."]})]}),c.jsxs("p",{className:"text-xs text-cyan-200/80",children:["Full steps: ",c.jsx("code",{className:"text-xs",children:"docs/GOOGLE_DRIVE_WORKAROUND.md"})," in the repo."]})]}):c.jsx("p",{children:"Local servers manage their own credentials (API keys, OAuth, etc.) in the spawned process. Complete any login in the terminal or config for that package before expecting tools here."})})]}),c.jsx(lK,{serviceId:A.id,tools:ot,isLoading:G})]}),e.type==="a2a"&&W&&c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[c.jsx(NL,{className:"w-5 h-5 mr-2"}),"Agent Overview"]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Agent Name"}),c.jsx("p",{className:"text-white font-semibold",children:W.name})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Version"}),c.jsx("p",{className:"text-white",children:W.version})]}),c.jsxs("div",{className:"md:col-span-2",children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Description"}),c.jsx("p",{className:"text-white",children:W.description})]}),W.provider&&c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Provider"}),c.jsx("p",{className:"text-white",children:W.provider.organization})]}),W.documentationUrl&&c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Documentation"}),c.jsxs(te,{size:"sm",variant:"ghost",onClick:()=>window.open(W.documentationUrl,"_blank"),className:"p-1 h-auto text-purple-300",children:[c.jsx(ei,{className:"w-4 h-4 mr-1"}),"View Docs"]})]})]})]}),W.capabilities&&c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[c.jsx(kT,{className:"w-5 h-5 mr-2"}),"Capabilities"]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[W.capabilities.streaming&&c.jsx(mn,{className:"bg-green-500/20 text-green-300",children:"Streaming"}),W.capabilities.pushNotifications&&c.jsx(mn,{className:"bg-blue-500/20 text-blue-300",children:"Push Notifications"}),W.capabilities.stateTransitionHistory&&c.jsx(mn,{className:"bg-purple-500/20 text-purple-300",children:"State History"})]})]}),W.skills&&W.skills.length>0&&c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[c.jsx($g,{className:"w-5 h-5 mr-2"}),"Skills (",W.skills.length,")"]}),c.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:W.skills.map((ae,me)=>c.jsxs("div",{className:"relative group cursor-pointer transform hover:scale-105 transition-all duration-300",style:{aspectRatio:"2/3",background:"linear-gradient(135deg, rgba(147, 51, 234, 0.1), rgba(196, 181, 253, 0.1))",border:"2px solid rgba(147, 51, 234, 0.3)",borderRadius:"12px",boxShadow:"0 4px 20px rgba(147, 51, 234, 0.2)",minWidth:"120px",maxWidth:"160px"},children:[c.jsx("div",{className:"absolute top-2 left-2 text-xs font-bold",children:c.jsx("div",{className:"text-purple-300 leading-none",children:"S"})}),c.jsx("div",{className:"absolute bottom-2 right-2 text-xs font-bold rotate-180",children:c.jsx("div",{className:"text-purple-300 leading-none",children:"S"})}),c.jsxs("div",{className:"absolute inset-x-3 top-8 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"text-purple-300 mb-2",children:c.jsx($g,{className:"w-6 h-6"})}),c.jsx("h4",{className:"font-bold text-sm mb-2 line-clamp-2 text-white",children:ae.name}),c.jsx("p",{className:"text-gray-300 text-xs line-clamp-4 mb-2",children:ae.description}),ae.tags&&ae.tags.length>0&&c.jsx("div",{className:"flex flex-wrap gap-1 justify-center",children:ae.tags.slice(0,2).map((vt,Cn)=>c.jsx("span",{className:"text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded",children:vt},Cn))})]}),c.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-br from-transparent via-purple-500/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none"})]},me))})]}),(W.defaultInputModes||W.defaultOutputModes)&&c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsxs("h3",{className:"text-lg font-semibold mb-3 flex items-center",children:[c.jsx(T_,{className:"w-5 h-5 mr-2"}),"Data Modes"]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[W.defaultInputModes&&c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-2",children:"Input Modes"}),c.jsx("div",{className:"flex flex-wrap gap-2",children:W.defaultInputModes.map((ae,me)=>c.jsx(mn,{className:"bg-blue-500/20 text-blue-300 text-xs",children:ae},me))})]}),W.defaultOutputModes&&c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-2",children:"Output Modes"}),c.jsx("div",{className:"flex flex-wrap gap-2",children:W.defaultOutputModes.map((ae,me)=>c.jsx(mn,{className:"bg-green-500/20 text-green-300 text-xs",children:ae},me))})]})]})]})]}),(e==null?void 0:e.type)==="mcp"&&I.status==="not_required"&&(A==null?void 0:A.id)&&c.jsxs("div",{className:"bg-blue-500/20 border border-blue-500/30 rounded-lg p-4 mb-4",children:[c.jsx("h3",{className:"text-blue-300 font-semibold mb-2",children:"How to connect"}),c.jsx(aE,{serviceId:A.id})]}),(e==null?void 0:e.type)==="mcp"&&I.status==="authenticated_refreshable"&&c.jsxs("div",{className:"bg-green-500/15 border border-green-500/30 rounded-lg p-4 mb-4",children:[c.jsx("h3",{className:"text-green-300 font-semibold mb-2",children:"✓ OAuth connected"}),c.jsx("p",{className:"text-green-100 text-sm",children:I.message})]}),(e==null?void 0:e.type)==="mcp"&&!Af(I.status)&&I.status!=="not_required"&&c.jsxs("div",{className:`${I.status==="expired"||I.status==="refresh_failed"?"bg-red-500/20 border-red-500/30":"bg-orange-500/20 border-orange-500/30"} rounded-lg p-4 mb-4`,children:[c.jsx("h3",{className:`${I.status==="expired"||I.status==="refresh_failed"?"text-red-300":"text-orange-300"} font-semibold mb-2`,children:I.status==="expired"||I.status==="refresh_failed"?"⏰ Token Expired":"🔐 Authentication Required"}),c.jsxs("div",{className:`${I.status==="expired"||I.status==="refresh_failed"?"text-red-200":"text-orange-200"} text-sm space-y-2`,children:[c.jsx("p",{children:c.jsx("strong",{children:I.message})}),c.jsx("p",{children:I.status==="expired"||I.status==="refresh_failed"?"Your OAuth token has expired or could not be renewed. Please re-authenticate to continue using this service.":"This MCP server requires OAuth authentication to access its tools. Please authenticate to continue."}),(A==null?void 0:A.id)&&c.jsx(aE,{serviceId:A.id,onConnected:()=>void k()}),((an=(ie=U==null?void 0:U.data)==null?void 0:ie.oauth)==null?void 0:an.resourceName)&&c.jsx("div",{className:"mt-3 p-2 bg-orange-500/10 rounded border border-orange-500/20 text-xs text-orange-100",children:c.jsxs("p",{children:[c.jsx("strong",{children:"Resource:"})," ",U.data.oauth.resourceName]})})]})]}),(e==null?void 0:e.type)==="mcp"&&c.jsxs("div",{className:"bg-gray-800/50 border border-gray-600/30 rounded-lg p-4 mb-4",children:[c.jsx("h3",{className:"text-gray-300 font-semibold mb-2",children:"Connection Logs"}),c.jsxs("div",{className:"text-gray-200 text-sm space-y-2",children:[c.jsxs("div",{className:"bg-black/30 p-2 rounded text-xs",children:[c.jsx("p",{children:c.jsx("strong",{children:"🔍 Attempting to discover tools for MCP service:"})}),c.jsxs("p",{children:["Service ID: ",e==null?void 0:e.id]}),c.jsxs("p",{children:["Service URL: ",A==null?void 0:A.url]}),c.jsxs("p",{children:["Status: ",G?"🔄 Loading...":re?"❌ Failed":"✅ Complete"]})]}),G&&c.jsxs("div",{className:"bg-yellow-500/20 p-2 rounded text-xs",children:[c.jsxs("p",{children:["🔄 Making HTTP request to: ",c.jsxs("code",{children:["GET /api/services/",e==null?void 0:e.id,"/tools"]})]}),c.jsxs("p",{children:["Target MCP server: ",c.jsx("code",{children:A==null?void 0:A.url})]})]}),re&&c.jsxs("div",{className:"bg-red-500/20 p-2 rounded text-xs",children:[c.jsx("p",{children:"❌ Request failed:"}),c.jsx("pre",{className:"whitespace-pre-wrap overflow-x-auto",children:re instanceof Error?re.message:String(re)}),c.jsxs("div",{className:"mt-2 p-2 bg-black/30 rounded",children:[c.jsx("p",{children:c.jsx("strong",{children:"🔍 What we tried:"})}),c.jsxs("p",{children:["• Service ID: ",e==null?void 0:e.id]}),c.jsxs("p",{children:["• Target URL: ",A==null?void 0:A.url]}),c.jsxs("p",{children:["• Request: GET /api/services/",e==null?void 0:e.id,"/tools"]}),qs(H)&&c.jsxs("div",{children:[c.jsx("p",{children:c.jsx("strong",{children:"📋 Headers sent:"})}),c.jsx("ul",{className:"text-xs font-mono",children:Tf(H).map(({name:ae,masked:me})=>c.jsxs("li",{children:[ae,": ",me]},ae))})]}),c.jsxs("div",{className:"mt-2",children:[c.jsx("p",{children:c.jsx("strong",{children:"💡 What this means:"})}),c.jsxs("p",{children:["• The MCP server at ",A==null?void 0:A.url," returned an error"]}),c.jsx("p",{children:"• This could be due to authentication issues, server being down, or invalid configuration"}),c.jsx("p",{children:"• Check the error message above for specific details from the MCP server"})]})]})]}),!G&&!re&&ot.length>0&&c.jsx("div",{className:"bg-green-500/20 p-2 rounded text-xs",children:c.jsxs("p",{children:["✅ Successfully discovered ",ot.length," tools from MCP server"]})}),!G&&!re&&ot.length===0&&c.jsxs("div",{className:"bg-yellow-500/20 p-2 rounded text-xs",children:[c.jsx("p",{children:"⚠️ Connected to MCP server but no tools were found"}),c.jsx("p",{children:"This could mean the server has no tools or requires specific authentication"})]})]})]}),re&&(e.type==="mcp"||e.type==="local-mcp")&&c.jsxs("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:[c.jsx("h3",{className:"text-red-300 font-semibold mb-2",children:"MCP Tool Discovery Failed"}),c.jsxs("div",{className:"text-red-200 text-sm space-y-2",children:[c.jsx("p",{children:c.jsx("strong",{children:"Raw Error:"})}),c.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap",children:re instanceof Error?re.message:String(re)}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service URL:"})," ",A==null?void 0:A.url]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service ID:"})," ",A==null?void 0:A.id]}),qs(H)&&c.jsxs("div",{children:[c.jsx("p",{children:c.jsx("strong",{children:"Custom Headers:"})}),c.jsx("ul",{className:"bg-black/30 p-2 rounded text-xs font-mono",children:Tf(H).map(({name:ae,masked:me})=>c.jsxs("li",{children:[ae,": ",me]},ae))})]})]})]}),Xe&&e.type==="a2a"&&c.jsxs("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:[c.jsx("h3",{className:"text-red-300 font-semibold mb-2",children:"A2A Manifest Discovery Failed"}),c.jsxs("div",{className:"text-red-200 text-sm space-y-2",children:[c.jsx("p",{children:c.jsx("strong",{children:"Raw Error:"})}),c.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap",children:Xe instanceof Error?Xe.message:String(Xe)}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service URL:"})," ",A==null?void 0:A.url]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service ID:"})," ",A==null?void 0:A.id]})]})]}),!fe&&!re&&!Xe&&(e.type==="mcp"||e.type==="local-mcp")&&ot.length===0&&(e.type==="local-mcp"||!((Ts=(js=U==null?void 0:U.data)==null?void 0:js.oauth)!=null&&Ts.required))&&c.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4",children:[c.jsx("h3",{className:"text-yellow-300 font-semibold mb-2",children:"No Tools Available"}),c.jsxs("p",{className:"text-yellow-200 text-sm",children:["Successfully connected to MCP server at ",A==null?void 0:A.url,", but no tools were discovered."]}),c.jsxs("div",{className:"text-yellow-200 text-xs mt-2",children:[c.jsx("p",{children:c.jsx("strong",{children:"This could mean:"})}),c.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[c.jsx("li",{children:"The MCP server has no tools registered"}),c.jsx("li",{children:"Tools require specific authentication"}),c.jsx("li",{children:"Tools are only available after certain operations"})]})]})]}),(e.type==="mcp"||e.type==="local-mcp")&&c.jsxs("div",{className:"bg-blue-500/20 border border-blue-500/30 rounded-lg p-4",children:[c.jsx("h3",{className:"text-blue-300 font-semibold mb-2",children:"🔍 MCP Server Analysis"}),c.jsxs("div",{className:"text-blue-200 text-sm space-y-2",children:[c.jsxs("p",{children:[c.jsx("strong",{children:"Server URL:"})," ",A==null?void 0:A.url]}),Y&&c.jsx("div",{className:"mt-3 p-3 bg-black/30 rounded",children:c.jsx("p",{children:"🔍 Analyzing MCP server configuration..."})}),U&&c.jsxs("div",{className:"mt-3 p-3 bg-black/30 rounded",children:[c.jsx("p",{children:c.jsx("strong",{children:"🔍 What we discovered:"})}),U.error&&U.analysis&&c.jsxs("div",{className:"text-yellow-200",children:[U.analysis.auth_type==="oauth2"&&c.jsxs("div",{children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),c.jsx("p",{children:"• This MCP server requires OAuth 2.0 Bearer token authentication"}),c.jsx("p",{children:"• You'll need to provide OAuth credentials (client ID, client secret, authorization URL, token URL)"}),c.jsx("p",{children:"• Check the service provider's documentation for OAuth setup instructions"})]}),U.analysis.protocol==="sse"&&c.jsxs("div",{children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"SSE Protocol Required"})]}),c.jsx("p",{children:"• This MCP server uses Server-Sent Events (SSE) protocol"}),c.jsx("p",{children:"• We'll need to connect using event streaming instead of HTTP"})]}),U.analysis.issue==="not_found"&&c.jsxs("div",{children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"Server Not Found"})]}),c.jsx("p",{children:"• The MCP server URL might be incorrect"}),c.jsx("p",{children:"• Check if the server is running and the URL is correct"})]}),U.analysis.issue==="server_error"&&c.jsxs("div",{children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"Server Error"})]}),c.jsx("p",{children:"• The MCP server is experiencing internal errors"}),c.jsx("p",{children:"• Try again later or contact the service provider"})]}),U.analysis.message&&c.jsxs("p",{children:["• ",c.jsx("strong",{children:"Analysis:"})," ",U.analysis.message]})]}),((N1=(C1=U==null?void 0:U.data)==null?void 0:C1.oauth)==null?void 0:N1.required)&&c.jsxs("div",{className:"text-yellow-200",children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),U.data.oauth.authorizationUrl&&c.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[c.jsx(te,{size:"sm",variant:"default",className:"h-7",onClick:async()=>{var ae,me;if(A!=null&&A.id)try{L({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const vt=await we("POST",`/api/oauth/${A.id}/auto-setup`,{});if(!vt.ok){const $n=await vt.json();(ae=$n.data)!=null&&ae.registrationUrl?(window.open($n.data.registrationUrl,"_blank"),L({title:"OAuth Registration Required",description:`${$n.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):L({title:"OAuth Setup Failed",description:$n.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Cn=await vt.json();Cn.success&&((me=Cn.data)!=null&&me.authorizationUrl)?(window.open(Cn.data.authorizationUrl,"_blank"),L({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),k()):L({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(vt){L({title:"OAuth Setup Failed",description:vt instanceof Error?vt.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),c.jsxs(te,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(U.data.oauth.authorizationUrl,"_blank"),children:[c.jsx(ei,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),!U.data.oauth.authorizationUrl&&U.data.oauth.protectedResourceConfigUrl&&c.jsx("div",{className:"mt-2",children:c.jsxs(te,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(U.data.oauth.protectedResourceConfigUrl,"_blank"),children:[c.jsx(ei,{className:"w-4 h-4 mr-1"}),"View OAuth Configuration"]})}),U.data.oauth.authorizationServerMetadataUrl&&c.jsxs("div",{className:"mt-2 text-xs text-gray-300",children:[c.jsx("span",{className:"mr-1",children:"Auth Server Metadata:"}),c.jsx("button",{className:"underline text-blue-300",onClick:()=>window.open(U.data.oauth.authorizationServerMetadataUrl,"_blank"),children:U.data.oauth.authorizationServerMetadataUrl})]})]}),(U==null?void 0:U.success)&&!((T1=(j1=U==null?void 0:U.data)==null?void 0:j1.oauth)!=null&&T1.required)&&c.jsxs("div",{className:"text-green-200",children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"✅ Server Analysis Complete"})]}),c.jsx("p",{children:"• MCP server is accessible and responding"}),c.jsx("p",{children:"• No authentication issues detected"}),c.jsx("p",{children:"• Protocol compatibility confirmed"})]}),((R1=(A1=U==null?void 0:U.data)==null?void 0:A1.oauth)==null?void 0:R1.required)&&c.jsxs("div",{className:"text-orange-200",children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"🔐 OAuth 2.0 Authentication Required"})]}),c.jsx("p",{children:"• This MCP server requires OAuth authentication"}),U.data.oauth.resourceName&&c.jsxs("p",{children:["• Service: ",U.data.oauth.resourceName]}),U.data.oauth.authorizationUrl&&c.jsxs("p",{children:["• Authorization URL: ",U.data.oauth.authorizationUrl]}),U.data.oauth.tokenUrl&&c.jsxs("p",{children:["• Token URL: ",U.data.oauth.tokenUrl]}),c.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[c.jsx(te,{size:"sm",variant:"default",className:"bg-orange-600 hover:bg-orange-700",onClick:async()=>{var ae,me;if(A!=null&&A.id)try{L({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const vt=await we("POST",`/api/oauth/${A.id}/auto-setup`,{});if(!vt.ok){const $n=await vt.json();(ae=$n.data)!=null&&ae.registrationUrl?(window.open($n.data.registrationUrl,"_blank"),L({title:"OAuth Registration Required",description:`${$n.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):L({title:"OAuth Setup Failed",description:$n.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Cn=await vt.json();Cn.success&&((me=Cn.data)!=null&&me.authorizationUrl)?(window.open(Cn.data.authorizationUrl,"_blank"),L({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),k()):L({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(vt){L({title:"OAuth Setup Failed",description:vt instanceof Error?vt.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),c.jsx(te,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-300 hover:bg-orange-500/10",onClick:()=>{const ae=`OAuth Setup Instructions:
444
-
445
- 1. Go to the service provider's OAuth/Developer settings
446
- 2. Create a new OAuth application
447
- 3. Set Redirect URL: http://localhost:8000/api/oauth/${A==null?void 0:A.id}/callback
448
- 4. Copy the Client ID and Client Secret
449
- 5. Edit this service and add the credentials
450
-
451
- ${U.data.oauth.authorizationUrl?`Authorization URL: ${U.data.oauth.authorizationUrl}`:""}
452
- ${U.data.oauth.tokenUrl?`Token URL: ${U.data.oauth.tokenUrl}`:""}
453
- ${U.data.oauth.issuer?`Issuer: ${U.data.oauth.issuer}`:""}`;L({title:"OAuth Setup Instructions",description:ae,duration:1e4})},children:"📋 Setup Instructions"})]})]}),c.jsxs("div",{className:"mt-2 text-xs",children:[c.jsx("p",{children:c.jsx("strong",{children:"💡 Next Steps:"})}),c.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[c.jsx("li",{children:"For OAuth servers: Provide OAuth credentials in service settings"}),c.jsx("li",{children:"For SSE servers: We'll automatically use the correct protocol"}),c.jsx("li",{children:"For connection issues: Verify the server URL and status"})]})]})]}),N&&c.jsxs("div",{className:"mt-3 p-3 bg-red-500/20 rounded",children:[c.jsx("p",{children:c.jsx("strong",{children:"❌ Discovery Failed"})}),c.jsx("p",{children:"Could not analyze MCP server configuration"}),c.jsx("pre",{className:"text-xs overflow-x-auto",children:N instanceof Error?N.message:String(N)})]})]})]}),!fe&&!re&&!Xe&&e.type==="a2a"&&!W&&c.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4",children:[c.jsx("h3",{className:"text-yellow-300 font-semibold mb-2",children:"Agent Details Not Available"}),c.jsxs("p",{className:"text-yellow-200 text-sm",children:["Successfully connected to A2A agent at ",A==null?void 0:A.url,", but no manifest was found."]}),c.jsxs("div",{className:"text-yellow-200 text-xs mt-2",children:[c.jsx("p",{children:c.jsx("strong",{children:"This could mean:"})}),c.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[c.jsx("li",{children:"The agent doesn't provide a manifest"}),c.jsx("li",{children:"Manifest endpoint is not implemented"}),c.jsx("li",{children:"Agent requires specific authentication"})]})]})]})]})]})})}function mK({open:e,onOpenChange:t}){const[n,r]=x.useState(null),[a,i]=x.useState(null),[s,o]=x.useState(null),[l,u]=x.useState(!1),d=un(),{toast:f}=rn(),p=()=>{r(null),i(null),o(null),u(!1)},h=_t({mutationFn:async()=>{if(!n)throw new Error("Choose a bundle file first");const m=await n.text();let b;try{b=JSON.parse(m)}catch{throw new Error("File is not valid JSON")}return vF(b)},onSuccess:m=>{o(m),d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/services"]}),d.invalidateQueries({queryKey:["/api/playbooks"]}),d.invalidateQueries({queryKey:["/api/playbooks/collection"]}),d.invalidateQueries({queryKey:["/api/credentials/collection"]}),d.invalidateQueries({queryKey:["/api/collection/warnings"]}),f({title:"Import complete",description:rk(m)})},onError:m=>{f({title:"Import failed",description:m.message,variant:"destructive"})}}),y=async m=>{var b,g,v;if(r(m),o(null),!m){i(null);return}try{const w=await m.text(),S=JSON.parse(w);i(`${((b=S.services)==null?void 0:b.length)??0} services · ${((g=S.playbooks)==null?void 0:g.length)??0} playbooks · ${((v=S.decks)==null?void 0:v.length)??0} decks`)}catch{i("Invalid JSON")}};return c.jsx(ks,{open:e,onOpenChange:m=>{m||p(),t(m)},children:c.jsxs(vi,{className:"sm:max-w-lg border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(bi,{children:[c.jsx(xi,{children:"Import bundle"}),c.jsx(Oo,{asChild:!0,children:c.jsxs("div",{className:"space-y-2 text-left text-sm text-[#A8C4C0]",children:[c.jsx("p",{children:"Adds MCP, playbooks, and decks from a JSON file."}),c.jsxs("div",{children:[c.jsx("p",{className:"font-medium text-amber-200/90",children:"Notes"}),c.jsxs("ul",{className:"mt-1 list-disc space-y-0.5 pl-4",children:[c.jsx("li",{children:"Same name as an existing card or deck is skipped (linked only)."}),c.jsx("li",{children:"No credentials or secrets — re-enter keys and reconnect OAuth."})]})]})]})})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"bundle-file",children:"Bundle file"}),c.jsx(it,{id:"bundle-file",type:"file",accept:".json,.agent-deck.json,application/json",className:"cursor-pointer bg-white/5 border-white/20",onChange:m=>{var b;return y(((b=m.target.files)==null?void 0:b[0])??null)},"data-testid":"input-import-bundle"}),a&&c.jsx("p",{className:"text-xs text-[#A8C4C0]","data-testid":"import-preview",children:a})]}),!s&&c.jsx(te,{onClick:()=>h.mutate(),disabled:!n||h.isPending||a==="Invalid JSON",className:"rounded-full border px-6 text-sm font-semibold hover:opacity-90",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"button-import-apply",children:h.isPending?"Importing…":"Import"}),s&&c.jsxs("div",{className:"space-y-2 rounded-lg border border-white/10 bg-white/5 p-3 text-sm","data-testid":"import-report",children:[c.jsx("p",{className:"font-medium",children:rk(s)}),s.servicesNeedingOauth.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-amber-200",children:"Needs OAuth reconnect:"}),c.jsx("ul",{className:"list-disc pl-5 text-[#A8C4C0]",children:s.servicesNeedingOauth.map(m=>c.jsx("li",{children:m},m))})]}),s.warnings.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-amber-200",children:"Warnings:"}),c.jsx("ul",{className:"list-disc pl-5 text-[#A8C4C0]",children:s.warnings.map(m=>c.jsx("li",{children:m},m))})]}),c.jsx(te,{variant:"outline",size:"sm",className:"rounded-full border border-white/20 text-white hover:bg-white/10",onClick:()=>u(m=>!m),children:l?"Hide id map":"Show id map"}),l&&c.jsx("pre",{className:"max-h-40 overflow-auto rounded bg-black/40 p-2 text-xs",children:JSON.stringify(s.idMap,null,2)}),c.jsx(te,{className:"rounded-full border px-6 text-sm font-semibold hover:opacity-90",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},onClick:()=>{p(),t(!1)},children:"Done"})]})]})]})})}function gK(){const[e,t]=x.useState("connecting"),[n,r]=x.useState(null),a=x.useRef(null),i=x.useRef(null),s=un();return x.useEffect(()=>{const l=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws/events`,u=()=>{try{const f=new WebSocket(l);a.current=f,f.onopen=()=>{console.log("WebSocket connected"),t("connected")},f.onmessage=p=>{var h;try{const y=JSON.parse(p.data);r(y),y.type==="deck_update"?(console.log("Received deck update:",y),s.invalidateQueries({queryKey:["/api/decks"]})):y.type==="service_update"?(console.log("Received service update:",y),Tu(s,typeof((h=y.data)==null?void 0:h.serviceId)=="string"?y.data.serviceId:void 0)):y.type==="connection_status"&&t(y.status==="connected"?"connected":"disconnected")}catch(y){console.error("Failed to parse WebSocket message:",y)}},f.onclose=()=>{console.log("WebSocket disconnected"),t("disconnected"),i.current=setTimeout(()=>{console.log("Attempting to reconnect WebSocket..."),t("connecting"),u()},3e3)},f.onerror=p=>{console.error("WebSocket error:",p),t("disconnected")}}catch(f){console.error("Failed to connect WebSocket:",f),t("disconnected")}};u();const d=f=>{f.origin===window.location.origin&&cK(f.data)&&Tu(s,f.data.serviceId)};return window.addEventListener("message",d),()=>{window.removeEventListener("message",d),i.current&&clearTimeout(i.current),a.current&&a.current.readyState===WebSocket.OPEN&&a.current.close()}},[s]),{connectionStatus:e,lastMessage:n}}async function sE(e,t){const n=e==="credential"?`credentialId=${encodeURIComponent(t)}`:`serviceId=${encodeURIComponent(t)}`;return(await(await we("GET",`/api/playbooks/dependents/check?${n}`)).json()).data??[]}function yK(e){const[t,n]=x.useState(null),[r,a]=x.useState(null),[i,s]=x.useState(null),[o,l]=x.useState(!1),u=un(),{toast:d}=rn(),f=()=>{if(!e)throw new Error("Select a deck to edit first");return e},p=_t({mutationFn:async j=>{var B,U,Y;const O=f(),A=(B=(await(await we("GET","/api/decks")).json()).data)==null?void 0:B.find(N=>N.id===O);if(!A)throw new Error("Selected deck not found");if((U=A.services)!=null&&U.some(N=>N.id===j))throw new Error("Service is already in the deck");const H=((Y=A.services)==null?void 0:Y.length)??0;return we("POST",`/api/decks/${O}/services`,{serviceId:j,position:H})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Service added to deck",description:`${(t==null?void 0:t.name)||"Service"} has been added to the deck.`})},onError:j=>{d({title:"Failed to add service",description:j.message,variant:"destructive"})}}),h=_t({mutationFn:async j=>{var H,B;const O=f(),A=(H=(await(await we("GET","/api/decks")).json()).data)==null?void 0:H.find(U=>U.id===O);if((B=A==null?void 0:A.credentials)!=null&&B.some(U=>U.id===j))throw new Error("API key is already in the deck");return we("POST",`/api/decks/${O}/credentials`,{credentialId:j})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key added to deck",description:`${(r==null?void 0:r.label)||"API key"} is scoped to this deck.`})},onError:j=>{d({title:"Failed to add API key",description:j.message,variant:"destructive"})}}),y=_t({mutationFn:async j=>{var H,B;const O=f(),A=(H=(await(await we("GET","/api/decks")).json()).data)==null?void 0:H.find(U=>U.id===O);if((B=A==null?void 0:A.playbooks)!=null&&B.some(U=>U.id===j))throw new Error("Playbook is already in the deck");return we("POST",`/api/decks/${O}/playbooks`,{playbookId:j})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook added to deck",description:`${(i==null?void 0:i.title)||"Playbook"} is on this deck.`})},onError:j=>{d({title:"Failed to add playbook",description:j.message,variant:"destructive"})}}),m=_t({mutationFn:async j=>{const O=await sE("service",j);if(O.length>0){const D=O.map(H=>H.title).join(", ");if(!window.confirm(`Warning: ${O.length} playbook(s) depend on this MCP (${D}). Remove from deck anyway?`))throw new Error("Cancelled")}const L=f();return we("DELETE",`/api/decks/${L}/services`,{serviceId:j})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Service removed from deck",description:`${(t==null?void 0:t.name)||"Service"} has been removed from the deck.`})},onError:j=>{j.message!=="Cancelled"&&d({title:"Failed to remove service",description:j.message,variant:"destructive"})}}),b=_t({mutationFn:async j=>{const O=await sE("credential",j);if(O.length>0){const D=O.map(H=>H.title).join(", ");if(!window.confirm(`Warning: ${O.length} playbook(s) depend on this API key (${D}). Remove from deck anyway?`))throw new Error("Cancelled")}const L=f();return we("DELETE",`/api/decks/${L}/credentials`,{credentialId:j})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key removed from deck",description:`${(r==null?void 0:r.label)||"API key"} is no longer on this deck.`})},onError:j=>{j.message!=="Cancelled"&&d({title:"Failed to remove API key",description:j.message,variant:"destructive"})}}),g=_t({mutationFn:async j=>{const O=f();return we("DELETE",`/api/decks/${O}/playbooks`,{playbookId:j})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook removed from deck",description:`${(i==null?void 0:i.title)||"Playbook"} is no longer on this deck.`})},onError:j=>{d({title:"Failed to remove playbook",description:j.message,variant:"destructive"})}}),v=(j,O)=>{j.currentTarget instanceof HTMLElement&&(j.currentTarget.style.opacity=O)},w=(j,O)=>{j.dataTransfer.setData("text/plain",O.id),j.dataTransfer.setData("application/json",JSON.stringify(O)),j.dataTransfer.effectAllowed=O.fromDeck?"move":"copy"},S=(j,O,L=!1)=>{n(O),a(null),s(null),l(L),w(j,{kind:"service",id:O.id,fromDeck:L}),v(j,"0.5")},E=(j,O,L=!1)=>{a(O),n(null),s(null),l(L),w(j,{kind:"credential",id:O.id,fromDeck:L}),v(j,"0.5")},C=(j,O,L=!1)=>{s(O),n(null),a(null),l(L),w(j,{kind:"playbook",id:O.id,fromDeck:L}),v(j,"0.5")},T=j=>{n(null),a(null),s(null),v(j,"1")},P=j=>{if(j.kind==="service"){j.fromDeck?m.mutate(j.id):p.mutate(j.id);return}if(j.kind==="credential"){j.fromDeck?b.mutate(j.id):h.mutate(j.id);return}j.fromDeck?g.mutate(j.id):y.mutate(j.id)};return{draggedService:t,draggedCredential:r,draggedPlaybook:i,isDraggingFromDeck:o,handleDragStart:S,handleCredentialDragStart:E,handlePlaybookDragStart:C,handleDragEnd:T,handleDrop:j=>{j.preventDefault();const O=j.dataTransfer.getData("application/json");if(O){try{P(JSON.parse(O))}catch{const L=j.dataTransfer.getData("text/plain");L&&t&&p.mutate(L)}n(null),a(null),s(null),l(!1)}},handleGlobalDrop:j=>{j.preventDefault();const O=j.dataTransfer.getData("application/json");if(O){try{const L=JSON.parse(O);L.fromDeck&&P(L)}catch{}n(null),a(null),s(null),l(!1)}},isDropping:p.isPending||h.isPending||y.isPending||m.isPending||b.isPending||g.isPending}}const ly="agent-deck-editing-deck-id";function vK(e){const[t,n]=x.useState(()=>typeof window>"u"?null:localStorage.getItem(ly));x.useEffect(()=>{if(e.length===0)return;if(!(t&&e.some(s=>s.id===t))){const s=e[0].id;n(s),localStorage.setItem(ly,s)}},[e,t]);const r=i=>{n(i),localStorage.setItem(ly,i)};return{editingDeck:e.find(i=>i.id===t)??null,editingDeckId:t,setEditingDeckId:r}}function oE(e,[t,n]){return Math.min(n,Math.max(t,e))}function bK(e){const t=x.useRef({value:e,previous:e});return x.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xK=[" ","Enter","ArrowUp","ArrowDown"],wK=[" ","Enter"],So="Select",[Nm,jm,SK]=Jb(So),[Tc,Rse]=gi(So,[SK,Cc]),Tm=Cc(),[_K,Cs]=Tc(So),[kK,EK]=Tc(So),eO=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:i,value:s,defaultValue:o,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:h,form:y}=e,m=Tm(t),[b,g]=x.useState(null),[v,w]=x.useState(null),[S,E]=x.useState(!1),C=Cx(u),[T,P]=vo({prop:r,defaultProp:a??!1,onChange:i,caller:So}),[R,$]=vo({prop:s,defaultProp:o,onChange:l,caller:So}),j=x.useRef(null),O=b?y||!!b.closest("form"):!0,[L,D]=x.useState(new Set),A=Array.from(L).map(H=>H.props.value).join(";");return c.jsx(lA,{...m,children:c.jsxs(_K,{required:h,scope:t,trigger:b,onTriggerChange:g,valueNode:v,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:ai(),value:R,onValueChange:$,open:T,onOpenChange:P,dir:C,triggerPointerDownPosRef:j,disabled:p,children:[c.jsx(Nm.Provider,{scope:t,children:c.jsx(kK,{scope:e.__scopeSelect,onNativeOptionAdd:x.useCallback(H=>{D(B=>new Set(B).add(H))},[]),onNativeOptionRemove:x.useCallback(H=>{D(B=>{const U=new Set(B);return U.delete(H),U})},[]),children:n})}),O?c.jsxs(kO,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:R,onChange:H=>$(H.target.value),disabled:p,form:y,children:[R===void 0?c.jsx("option",{value:""}):null,Array.from(L)]},A):null]})})};eO.displayName=So;var tO="SelectTrigger",nO=x.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,i=Tm(n),s=Cs(tO,n),o=s.disabled||r,l=ut(t,s.onTriggerChange),u=jm(n),d=x.useRef("touch"),[f,p,h]=CO(m=>{const b=u().filter(w=>!w.disabled),g=b.find(w=>w.value===s.value),v=NO(b,m,g);v!==void 0&&s.onValueChange(v.value)}),y=m=>{o||(s.onOpenChange(!0),h()),m&&(s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return c.jsx(dm,{asChild:!0,...i,children:c.jsx(Me.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":EO(s.value)?"":void 0,...a,ref:l,onClick:ve(a.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&y(m)}),onPointerDown:ve(a.onPointerDown,m=>{d.current=m.pointerType;const b=m.target;b.hasPointerCapture(m.pointerId)&&b.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(y(m),m.preventDefault())}),onKeyDown:ve(a.onKeyDown,m=>{const b=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(b&&m.key===" ")&&xK.includes(m.key)&&(y(),m.preventDefault())})})})});nO.displayName=tO;var rO="SelectValue",aO=x.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:s="",...o}=e,l=Cs(rO,n),{onValueNodeHasChildrenChange:u}=l,d=i!==void 0,f=ut(t,l.onValueNodeChange);return _n(()=>{u(d)},[u,d]),c.jsx(Me.span,{...o,ref:f,style:{pointerEvents:"none"},children:EO(l.value)?c.jsx(c.Fragment,{children:s}):i})});aO.displayName=rO;var CK="SelectIcon",iO=x.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return c.jsx(Me.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});iO.displayName=CK;var NK="SelectPortal",sO=e=>c.jsx(Nd,{asChild:!0,...e});sO.displayName=NK;var _o="SelectContent",oO=x.forwardRef((e,t)=>{const n=Cs(_o,e.__scopeSelect),[r,a]=x.useState();if(_n(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?No.createPortal(c.jsx(lO,{scope:e.__scopeSelect,children:c.jsx(Nm.Slot,{scope:e.__scopeSelect,children:c.jsx("div",{children:e.children})})}),i):null}return c.jsx(cO,{...e,ref:t})});oO.displayName=_o;var Gr=10,[lO,Ns]=Tc(_o),jK="SelectContentImpl",TK=yo("SelectContent.RemoveScroll"),cO=x.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:s,side:o,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:y,hideWhenDetached:m,avoidCollisions:b,...g}=e,v=Cs(_o,n),[w,S]=x.useState(null),[E,C]=x.useState(null),T=ut(t,K=>S(K)),[P,R]=x.useState(null),[$,j]=x.useState(null),O=jm(n),[L,D]=x.useState(!1),A=x.useRef(!1);x.useEffect(()=>{if(w)return wx(w)},[w]),xx();const H=x.useCallback(K=>{const[G,...re]=O().map(Se=>Se.ref.current),[oe]=re.slice(-1),he=document.activeElement;for(const Se of K)if(Se===he||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===G&&E&&(E.scrollTop=0),Se===oe&&E&&(E.scrollTop=E.scrollHeight),Se==null||Se.focus(),document.activeElement!==he))return},[O,E]),B=x.useCallback(()=>H([P,w]),[H,P,w]);x.useEffect(()=>{L&&B()},[L,B]);const{onOpenChange:U,triggerPointerDownPosRef:Y}=v;x.useEffect(()=>{if(w){let K={x:0,y:0};const G=oe=>{var he,Se;K={x:Math.abs(Math.round(oe.pageX)-(((he=Y.current)==null?void 0:he.x)??0)),y:Math.abs(Math.round(oe.pageY)-(((Se=Y.current)==null?void 0:Se.y)??0))}},re=oe=>{K.x<=10&&K.y<=10?oe.preventDefault():w.contains(oe.target)||U(!1),document.removeEventListener("pointermove",G),Y.current=null};return Y.current!==null&&(document.addEventListener("pointermove",G),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",G),document.removeEventListener("pointerup",re,{capture:!0})}}},[w,U,Y]),x.useEffect(()=>{const K=()=>U(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[U]);const[N,F]=CO(K=>{const G=O().filter(he=>!he.disabled),re=G.find(he=>he.ref.current===document.activeElement),oe=NO(G,K,re);oe&&setTimeout(()=>oe.ref.current.focus())}),V=x.useCallback((K,G,re)=>{const oe=!A.current&&!re;(v.value!==void 0&&v.value===G||oe)&&(R(K),oe&&(A.current=!0))},[v.value]),_=x.useCallback(()=>w==null?void 0:w.focus(),[w]),k=x.useCallback((K,G,re)=>{const oe=!A.current&&!re;(v.value!==void 0&&v.value===G||oe)&&j(K)},[v.value]),M=r==="popper"?o0:uO,I=M===o0?{side:o,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:y,hideWhenDetached:m,avoidCollisions:b}:{};return c.jsx(lO,{scope:n,content:w,viewport:E,onViewportChange:C,itemRefCallback:V,selectedItem:P,onItemLeave:_,itemTextRefCallback:k,focusSelectedItem:B,selectedItemText:$,position:r,isPositioned:L,searchRef:N,children:c.jsx(gm,{as:TK,allowPinchZoom:!0,children:c.jsx(pm,{asChild:!0,trapped:v.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:ve(a,K=>{var G;(G=v.trigger)==null||G.focus({preventScroll:!0}),K.preventDefault()}),children:c.jsx(Sc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:c.jsx(M,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:K=>K.preventDefault(),...g,...I,onPlaced:()=>D(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:ve(g.onKeyDown,K=>{const G=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!G&&K.key.length===1&&F(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let oe=O().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(K.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const he=K.target,Se=oe.indexOf(he);oe=oe.slice(Se+1)}setTimeout(()=>H(oe)),K.preventDefault()}})})})})})})});cO.displayName=jK;var AK="SelectItemAlignedPosition",uO=x.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,i=Cs(_o,n),s=Ns(_o,n),[o,l]=x.useState(null),[u,d]=x.useState(null),f=ut(t,T=>d(T)),p=jm(n),h=x.useRef(!1),y=x.useRef(!0),{viewport:m,selectedItem:b,selectedItemText:g,focusSelectedItem:v}=s,w=x.useCallback(()=>{if(i.trigger&&i.valueNode&&o&&u&&m&&b&&g){const T=i.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),$=g.getBoundingClientRect();if(i.dir!=="rtl"){const he=$.left-P.left,Se=R.left-he,Xe=T.left-Se,ot=T.width+Xe,W=Math.max(ot,P.width),fe=window.innerWidth-Gr,ne=oE(Se,[Gr,Math.max(Gr,fe-W)]);o.style.minWidth=ot+"px",o.style.left=ne+"px"}else{const he=P.right-$.right,Se=window.innerWidth-R.right-he,Xe=window.innerWidth-T.right-Se,ot=T.width+Xe,W=Math.max(ot,P.width),fe=window.innerWidth-Gr,ne=oE(Se,[Gr,Math.max(Gr,fe-W)]);o.style.minWidth=ot+"px",o.style.right=ne+"px"}const j=p(),O=window.innerHeight-Gr*2,L=m.scrollHeight,D=window.getComputedStyle(u),A=parseInt(D.borderTopWidth,10),H=parseInt(D.paddingTop,10),B=parseInt(D.borderBottomWidth,10),U=parseInt(D.paddingBottom,10),Y=A+H+L+U+B,N=Math.min(b.offsetHeight*5,Y),F=window.getComputedStyle(m),V=parseInt(F.paddingTop,10),_=parseInt(F.paddingBottom,10),k=T.top+T.height/2-Gr,M=O-k,I=b.offsetHeight/2,K=b.offsetTop+I,G=A+H+K,re=Y-G;if(G<=k){const he=j.length>0&&b===j[j.length-1].ref.current;o.style.bottom="0px";const Se=u.clientHeight-m.offsetTop-m.offsetHeight,Xe=Math.max(M,I+(he?_:0)+Se+B),ot=G+Xe;o.style.height=ot+"px"}else{const he=j.length>0&&b===j[0].ref.current;o.style.top="0px";const Xe=Math.max(k,A+m.offsetTop+(he?V:0)+I)+re;o.style.height=Xe+"px",m.scrollTop=G-k+m.offsetTop}o.style.margin=`${Gr}px 0`,o.style.minHeight=N+"px",o.style.maxHeight=O+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[p,i.trigger,i.valueNode,o,u,m,b,g,i.dir,r]);_n(()=>w(),[w]);const[S,E]=x.useState();_n(()=>{u&&E(window.getComputedStyle(u).zIndex)},[u]);const C=x.useCallback(T=>{T&&y.current===!0&&(w(),v==null||v(),y.current=!1)},[w,v]);return c.jsx($K,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:h,onScrollButtonChange:C,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:c.jsx(Me.div,{...a,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});uO.displayName=AK;var RK="SelectPopperPosition",o0=x.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=Gr,...i}=e,s=Tm(n);return c.jsx(mx,{...s,...i,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});o0.displayName=RK;var[$K,Wx]=Tc(_o,{}),l0="SelectViewport",dO=x.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,i=Ns(l0,n),s=Wx(l0,n),o=ut(t,i.onViewportChange),l=x.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),c.jsx(Nm.Slot,{scope:n,children:c.jsx(Me.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:ve(a.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:p}=s;if(p!=null&&p.current&&f){const h=Math.abs(l.current-d.scrollTop);if(h>0){const y=window.innerHeight-Gr*2,m=parseFloat(f.style.minHeight),b=parseFloat(f.style.height),g=Math.max(m,b);if(g<y){const v=g+h,w=Math.min(y,v),S=v-w;f.style.height=w+"px",f.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});dO.displayName=l0;var fO="SelectGroup",[OK,MK]=Tc(fO),PK=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=ai();return c.jsx(OK,{scope:n,id:a,children:c.jsx(Me.div,{role:"group","aria-labelledby":a,...r,ref:t})})});PK.displayName=fO;var hO="SelectLabel",pO=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=MK(hO,n);return c.jsx(Me.div,{id:a.id,...r,ref:t})});pO.displayName=hO;var mp="SelectItem",[DK,mO]=Tc(mp),gO=x.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...s}=e,o=Cs(mp,n),l=Ns(mp,n),u=o.value===r,[d,f]=x.useState(i??""),[p,h]=x.useState(!1),y=ut(t,v=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,v,r,a)}),m=ai(),b=x.useRef("touch"),g=()=>{a||(o.onValueChange(r),o.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return c.jsx(DK,{scope:n,value:r,disabled:a,textId:m,isSelected:u,onItemTextChange:x.useCallback(v=>{f(w=>w||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(Nm.ItemSlot,{scope:n,value:r,disabled:a,textValue:d,children:c.jsx(Me.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:y,onFocus:ve(s.onFocus,()=>h(!0)),onBlur:ve(s.onBlur,()=>h(!1)),onClick:ve(s.onClick,()=>{b.current!=="mouse"&&g()}),onPointerUp:ve(s.onPointerUp,()=>{b.current==="mouse"&&g()}),onPointerDown:ve(s.onPointerDown,v=>{b.current=v.pointerType}),onPointerMove:ve(s.onPointerMove,v=>{var w;b.current=v.pointerType,a?(w=l.onItemLeave)==null||w.call(l):b.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(s.onPointerLeave,v=>{var w;v.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:ve(s.onKeyDown,v=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&v.key===" "||(wK.includes(v.key)&&g(),v.key===" "&&v.preventDefault())})})})})});gO.displayName=mp;var au="SelectItemText",yO=x.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...i}=e,s=Cs(au,n),o=Ns(au,n),l=mO(au,n),u=EK(au,n),[d,f]=x.useState(null),p=ut(t,g=>f(g),l.onItemTextChange,g=>{var v;return(v=o.itemTextRefCallback)==null?void 0:v.call(o,g,l.value,l.disabled)}),h=d==null?void 0:d.textContent,y=x.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:b}=u;return _n(()=>(m(y),()=>b(y)),[m,b,y]),c.jsxs(c.Fragment,{children:[c.jsx(Me.span,{id:l.textId,...i,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?No.createPortal(i.children,s.valueNode):null]})});yO.displayName=au;var vO="SelectItemIndicator",bO=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return mO(vO,n).isSelected?c.jsx(Me.span,{"aria-hidden":!0,...r,ref:t}):null});bO.displayName=vO;var c0="SelectScrollUpButton",xO=x.forwardRef((e,t)=>{const n=Ns(c0,e.__scopeSelect),r=Wx(c0,e.__scopeSelect),[a,i]=x.useState(!1),s=ut(t,r.onScrollButtonChange);return _n(()=>{if(n.viewport&&n.isPositioned){let o=function(){const u=l.scrollTop>0;i(u)};const l=n.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),a?c.jsx(SO,{...e,ref:s,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=n;o&&l&&(o.scrollTop=o.scrollTop-l.offsetHeight)}}):null});xO.displayName=c0;var u0="SelectScrollDownButton",wO=x.forwardRef((e,t)=>{const n=Ns(u0,e.__scopeSelect),r=Wx(u0,e.__scopeSelect),[a,i]=x.useState(!1),s=ut(t,r.onScrollButtonChange);return _n(()=>{if(n.viewport&&n.isPositioned){let o=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<u;i(d)};const l=n.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),a?c.jsx(SO,{...e,ref:s,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=n;o&&l&&(o.scrollTop=o.scrollTop+l.offsetHeight)}}):null});wO.displayName=u0;var SO=x.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,i=Ns("SelectScrollButton",n),s=x.useRef(null),o=jm(n),l=x.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return x.useEffect(()=>()=>l(),[l]),_n(()=>{var d;const u=o().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[o]),c.jsx(Me.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:ve(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:ve(a.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:ve(a.onPointerLeave,()=>{l()})})}),zK="SelectSeparator",_O=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(Me.div,{"aria-hidden":!0,...r,ref:t})});_O.displayName=zK;var d0="SelectArrow",IK=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Tm(n),i=Cs(d0,n),s=Ns(d0,n);return i.open&&s.position==="popper"?c.jsx(gx,{...a,...r,ref:t}):null});IK.displayName=d0;var LK="SelectBubbleInput",kO=x.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=x.useRef(null),i=ut(r,a),s=bK(t);return x.useEffect(()=>{const o=a.current;if(!o)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==t&&d){const f=new Event("change",{bubbles:!0});d.call(o,t),o.dispatchEvent(f)}},[s,t]),c.jsx(Me.select,{...n,style:{...eT,...n.style},ref:i,defaultValue:t})});kO.displayName=LK;function EO(e){return e===""||e===void 0}function CO(e){const t=qr(e),n=x.useRef(""),r=x.useRef(0),a=x.useCallback(s=>{const o=n.current+s;t(o),function l(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(o)},[t]),i=x.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function NO(e,t,n){const a=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=UK(e,Math.max(i,0));a.length===1&&(s=s.filter(u=>u!==n));const l=s.find(u=>u.textValue.toLowerCase().startsWith(a.toLowerCase()));return l!==n?l:void 0}function UK(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var FK=eO,jO=nO,qK=aO,HK=iO,BK=sO,TO=oO,VK=dO,AO=pO,RO=gO,ZK=yO,KK=bO,$O=xO,OO=wO,MO=_O;const GK=FK,QK=qK,PO=x.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(jO,{ref:r,className:Ce("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,c.jsx(HK,{asChild:!0,children:c.jsx(sm,{className:"h-4 w-4 opacity-50"})})]}));PO.displayName=jO.displayName;const DO=x.forwardRef(({className:e,...t},n)=>c.jsx($O,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(yL,{className:"h-4 w-4"})}));DO.displayName=$O.displayName;const zO=x.forwardRef(({className:e,...t},n)=>c.jsx(OO,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(sm,{className:"h-4 w-4"})}));zO.displayName=OO.displayName;const IO=x.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>c.jsx(BK,{children:c.jsxs(TO,{ref:a,className:Ce("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[c.jsx(DO,{}),c.jsx(VK,{className:Ce("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(zO,{})]})}));IO.displayName=TO.displayName;const YK=x.forwardRef(({className:e,...t},n)=>c.jsx(AO,{ref:n,className:Ce("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));YK.displayName=AO.displayName;const Yo=x.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(RO,{ref:r,className:Ce("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[c.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(KK,{children:c.jsx(ET,{className:"h-4 w-4"})})}),c.jsx(ZK,{children:t})]}));Yo.displayName=RO.displayName;const XK=x.forwardRef(({className:e,...t},n)=>c.jsx(MO,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));XK.displayName=MO.displayName;const WK="/assets/AgentDeckLogo3-X5qCXS2A.png";function JK(){const[e,t]=x.useState(""),[n,r]=x.useState(""),[a,i]=x.useState(!1),[s,o]=x.useState(!1),[l,u]=x.useState(null),[d,f]=x.useState(!1),[p,h]=x.useState(!1),[y,m]=x.useState(null),[b,g]=x.useState(!1),[v,w]=x.useState(!1),[S,E]=x.useState(null),[C,T]=x.useState(!1),[P,R]=x.useState(!1),[$,j]=x.useState(!1),[O,L]=x.useState(null),{toast:D}=rn(),{data:A=[]}=St({queryKey:["/api/playbook-patches","proposed"],queryFn:()=>Gv("proposed")}),{data:H=0}=St({queryKey:["/api/feedback-signals/count","available"],queryFn:()=>DR()}),B=async()=>{j(!0);try{const ie=await MR({scope:"collection"});PR(ie,"backup.agent-deck.json"),D({title:"Exported collection",description:`${ie.services.length} services, ${ie.playbooks.length} playbooks, ${ie.decks.length} decks`})}catch(ie){D({title:"Export failed",description:ie instanceof Error?ie.message:"Unknown error",variant:"destructive"})}finally{j(!1)}},{connectionStatus:U}=gK(),{data:Y,isLoading:N,error:F}=St({queryKey:["/api/decks"]}),V=(Y==null?void 0:Y.data)||[],{editingDeck:_,editingDeckId:k,setEditingDeckId:M}=vK(V),{handleDragStart:I,handleCredentialDragStart:K,handlePlaybookDragStart:G,handleDragEnd:re,handleDrop:oe,handleGlobalDrop:he,isDraggingFromDeck:Se}=yK(k),{data:Xe,isLoading:ot,error:W}=St({queryKey:["/api/services"]}),{data:fe,isLoading:ne}=St({queryKey:["/api/credentials/vault"]}),{data:ze,isLoading:ce}=St({queryKey:["/api/playbooks/vault"]}),{data:$e}=St({queryKey:["/api/collection/warnings"],staleTime:6e4}),qe=(Xe==null?void 0:Xe.data)||[],Pt=(fe==null?void 0:fe.data)||[],kr=(ze==null?void 0:ze.data)||[],yt=x.useMemo(()=>XU($e==null?void 0:$e.data),[$e==null?void 0:$e.data]),sr=(ie,an)=>a?ie==="service"?yt.serviceWarnings.has(an):ie==="credential"?yt.credentialWarnings.has(an):yt.playbookWarnings.has(an):!0,Z=qe.filter(ie=>{var Ts;if(!sr("service",ie.id)||n==="api-key"||n==="playbook")return!1;const an=ie.name.toLowerCase().includes(e.toLowerCase())||((Ts=ie.description)==null?void 0:Ts.toLowerCase().includes(e.toLowerCase())),js=!n||n==="all"||ie.type===n;return an&&js}),ee=Pt.filter(ie=>!sr("credential",ie.id)||n&&n!=="all"&&n!=="api-key"?!1:ie.label.toLowerCase().includes(e.toLowerCase())),be=kr.filter(ie=>!sr("playbook",ie.id)||n&&n!=="all"&&n!=="playbook"?!1:ie.title.toLowerCase().includes(e.toLowerCase())||ie.body.toLowerCase().includes(e.toLowerCase())),Ee=Z.length+ee.length+be.length;W&&console.error("Services error:",W),F&&console.error("Decks error:",F);const We=()=>{t(""),r(""),i(!1)},fn=!!(e||n||a),Er=new Set(((_==null?void 0:_.credentials)??[]).map(ie=>ie.id)),qn=new Set(((_==null?void 0:_.playbooks)??[]).map(ie=>ie.id)),la=(_==null?void 0:_.services)||[],ca=(_==null?void 0:_.playbooks)||[],Yt=ie=>{u(ie),f(!0)},Cr=ie=>{E(ie.id),T(!0)},Rn=ie=>{m(ie.id),g(!0)},Oa=ie=>{L(ie)};if(W||F){const ie=(F instanceof Error?F.message:null)??(W instanceof Error?W.message:null)??"There was an error loading the application data.";return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-900",children:c.jsxs("div",{className:"text-center max-w-lg px-4",children:[c.jsx("h2",{className:"text-2xl font-bold text-red-400 mb-4",children:"Error Loading Data"}),c.jsx("p",{className:"text-gray-300 mb-2",children:"There was an error loading the application data."}),c.jsx("p",{className:"text-gray-400 text-sm mb-4",children:ie}),c.jsxs("p",{className:"text-gray-500 text-xs mb-6",children:["Is the API running? Try ",c.jsx("code",{className:"text-gray-300",children:"agent-deck stop && agent-deck start"})]}),c.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",children:"Reload Page"})]})})}return ot||N||ne||ce?c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-900",children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-yellow-400 mx-auto mb-4"}),c.jsx("p",{className:"text-gray-300",children:"Loading AgentDeck..."})]})}):c.jsxs("div",{className:"flex min-h-dvh flex-col overflow-x-hidden",onDrop:he,onDragOver:ie=>ie.preventDefault(),style:{position:"relative",...Se&&{background:"linear-gradient(to bottom right, #1a1a2e, #16213e, #0f3460)"}},children:[c.jsx("header",{className:"relative z-20 shrink-0 bg-black/30 backdrop-blur-md border-b border-white/10",children:c.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-4",children:c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[c.jsx("img",{src:WK,alt:"Agent Deck Logo",className:"h-12 w-12 shrink-0 object-contain sm:h-16 sm:w-16"}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("h1",{className:"text-xl font-bold bg-gradient-to-r from-yellow-400 to-yellow-600 bg-clip-text text-transparent sm:text-2xl",style:{background:"linear-gradient(to right, #C4B643, #D4C760)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:"AgentDeck"}),c.jsx("p",{className:"text-xs sm:text-sm",style:{color:"#92E4DD"},children:"Build tool deck for your agent"})]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3 sm:gap-6",children:[c.jsxs("div",{className:`flex items-center space-x-2 px-3 py-1 rounded-full border ${U==="connected"?"bg-emerald-500/20 border-emerald-500/30":"bg-red-500/20 border-red-500/30"}`,children:[c.jsx("div",{className:`w-2 h-2 rounded-full animate-pulse ${U==="connected"?"bg-emerald-400":"bg-red-400"}`}),c.jsx("button",{className:`text-sm hover:underline cursor-pointer ${U==="connected"?"text-emerald-300":"text-red-300"}`,"data-testid":"button-copy-mcp-url",onClick:()=>{navigator.clipboard.writeText("http://localhost:3001/mcp").then(()=>{D({title:"MCP URL copied!",description:"The MCP server URL has been copied to your clipboard."})})},title:"Click to copy MCP URL",children:"Get MCP URL"})]}),c.jsx(M9,{highlightDeckId:k??void 0}),c.jsx(nc,{href:"/feedback-signals",children:c.jsxs(te,{variant:"outline",size:"sm",className:"relative border-white/20 bg-white/5 text-[#E8F6F4]",children:["Feedback",H>0&&c.jsx("span",{className:"ml-2 rounded-full px-2 py-0.5 text-xs font-semibold",style:{background:"#C4B643",color:"#0A0A07"},title:"Open feedback available for curation",children:H})]})}),c.jsx(nc,{href:"/playbook-patches",children:c.jsxs(te,{variant:"outline",size:"sm",className:"relative border-white/20 bg-white/5 text-[#E8F6F4]",children:[c.jsx(xL,{className:"mr-2 h-4 w-4"}),"Review",A.length>0&&c.jsx("span",{className:"ml-2 rounded-full px-2 py-0.5 text-xs font-semibold",style:{background:"#C4B643",color:"#0A0A07"},title:"Proposed playbook patches",children:A.length})]})})]})]})})}),Se&&c.jsx("div",{className:"fixed inset-0 pointer-events-none z-50 flex items-center justify-center",children:c.jsxs("div",{className:"bg-red-500/20 border-2 border-dashed border-red-500/50 rounded-lg p-8 text-center",children:[c.jsx("div",{className:"text-red-400 text-lg font-bold mb-2",children:"Drop to Remove"}),c.jsx("div",{className:"text-red-300 text-sm",children:"Release to remove card from deck"})]})}),c.jsx("main",{className:"container mx-auto flex min-h-0 flex-1 flex-col px-4 py-4 sm:py-6",children:c.jsxs("div",{className:"grid min-w-0 grid-cols-1 gap-4 sm:gap-6 xl:min-h-0 xl:flex-1 xl:grid-cols-4 xl:overflow-hidden",children:[c.jsxs("div",{className:"min-w-0 space-y-4 sm:space-y-6 xl:col-span-1 xl:min-h-0 xl:overflow-y-auto",children:[c.jsx("div",{className:"panel-surface h-64 overflow-hidden p-4 min-w-0 sm:h-72 xl:h-80",children:c.jsx(xF,{decks:V,editingDeckId:k,onSelectDeck:M,isLoading:N})}),c.jsxs("div",{className:"panel-surface p-4",children:[c.jsxs("h2",{className:"text-lg font-bold mb-3 flex items-center",children:[c.jsx(kT,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),c.jsx("span",{style:{color:"#92E4DD"},children:"Add Cards"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs(te,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${ga}`,style:ya(Dn),onClick:()=>o(!0),"data-testid":"button-register-mcp",children:[c.jsx(ep,{className:"w-3 h-3 mr-2"}),"Register MCP"]}),c.jsxs(te,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${ga}`,style:ya(Xn),onClick:()=>h(!0),"data-testid":"button-register-api-key",children:[c.jsx(zv,{className:"w-3 h-3 mr-2"}),"Register API key"]}),c.jsxs(te,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${ga}`,style:ya(Yr),onClick:()=>w(!0),"data-testid":"button-register-playbook",children:[c.jsx(rx,{className:"w-3 h-3 mr-2"}),"Register Playbook"]})]})]})]}),c.jsxs("div",{className:"flex min-w-0 flex-col gap-4 sm:gap-6 xl:col-span-3 xl:h-full xl:min-h-0",children:[c.jsx("div",{className:"panel-surface h-64 shrink-0 overflow-hidden p-4 min-w-0 sm:h-72 xl:h-80",children:_?c.jsx("div",{className:"h-full",children:c.jsx(g6,{deck:_,services:la,credentials:_.credentials??[],playbooks:ca,allServices:qe,collectionWarnings:yt,onDrop:oe,onDragStart:I,onCredentialDragStart:K,onPlaybookDragStart:G,onDragEnd:re,onCardClick:Yt,onPlaybookClick:Cr,onCredentialClick:Rn})}):c.jsxs("div",{className:"text-center h-full flex flex-col justify-center",children:[c.jsx("div",{className:"w-12 h-12 rounded-full bg-yellow-500/20 border border-yellow-500/30 flex items-center justify-center mx-auto mb-3",children:c.jsx(Jh,{className:"w-6 h-6 text-yellow-400"})}),c.jsx("h3",{className:"text-lg font-bold mb-2",style:{color:"#92E4DD"},children:"No deck selected"}),c.jsx("p",{className:"text-gray-300 mb-4 text-sm",children:"Create a deck or select one from the sidebar to edit its cards."}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs(te,{onClick:()=>{const ie=document.querySelector('[data-testid="create-deck-button"]');ie&&ie.click()},className:"border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},children:[c.jsx(Ks,{className:"w-4 h-4 mr-2"}),"Create New Deck"]}),c.jsxs(te,{variant:"outline",className:"border-white/20 text-white hover:bg-white/10 text-sm py-2",onClick:()=>{const ie=document.querySelector('[data-testid="deck-management-panel"]');ie&&ie.scrollIntoView({behavior:"smooth"})},children:[c.jsx(Jh,{className:"w-4 h-4 mr-2"}),"Manage Decks"]})]})]})}),c.jsxs("div",{className:"panel-surface flex min-h-[20rem] flex-col overflow-hidden p-4 min-w-0 sm:min-h-[24rem] xl:min-h-0 xl:flex-1","data-testid":"collection-panel",children:[c.jsxs("div",{className:"mb-3 flex shrink-0 flex-wrap items-center justify-between gap-2",children:[c.jsxs("h2",{className:"text-lg font-bold flex items-center",children:[c.jsx(wL,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),c.jsx("span",{style:{color:"#92E4DD"},children:"My Collection"}),c.jsxs("span",{className:"ml-3 text-sm font-normal text-gray-400",children:["(",Ee," cards)"]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs(te,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:B,disabled:$,title:"Export all MCP, playbooks, and decks","data-testid":"button-export-all",children:[c.jsx(TT,{className:"w-3 h-3 mr-1"}),$?"Exporting…":"Export all"]}),c.jsxs(te,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:()=>R(!0),title:"Import a bundle file","data-testid":"button-import-bundle",children:[c.jsx(CL,{className:"w-3 h-3 mr-1"}),"Import"]}),c.jsxs("div",{className:"relative",children:[c.jsx(AT,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),c.jsx(it,{placeholder:"Search...",value:e,onChange:ie=>t(ie.target.value),className:"h-8 w-36 pl-8 text-sm bg-white/10 border-white/20 text-white placeholder-gray-400 sm:w-48","data-testid":"input-search"})]}),c.jsxs(GK,{value:n||"all",onValueChange:ie=>r(ie==="all"?"":ie),children:[c.jsxs(PO,{className:"w-[7.5rem] h-8 bg-white/10 border-white/20 text-white text-xs shrink-0","data-testid":"select-type",children:[c.jsx(bL,{className:"w-3 h-3 mr-1 shrink-0"}),c.jsx(QK,{placeholder:"Type"})]}),c.jsxs(IO,{children:[c.jsx(Yo,{value:"all",children:"All"}),c.jsx(Yo,{value:"mcp",children:"MCP"}),c.jsx(Yo,{value:"local-mcp",children:"Local MCP"}),c.jsx(Yo,{value:"api-key",children:"API Key"}),c.jsx(Yo,{value:"playbook",children:"Playbook"})]})]}),(e||n||a)&&c.jsx(te,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:We,title:"Clear all filters",children:"Clear"})]})]}),yt.total>0&&c.jsx("button",{type:"button",onClick:()=>i(ie=>!ie),className:`mb-3 w-full shrink-0 rounded-lg border px-3 py-2 text-left text-sm transition-colors ${a?"border-amber-300/60 bg-amber-500/15 text-amber-100":"border-amber-400/30 bg-amber-500/10 text-amber-100 hover:bg-amber-500/15"}`,"data-testid":"button-collection-warnings",children:c.jsxs("span",{className:"flex items-start gap-2",children:[c.jsx(Mr,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-300"}),c.jsx("span",{children:a?c.jsxs(c.Fragment,{children:["Showing ",c.jsx("strong",{children:Ee})," card",Ee===1?"":"s"," needing attention.",c.jsx("span",{className:"text-amber-200/80",children:" Click to show all cards."})]}):c.jsxs(c.Fragment,{children:[c.jsx("strong",{children:yt.total})," card",yt.total===1?"":"s"," need attention",yt.byKind.oauth_expired+yt.byKind.oauth_required>0&&c.jsxs(c.Fragment,{children:[" ","(",yt.byKind.oauth_expired+yt.byKind.oauth_required," ","OAuth)"]}),". ",c.jsx("span",{className:"text-amber-200/80",children:"Click to filter."})]})})]})}),c.jsx("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-1 py-2",children:ot||ne||ce?c.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,5rem)] gap-y-2 pr-12",children:Array.from({length:10}).map((ie,an)=>c.jsx("div",{className:"animate-pulse",children:c.jsx("div",{className:"bg-white/10 rounded-lg w-32 h-48 aspect-[2/3]"})},an))}):Ee===0?c.jsxs("div",{className:"text-center py-12",children:[c.jsx("div",{className:"text-gray-400 mb-4",children:c.jsx("i",{className:"fas fa-layer-group text-4xl"})}),c.jsx("h3",{className:"text-lg font-semibold text-gray-300 mb-2",children:"No cards yet"}),c.jsx("p",{className:"text-gray-400 text-sm mb-4",children:fn?a?"No cards with warnings match your current filters":"Try adjusting your search or filters":"Register an MCP server, API key, or playbook to get started"}),!fn&&c.jsxs("div",{className:"flex gap-3 justify-center",children:[c.jsxs(te,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${ga}`,style:ya(Dn),onClick:()=>o(!0),"data-testid":"button-register-mcp-empty",children:[c.jsx(ep,{className:"w-3 h-3 mr-1"}),"Register MCP"]}),c.jsxs(te,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${ga}`,style:ya(Xn),onClick:()=>h(!0),"data-testid":"button-register-api-key-empty",children:[c.jsx(zv,{className:"w-3 h-3 mr-1"}),"Register API key"]})]})]}):c.jsxs("div",{className:"relative isolate grid grid-cols-[repeat(auto-fill,5rem)] gap-y-2 pr-12",style:{isolation:"isolate"},"data-testid":"collection-card-grid",children:[be.map((ie,an)=>c.jsx("div",{className:"relative group",style:{zIndex:O===ie.id?999999:Ee-an},children:c.jsx(s6,{playbook:ie,isInActiveDeck:qn.has(ie.id),activeDeck:_??void 0,isInCollection:!0,onDragStart:G,onDragEnd:re,onCardClick:Cr,onMouseEnter:()=>Oa(ie.id),onMouseLeave:()=>Oa(null),warnings:yt.playbookWarnings.get(ie.id)})},ie.id)),ee.map((ie,an)=>c.jsx("div",{className:"relative group",style:{zIndex:O===ie.id?999999:Ee-be.length-an},children:c.jsx(a6,{credential:ie,isInActiveDeck:Er.has(ie.id),activeDeck:_??void 0,isInCollection:!0,onDragStart:K,onDragEnd:re,onMouseEnter:()=>Oa(ie.id),onMouseLeave:()=>Oa(null),onCardClick:Rn,warnings:yt.credentialWarnings.get(ie.id)})},ie.id)),Z.map((ie,an)=>{var js;return c.jsx("div",{className:"relative group",style:{zIndex:O===ie.id?999999:Ee-be.length-ee.length-an},children:c.jsx(t6,{service:ie,onDragStart:I,onDragEnd:re,isInActiveDeck:((js=_==null?void 0:_.services)==null?void 0:js.some(Ts=>Ts.id===ie.id))||!1,onCardClick:Yt,isInCollection:!0,onMouseEnter:()=>Oa(ie.id),onMouseLeave:()=>Oa(null),activeDeck:_??void 0,warnings:yt.serviceWarnings.get(ie.id)})},ie.id)})]})})]})]})]})}),c.jsxs("div",{className:"fixed inset-0 pointer-events-none z-0 overflow-hidden",children:[c.jsx("div",{className:"absolute top-20 left-20",children:c.jsx("div",{className:"h-96 w-96 rounded-full bg-cyan-500/10 blur-3xl animate-orb-drift-1"})}),c.jsx("div",{className:"absolute bottom-20 right-20",children:c.jsx("div",{className:"h-96 w-96 rounded-full bg-pink-500/10 blur-3xl animate-orb-drift-2"})}),c.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:c.jsx("div",{className:"h-96 w-96 rounded-full bg-purple-500/5 blur-3xl animate-orb-drift-3"})})]}),c.jsx(yF,{type:"mcp",open:s,onOpenChange:o}),c.jsx(pK,{service:l,isOpen:d,onClose:()=>f(!1)}),c.jsx(wF,{open:p,onOpenChange:h}),c.jsx(OF,{credentialId:y,open:b,onOpenChange:g}),c.jsx(SF,{open:v,onOpenChange:w}),c.jsx($F,{playbookId:S,open:C,onOpenChange:T}),c.jsx(mK,{open:P,onOpenChange:R})]})}const Ba=x.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ce("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ba.displayName="Card";const $i=x.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ce("flex flex-col space-y-1.5 p-6",e),...t}));$i.displayName="CardHeader";const Oi=x.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ce("text-2xl font-semibold leading-none tracking-tight",e),...t}));Oi.displayName="CardTitle";const Au=x.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));Au.displayName="CardDescription";const Va=x.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ce("p-6 pt-0",e),...t}));Va.displayName="CardContent";const eG=x.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ce("flex items-center p-6 pt-0",e),...t}));eG.displayName="CardFooter";function tG(){return c.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gray-50",children:c.jsx(Ba,{className:"w-full max-w-md mx-4",children:c.jsxs(Va,{className:"pt-6",children:[c.jsxs("div",{className:"flex mb-4 gap-2",children:[c.jsx(jT,{className:"h-8 w-8 text-red-500"}),c.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"404 Page Not Found"})]}),c.jsx("p",{className:"mt-4 text-sm text-gray-600",children:"Did you forget to add the page to the router?"})]})})})}function nG(){const[e]=R3(),[t,n]=x.useState("loading"),[r,a]=x.useState("Authenticating...");return x.useEffect(()=>{(async()=>{try{const s=new URL(window.location.href),o=s.searchParams.get("success"),l=s.searchParams.get("error"),u=s.searchParams.get("serviceId");o==="true"?(n("success"),a("Authentication successful! This window will close automatically."),window.opener&&!window.opener.closed&&window.opener.postMessage({type:J$,serviceId:u??void 0},window.location.origin),setTimeout(()=>{window.close()},2e3)):o==="false"?(n("error"),a(`OAuth Error: ${l||"Authentication failed"}`)):(n("error"),a("Invalid OAuth callback - please try again"))}catch(s){n("error"),a(s instanceof Error?s.message:"Authentication failed")}})()},[e]),c.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:c.jsxs("div",{className:"text-center space-y-4",children:[t==="loading"&&c.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto"}),t==="success"&&c.jsx("div",{className:"text-green-500 text-4xl",children:"✓"}),t==="error"&&c.jsx("div",{className:"text-red-500 text-4xl",children:"✗"}),c.jsx("h1",{className:"text-xl font-semibold",children:r}),t==="error"&&c.jsx("button",{onClick:()=>window.close(),className:"px-4 py-2 bg-primary text-primary-foreground rounded hover:bg-primary/90",children:"Close Window"})]})})}function hl(e){const t=()=>{throw new Error(`Invalid url to pass to open(): ${e}`)};let n;try{n=new URL(e)}catch{t()}return n.protocol!=="https:"&&n.protocol!=="http:"&&t(),n.hostname!==encodeURIComponent(n.hostname)&&t(),n.username&&(n.username=encodeURIComponent(n.username)),n.password&&(n.password=encodeURIComponent(n.password)),n.pathname=n.pathname.slice(0,1)+encodeURIComponent(n.pathname.slice(1)).replace(/%2f/ig,"/"),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(rG).join("&"),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}function rG([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:""}`}var lE=class{constructor(e,t={}){Ma(this,"serverUrl");Ma(this,"storageKeyPrefix");Ma(this,"serverUrlHash");Ma(this,"clientName");Ma(this,"clientUri");Ma(this,"callbackUrl");Ma(this,"preventAutoAuth");Ma(this,"onPopupWindow");this.serverUrl=e,this.storageKeyPrefix=t.storageKeyPrefix||"mcp:auth",this.serverUrlHash=this.hashString(e),this.clientName=t.clientName||"MCP Browser Client",this.clientUri=t.clientUri||(typeof window<"u"?window.location.origin:""),this.callbackUrl=hl(t.callbackUrl||(typeof window<"u"?new URL("/oauth/callback",window.location.origin).toString():"/oauth/callback")),this.preventAutoAuth=t.preventAutoAuth,this.onPopupWindow=t.onPopupWindow}get redirectUrl(){return hl(this.callbackUrl)}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:this.clientName,client_uri:this.clientUri}}async clientInformation(){const e=this.getKey("client_info"),t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(n){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,n),localStorage.removeItem(e);return}}async saveClientInformation(e){const t=this.getKey("client_info");localStorage.setItem(t,JSON.stringify(e))}async tokens(){const e=this.getKey("tokens"),t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(n){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,n),localStorage.removeItem(e);return}}async saveTokens(e){const t=this.getKey("tokens");localStorage.setItem(t,JSON.stringify(e)),localStorage.removeItem(this.getKey("code_verifier")),localStorage.removeItem(this.getKey("last_auth_url"))}async saveCodeVerifier(e){const t=this.getKey("code_verifier");localStorage.setItem(t,e)}async codeVerifier(){const e=this.getKey("code_verifier"),t=localStorage.getItem(e);if(!t)throw new Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return t}async prepareAuthorizationUrl(e){const t=crypto.randomUUID(),n=`${this.storageKeyPrefix}:state_${t}`,r={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl}};localStorage.setItem(n,JSON.stringify(r)),e.searchParams.set("state",t);const a=e.toString(),i=hl(a);return localStorage.setItem(this.getKey("last_auth_url"),i),i}async redirectToAuthorization(e){if(this.preventAutoAuth)return;const t=await this.prepareAuthorizationUrl(e),n="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const r=window.open(t,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(t,n,r),!r||r.closed||typeof r.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(r.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(r){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,r)}}getLastAttemptedAuthUrl(){const e=localStorage.getItem(this.getKey("last_auth_url"));return e?hl(e):null}clearStorage(){const e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[];let r=0;for(let i=0;i<localStorage.length;i++){const s=localStorage.key(i);if(s){if(s.startsWith(e))n.push(s);else if(s.startsWith(t))try{const o=localStorage.getItem(s);o&&JSON.parse(o).serverUrlHash===this.serverUrlHash&&n.push(s)}catch(o){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${s} during clearStorage:`,o)}}}return[...new Set(n)].forEach(i=>{localStorage.removeItem(i),r++}),r}hashString(e){let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return Math.abs(t).toString(16)}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}};const aG=Object.freeze({status:"aborted"});function Q(e,t,n){function r(o,l){var u;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(u=o._zod).traits??(u.traits=new Set),o._zod.traits.add(e),t(o,l);for(const d in s.prototype)d in o||Object.defineProperty(o,d,{value:s.prototype[d].bind(o)});o._zod.constr=s,o._zod.def=l}const a=(n==null?void 0:n.Parent)??Object;class i extends a{}Object.defineProperty(i,"name",{value:e});function s(o){var l;const u=n!=null&&n.Parent?new i:this;r(u,o),(l=u._zod).deferred??(l.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:o=>{var l,u;return n!=null&&n.Parent&&o instanceof n.Parent?!0:(u=(l=o==null?void 0:o._zod)==null?void 0:l.traits)==null?void 0:u.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class id extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const LO={};function bs(e){return LO}function iG(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,a])=>t.indexOf(+r)===-1).map(([r,a])=>a)}function sG(e,t){return typeof t=="bigint"?t.toString():t}function Jx(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ew(e){return e==null}function tw(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function oG(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r,i=Number.parseInt(e.toFixed(a).replace(".","")),s=Number.parseInt(t.toFixed(a).replace(".",""));return i%s/10**a}function Nt(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Am(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Kc(e){return JSON.stringify(e)}const UO=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function gp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const lG=Jx(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function yp(e){if(gp(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(gp(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const cG=new Set(["string","number","symbol"]);function zd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Po(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function pe(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function uG(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const dG={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function fG(e,t){const n={},r=e._zod.def;for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(n[a]=r.shape[a])}return Po(e,{...e._zod.def,shape:n,checks:[]})}function hG(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete n[a]}return Po(e,{...e._zod.def,shape:n,checks:[]})}function pG(e,t){if(!yp(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return Am(this,"shape",r),r},checks:[]};return Po(e,n)}function mG(e,t){return Po(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Am(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function gG(e,t,n){const r=t._zod.def.shape,a={...r};if(n)for(const i in n){if(!(i in r))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(a[i]=e?new e({type:"optional",innerType:r[i]}):r[i])}else for(const i in r)a[i]=e?new e({type:"optional",innerType:r[i]}):r[i];return Po(t,{...t._zod.def,shape:a,checks:[]})}function yG(e,t,n){const r=t._zod.def.shape,a={...r};if(n)for(const i in n){if(!(i in a))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(a[i]=new e({type:"nonoptional",innerType:r[i]}))}else for(const i in r)a[i]=new e({type:"nonoptional",innerType:r[i]});return Po(t,{...t._zod.def,shape:a,checks:[]})}function Ru(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Gs(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Rf(e){return typeof e=="string"?e:e==null?void 0:e.message}function xs(e,t,n){var a,i,s,o,l,u;const r={...e,path:e.path??[]};if(!e.message){const d=Rf((s=(i=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??Rf((o=t==null?void 0:t.error)==null?void 0:o.call(t,e))??Rf((l=n.customError)==null?void 0:l.call(n,e))??Rf((u=n.localeError)==null?void 0:u.call(n,e))??"Invalid input";r.message=d}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function nw(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function sd(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const FO=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,sG,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},qO=Q("$ZodError",FO),HO=Q("$ZodError",FO,{Parent:Error});function vG(e,t=n=>n.message){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function bG(e,t){const n=t||function(i){return i.message},r={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>a({issues:o}));else if(s.code==="invalid_key")a({issues:s.issues});else if(s.code==="invalid_element")a({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let o=r,l=0;for(;l<s.path.length;){const u=s.path[l];l===s.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(s))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return a(e),r}const xG=e=>(t,n,r,a)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new id;if(s.issues.length){const o=new((a==null?void 0:a.Err)??e)(s.issues.map(l=>xs(l,i,bs())));throw UO(o,a==null?void 0:a.callee),o}return s.value},wG=e=>async(t,n,r,a)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const o=new((a==null?void 0:a.Err)??e)(s.issues.map(l=>xs(l,i,bs())));throw UO(o,a==null?void 0:a.callee),o}return s.value},BO=e=>(t,n,r)=>{const a=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise)throw new id;return i.issues.length?{success:!1,error:new(e??qO)(i.issues.map(s=>xs(s,a,bs())))}:{success:!0,data:i.value}},VO=BO(HO),ZO=e=>async(t,n,r)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},a);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>xs(s,a,bs())))}:{success:!0,data:i.value}},SG=ZO(HO),_G=/^[cC][^\s-]{8,}$/,kG=/^[0-9a-z]+$/,EG=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,CG=/^[0-9a-vA-V]{20}$/,NG=/^[A-Za-z0-9]{27}$/,jG=/^[a-zA-Z0-9_-]{21}$/,TG=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,AG=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,cE=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,RG=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$G="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function OG(){return new RegExp($G,"u")}const MG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,PG=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,DG=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zG=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,IG=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,KO=/^[A-Za-z0-9_-]*$/,LG=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,UG=/^\+(?:[0-9]){6,14}[0-9]$/,GO="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",FG=new RegExp(`^${GO}$`);function QO(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function qG(e){return new RegExp(`^${QO(e)}$`)}function HG(e){const t=QO({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${GO}T(?:${r})$`)}const BG=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},VG=/^\d+$/,ZG=/^-?\d+(?:\.\d+)?/i,KG=/true|false/i,GG=/null/i,QG=/^[^A-Z]*$/,YG=/^[^a-z]*$/,ir=Q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),YO={number:"number",bigint:"bigint",object:"date"},XO=Q("$ZodCheckLessThan",(e,t)=>{ir.init(e,t);const n=YO[typeof t.value];e._zod.onattach.push(r=>{const a=r._zod.bag,i=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),WO=Q("$ZodCheckGreaterThan",(e,t)=>{ir.init(e,t);const n=YO[typeof t.value];e._zod.onattach.push(r=>{const a=r._zod.bag,i=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),XG=Q("$ZodCheckMultipleOf",(e,t)=>{ir.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):oG(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),WG=Q("$ZodCheckNumberFormat",(e,t)=>{var s;ir.init(e,t),t.format=t.format||"float64";const n=(s=t.format)==null?void 0:s.includes("int"),r=n?"int":"number",[a,i]=dG[t.format];e._zod.onattach.push(o=>{const l=o._zod.bag;l.format=t.format,l.minimum=a,l.maximum=i,n&&(l.pattern=VG)}),e._zod.check=o=>{const l=o.value;if(n){if(!Number.isInteger(l)){o.issues.push({expected:r,format:t.format,code:"invalid_type",input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?o.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):o.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}l<a&&o.issues.push({origin:"number",input:l,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),l>i&&o.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inst:e})}}),JG=Q("$ZodCheckMaxLength",(e,t)=>{var n;ir.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!ew(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const a=r.value;if(a.length<=t.maximum)return;const s=nw(a);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),eQ=Q("$ZodCheckMinLength",(e,t)=>{var n;ir.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!ew(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const a=r.value;if(a.length>=t.minimum)return;const s=nw(a);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),tQ=Q("$ZodCheckLengthEquals",(e,t)=>{var n;ir.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!ew(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=r=>{const a=r.value,i=a.length;if(i===t.length)return;const s=nw(a),o=i>t.length;r.issues.push({origin:s,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Rm=Q("$ZodCheckStringFormat",(e,t)=>{var n,r;ir.init(e,t),e._zod.onattach.push(a=>{const i=a._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),nQ=Q("$ZodCheckRegex",(e,t)=>{Rm.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),rQ=Q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=QG),Rm.init(e,t)}),aQ=Q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=YG),Rm.init(e,t)}),iQ=Q("$ZodCheckIncludes",(e,t)=>{ir.init(e,t);const n=zd(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(a=>{const i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),sQ=Q("$ZodCheckStartsWith",(e,t)=>{ir.init(e,t);const n=new RegExp(`^${zd(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),oQ=Q("$ZodCheckEndsWith",(e,t)=>{ir.init(e,t);const n=new RegExp(`.*${zd(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),lQ=Q("$ZodCheckOverwrite",(e,t)=>{ir.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class cQ{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
454
- `).filter(s=>s),a=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(a)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this==null?void 0:this.args,a=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,a.join(`
455
- `))}}const uQ={major:4,minor:0,patch:0},gt=Q("$ZodType",(e,t)=>{var a;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=uQ;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const s of i._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,o,l)=>{let u=Ru(s),d;for(const f of o){if(f._zod.def.when){if(!f._zod.def.when(s))continue}else if(u)continue;const p=s.issues.length,h=f._zod.check(s);if(h instanceof Promise&&(l==null?void 0:l.async)===!1)throw new id;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,s.issues.length!==p&&(u||(u=Ru(s,p)))});else{if(s.issues.length===p)continue;u||(u=Ru(s,p))}}return d?d.then(()=>s):s};e._zod.run=(s,o)=>{const l=e._zod.parse(s,o);if(l instanceof Promise){if(o.async===!1)throw new id;return l.then(u=>i(u,r,o))}return i(l,r,o)}}e["~standard"]={validate:i=>{var s;try{const o=VO(e,i);return o.success?{value:o.data}:{issues:(s=o.error)==null?void 0:s.issues}}catch{return SG(e,i).then(l=>{var u;return l.success?{value:l.data}:{issues:(u=l.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),rw=Q("$ZodString",(e,t)=>{var n;gt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??BG(e._zod.bag),e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),$t=Q("$ZodStringFormat",(e,t)=>{Rm.init(e,t),rw.init(e,t)}),dQ=Q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=AG),$t.init(e,t)}),fQ=Q("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=cE(r))}else t.pattern??(t.pattern=cE());$t.init(e,t)}),hQ=Q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=RG),$t.init(e,t)}),pQ=Q("$ZodURL",(e,t)=>{$t.init(e,t),e._zod.check=n=>{try{const r=n.value,a=new URL(r),i=a.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:LG.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&i.endsWith("/")?n.value=i.slice(0,-1):n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),mQ=Q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=OG()),$t.init(e,t)}),gQ=Q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=jG),$t.init(e,t)}),yQ=Q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_G),$t.init(e,t)}),vQ=Q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=kG),$t.init(e,t)}),bQ=Q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=EG),$t.init(e,t)}),xQ=Q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=CG),$t.init(e,t)}),wQ=Q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=NG),$t.init(e,t)}),SQ=Q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=HG(t)),$t.init(e,t)}),_Q=Q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=FG),$t.init(e,t)}),kQ=Q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=qG(t)),$t.init(e,t)}),EQ=Q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=TG),$t.init(e,t)}),CQ=Q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=MG),$t.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),NQ=Q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=PG),$t.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),jQ=Q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=DG),$t.init(e,t)}),TQ=Q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=zG),$t.init(e,t),e._zod.check=n=>{const[r,a]=n.value.split("/");try{if(!a)throw new Error;const i=Number(a);if(`${i}`!==a)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function JO(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const AQ=Q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=IG),$t.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{JO(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function RQ(e){if(!KO.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return JO(n)}const $Q=Q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=KO),$t.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{RQ(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),OQ=Q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=UG),$t.init(e,t)});function MQ(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const a=JSON.parse(atob(r));return!("typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}const PQ=Q("$ZodJWT",(e,t)=>{$t.init(e,t),e._zod.check=n=>{MQ(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),eM=Q("$ZodNumber",(e,t)=>{gt.init(e,t),e._zod.pattern=e._zod.bag.pattern??ZG,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const a=n.value;if(typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a))return n;const i=typeof a=="number"?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...i?{received:i}:{}}),n}}),DQ=Q("$ZodNumber",(e,t)=>{WG.init(e,t),eM.init(e,t)}),zQ=Q("$ZodBoolean",(e,t)=>{gt.init(e,t),e._zod.pattern=KG,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const a=n.value;return typeof a=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),n}}),IQ=Q("$ZodNull",(e,t)=>{gt.init(e,t),e._zod.pattern=GG,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const a=n.value;return a===null||n.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),n}}),LQ=Q("$ZodAny",(e,t)=>{gt.init(e,t),e._zod.parse=n=>n}),UQ=Q("$ZodUnknown",(e,t)=>{gt.init(e,t),e._zod.parse=n=>n}),FQ=Q("$ZodNever",(e,t)=>{gt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function uE(e,t,n){e.issues.length&&t.issues.push(...Gs(n,e.issues)),t.value[n]=e.value}const qQ=Q("$ZodArray",(e,t)=>{gt.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),n;n.value=Array(a.length);const i=[];for(let s=0;s<a.length;s++){const o=a[s],l=t.element._zod.run({value:o,issues:[]},r);l instanceof Promise?i.push(l.then(u=>uE(u,n,s))):uE(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function $f(e,t,n){e.issues.length&&t.issues.push(...Gs(n,e.issues)),t.value[n]=e.value}function dE(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...Gs(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const HQ=Q("$ZodObject",(e,t)=>{gt.init(e,t);const n=Jx(()=>{const f=Object.keys(t.shape);for(const h of f)if(!(t.shape[h]instanceof gt))throw new Error(`Invalid element at key "${h}": expected a Zod schema`);const p=uG(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(p)}});Nt(e._zod,"propValues",()=>{const f=t.shape,p={};for(const h in f){const y=f[h]._zod;if(y.values){p[h]??(p[h]=new Set);for(const m of y.values)p[h].add(m)}}return p});const r=f=>{const p=new cQ(["shape","payload","ctx"]),h=n.value,y=v=>{const w=Kc(v);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};p.write("const input = payload.value;");const m=Object.create(null);let b=0;for(const v of h.keys)m[v]=`key_${b++}`;p.write("const newResult = {}");for(const v of h.keys)if(h.optionalKeys.has(v)){const w=m[v];p.write(`const ${w} = ${y(v)};`);const S=Kc(v);p.write(`
456
- if (${w}.issues.length) {
457
- if (input[${S}] === undefined) {
458
- if (${S} in input) {
459
- newResult[${S}] = undefined;
460
- }
461
- } else {
462
- payload.issues = payload.issues.concat(
463
- ${w}.issues.map((iss) => ({
464
- ...iss,
465
- path: iss.path ? [${S}, ...iss.path] : [${S}],
466
- }))
467
- );
468
- }
469
- } else if (${w}.value === undefined) {
470
- if (${S} in input) newResult[${S}] = undefined;
471
- } else {
472
- newResult[${S}] = ${w}.value;
473
- }
474
- `)}else{const w=m[v];p.write(`const ${w} = ${y(v)};`),p.write(`
475
- if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
476
- ...iss,
477
- path: iss.path ? [${Kc(v)}, ...iss.path] : [${Kc(v)}]
478
- })));`),p.write(`newResult[${Kc(v)}] = ${w}.value`)}p.write("payload.value = newResult;"),p.write("return payload;");const g=p.compile();return(v,w)=>g(f,v,w)};let a;const i=gp,s=!LO.jitless,l=s&&lG.value,u=t.catchall;let d;e._zod.parse=(f,p)=>{d??(d=n.value);const h=f.value;if(!i(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;const y=[];if(s&&l&&(p==null?void 0:p.async)===!1&&p.jitless!==!0)a||(a=r(t.shape)),f=a(f,p);else{f.value={};const w=d.shape;for(const S of d.keys){const E=w[S],C=E._zod.run({value:h[S],issues:[]},p),T=E._zod.optin==="optional"&&E._zod.optout==="optional";C instanceof Promise?y.push(C.then(P=>T?dE(P,f,S,h):$f(P,f,S))):T?dE(C,f,S,h):$f(C,f,S)}}if(!u)return y.length?Promise.all(y).then(()=>f):f;const m=[],b=d.keySet,g=u._zod,v=g.def.type;for(const w of Object.keys(h)){if(b.has(w))continue;if(v==="never"){m.push(w);continue}const S=g.run({value:h[w],issues:[]},p);S instanceof Promise?y.push(S.then(E=>$f(E,f,w))):$f(S,f,w)}return m.length&&f.issues.push({code:"unrecognized_keys",keys:m,input:h,inst:e}),y.length?Promise.all(y).then(()=>f):f}});function fE(e,t,n,r){for(const a of e)if(a.issues.length===0)return t.value=a.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(a=>a.issues.map(i=>xs(i,r,bs())))}),t}const tM=Q("$ZodUnion",(e,t)=>{gt.init(e,t),Nt(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Nt(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Nt(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Nt(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>tw(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let a=!1;const i=[];for(const s of t.options){const o=s._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)i.push(o),a=!0;else{if(o.issues.length===0)return o;i.push(o)}}return a?Promise.all(i).then(s=>fE(s,n,e,r)):fE(i,n,e,r)}}),BQ=Q("$ZodDiscriminatedUnion",(e,t)=>{tM.init(e,t);const n=e._zod.parse;Nt(e._zod,"propValues",()=>{const a={};for(const i of t.options){const s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[o,l]of Object.entries(s)){a[o]||(a[o]=new Set);for(const u of l)a[o].add(u)}}return a});const r=Jx(()=>{const a=t.options,i=new Map;for(const s of a){const o=s._zod.propValues[t.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const l of o){if(i.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(a,i)=>{const s=a.value;if(!gp(s))return a.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),a;const o=r.value.get(s==null?void 0:s[t.discriminator]);return o?o._zod.run(a,i):t.unionFallback?n(a,i):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),a)}}),VQ=Q("$ZodIntersection",(e,t)=>{gt.init(e,t),e._zod.parse=(n,r)=>{const a=n.value,i=t.left._zod.run({value:a,issues:[]},r),s=t.right._zod.run({value:a,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,u])=>hE(n,l,u)):hE(n,i,s)}});function f0(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(yp(e)&&yp(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),a={...e,...t};for(const i of r){const s=f0(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};a[i]=s.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const a=e[r],i=t[r],s=f0(a,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function hE(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Ru(e))return e;const r=f0(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const ZQ=Q("$ZodRecord",(e,t)=>{gt.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!yp(a))return n.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),n;const i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const u=t.valueType._zod.run({value:a[l],issues:[]},r);u instanceof Promise?i.push(u.then(d=>{d.issues.length&&n.issues.push(...Gs(l,d.issues)),n.value[l]=d.value})):(u.issues.length&&n.issues.push(...Gs(l,u.issues)),n.value[l]=u.value)}let o;for(const l in a)s.has(l)||(o=o??[],o.push(l));o&&o.length>0&&n.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:o})}else{n.value={};for(const s of Reflect.ownKeys(a)){if(s==="__proto__")continue;const o=t.keyType._zod.run({value:s,issues:[]},r);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:o.issues.map(u=>xs(u,r,bs())),input:s,path:[s],inst:e}),n.value[o.value]=o.value;continue}const l=t.valueType._zod.run({value:a[s],issues:[]},r);l instanceof Promise?i.push(l.then(u=>{u.issues.length&&n.issues.push(...Gs(s,u.issues)),n.value[o.value]=u.value})):(l.issues.length&&n.issues.push(...Gs(s,l.issues)),n.value[o.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),KQ=Q("$ZodEnum",(e,t)=>{gt.init(e,t);const n=iG(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>cG.has(typeof r)).map(r=>typeof r=="string"?zd(r):r.toString()).join("|")})$`),e._zod.parse=(r,a)=>{const i=r.value;return e._zod.values.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:e}),r}}),GQ=Q("$ZodLiteral",(e,t)=>{gt.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?zd(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const a=n.value;return e._zod.values.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}}),QQ=Q("$ZodTransform",(e,t)=>{gt.init(e,t),e._zod.parse=(n,r)=>{const a=t.transform(n.value,n);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then(s=>(n.value=s,n));if(a instanceof Promise)throw new id;return n.value=a,n}}),YQ=Q("$ZodOptional",(e,t)=>{gt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Nt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Nt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${tw(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),XQ=Q("$ZodNullable",(e,t)=>{gt.init(e,t),Nt(e._zod,"optin",()=>t.innerType._zod.optin),Nt(e._zod,"optout",()=>t.innerType._zod.optout),Nt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${tw(n.source)}|null)$`):void 0}),Nt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),WQ=Q("$ZodDefault",(e,t)=>{gt.init(e,t),e._zod.optin="optional",Nt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(i=>pE(i,t)):pE(a,t)}});function pE(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const JQ=Q("$ZodPrefault",(e,t)=>{gt.init(e,t),e._zod.optin="optional",Nt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),eY=Q("$ZodNonOptional",(e,t)=>{gt.init(e,t),Nt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(i=>mE(i,e)):mE(a,e)}});function mE(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const tY=Q("$ZodCatch",(e,t)=>{gt.init(e,t),e._zod.optin="optional",Nt(e._zod,"optout",()=>t.innerType._zod.optout),Nt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>xs(s,r,bs()))},input:n.value}),n.issues=[]),n)):(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(i=>xs(i,r,bs()))},input:n.value}),n.issues=[]),n)}}),nY=Q("$ZodPipe",(e,t)=>{gt.init(e,t),Nt(e._zod,"values",()=>t.in._zod.values),Nt(e._zod,"optin",()=>t.in._zod.optin),Nt(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const a=t.in._zod.run(n,r);return a instanceof Promise?a.then(i=>gE(i,t,r)):gE(a,t,r)}});function gE(e,t,n){return Ru(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const rY=Q("$ZodReadonly",(e,t)=>{gt.init(e,t),Nt(e._zod,"propValues",()=>t.innerType._zod.propValues),Nt(e._zod,"values",()=>t.innerType._zod.values),Nt(e._zod,"optin",()=>t.innerType._zod.optin),Nt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(yE):yE(a)}});function yE(e){return e.value=Object.freeze(e.value),e}const aY=Q("$ZodCustom",(e,t)=>{ir.init(e,t),gt.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,a=t.fn(r);if(a instanceof Promise)return a.then(i=>vE(i,n,r,e));vE(a,n,r,e)}});function vE(e,t,n,r){if(!e){const a={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(a.params=r._zod.def.params),t.issues.push(sd(a))}}class iY{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function sY(){return new iY}const Of=sY();function oY(e,t){return new e({type:"string",...pe(t)})}function lY(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...pe(t)})}function bE(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...pe(t)})}function cY(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...pe(t)})}function uY(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...pe(t)})}function dY(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...pe(t)})}function fY(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...pe(t)})}function nM(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...pe(t)})}function hY(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...pe(t)})}function pY(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...pe(t)})}function mY(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...pe(t)})}function gY(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...pe(t)})}function yY(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...pe(t)})}function vY(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...pe(t)})}function bY(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...pe(t)})}function xY(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...pe(t)})}function wY(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...pe(t)})}function SY(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...pe(t)})}function _Y(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...pe(t)})}function kY(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...pe(t)})}function EY(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...pe(t)})}function CY(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...pe(t)})}function NY(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...pe(t)})}function jY(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...pe(t)})}function TY(e,t){return new e({type:"string",format:"date",check:"string_format",...pe(t)})}function AY(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...pe(t)})}function RY(e,t){return new e({type:"string",format:"duration",check:"string_format",...pe(t)})}function $Y(e,t){return new e({type:"number",checks:[],...pe(t)})}function OY(e,t){return new e({type:"number",coerce:!0,checks:[],...pe(t)})}function MY(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...pe(t)})}function PY(e,t){return new e({type:"boolean",...pe(t)})}function DY(e,t){return new e({type:"null",...pe(t)})}function zY(e){return new e({type:"any"})}function IY(e){return new e({type:"unknown"})}function LY(e,t){return new e({type:"never",...pe(t)})}function xE(e,t){return new XO({check:"less_than",...pe(t),value:e,inclusive:!1})}function cy(e,t){return new XO({check:"less_than",...pe(t),value:e,inclusive:!0})}function wE(e,t){return new WO({check:"greater_than",...pe(t),value:e,inclusive:!1})}function uy(e,t){return new WO({check:"greater_than",...pe(t),value:e,inclusive:!0})}function SE(e,t){return new XG({check:"multiple_of",...pe(t),value:e})}function rM(e,t){return new JG({check:"max_length",...pe(t),maximum:e})}function vp(e,t){return new eQ({check:"min_length",...pe(t),minimum:e})}function aM(e,t){return new tQ({check:"length_equals",...pe(t),length:e})}function UY(e,t){return new nQ({check:"string_format",format:"regex",...pe(t),pattern:e})}function FY(e){return new rQ({check:"string_format",format:"lowercase",...pe(e)})}function qY(e){return new aQ({check:"string_format",format:"uppercase",...pe(e)})}function HY(e,t){return new iQ({check:"string_format",format:"includes",...pe(t),includes:e})}function BY(e,t){return new sQ({check:"string_format",format:"starts_with",...pe(t),prefix:e})}function VY(e,t){return new oQ({check:"string_format",format:"ends_with",...pe(t),suffix:e})}function Id(e){return new lQ({check:"overwrite",tx:e})}function ZY(e){return Id(t=>t.normalize(e))}function KY(){return Id(e=>e.trim())}function GY(){return Id(e=>e.toLowerCase())}function QY(){return Id(e=>e.toUpperCase())}function YY(e,t,n){return new e({type:"array",element:t,...pe(n)})}function XY(e,t,n){const r=pe(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function WY(e,t,n){return new e({type:"custom",check:"custom",fn:t,...pe(n)})}const JY=Q("ZodISODateTime",(e,t)=>{SQ.init(e,t),It.init(e,t)});function iM(e){return jY(JY,e)}const eX=Q("ZodISODate",(e,t)=>{_Q.init(e,t),It.init(e,t)});function tX(e){return TY(eX,e)}const nX=Q("ZodISOTime",(e,t)=>{kQ.init(e,t),It.init(e,t)});function rX(e){return AY(nX,e)}const aX=Q("ZodISODuration",(e,t)=>{EQ.init(e,t),It.init(e,t)});function iX(e){return RY(aX,e)}const sX=(e,t)=>{qO.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>bG(e,n)},flatten:{value:n=>vG(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},$m=Q("ZodError",sX,{Parent:Error}),oX=xG($m),lX=wG($m),cX=BO($m),uX=ZO($m),Ot=Q("ZodType",(e,t)=>(gt.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>Po(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>oX(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>cX(e,n,r),e.parseAsync=async(n,r)=>lX(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>uX(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(rW(n,r)),e.superRefine=n=>e.check(aW(n)),e.overwrite=n=>e.check(Id(n)),e.optional=()=>Dt(e),e.nullable=()=>EE(e),e.nullish=()=>Dt(EE(e)),e.nonoptional=n=>QX(e,n),e.array=()=>se(e),e.or=n=>Mt([e,n]),e.and=n=>iw(e,n),e.transform=n=>p0(e,dM(n)),e.default=n=>ZX(e,n),e.prefault=n=>GX(e,n),e.catch=n=>XX(e,n),e.pipe=n=>p0(e,n),e.readonly=()=>eW(e),e.describe=n=>{const r=e.clone();return Of.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Of.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Of.get(e);const r=e.clone();return Of.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),sM=Q("_ZodString",(e,t)=>{rw.init(e,t),Ot.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(UY(...r)),e.includes=(...r)=>e.check(HY(...r)),e.startsWith=(...r)=>e.check(BY(...r)),e.endsWith=(...r)=>e.check(VY(...r)),e.min=(...r)=>e.check(vp(...r)),e.max=(...r)=>e.check(rM(...r)),e.length=(...r)=>e.check(aM(...r)),e.nonempty=(...r)=>e.check(vp(1,...r)),e.lowercase=r=>e.check(FY(r)),e.uppercase=r=>e.check(qY(r)),e.trim=()=>e.check(KY()),e.normalize=(...r)=>e.check(ZY(...r)),e.toLowerCase=()=>e.check(GY()),e.toUpperCase=()=>e.check(QY())}),dX=Q("ZodString",(e,t)=>{rw.init(e,t),sM.init(e,t),e.email=n=>e.check(lY(fX,n)),e.url=n=>e.check(nM(oM,n)),e.jwt=n=>e.check(NY(jX,n)),e.emoji=n=>e.check(hY(pX,n)),e.guid=n=>e.check(bE(_E,n)),e.uuid=n=>e.check(cY(Mf,n)),e.uuidv4=n=>e.check(uY(Mf,n)),e.uuidv6=n=>e.check(dY(Mf,n)),e.uuidv7=n=>e.check(fY(Mf,n)),e.nanoid=n=>e.check(pY(mX,n)),e.guid=n=>e.check(bE(_E,n)),e.cuid=n=>e.check(mY(gX,n)),e.cuid2=n=>e.check(gY(yX,n)),e.ulid=n=>e.check(yY(vX,n)),e.base64=n=>e.check(kY(EX,n)),e.base64url=n=>e.check(EY(CX,n)),e.xid=n=>e.check(vY(bX,n)),e.ksuid=n=>e.check(bY(xX,n)),e.ipv4=n=>e.check(xY(wX,n)),e.ipv6=n=>e.check(wY(SX,n)),e.cidrv4=n=>e.check(SY(_X,n)),e.cidrv6=n=>e.check(_Y(kX,n)),e.e164=n=>e.check(CY(NX,n)),e.datetime=n=>e.check(iM(n)),e.date=n=>e.check(tX(n)),e.time=n=>e.check(rX(n)),e.duration=n=>e.check(iX(n))});function q(e){return oY(dX,e)}const It=Q("ZodStringFormat",(e,t)=>{$t.init(e,t),sM.init(e,t)}),fX=Q("ZodEmail",(e,t)=>{hQ.init(e,t),It.init(e,t)}),_E=Q("ZodGUID",(e,t)=>{dQ.init(e,t),It.init(e,t)}),Mf=Q("ZodUUID",(e,t)=>{fQ.init(e,t),It.init(e,t)}),oM=Q("ZodURL",(e,t)=>{pQ.init(e,t),It.init(e,t)});function hX(e){return nM(oM,e)}const pX=Q("ZodEmoji",(e,t)=>{mQ.init(e,t),It.init(e,t)}),mX=Q("ZodNanoID",(e,t)=>{gQ.init(e,t),It.init(e,t)}),gX=Q("ZodCUID",(e,t)=>{yQ.init(e,t),It.init(e,t)}),yX=Q("ZodCUID2",(e,t)=>{vQ.init(e,t),It.init(e,t)}),vX=Q("ZodULID",(e,t)=>{bQ.init(e,t),It.init(e,t)}),bX=Q("ZodXID",(e,t)=>{xQ.init(e,t),It.init(e,t)}),xX=Q("ZodKSUID",(e,t)=>{wQ.init(e,t),It.init(e,t)}),wX=Q("ZodIPv4",(e,t)=>{CQ.init(e,t),It.init(e,t)}),SX=Q("ZodIPv6",(e,t)=>{NQ.init(e,t),It.init(e,t)}),_X=Q("ZodCIDRv4",(e,t)=>{jQ.init(e,t),It.init(e,t)}),kX=Q("ZodCIDRv6",(e,t)=>{TQ.init(e,t),It.init(e,t)}),EX=Q("ZodBase64",(e,t)=>{AQ.init(e,t),It.init(e,t)}),CX=Q("ZodBase64URL",(e,t)=>{$Q.init(e,t),It.init(e,t)}),NX=Q("ZodE164",(e,t)=>{OQ.init(e,t),It.init(e,t)}),jX=Q("ZodJWT",(e,t)=>{PQ.init(e,t),It.init(e,t)}),aw=Q("ZodNumber",(e,t)=>{eM.init(e,t),Ot.init(e,t),e.gt=(r,a)=>e.check(wE(r,a)),e.gte=(r,a)=>e.check(uy(r,a)),e.min=(r,a)=>e.check(uy(r,a)),e.lt=(r,a)=>e.check(xE(r,a)),e.lte=(r,a)=>e.check(cy(r,a)),e.max=(r,a)=>e.check(cy(r,a)),e.int=r=>e.check(kE(r)),e.safe=r=>e.check(kE(r)),e.positive=r=>e.check(wE(0,r)),e.nonnegative=r=>e.check(uy(0,r)),e.negative=r=>e.check(xE(0,r)),e.nonpositive=r=>e.check(cy(0,r)),e.multipleOf=(r,a)=>e.check(SE(r,a)),e.step=(r,a)=>e.check(SE(r,a)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function nt(e){return $Y(aw,e)}const TX=Q("ZodNumberFormat",(e,t)=>{DQ.init(e,t),aw.init(e,t)});function kE(e){return MY(TX,e)}const AX=Q("ZodBoolean",(e,t)=>{zQ.init(e,t),Ot.init(e,t)});function Et(e){return PY(AX,e)}const RX=Q("ZodNull",(e,t)=>{IQ.init(e,t),Ot.init(e,t)});function $X(e){return DY(RX,e)}const OX=Q("ZodAny",(e,t)=>{LQ.init(e,t),Ot.init(e,t)});function MX(){return zY(OX)}const PX=Q("ZodUnknown",(e,t)=>{UQ.init(e,t),Ot.init(e,t)});function zt(){return IY(PX)}const DX=Q("ZodNever",(e,t)=>{FQ.init(e,t),Ot.init(e,t)});function zX(e){return LY(DX,e)}const IX=Q("ZodArray",(e,t)=>{qQ.init(e,t),Ot.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(vp(n,r)),e.nonempty=n=>e.check(vp(1,n)),e.max=(n,r)=>e.check(rM(n,r)),e.length=(n,r)=>e.check(aM(n,r)),e.unwrap=()=>e.element});function se(e,t){return YY(IX,e,t)}const lM=Q("ZodObject",(e,t)=>{HQ.init(e,t),Ot.init(e,t),Nt(e,"shape",()=>t.shape),e.keyof=()=>Sr(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:zt()}),e.loose=()=>e.clone({...e._zod.def,catchall:zt()}),e.strict=()=>e.clone({...e._zod.def,catchall:zX()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>pG(e,n),e.merge=n=>mG(e,n),e.pick=n=>fG(e,n),e.omit=n=>hG(e,n),e.partial=(...n)=>gG(fM,e,n[0]),e.required=(...n)=>yG(hM,e,n[0])});function le(e,t){const n={type:"object",get shape(){return Am(this,"shape",{...e}),this.shape},...pe(t)};return new lM(n)}function wn(e,t){return new lM({type:"object",get shape(){return Am(this,"shape",{...e}),this.shape},catchall:zt(),...pe(t)})}const cM=Q("ZodUnion",(e,t)=>{tM.init(e,t),Ot.init(e,t),e.options=t.options});function Mt(e,t){return new cM({type:"union",options:e,...pe(t)})}const LX=Q("ZodDiscriminatedUnion",(e,t)=>{cM.init(e,t),BQ.init(e,t)});function uM(e,t,n){return new LX({type:"union",options:t,discriminator:e,...pe(n)})}const UX=Q("ZodIntersection",(e,t)=>{VQ.init(e,t),Ot.init(e,t)});function iw(e,t){return new UX({type:"intersection",left:e,right:t})}const FX=Q("ZodRecord",(e,t)=>{ZQ.init(e,t),Ot.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function jt(e,t,n){return new FX({type:"record",keyType:e,valueType:t,...pe(n)})}const h0=Q("ZodEnum",(e,t)=>{KQ.init(e,t),Ot.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,a)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new h0({...t,checks:[],...pe(a),entries:i})},e.exclude=(r,a)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new h0({...t,checks:[],...pe(a),entries:i})}});function Sr(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new h0({type:"enum",entries:n,...pe(t)})}const qX=Q("ZodLiteral",(e,t)=>{GQ.init(e,t),Ot.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ye(e,t){return new qX({type:"literal",values:Array.isArray(e)?e:[e],...pe(t)})}const HX=Q("ZodTransform",(e,t)=>{QQ.init(e,t),Ot.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(sd(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),s.continue??(s.continue=!0),n.issues.push(sd(s))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then(i=>(n.value=i,n)):(n.value=a,n)}});function dM(e){return new HX({type:"transform",transform:e})}const fM=Q("ZodOptional",(e,t)=>{YQ.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Dt(e){return new fM({type:"optional",innerType:e})}const BX=Q("ZodNullable",(e,t)=>{XQ.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function EE(e){return new BX({type:"nullable",innerType:e})}const VX=Q("ZodDefault",(e,t)=>{WQ.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ZX(e,t){return new VX({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const KX=Q("ZodPrefault",(e,t)=>{JQ.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function GX(e,t){return new KX({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const hM=Q("ZodNonOptional",(e,t)=>{eY.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function QX(e,t){return new hM({type:"nonoptional",innerType:e,...pe(t)})}const YX=Q("ZodCatch",(e,t)=>{tY.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function XX(e,t){return new YX({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const WX=Q("ZodPipe",(e,t)=>{nY.init(e,t),Ot.init(e,t),e.in=t.in,e.out=t.out});function p0(e,t){return new WX({type:"pipe",in:e,out:t})}const JX=Q("ZodReadonly",(e,t)=>{rY.init(e,t),Ot.init(e,t)});function eW(e){return new JX({type:"readonly",innerType:e})}const pM=Q("ZodCustom",(e,t)=>{aY.init(e,t),Ot.init(e,t)});function tW(e){const t=new ir({check:"custom"});return t._zod.check=e,t}function nW(e,t){return XY(pM,e??(()=>!0),t)}function rW(e,t={}){return WY(pM,e,t)}function aW(e){const t=tW(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(sd(r,n.value,t._zod.def));else{const a=r;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=t),a.continue??(a.continue=!t._zod.def.abort),n.issues.push(sd(a))}},e(n.value,n)));return t}function mM(e,t){return p0(dM(e),t)}const iW={custom:"custom"};function sW(e){return OY(aw,e)}const Om="2025-11-25",oW=[Om,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Us="io.modelcontextprotocol/related-task",Mm="2.0",tn=nW(e=>e!==null&&(typeof e=="object"||typeof e=="function")),gM=Mt([q(),nt().int()]),yM=q();wn({ttl:nt().optional(),pollInterval:nt().optional()});const lW=le({ttl:nt().optional()}),cW=le({taskId:q()}),sw=wn({progressToken:gM.optional(),[Us]:cW.optional()}),_r=le({_meta:sw.optional()}),Ld=_r.extend({task:lW.optional()}),uW=e=>Ld.safeParse(e).success,kn=le({method:q(),params:_r.loose().optional()}),Hr=le({_meta:sw.optional()}),Br=le({method:q(),params:Hr.loose().optional()}),En=wn({_meta:sw.optional()}),Pm=Mt([q(),nt().int()]),vM=le({jsonrpc:ye(Mm),id:Pm,...kn.shape}).strict(),m0=e=>vM.safeParse(e).success,bM=le({jsonrpc:ye(Mm),...Br.shape}).strict(),dW=e=>bM.safeParse(e).success,ow=le({jsonrpc:ye(Mm),id:Pm,result:En}).strict(),iu=e=>ow.safeParse(e).success;var Ae;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Ae||(Ae={}));const lw=le({jsonrpc:ye(Mm),id:Pm.optional(),error:le({code:nt().int(),message:q(),data:zt().optional()})}).strict(),fW=e=>lw.safeParse(e).success,fh=Mt([vM,bM,ow,lw]);Mt([ow,lw]);const pl=En.strict(),hW=Hr.extend({requestId:Pm.optional(),reason:q().optional()}),cw=Br.extend({method:ye("notifications/cancelled"),params:hW}),pW=le({src:q(),mimeType:q().optional(),sizes:se(q()).optional(),theme:Sr(["light","dark"]).optional()}),Ud=le({icons:se(pW).optional()}),lc=le({name:q(),title:q().optional()}),xM=lc.extend({...lc.shape,...Ud.shape,version:q(),websiteUrl:q().optional(),description:q().optional()}),mW=iw(le({applyDefaults:Et().optional()}),jt(q(),zt())),gW=mM(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,iw(le({form:mW.optional(),url:tn.optional()}),jt(q(),zt()).optional())),yW=wn({list:tn.optional(),cancel:tn.optional(),requests:wn({sampling:wn({createMessage:tn.optional()}).optional(),elicitation:wn({create:tn.optional()}).optional()}).optional()}),vW=wn({list:tn.optional(),cancel:tn.optional(),requests:wn({tools:wn({call:tn.optional()}).optional()}).optional()}),bW=le({experimental:jt(q(),tn).optional(),sampling:le({context:tn.optional(),tools:tn.optional()}).optional(),elicitation:gW.optional(),roots:le({listChanged:Et().optional()}).optional(),tasks:yW.optional(),extensions:jt(q(),tn).optional()}),xW=_r.extend({protocolVersion:q(),capabilities:bW,clientInfo:xM}),wW=kn.extend({method:ye("initialize"),params:xW}),SW=le({experimental:jt(q(),tn).optional(),logging:tn.optional(),completions:tn.optional(),prompts:le({listChanged:Et().optional()}).optional(),resources:le({subscribe:Et().optional(),listChanged:Et().optional()}).optional(),tools:le({listChanged:Et().optional()}).optional(),tasks:vW.optional(),extensions:jt(q(),tn).optional()}),wM=En.extend({protocolVersion:q(),capabilities:SW,serverInfo:xM,instructions:q().optional()}),SM=Br.extend({method:ye("notifications/initialized"),params:Hr.optional()}),_W=e=>SM.safeParse(e).success,uw=kn.extend({method:ye("ping"),params:_r.optional()}),kW=le({progress:nt(),total:Dt(nt()),message:Dt(q())}),EW=le({...Hr.shape,...kW.shape,progressToken:gM}),dw=Br.extend({method:ye("notifications/progress"),params:EW}),CW=_r.extend({cursor:yM.optional()}),Fd=kn.extend({params:CW.optional()}),qd=En.extend({nextCursor:yM.optional()}),NW=Sr(["working","input_required","completed","failed","cancelled"]),Hd=le({taskId:q(),status:NW,ttl:Mt([nt(),$X()]),createdAt:q(),lastUpdatedAt:q(),pollInterval:Dt(nt()),statusMessage:Dt(q())}),od=En.extend({task:Hd}),jW=Hr.merge(Hd),bp=Br.extend({method:ye("notifications/tasks/status"),params:jW}),fw=kn.extend({method:ye("tasks/get"),params:_r.extend({taskId:q()})}),hw=En.merge(Hd),pw=kn.extend({method:ye("tasks/result"),params:_r.extend({taskId:q()})});En.loose();const mw=Fd.extend({method:ye("tasks/list")}),gw=qd.extend({tasks:se(Hd)}),yw=kn.extend({method:ye("tasks/cancel"),params:_r.extend({taskId:q()})}),TW=En.merge(Hd),_M=le({uri:q(),mimeType:Dt(q()),_meta:jt(q(),zt()).optional()}),kM=_M.extend({text:q()}),vw=q().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),EM=_M.extend({blob:vw}),Bd=Sr(["user","assistant"]),Ac=le({audience:se(Bd).optional(),priority:nt().min(0).max(1).optional(),lastModified:iM({offset:!0}).optional()}),CM=le({...lc.shape,...Ud.shape,uri:q(),description:Dt(q()),mimeType:Dt(q()),size:Dt(nt()),annotations:Ac.optional(),_meta:Dt(wn({}))}),AW=le({...lc.shape,...Ud.shape,uriTemplate:q(),description:Dt(q()),mimeType:Dt(q()),annotations:Ac.optional(),_meta:Dt(wn({}))}),RW=Fd.extend({method:ye("resources/list")}),xp=qd.extend({resources:se(CM)}),$W=Fd.extend({method:ye("resources/templates/list")}),NM=qd.extend({resourceTemplates:se(AW)}),bw=_r.extend({uri:q()}),OW=bw,MW=kn.extend({method:ye("resources/read"),params:OW}),xw=En.extend({contents:se(Mt([kM,EM]))}),jM=Br.extend({method:ye("notifications/resources/list_changed"),params:Hr.optional()}),PW=bw,DW=kn.extend({method:ye("resources/subscribe"),params:PW}),zW=bw,IW=kn.extend({method:ye("resources/unsubscribe"),params:zW}),LW=Hr.extend({uri:q()}),UW=Br.extend({method:ye("notifications/resources/updated"),params:LW}),FW=le({name:q(),description:Dt(q()),required:Dt(Et())}),qW=le({...lc.shape,...Ud.shape,description:Dt(q()),arguments:Dt(se(FW)),_meta:Dt(wn({}))}),HW=Fd.extend({method:ye("prompts/list")}),wp=qd.extend({prompts:se(qW)}),BW=_r.extend({name:q(),arguments:jt(q(),q()).optional()}),VW=kn.extend({method:ye("prompts/get"),params:BW}),ww=le({type:ye("text"),text:q(),annotations:Ac.optional(),_meta:jt(q(),zt()).optional()}),Sw=le({type:ye("image"),data:vw,mimeType:q(),annotations:Ac.optional(),_meta:jt(q(),zt()).optional()}),_w=le({type:ye("audio"),data:vw,mimeType:q(),annotations:Ac.optional(),_meta:jt(q(),zt()).optional()}),ZW=le({type:ye("tool_use"),name:q(),id:q(),input:jt(q(),zt()),_meta:jt(q(),zt()).optional()}),KW=le({type:ye("resource"),resource:Mt([kM,EM]),annotations:Ac.optional(),_meta:jt(q(),zt()).optional()}),GW=CM.extend({type:ye("resource_link")}),kw=Mt([ww,Sw,_w,GW,KW]),QW=le({role:Bd,content:kw}),Ew=En.extend({description:q().optional(),messages:se(QW)}),TM=Br.extend({method:ye("notifications/prompts/list_changed"),params:Hr.optional()}),YW=le({title:q().optional(),readOnlyHint:Et().optional(),destructiveHint:Et().optional(),idempotentHint:Et().optional(),openWorldHint:Et().optional()}),XW=le({taskSupport:Sr(["required","optional","forbidden"]).optional()}),AM=le({...lc.shape,...Ud.shape,description:q().optional(),inputSchema:le({type:ye("object"),properties:jt(q(),tn).optional(),required:se(q()).optional()}).catchall(zt()),outputSchema:le({type:ye("object"),properties:jt(q(),tn).optional(),required:se(q()).optional()}).catchall(zt()).optional(),annotations:YW.optional(),execution:XW.optional(),_meta:jt(q(),zt()).optional()}),WW=Fd.extend({method:ye("tools/list")}),Cw=qd.extend({tools:se(AM)}),Vd=En.extend({content:se(kw).default([]),structuredContent:jt(q(),zt()).optional(),isError:Et().optional()});Vd.or(En.extend({toolResult:zt()}));const JW=Ld.extend({name:q(),arguments:jt(q(),zt()).optional()}),eJ=kn.extend({method:ye("tools/call"),params:JW}),RM=Br.extend({method:ye("notifications/tools/list_changed"),params:Hr.optional()}),tJ=le({autoRefresh:Et().default(!0),debounceMs:nt().int().nonnegative().default(300)}),$M=Sr(["debug","info","notice","warning","error","critical","alert","emergency"]),nJ=_r.extend({level:$M}),rJ=kn.extend({method:ye("logging/setLevel"),params:nJ}),aJ=Hr.extend({level:$M,logger:q().optional(),data:zt()}),iJ=Br.extend({method:ye("notifications/message"),params:aJ}),sJ=le({name:q().optional()}),oJ=le({hints:se(sJ).optional(),costPriority:nt().min(0).max(1).optional(),speedPriority:nt().min(0).max(1).optional(),intelligencePriority:nt().min(0).max(1).optional()}),lJ=le({mode:Sr(["auto","required","none"]).optional()}),cJ=le({type:ye("tool_result"),toolUseId:q().describe("The unique identifier for the corresponding tool call."),content:se(kw).default([]),structuredContent:le({}).loose().optional(),isError:Et().optional(),_meta:jt(q(),zt()).optional()}),uJ=uM("type",[ww,Sw,_w]),Sp=uM("type",[ww,Sw,_w,ZW,cJ]),dJ=le({role:Bd,content:Mt([Sp,se(Sp)]),_meta:jt(q(),zt()).optional()}),fJ=Ld.extend({messages:se(dJ),modelPreferences:oJ.optional(),systemPrompt:q().optional(),includeContext:Sr(["none","thisServer","allServers"]).optional(),temperature:nt().optional(),maxTokens:nt().int(),stopSequences:se(q()).optional(),metadata:tn.optional(),tools:se(AM).optional(),toolChoice:lJ.optional()}),OM=kn.extend({method:ye("sampling/createMessage"),params:fJ}),MM=En.extend({model:q(),stopReason:Dt(Sr(["endTurn","stopSequence","maxTokens"]).or(q())),role:Bd,content:uJ}),PM=En.extend({model:q(),stopReason:Dt(Sr(["endTurn","stopSequence","maxTokens","toolUse"]).or(q())),role:Bd,content:Mt([Sp,se(Sp)])}),hJ=le({type:ye("boolean"),title:q().optional(),description:q().optional(),default:Et().optional()}),pJ=le({type:ye("string"),title:q().optional(),description:q().optional(),minLength:nt().optional(),maxLength:nt().optional(),format:Sr(["email","uri","date","date-time"]).optional(),default:q().optional()}),mJ=le({type:Sr(["number","integer"]),title:q().optional(),description:q().optional(),minimum:nt().optional(),maximum:nt().optional(),default:nt().optional()}),gJ=le({type:ye("string"),title:q().optional(),description:q().optional(),enum:se(q()),default:q().optional()}),yJ=le({type:ye("string"),title:q().optional(),description:q().optional(),oneOf:se(le({const:q(),title:q()})),default:q().optional()}),vJ=le({type:ye("string"),title:q().optional(),description:q().optional(),enum:se(q()),enumNames:se(q()).optional(),default:q().optional()}),bJ=Mt([gJ,yJ]),xJ=le({type:ye("array"),title:q().optional(),description:q().optional(),minItems:nt().optional(),maxItems:nt().optional(),items:le({type:ye("string"),enum:se(q())}),default:se(q()).optional()}),wJ=le({type:ye("array"),title:q().optional(),description:q().optional(),minItems:nt().optional(),maxItems:nt().optional(),items:le({anyOf:se(le({const:q(),title:q()}))}),default:se(q()).optional()}),SJ=Mt([xJ,wJ]),_J=Mt([vJ,bJ,SJ]),kJ=Mt([_J,hJ,pJ,mJ]),EJ=Ld.extend({mode:ye("form").optional(),message:q(),requestedSchema:le({type:ye("object"),properties:jt(q(),kJ),required:se(q()).optional()})}),CJ=Ld.extend({mode:ye("url"),message:q(),elicitationId:q(),url:q().url()}),NJ=Mt([EJ,CJ]),DM=kn.extend({method:ye("elicitation/create"),params:NJ}),jJ=Hr.extend({elicitationId:q()}),TJ=Br.extend({method:ye("notifications/elicitation/complete"),params:jJ}),zM=En.extend({action:Sr(["accept","decline","cancel"]),content:mM(e=>e===null?void 0:e,jt(q(),Mt([q(),nt(),Et(),se(q())])).optional())}),AJ=le({type:ye("ref/resource"),uri:q()}),RJ=le({type:ye("ref/prompt"),name:q()}),$J=_r.extend({ref:Mt([RJ,AJ]),argument:le({name:q(),value:q()}),context:le({arguments:jt(q(),q()).optional()}).optional()}),OJ=kn.extend({method:ye("completion/complete"),params:$J}),IM=En.extend({completion:wn({values:se(q()).max(100),total:Dt(nt().int()),hasMore:Dt(Et())})}),MJ=le({uri:q().startsWith("file://"),name:q().optional(),_meta:jt(q(),zt()).optional()}),PJ=kn.extend({method:ye("roots/list"),params:_r.optional()}),DJ=En.extend({roots:se(MJ)}),zJ=Br.extend({method:ye("notifications/roots/list_changed"),params:Hr.optional()});Mt([uw,wW,OJ,rJ,VW,HW,RW,$W,MW,DW,IW,eJ,WW,fw,pw,mw,yw]);Mt([cw,dw,SM,zJ,bp]);Mt([pl,MM,PM,zM,DJ,hw,gw,od]);Mt([uw,OM,DM,PJ,fw,pw,mw,yw]);Mt([cw,dw,iJ,UW,jM,RM,TM,bp,TJ]);Mt([pl,wM,IM,Ew,wp,xp,NM,xw,Vd,Cw,hw,gw,od]);class ke extends Error{constructor(t,n,r){super(`MCP error ${t}: ${n}`),this.code=t,this.data=r,this.name="McpError"}static fromError(t,n,r){if(t===Ae.UrlElicitationRequired&&r){const a=r;if(a.elicitations)return new IJ(a.elicitations,n)}return new ke(t,n,r)}}class IJ extends ke{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super(Ae.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}}class CE extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}function dy(e){}function LM(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=dy,onError:n=dy,onRetry:r=dy,onComment:a}=e;let i="",s=!0,o,l="",u="";function d(m){const b=s?m.replace(/^\xEF\xBB\xBF/,""):m,[g,v]=LJ(`${i}${b}`);for(const w of g)f(w);i=v,s=!1}function f(m){if(m===""){h();return}if(m.startsWith(":")){a&&a(m.slice(m.startsWith(": ")?2:1));return}const b=m.indexOf(":");if(b!==-1){const g=m.slice(0,b),v=m[b+1]===" "?2:1,w=m.slice(b+v);p(g,w,m);return}p(m,"",m)}function p(m,b,g){switch(m){case"event":u=b;break;case"data":l=`${l}${b}
479
- `;break;case"id":o=b.includes("\0")?void 0:b;break;case"retry":/^\d+$/.test(b)?r(parseInt(b,10)):n(new CE(`Invalid \`retry\` value: "${b}"`,{type:"invalid-retry",value:b,line:g}));break;default:n(new CE(`Unknown field "${m.length>20?`${m.slice(0,20)}…`:m}"`,{type:"unknown-field",field:m,value:b,line:g}));break}}function h(){l.length>0&&t({id:o,event:u||void 0,data:l.endsWith(`
480
- `)?l.slice(0,-1):l}),o=void 0,l="",u=""}function y(m={}){i&&m.consume&&f(i),s=!0,o=void 0,l="",u="",i=""}return{feed:d,reset:y}}function LJ(e){const t=[];let n="",r=0;for(;r<e.length;){const a=e.indexOf("\r",r),i=e.indexOf(`
481
- `,r);let s=-1;if(a!==-1&&i!==-1?s=Math.min(a,i):a!==-1?a===e.length-1?s=-1:s=a:i!==-1&&(s=i),s===-1){n=e.slice(r);break}else{const o=e.slice(r,s);t.push(o),r=s+1,e[r-1]==="\r"&&e[r]===`
482
- `&&r++}}return[t,n]}class NE extends Event{constructor(t,n){var r,a;super(t),this.code=(r=n==null?void 0:n.code)!=null?r:void 0,this.message=(a=n==null?void 0:n.message)!=null?a:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(jE(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(jE(this),n)}}function UJ(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function g0(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(g0).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${g0(e.cause)}`:e.message:`${e}`}function jE(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var UM=e=>{throw TypeError(e)},Nw=(e,t,n)=>t.has(e)||UM("Cannot "+n),He=(e,t,n)=>(Nw(e,t,"read from private field"),n?n.call(e):t.get(e)),Xt=(e,t,n)=>t.has(e)?UM("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Rt=(e,t,n,r)=>(Nw(e,t,"write to private field"),t.set(e,n),n),qa=(e,t,n)=>(Nw(e,t,"access private method"),n),Jn,Hs,Xo,hh,_p,$u,ml,Ou,Li,Wo,jl,Jo,su,Qr,y0,v0,b0,TE,x0,w0,ou,S0,_0;class ph extends EventTarget{constructor(t,n){var r,a;super(),Xt(this,Qr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Xt(this,Jn),Xt(this,Hs),Xt(this,Xo),Xt(this,hh),Xt(this,_p),Xt(this,$u),Xt(this,ml),Xt(this,Ou,null),Xt(this,Li),Xt(this,Wo),Xt(this,jl,null),Xt(this,Jo,null),Xt(this,su,null),Xt(this,v0,async i=>{var s;He(this,Wo).reset();const{body:o,redirected:l,status:u,headers:d}=i;if(u===204){qa(this,Qr,ou).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?Rt(this,Xo,new URL(i.url)):Rt(this,Xo,void 0),u!==200){qa(this,Qr,ou).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){qa(this,Qr,ou).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(He(this,Jn)===this.CLOSED)return;Rt(this,Jn,this.OPEN);const f=new Event("open");if((s=He(this,su))==null||s.call(this,f),this.dispatchEvent(f),typeof o!="object"||!o||!("getReader"in o)){qa(this,Qr,ou).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const p=new TextDecoder,h=o.getReader();let y=!0;do{const{done:m,value:b}=await h.read();b&&He(this,Wo).feed(p.decode(b,{stream:!m})),m&&(y=!1,He(this,Wo).reset(),qa(this,Qr,S0).call(this))}while(y)}),Xt(this,b0,i=>{Rt(this,Li,void 0),!(i.name==="AbortError"||i.type==="aborted")&&qa(this,Qr,S0).call(this,g0(i))}),Xt(this,x0,i=>{typeof i.id=="string"&&Rt(this,Ou,i.id);const s=new MessageEvent(i.event||"message",{data:i.data,origin:He(this,Xo)?He(this,Xo).origin:He(this,Hs).origin,lastEventId:i.id||""});He(this,Jo)&&(!i.event||i.event==="message")&&He(this,Jo).call(this,s),this.dispatchEvent(s)}),Xt(this,w0,i=>{Rt(this,$u,i)}),Xt(this,_0,()=>{Rt(this,ml,void 0),He(this,Jn)===this.CONNECTING&&qa(this,Qr,y0).call(this)});try{if(t instanceof URL)Rt(this,Hs,t);else if(typeof t=="string")Rt(this,Hs,new URL(t,FJ()));else throw new Error("Invalid URL")}catch{throw UJ("An invalid or illegal string was specified")}Rt(this,Wo,LM({onEvent:He(this,x0),onRetry:He(this,w0)})),Rt(this,Jn,this.CONNECTING),Rt(this,$u,3e3),Rt(this,_p,(r=n==null?void 0:n.fetch)!=null?r:globalThis.fetch),Rt(this,hh,(a=n==null?void 0:n.withCredentials)!=null?a:!1),qa(this,Qr,y0).call(this)}get readyState(){return He(this,Jn)}get url(){return He(this,Hs).href}get withCredentials(){return He(this,hh)}get onerror(){return He(this,jl)}set onerror(t){Rt(this,jl,t)}get onmessage(){return He(this,Jo)}set onmessage(t){Rt(this,Jo,t)}get onopen(){return He(this,su)}set onopen(t){Rt(this,su,t)}addEventListener(t,n,r){const a=n;super.addEventListener(t,a,r)}removeEventListener(t,n,r){const a=n;super.removeEventListener(t,a,r)}close(){He(this,ml)&&clearTimeout(He(this,ml)),He(this,Jn)!==this.CLOSED&&(He(this,Li)&&He(this,Li).abort(),Rt(this,Jn,this.CLOSED),Rt(this,Li,void 0))}}Jn=new WeakMap,Hs=new WeakMap,Xo=new WeakMap,hh=new WeakMap,_p=new WeakMap,$u=new WeakMap,ml=new WeakMap,Ou=new WeakMap,Li=new WeakMap,Wo=new WeakMap,jl=new WeakMap,Jo=new WeakMap,su=new WeakMap,Qr=new WeakSet,y0=function(){Rt(this,Jn,this.CONNECTING),Rt(this,Li,new AbortController),He(this,_p)(He(this,Hs),qa(this,Qr,TE).call(this)).then(He(this,v0)).catch(He(this,b0))},v0=new WeakMap,b0=new WeakMap,TE=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...He(this,Ou)?{"Last-Event-ID":He(this,Ou)}:void 0},cache:"no-store",signal:(e=He(this,Li))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},x0=new WeakMap,w0=new WeakMap,ou=function(e,t){var n;He(this,Jn)!==this.CLOSED&&Rt(this,Jn,this.CLOSED);const r=new NE("error",{code:t,message:e});(n=He(this,jl))==null||n.call(this,r),this.dispatchEvent(r)},S0=function(e,t){var n;if(He(this,Jn)===this.CLOSED)return;Rt(this,Jn,this.CONNECTING);const r=new NE("error",{code:t,message:e});(n=He(this,jl))==null||n.call(this,r),this.dispatchEvent(r),Rt(this,ml,setTimeout(He(this,_0),He(this,$u)))},_0=new WeakMap,ph.CONNECTING=0,ph.OPEN=1,ph.CLOSED=2;function FJ(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}function kp(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function FM(e=fetch,t){return t?async(n,r)=>{const a={...t,...r,headers:r!=null&&r.headers?{...kp(t.headers),...kp(r.headers)}:t.headers};return e(n,a)}:e}let jw;jw=globalThis.crypto;async function qJ(e){return(await jw).getRandomValues(new Uint8Array(e))}async function HJ(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let n="";const r=await qJ(e);for(let a=0;a<e;a++){const i=r[a]%t.length;n+=t[i]}return n}async function BJ(e){return await HJ(e)}async function VJ(e){const t=await(await jw).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function ZJ(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await BJ(e),n=await VJ(t);return{code_verifier:t,code_challenge:n}}const gn=hX().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:iW.custom,message:"URL must be parseable",fatal:!0}),aG}).refine(e=>{const t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),KJ=wn({resource:q().url(),authorization_servers:se(gn).optional(),jwks_uri:q().url().optional(),scopes_supported:se(q()).optional(),bearer_methods_supported:se(q()).optional(),resource_signing_alg_values_supported:se(q()).optional(),resource_name:q().optional(),resource_documentation:q().optional(),resource_policy_uri:q().url().optional(),resource_tos_uri:q().url().optional(),tls_client_certificate_bound_access_tokens:Et().optional(),authorization_details_types_supported:se(q()).optional(),dpop_signing_alg_values_supported:se(q()).optional(),dpop_bound_access_tokens_required:Et().optional()}),qM=wn({issuer:q(),authorization_endpoint:gn,token_endpoint:gn,registration_endpoint:gn.optional(),scopes_supported:se(q()).optional(),response_types_supported:se(q()),response_modes_supported:se(q()).optional(),grant_types_supported:se(q()).optional(),token_endpoint_auth_methods_supported:se(q()).optional(),token_endpoint_auth_signing_alg_values_supported:se(q()).optional(),service_documentation:gn.optional(),revocation_endpoint:gn.optional(),revocation_endpoint_auth_methods_supported:se(q()).optional(),revocation_endpoint_auth_signing_alg_values_supported:se(q()).optional(),introspection_endpoint:q().optional(),introspection_endpoint_auth_methods_supported:se(q()).optional(),introspection_endpoint_auth_signing_alg_values_supported:se(q()).optional(),code_challenge_methods_supported:se(q()).optional(),client_id_metadata_document_supported:Et().optional()}),GJ=wn({issuer:q(),authorization_endpoint:gn,token_endpoint:gn,userinfo_endpoint:gn.optional(),jwks_uri:gn,registration_endpoint:gn.optional(),scopes_supported:se(q()).optional(),response_types_supported:se(q()),response_modes_supported:se(q()).optional(),grant_types_supported:se(q()).optional(),acr_values_supported:se(q()).optional(),subject_types_supported:se(q()),id_token_signing_alg_values_supported:se(q()),id_token_encryption_alg_values_supported:se(q()).optional(),id_token_encryption_enc_values_supported:se(q()).optional(),userinfo_signing_alg_values_supported:se(q()).optional(),userinfo_encryption_alg_values_supported:se(q()).optional(),userinfo_encryption_enc_values_supported:se(q()).optional(),request_object_signing_alg_values_supported:se(q()).optional(),request_object_encryption_alg_values_supported:se(q()).optional(),request_object_encryption_enc_values_supported:se(q()).optional(),token_endpoint_auth_methods_supported:se(q()).optional(),token_endpoint_auth_signing_alg_values_supported:se(q()).optional(),display_values_supported:se(q()).optional(),claim_types_supported:se(q()).optional(),claims_supported:se(q()).optional(),service_documentation:q().optional(),claims_locales_supported:se(q()).optional(),ui_locales_supported:se(q()).optional(),claims_parameter_supported:Et().optional(),request_parameter_supported:Et().optional(),request_uri_parameter_supported:Et().optional(),require_request_uri_registration:Et().optional(),op_policy_uri:gn.optional(),op_tos_uri:gn.optional(),client_id_metadata_document_supported:Et().optional()}),QJ=le({...GJ.shape,...qM.pick({code_challenge_methods_supported:!0}).shape}),YJ=le({access_token:q(),id_token:q().optional(),token_type:q(),expires_in:sW().optional(),scope:q().optional(),refresh_token:q().optional()}).strip(),XJ=le({error:q(),error_description:q().optional(),error_uri:q().optional()}),AE=gn.optional().or(ye("").transform(()=>{})),WJ=le({redirect_uris:se(gn),token_endpoint_auth_method:q().optional(),grant_types:se(q()).optional(),response_types:se(q()).optional(),client_name:q().optional(),client_uri:gn.optional(),logo_uri:AE,scope:q().optional(),contacts:se(q()).optional(),tos_uri:AE,policy_uri:q().optional(),jwks_uri:gn.optional(),jwks:MX().optional(),software_id:q().optional(),software_version:q().optional(),software_statement:q().optional()}).strip(),JJ=le({client_id:q(),client_secret:q().optional(),client_id_issued_at:nt().optional(),client_secret_expires_at:nt().optional()}).strip(),eee=WJ.merge(JJ);le({error:q(),error_description:q().optional()}).strip();le({token:q(),token_type_hint:q().optional()}).strip();function tee(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function nee({requestedResource:e,configuredResource:t}){const n=typeof e=="string"?new URL(e):new URL(e.href),r=typeof t=="string"?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;const a=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return a.startsWith(i)}class dn extends Error{constructor(t,n){super(t),this.errorUri=n,this.name=this.constructor.name}toResponseObject(){const t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}}class k0 extends dn{}k0.errorCode="invalid_request";class Ep extends dn{}Ep.errorCode="invalid_client";class Cp extends dn{}Cp.errorCode="invalid_grant";class Np extends dn{}Np.errorCode="unauthorized_client";class E0 extends dn{}E0.errorCode="unsupported_grant_type";class C0 extends dn{}C0.errorCode="invalid_scope";class N0 extends dn{}N0.errorCode="access_denied";class cc extends dn{}cc.errorCode="server_error";class j0 extends dn{}j0.errorCode="temporarily_unavailable";class T0 extends dn{}T0.errorCode="unsupported_response_type";class A0 extends dn{}A0.errorCode="unsupported_token_type";class R0 extends dn{}R0.errorCode="invalid_token";class $0 extends dn{}$0.errorCode="method_not_allowed";class O0 extends dn{}O0.errorCode="too_many_requests";class jp extends dn{}jp.errorCode="invalid_client_metadata";class M0 extends dn{}M0.errorCode="insufficient_scope";class P0 extends dn{}P0.errorCode="invalid_target";const ree={[k0.errorCode]:k0,[Ep.errorCode]:Ep,[Cp.errorCode]:Cp,[Np.errorCode]:Np,[E0.errorCode]:E0,[C0.errorCode]:C0,[N0.errorCode]:N0,[cc.errorCode]:cc,[j0.errorCode]:j0,[T0.errorCode]:T0,[A0.errorCode]:A0,[R0.errorCode]:R0,[$0.errorCode]:$0,[O0.errorCode]:O0,[jp.errorCode]:jp,[M0.errorCode]:M0,[P0.errorCode]:P0};class dr extends Error{constructor(t){super(t??"Unauthorized")}}function aee(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const fy="code",hy="S256";function iee(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&aee(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?"client_secret_basic":"none":n&&t.includes("client_secret_basic")?"client_secret_basic":n&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":n?"client_secret_post":"none"}function see(e,t,n,r){const{client_id:a,client_secret:i}=t;switch(e){case"client_secret_basic":oee(a,i,n);return;case"client_secret_post":lee(a,i,r);return;case"none":cee(a,r);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function oee(e,t,n){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const r=btoa(`${e}:${t}`);n.set("Authorization",`Basic ${r}`)}function lee(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function cee(e,t){t.set("client_id",e)}async function HM(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const r=XJ.parse(JSON.parse(n)),{error:a,error_description:i,error_uri:s}=r,o=ree[a]||cc;return new o(i||"",s)}catch(r){const a=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${r}. Raw body: ${n}`;return new cc(a)}}async function ta(e,t){var n,r;try{return await py(e,t)}catch(a){if(a instanceof Ep||a instanceof Np)return await((n=e.invalidateCredentials)==null?void 0:n.call(e,"all")),await py(e,t);if(a instanceof Cp)return await((r=e.invalidateCredentials)==null?void 0:r.call(e,"tokens")),await py(e,t);throw a}}async function py(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:a,fetchFn:i}){var w,S,E,C,T;const s=await((w=e.discoveryState)==null?void 0:w.call(e));let o,l,u,d=a;if(!d&&(s!=null&&s.resourceMetadataUrl)&&(d=new URL(s.resourceMetadataUrl)),s!=null&&s.authorizationServerUrl){if(l=s.authorizationServerUrl,o=s.resourceMetadata,u=s.authorizationServerMetadata??await VM(l,{fetchFn:i}),!o)try{o=await BM(t,{resourceMetadataUrl:d},i)}catch{}(u!==s.authorizationServerMetadata||o!==s.resourceMetadata)&&await((S=e.saveDiscoveryState)==null?void 0:S.call(e,{authorizationServerUrl:String(l),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:o,authorizationServerMetadata:u}))}else{const P=await gee(t,{resourceMetadataUrl:d,fetchFn:i});l=P.authorizationServerUrl,u=P.authorizationServerMetadata,o=P.resourceMetadata,await((E=e.saveDiscoveryState)==null?void 0:E.call(e,{authorizationServerUrl:String(l),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:o,authorizationServerMetadata:u}))}const f=await dee(t,e,o),p=r||((C=o==null?void 0:o.scopes_supported)==null?void 0:C.join(" "))||e.clientMetadata.scope;let h=await Promise.resolve(e.clientInformation());if(!h){if(n!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const P=(u==null?void 0:u.client_id_metadata_document_supported)===!0,R=e.clientMetadataUrl;if(R&&!uee(R))throw new jp(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${R}`);if(P&&R)h={client_id:R},await((T=e.saveClientInformation)==null?void 0:T.call(e,h));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const j=await wee(l,{metadata:u,clientMetadata:e.clientMetadata,scope:p,fetchFn:i});await e.saveClientInformation(j),h=j}}const y=!e.redirectUrl;if(n!==void 0||y){const P=await xee(e,l,{metadata:u,resource:f,authorizationCode:n,fetchFn:i});return await e.saveTokens(P),"AUTHORIZED"}const m=await e.tokens();if(m!=null&&m.refresh_token)try{const P=await bee(l,{metadata:u,clientInformation:h,refreshToken:m.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(P),"AUTHORIZED"}catch(P){if(!(!(P instanceof dn)||P instanceof cc))throw P}const b=e.state?await e.state():void 0,{authorizationUrl:g,codeVerifier:v}=await yee(l,{metadata:u,clientInformation:h,state:b,redirectUrl:e.redirectUrl,scope:p,resource:f});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(g),"REDIRECT"}function uee(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function dee(e,t,n){const r=tee(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n==null?void 0:n.resource);if(n){if(!nee({requestedResource:r,configuredResource:n.resource}))throw new Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function Tp(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,r]=t.split(" ");if(n.toLowerCase()!=="bearer"||!r)return{};const a=my(e,"resource_metadata")||void 0;let i;if(a)try{i=new URL(a)}catch{}const s=my(e,"scope")||void 0,o=my(e,"error")||void 0;return{resourceMetadataUrl:i,scope:s,error:o}}function my(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const r=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),a=n.match(r);return a?a[1]||a[2]:null}async function BM(e,t,n=fetch){var a,i;const r=await pee(e,"oauth-protected-resource",n,{protocolVersion:t==null?void 0:t.protocolVersion,metadataUrl:t==null?void 0:t.resourceMetadataUrl});if(!r||r.status===404)throw await((a=r==null?void 0:r.body)==null?void 0:a.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!r.ok)throw await((i=r.body)==null?void 0:i.cancel()),new Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return KJ.parse(await r.json())}async function Tw(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?Tw(e,void 0,n):void 0;throw r}}function fee(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function RE(e,t,n=fetch){return await Tw(e,{"MCP-Protocol-Version":t},n)}function hee(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function pee(e,t,n,r){const a=new URL(e),i=(r==null?void 0:r.protocolVersion)??Om;let s;if(r!=null&&r.metadataUrl)s=new URL(r.metadataUrl);else{const l=fee(t,a.pathname);s=new URL(l,(r==null?void 0:r.metadataServerUrl)??a),s.search=a.search}let o=await RE(s,i,n);if(!(r!=null&&r.metadataUrl)&&hee(o,a.pathname)){const l=new URL(`/.well-known/${t}`,a);o=await RE(l,i,n)}return o}function mee(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",r=[];if(!n)return r.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),r.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),r;let a=t.pathname;return a.endsWith("/")&&(a=a.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${a}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${a}`,t.origin),type:"oidc"}),r.push({url:new URL(`${a}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function VM(e,{fetchFn:t=fetch,protocolVersion:n=Om}={}){var i;const r={"MCP-Protocol-Version":n,Accept:"application/json"},a=mee(e);for(const{url:s,type:o}of a){const l=await Tw(s,r,t);if(l){if(!l.ok){if(await((i=l.body)==null?void 0:i.cancel()),l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${o==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return o==="oauth"?qM.parse(await l.json()):QJ.parse(await l.json())}}}async function gee(e,t){let n,r;try{n=await BM(e,{resourceMetadataUrl:t==null?void 0:t.resourceMetadataUrl},t==null?void 0:t.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||(r=String(new URL("/",e)));const a=await VM(r,{fetchFn:t==null?void 0:t.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:a,resourceMetadata:n}}async function yee(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:a,state:i,resource:s}){let o;if(t){if(o=new URL(t.authorization_endpoint),!t.response_types_supported.includes(fy))throw new Error(`Incompatible auth server: does not support response type ${fy}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(hy))throw new Error(`Incompatible auth server: does not support code challenge method ${hy}`)}else o=new URL("/authorize",e);const l=await ZJ(),u=l.code_verifier,d=l.code_challenge;return o.searchParams.set("response_type",fy),o.searchParams.set("client_id",n.client_id),o.searchParams.set("code_challenge",d),o.searchParams.set("code_challenge_method",hy),o.searchParams.set("redirect_uri",String(r)),i&&o.searchParams.set("state",i),a&&o.searchParams.set("scope",a),a!=null&&a.includes("offline_access")&&o.searchParams.append("prompt","consent"),s&&o.searchParams.set("resource",s.href),{authorizationUrl:o,codeVerifier:u}}function vee(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function ZM(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:a,resource:i,fetchFn:s}){const o=t!=null&&t.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),l=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i&&n.set("resource",i.href),a)await a(l,n,o,t);else if(r){const d=(t==null?void 0:t.token_endpoint_auth_methods_supported)??[],f=iee(r,d);see(f,r,l,n)}const u=await(s??fetch)(o,{method:"POST",headers:l,body:n});if(!u.ok)throw await HM(u);return YJ.parse(await u.json())}async function bee(e,{metadata:t,clientInformation:n,refreshToken:r,resource:a,addClientAuthentication:i,fetchFn:s}){const o=new URLSearchParams({grant_type:"refresh_token",refresh_token:r}),l=await ZM(e,{metadata:t,tokenRequestParams:o,clientInformation:n,addClientAuthentication:i,resource:a,fetchFn:s});return{refresh_token:r,...l}}async function xee(e,t,{metadata:n,resource:r,authorizationCode:a,fetchFn:i}={}){const s=e.clientMetadata.scope;let o;if(e.prepareTokenRequest&&(o=await e.prepareTokenRequest(s)),!o){if(!a)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const u=await e.codeVerifier();o=vee(a,u,e.redirectUrl)}const l=await e.clientInformation();return ZM(t,{metadata:n,tokenRequestParams:o,clientInformation:l??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:i})}async function wee(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:a}){let i;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(t.registration_endpoint)}else i=new URL("/register",e);const s=await(a??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...r!==void 0?{scope:r}:{}})});if(!s.ok)throw await HM(s);return eee.parse(await s.json())}class See extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class _ee{constructor(t,n){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=n==null?void 0:n.eventSourceInit,this._requestInit=n==null?void 0:n.requestInit,this._authProvider=n==null?void 0:n.authProvider,this._fetch=n==null?void 0:n.fetch,this._fetchWithInit=FM(n==null?void 0:n.fetch,n==null?void 0:n.requestInit)}async _authThenStart(){var n;if(!this._authProvider)throw new dr("No auth provider");let t;try{t=await ta(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw(n=this.onerror)==null||n.call(this,r),r}if(t!=="AUTHORIZED")throw new dr;return await this._startOrAuth()}async _commonHeaders(){var r;const t={};if(this._authProvider){const a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=kp((r=this._requestInit)==null?void 0:r.headers);return new Headers({...t,...n})}_startOrAuth(){var n;const t=((n=this==null?void 0:this._eventSourceInit)==null?void 0:n.fetch)??this._fetch??fetch;return new Promise((r,a)=>{this._eventSource=new ph(this._url.href,{...this._eventSourceInit,fetch:async(i,s)=>{const o=await this._commonHeaders();o.set("Accept","text/event-stream");const l=await t(i,{...s,headers:o});if(l.status===401&&l.headers.has("www-authenticate")){const{resourceMetadataUrl:u,scope:d}=Tp(l);this._resourceMetadataUrl=u,this._scope=d}return l}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{var o;if(i.code===401&&this._authProvider){this._authThenStart().then(r,a);return}const s=new See(i.code,i.message,i);a(s),(o=this.onerror)==null||o.call(this,s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",i=>{var o;const s=i;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(l){a(l),(o=this.onerror)==null||o.call(this,l),this.close();return}r()}),this._eventSource.onmessage=i=>{var l,u;const s=i;let o;try{o=fh.parse(JSON.parse(s.data))}catch(d){(l=this.onerror)==null||l.call(this,d);return}(u=this.onmessage)==null||u.call(this,o)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(t){if(!this._authProvider)throw new dr("No auth provider");if(await ta(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new dr("Failed to authorize")}async close(){var t,n,r;(t=this._abortController)==null||t.abort(),(n=this._eventSource)==null||n.close(),(r=this.onclose)==null||r.call(this)}async send(t){var n,r,a;if(!this._endpoint)throw new Error("Not connected");try{const i=await this._commonHeaders();i.set("content-type","application/json");const s={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(t),signal:(n=this._abortController)==null?void 0:n.signal},o=await(this._fetch??fetch)(this._endpoint,s);if(!o.ok){const l=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){const{resourceMetadataUrl:u,scope:d}=Tp(o);if(this._resourceMetadataUrl=u,this._scope=d,await ta(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new dr;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${l}`)}await((r=o.body)==null?void 0:r.cancel())}catch(i){throw(a=this.onerror)==null||a.call(this,i),i}}setProtocolVersion(t){this._protocolVersion=t}}class kee extends TransformStream{constructor({onError:t,onRetry:n,onComment:r}={}){let a;super({start(i){a=LM({onEvent:s=>{i.enqueue(s)},onError(s){t==="terminate"?i.error(s):typeof t=="function"&&t(s)},onRetry:n,onComment:r})},transform(i){a.feed(i)}})}}const Eee={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class qo extends Error{constructor(t,n){super(`Streamable HTTP error: ${n}`),this.code=t}}class Cee{constructor(t,n){this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=n==null?void 0:n.requestInit,this._authProvider=n==null?void 0:n.authProvider,this._fetch=n==null?void 0:n.fetch,this._fetchWithInit=FM(n==null?void 0:n.fetch,n==null?void 0:n.requestInit),this._sessionId=n==null?void 0:n.sessionId,this._reconnectionOptions=(n==null?void 0:n.reconnectionOptions)??Eee}async _authThenStart(){var n;if(!this._authProvider)throw new dr("No auth provider");let t;try{t=await ta(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw(n=this.onerror)==null||n.call(this,r),r}if(t!=="AUTHORIZED")throw new dr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var r;const t={};if(this._authProvider){const a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=kp((r=this._requestInit)==null?void 0:r.headers);return new Headers({...t,...n})}async _startOrAuthSse(t){var r,a,i;const{resumptionToken:n}=t;try{const s=await this._commonHeaders();s.set("Accept","text/event-stream"),n&&s.set("last-event-id",n);const o=await(this._fetch??fetch)(this._url,{method:"GET",headers:s,signal:(r=this._abortController)==null?void 0:r.signal});if(!o.ok){if(await((a=o.body)==null?void 0:a.cancel()),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new qo(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,t,!0)}catch(s){throw(i=this.onerror)==null||i.call(this,s),s}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const n=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,a=this._reconnectionOptions.maxReconnectionDelay;return Math.min(n*Math.pow(r,t),a)}_scheduleReconnection(t,n=0){var i;const r=this._reconnectionOptions.maxRetries;if(n>=r){(i=this.onerror)==null||i.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}const a=this._getNextReconnectionDelay(n);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(s=>{var o;(o=this.onerror)==null||o.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(t,n+1)})},a)}_handleSseStream(t,n,r){if(!t)return;const{onresumptiontoken:a,replayMessageId:i}=n;let s,o=!1,l=!1;(async()=>{var d,f,p,h;try{const y=t.pipeThrough(new TextDecoderStream).pipeThrough(new kee({onRetry:g=>{this._serverRetryMs=g}})).getReader();for(;;){const{value:g,done:v}=await y.read();if(v)break;if(g.id&&(s=g.id,o=!0,a==null||a(g.id)),!!g.data&&(!g.event||g.event==="message"))try{const w=fh.parse(JSON.parse(g.data));iu(w)&&(l=!0,i!==void 0&&(w.id=i)),(d=this.onmessage)==null||d.call(this,w)}catch(w){(f=this.onerror)==null||f.call(this,w)}}(r||o)&&!l&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:a,replayMessageId:i},0)}catch(y){if((p=this.onerror)==null||p.call(this,new Error(`SSE stream disconnected: ${y}`)),(r||o)&&!l&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:a,replayMessageId:i},0)}catch(g){(h=this.onerror)==null||h.call(this,new Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(t){if(!this._authProvider)throw new dr("No auth provider");if(await ta(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new dr("Failed to authorize")}async close(){var t,n;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(t=this._abortController)==null||t.abort(),(n=this.onclose)==null||n.call(this)}async send(t,n){var r,a,i,s,o,l;try{const{resumptionToken:u,onresumptiontoken:d}=n||{};if(u){this._startOrAuthSse({resumptionToken:u,replayMessageId:m0(t)?t.id:void 0}).catch(v=>{var w;return(w=this.onerror)==null?void 0:w.call(this,v)});return}const f=await this._commonHeaders();f.set("content-type","application/json"),f.set("accept","application/json, text/event-stream");const p={...this._requestInit,method:"POST",headers:f,body:JSON.stringify(t),signal:(r=this._abortController)==null?void 0:r.signal},h=await(this._fetch??fetch)(this._url,p),y=h.headers.get("mcp-session-id");if(y&&(this._sessionId=y),!h.ok){const v=await h.text().catch(()=>null);if(h.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new qo(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:w,scope:S}=Tp(h);if(this._resourceMetadataUrl=w,this._scope=S,await ta(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new dr;return this._hasCompletedAuthFlow=!0,this.send(t)}if(h.status===403&&this._authProvider){const{resourceMetadataUrl:w,scope:S,error:E}=Tp(h);if(E==="insufficient_scope"){const C=h.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===C)throw new qo(403,"Server returned 403 after trying upscoping");if(S&&(this._scope=S),w&&(this._resourceMetadataUrl=w),this._lastUpscopingHeader=C??void 0,await ta(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new dr;return this.send(t)}}throw new qo(h.status,`Error POSTing to endpoint: ${v}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,h.status===202){await((a=h.body)==null?void 0:a.cancel()),_W(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var w;return(w=this.onerror)==null?void 0:w.call(this,v)});return}const b=(Array.isArray(t)?t:[t]).filter(v=>"method"in v&&"id"in v&&v.id!==void 0).length>0,g=h.headers.get("content-type");if(b)if(g!=null&&g.includes("text/event-stream"))this._handleSseStream(h.body,{onresumptiontoken:d},!1);else if(g!=null&&g.includes("application/json")){const v=await h.json(),w=Array.isArray(v)?v.map(S=>fh.parse(S)):[fh.parse(v)];for(const S of w)(i=this.onmessage)==null||i.call(this,S)}else throw await((s=h.body)==null?void 0:s.cancel()),new qo(-1,`Unexpected content type: ${g}`);else await((o=h.body)==null?void 0:o.cancel())}catch(u){throw(l=this.onerror)==null||l.call(this,u),u}}get sessionId(){return this._sessionId}async terminateSession(){var t,n,r;if(this._sessionId)try{const a=await this._commonHeaders(),i={...this._requestInit,method:"DELETE",headers:a,signal:(t=this._abortController)==null?void 0:t.signal},s=await(this._fetch??fetch)(this._url,i);if(await((n=s.body)==null?void 0:n.cancel()),!s.ok&&s.status!==405)throw new qo(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(a){throw(r=this.onerror)==null||r.call(this,a),a}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,n){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:n==null?void 0:n.onresumptiontoken})}}function Dm(e){return!!e._zod}function Mi(e,t){return Dm(e)?VO(e,t):e.safeParse(t)}function KM(e){var n,r;if(!e)return;let t;if(Dm(e)?t=(r=(n=e._zod)==null?void 0:n.def)==null?void 0:r.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Nee(e){var a;if(Dm(e)){const s=(a=e._zod)==null?void 0:a.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}const n=e._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const r=e.value;if(r!==void 0)return r}function Os(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function $E(e){const t=KM(e),n=t==null?void 0:t.method;if(!n)throw new Error("Schema is missing a method literal");const r=Nee(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function OE(e,t){const n=Mi(e,t);if(!n.success)throw n.error;return n.data}const jee=6e4;class Tee{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(cw,n=>{this._oncancel(n)}),this.setNotificationHandler(dw,n=>{this._onprogress(n)}),this.setRequestHandler(uw,n=>({})),this._taskStore=t==null?void 0:t.taskStore,this._taskMessageQueue=t==null?void 0:t.taskMessageQueue,this._taskStore&&(this.setRequestHandler(fw,async(n,r)=>{const a=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!a)throw new ke(Ae.InvalidParams,"Failed to retrieve task: Task not found");return{...a}}),this.setRequestHandler(pw,async(n,r)=>{const a=async()=>{var o;const i=n.params.taskId;if(this._taskMessageQueue){let l;for(;l=await this._taskMessageQueue.dequeue(i,r.sessionId);){if(l.type==="response"||l.type==="error"){const u=l.message,d=u.id,f=this._requestResolvers.get(d);if(f)if(this._requestResolvers.delete(d),l.type==="response")f(u);else{const p=u,h=new ke(p.error.code,p.error.message,p.error.data);f(h)}else{const p=l.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${d}`))}continue}await((o=this._transport)==null?void 0:o.send(l.message,{relatedRequestId:r.requestId}))}}const s=await this._taskStore.getTask(i,r.sessionId);if(!s)throw new ke(Ae.InvalidParams,`Task not found: ${i}`);if(!Os(s.status))return await this._waitForTaskUpdate(i,r.signal),await a();if(Os(s.status)){const l=await this._taskStore.getTaskResult(i,r.sessionId);return this._clearTaskQueue(i),{...l,_meta:{...l._meta,[Us]:{taskId:i}}}}return await a()};return await a()}),this.setRequestHandler(mw,async(n,r)=>{var a;try{const{tasks:i,nextCursor:s}=await this._taskStore.listTasks((a=n.params)==null?void 0:a.cursor,r.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new ke(Ae.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(yw,async(n,r)=>{try{const a=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!a)throw new ke(Ae.InvalidParams,`Task not found: ${n.params.taskId}`);if(Os(a.status))throw new ke(Ae.InvalidParams,`Cannot cancel task in terminal status: ${a.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId);const i=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!i)throw new ke(Ae.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...i}}catch(a){throw a instanceof ke?a:new ke(Ae.InvalidRequest,`Failed to cancel task: ${a instanceof Error?a.message:String(a)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;const n=this._requestHandlerAbortControllers.get(t.params.requestId);n==null||n.abort(t.params.reason)}_setupTimeout(t,n,r,a,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(a,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:a})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),ke.fromError(Ae.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){const n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var i,s,o;if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;const n=(i=this.transport)==null?void 0:i.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};const r=(s=this.transport)==null?void 0:s.onerror;this._transport.onerror=l=>{r==null||r(l),this._onerror(l)};const a=(o=this._transport)==null?void 0:o.onmessage;this._transport.onmessage=(l,u)=>{a==null||a(l,u),iu(l)||fW(l)?this._onresponse(l):m0(l)?this._onrequest(l,u):dW(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var r;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const a of this._timeoutInfo.values())clearTimeout(a.timeoutId);this._timeoutInfo.clear();for(const a of this._requestHandlerAbortControllers.values())a.abort();this._requestHandlerAbortControllers.clear();const n=ke.fromError(Ae.ConnectionClosed,"Connection closed");this._transport=void 0,(r=this.onclose)==null||r.call(this);for(const a of t.values())a(n)}_onerror(t){var n;(n=this.onerror)==null||n.call(this,t)}_onnotification(t){const n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(t,n){var d,f,p,h;const r=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,a=this._transport,i=(p=(f=(d=t.params)==null?void 0:d._meta)==null?void 0:f[Us])==null?void 0:p.taskId;if(r===void 0){const y={jsonrpc:"2.0",id:t.id,error:{code:Ae.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:y,timestamp:Date.now()},a==null?void 0:a.sessionId).catch(m=>this._onerror(new Error(`Failed to enqueue error response: ${m}`))):a==null||a.send(y).catch(m=>this._onerror(new Error(`Failed to send an error response: ${m}`)));return}const s=new AbortController;this._requestHandlerAbortControllers.set(t.id,s);const o=uW(t.params)?t.params.task:void 0,l=this._taskStore?this.requestTaskStore(t,a==null?void 0:a.sessionId):void 0,u={signal:s.signal,sessionId:a==null?void 0:a.sessionId,_meta:(h=t.params)==null?void 0:h._meta,sendNotification:async y=>{if(s.signal.aborted)return;const m={relatedRequestId:t.id};i&&(m.relatedTask={taskId:i}),await this.notification(y,m)},sendRequest:async(y,m,b)=>{var w;if(s.signal.aborted)throw new ke(Ae.ConnectionClosed,"Request was cancelled");const g={...b,relatedRequestId:t.id};i&&!g.relatedTask&&(g.relatedTask={taskId:i});const v=((w=g.relatedTask)==null?void 0:w.taskId)??i;return v&&l&&await l.updateTaskStatus(v,"input_required"),await this.request(y,m,g)},authInfo:n==null?void 0:n.authInfo,requestId:t.id,requestInfo:n==null?void 0:n.requestInfo,taskId:i,taskStore:l,taskRequestedTtl:o==null?void 0:o.ttl,closeSSEStream:n==null?void 0:n.closeSSEStream,closeStandaloneSSEStream:n==null?void 0:n.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(t.method)}).then(()=>r(t,u)).then(async y=>{if(s.signal.aborted)return;const m={result:y,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:m,timestamp:Date.now()},a==null?void 0:a.sessionId):await(a==null?void 0:a.send(m))},async y=>{if(s.signal.aborted)return;const m={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(y.code)?y.code:Ae.InternalError,message:y.message??"Internal error",...y.data!==void 0&&{data:y.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:m,timestamp:Date.now()},a==null?void 0:a.sessionId):await(a==null?void 0:a.send(m))}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===s&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...r}=t.params,a=Number(n),i=this._progressHandlers.get(a);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const s=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&s&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(l){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),s(l);return}i(r)}_onresponse(t){const n=Number(t.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),iu(t))r(t);else{const s=new ke(t.error.code,t.error.message,t.error.data);r(s)}return}const a=this._responseHandlers.get(n);if(a===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let i=!1;if(iu(t)&&t.result&&typeof t.result=="object"){const s=t.result;if(s.task&&typeof s.task=="object"){const o=s.task;typeof o.taskId=="string"&&(i=!0,this._taskProgressTokens.set(o.taskId,n))}}if(i||this._progressHandlers.delete(n),iu(t))a(t);else{const s=ke.fromError(t.error.code,t.error.message,t.error.data);a(s)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)==null?void 0:t.close())}async*requestStream(t,n,r){var s,o;const{task:a}=r??{};if(!a){try{yield{type:"result",result:await this.request(t,n,r)}}catch(l){yield{type:"error",error:l instanceof ke?l:new ke(Ae.InternalError,String(l))}}return}let i;try{const l=await this.request(t,od,r);if(l.task)i=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new ke(Ae.InternalError,"Task creation did not return a task");for(;;){const u=await this.getTask({taskId:i},r);if(yield{type:"taskStatus",task:u},Os(u.status)){u.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},n,r)}:u.status==="failed"?yield{type:"error",error:new ke(Ae.InternalError,`Task ${i} failed`)}:u.status==="cancelled"&&(yield{type:"error",error:new ke(Ae.InternalError,`Task ${i} was cancelled`)});return}if(u.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},n,r)};return}const d=u.pollInterval??((s=this._options)==null?void 0:s.defaultTaskPollInterval)??1e3;await new Promise(f=>setTimeout(f,d)),(o=r==null?void 0:r.signal)==null||o.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof ke?l:new ke(Ae.InternalError,String(l))}}}request(t,n,r){const{relatedRequestId:a,resumptionToken:i,onresumptiontoken:s,task:o,relatedTask:l}=r??{};return new Promise((u,d)=>{var v,w,S,E,C;const f=T=>{d(T)};if(!this._transport){f(new Error("Not connected"));return}if(((v=this._options)==null?void 0:v.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),o&&this.assertTaskCapability(t.method)}catch(T){f(T);return}(w=r==null?void 0:r.signal)==null||w.throwIfAborted();const p=this._requestMessageId++,h={...t,jsonrpc:"2.0",id:p};r!=null&&r.onprogress&&(this._progressHandlers.set(p,r.onprogress),h.params={...t.params,_meta:{...((S=t.params)==null?void 0:S._meta)||{},progressToken:p}}),o&&(h.params={...h.params,task:o}),l&&(h.params={...h.params,_meta:{...((E=h.params)==null?void 0:E._meta)||{},[Us]:l}});const y=T=>{var R;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(R=this._transport)==null||R.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(T)}},{relatedRequestId:a,resumptionToken:i,onresumptiontoken:s}).catch($=>this._onerror(new Error(`Failed to send cancellation: ${$}`)));const P=T instanceof ke?T:new ke(Ae.RequestTimeout,String(T));d(P)};this._responseHandlers.set(p,T=>{var P;if(!((P=r==null?void 0:r.signal)!=null&&P.aborted)){if(T instanceof Error)return d(T);try{const R=Mi(n,T.result);R.success?u(R.data):d(R.error)}catch(R){d(R)}}}),(C=r==null?void 0:r.signal)==null||C.addEventListener("abort",()=>{var T;y((T=r==null?void 0:r.signal)==null?void 0:T.reason)});const m=(r==null?void 0:r.timeout)??jee,b=()=>y(ke.fromError(Ae.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(p,m,r==null?void 0:r.maxTotalTimeout,b,(r==null?void 0:r.resetTimeoutOnProgress)??!1);const g=l==null?void 0:l.taskId;if(g){const T=P=>{const R=this._responseHandlers.get(p);R?R(P):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,T),this._enqueueTaskMessage(g,{type:"request",message:h,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(p),d(P)})}else this._transport.send(h,{relatedRequestId:a,resumptionToken:i,onresumptiontoken:s}).catch(T=>{this._cleanupTimeout(p),d(T)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},hw,n)}async getTaskResult(t,n,r){return this.request({method:"tasks/result",params:t},n,r)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},gw,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},TW,n)}async notification(t,n){var o,l,u,d;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const r=(o=n==null?void 0:n.relatedTask)==null?void 0:o.taskId;if(r){const f={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((l=t.params)==null?void 0:l._meta)||{},[Us]:n.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:f,timestamp:Date.now()});return}if((((u=this._options)==null?void 0:u.debouncedNotificationMethods)??[]).includes(t.method)&&!t.params&&!(n!=null&&n.relatedRequestId)&&!(n!=null&&n.relatedTask)){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var p,h;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let f={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(f={...f,params:{...f.params,_meta:{...((p=f.params)==null?void 0:p._meta)||{},[Us]:n.relatedTask}}}),(h=this._transport)==null||h.send(f,n).catch(y=>this._onerror(y))});return}let s={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(s={...s,params:{...s.params,_meta:{...((d=s.params)==null?void 0:d._meta)||{},[Us]:n.relatedTask}}}),await this._transport.send(s,n)}setRequestHandler(t,n){const r=$E(t);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(a,i)=>{const s=OE(t,a);return Promise.resolve(n(s,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){const r=$E(t);this._notificationHandlers.set(r,a=>{const i=OE(t,a);return Promise.resolve(n(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,r){var i;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const a=(i=this._options)==null?void 0:i.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,r,a)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(t,n);for(const a of r)if(a.type==="request"&&m0(a.message)){const i=a.message.id,s=this._requestResolvers.get(i);s?(s(new ke(Ae.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){var a,i;let r=((a=this._options)==null?void 0:a.defaultTaskPollInterval)??1e3;try{const s=await((i=this._taskStore)==null?void 0:i.getTask(t));s!=null&&s.pollInterval&&(r=s.pollInterval)}catch{}return new Promise((s,o)=>{if(n.aborted){o(new ke(Ae.InvalidRequest,"Request cancelled"));return}const l=setTimeout(s,r);n.addEventListener("abort",()=>{clearTimeout(l),o(new ke(Ae.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async a=>{if(!t)throw new Error("No request provided");return await r.createTask(a,t.id,{method:t.method,params:t.params},n)},getTask:async a=>{const i=await r.getTask(a,n);if(!i)throw new ke(Ae.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(a,i,s)=>{await r.storeTaskResult(a,i,s,n);const o=await r.getTask(a,n);if(o){const l=bp.parse({method:"notifications/tasks/status",params:o});await this.notification(l),Os(o.status)&&this._cleanupTaskProgressHandler(a)}},getTaskResult:a=>r.getTaskResult(a,n),updateTaskStatus:async(a,i,s)=>{const o=await r.getTask(a,n);if(!o)throw new ke(Ae.InvalidParams,`Task "${a}" not found - it may have been cleaned up`);if(Os(o.status))throw new ke(Ae.InvalidParams,`Cannot update task "${a}" from terminal status "${o.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(a,i,s,n);const l=await r.getTask(a,n);if(l){const u=bp.parse({method:"notifications/tasks/status",params:l});await this.notification(u),Os(l.status)&&this._cleanupTaskProgressHandler(a)}},listTasks:a=>r.listTasks(a,n)}}}function ME(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Aee(e,t){const n={...e};for(const r in t){const a=r,i=t[a];if(i===void 0)continue;const s=n[a];ME(s)&&ME(i)?n[a]={...s,...i}:n[a]=i}return n}var D0={exports:{}},GM={},ra={},uc={},Zd={},Le={},ld={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(v){if(super(),!e.IDENTIFIER.test(v))throw new Error("CodeGen: name must be a valid identifier");this.str=v}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class r extends t{constructor(v){super(),this._items=typeof v=="string"?[v]:v}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const v=this._items[0];return v===""||v==='""'}get str(){var v;return(v=this._str)!==null&&v!==void 0?v:this._str=this._items.reduce((w,S)=>`${w}${S}`,"")}get names(){var v;return(v=this._names)!==null&&v!==void 0?v:this._names=this._items.reduce((w,S)=>(S instanceof n&&(w[S.str]=(w[S.str]||0)+1),w),{})}}e._Code=r,e.nil=new r("");function a(g,...v){const w=[g[0]];let S=0;for(;S<v.length;)o(w,v[S]),w.push(g[++S]);return new r(w)}e._=a;const i=new r("+");function s(g,...v){const w=[h(g[0])];let S=0;for(;S<v.length;)w.push(i),o(w,v[S]),w.push(i,h(g[++S]));return l(w),new r(w)}e.str=s;function o(g,v){v instanceof r?g.push(...v._items):v instanceof n?g.push(v):g.push(f(v))}e.addCodeArg=o;function l(g){let v=1;for(;v<g.length-1;){if(g[v]===i){const w=u(g[v-1],g[v+1]);if(w!==void 0){g.splice(v-1,3,w);continue}g[v++]="+"}v++}}function u(g,v){if(v==='""')return g;if(g==='""')return v;if(typeof g=="string")return v instanceof n||g[g.length-1]!=='"'?void 0:typeof v!="string"?`${g.slice(0,-1)}${v}"`:v[0]==='"'?g.slice(0,-1)+v.slice(1):void 0;if(typeof v=="string"&&v[0]==='"'&&!(g instanceof n))return`"${g}${v.slice(1)}`}function d(g,v){return v.emptyStr()?g:g.emptyStr()?v:s`${g}${v}`}e.strConcat=d;function f(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:h(Array.isArray(g)?g.join(","):g)}function p(g){return new r(h(g))}e.stringify=p;function h(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=h;function y(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new r(`.${g}`):a`[${g}]`}e.getProperty=y;function m(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new r(`${g}`);throw new Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=m;function b(g){return new r(g.toString())}e.regexpCode=b})(ld);var z0={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=ld;class n extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var r;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class a{constructor({prefixes:u,parent:d}={}){this._names={},this._prefixes=u,this._parent=d}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const d=this._names[u]||this._nameGroup(u);return`${u}${d.index++}`}_nameGroup(u){var d,f;if(!((f=(d=this._parent)===null||d===void 0?void 0:d._prefixes)===null||f===void 0)&&f.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=a;class i extends t.Name{constructor(u,d){super(d),this.prefix=u}setValue(u,{property:d,itemIndex:f}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(d)}[${f}]`}}e.ValueScopeName=i;const s=(0,t._)`\n`;class o extends a{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?s:t.nil}}get(){return this._scope}name(u){return new i(u,this._newName(u))}value(u,d){var f;if(d.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const p=this.toName(u),{prefix:h}=p,y=(f=d.key)!==null&&f!==void 0?f:d.ref;let m=this._values[h];if(m){const v=m.get(y);if(v)return v}else m=this._values[h]=new Map;m.set(y,p);const b=this._scope[h]||(this._scope[h]=[]),g=b.length;return b[g]=d.ref,p.setValue(d,{property:h,itemIndex:g}),p}getValue(u,d){const f=this._values[u];if(f)return f.get(d)}scopeRefs(u,d=this._values){return this._reduceValues(d,f=>{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,t._)`${u}${f.scopePath}`})}scopeCode(u=this._values,d,f){return this._reduceValues(u,p=>{if(p.value===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return p.value.code},d,f)}_reduceValues(u,d,f={},p){let h=t.nil;for(const y in u){const m=u[y];if(!m)continue;const b=f[y]=f[y]||new Map;m.forEach(g=>{if(b.has(g))return;b.set(g,r.Started);let v=d(g);if(v){const w=this.opts.es5?e.varKinds.var:e.varKinds.const;h=(0,t._)`${h}${w} ${g} = ${v};${this.opts._n}`}else if(v=p==null?void 0:p(g))h=(0,t._)`${h}${v}${this.opts._n}`;else throw new n(g);b.set(g,r.Completed)})}return h}}e.ValueScope=o})(z0);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=ld,n=z0;var r=ld;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var a=z0;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class i{optimizeNodes(){return this}optimizeNames(k,M){return this}}class s extends i{constructor(k,M,I){super(),this.varKind=k,this.name=M,this.rhs=I}render({es5:k,_n:M}){const I=k?n.varKinds.var:this.varKind,K=this.rhs===void 0?"":` = ${this.rhs}`;return`${I} ${this.name}${K};`+M}optimizeNames(k,M){if(k[this.name.str])return this.rhs&&(this.rhs=D(this.rhs,k,M)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class o extends i{constructor(k,M,I){super(),this.lhs=k,this.rhs=M,this.sideEffects=I}render({_n:k}){return`${this.lhs} = ${this.rhs};`+k}optimizeNames(k,M){if(!(this.lhs instanceof t.Name&&!k[this.lhs.str]&&!this.sideEffects))return this.rhs=D(this.rhs,k,M),this}get names(){const k=this.lhs instanceof t.Name?{}:{...this.lhs.names};return L(k,this.rhs)}}class l extends o{constructor(k,M,I,K){super(k,I,K),this.op=M}render({_n:k}){return`${this.lhs} ${this.op}= ${this.rhs};`+k}}class u extends i{constructor(k){super(),this.label=k,this.names={}}render({_n:k}){return`${this.label}:`+k}}class d extends i{constructor(k){super(),this.label=k,this.names={}}render({_n:k}){return`break${this.label?` ${this.label}`:""};`+k}}class f extends i{constructor(k){super(),this.error=k}render({_n:k}){return`throw ${this.error};`+k}get names(){return this.error.names}}class p extends i{constructor(k){super(),this.code=k}render({_n:k}){return`${this.code};`+k}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(k,M){return this.code=D(this.code,k,M),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class h extends i{constructor(k=[]){super(),this.nodes=k}render(k){return this.nodes.reduce((M,I)=>M+I.render(k),"")}optimizeNodes(){const{nodes:k}=this;let M=k.length;for(;M--;){const I=k[M].optimizeNodes();Array.isArray(I)?k.splice(M,1,...I):I?k[M]=I:k.splice(M,1)}return k.length>0?this:void 0}optimizeNames(k,M){const{nodes:I}=this;let K=I.length;for(;K--;){const G=I[K];G.optimizeNames(k,M)||(A(k,G.names),I.splice(K,1))}return I.length>0?this:void 0}get names(){return this.nodes.reduce((k,M)=>O(k,M.names),{})}}class y extends h{render(k){return"{"+k._n+super.render(k)+"}"+k._n}}class m extends h{}class b extends y{}b.kind="else";class g extends y{constructor(k,M){super(M),this.condition=k}render(k){let M=`if(${this.condition})`+super.render(k);return this.else&&(M+="else "+this.else.render(k)),M}optimizeNodes(){super.optimizeNodes();const k=this.condition;if(k===!0)return this.nodes;let M=this.else;if(M){const I=M.optimizeNodes();M=this.else=Array.isArray(I)?new b(I):I}if(M)return k===!1?M instanceof g?M:M.nodes:this.nodes.length?this:new g(H(k),M instanceof g?[M]:M.nodes);if(!(k===!1||!this.nodes.length))return this}optimizeNames(k,M){var I;if(this.else=(I=this.else)===null||I===void 0?void 0:I.optimizeNames(k,M),!!(super.optimizeNames(k,M)||this.else))return this.condition=D(this.condition,k,M),this}get names(){const k=super.names;return L(k,this.condition),this.else&&O(k,this.else.names),k}}g.kind="if";class v extends y{}v.kind="for";class w extends v{constructor(k){super(),this.iteration=k}render(k){return`for(${this.iteration})`+super.render(k)}optimizeNames(k,M){if(super.optimizeNames(k,M))return this.iteration=D(this.iteration,k,M),this}get names(){return O(super.names,this.iteration.names)}}class S extends v{constructor(k,M,I,K){super(),this.varKind=k,this.name=M,this.from=I,this.to=K}render(k){const M=k.es5?n.varKinds.var:this.varKind,{name:I,from:K,to:G}=this;return`for(${M} ${I}=${K}; ${I}<${G}; ${I}++)`+super.render(k)}get names(){const k=L(super.names,this.from);return L(k,this.to)}}class E extends v{constructor(k,M,I,K){super(),this.loop=k,this.varKind=M,this.name=I,this.iterable=K}render(k){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(k)}optimizeNames(k,M){if(super.optimizeNames(k,M))return this.iterable=D(this.iterable,k,M),this}get names(){return O(super.names,this.iterable.names)}}class C extends y{constructor(k,M,I){super(),this.name=k,this.args=M,this.async=I}render(k){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(k)}}C.kind="func";class T extends h{render(k){return"return "+super.render(k)}}T.kind="return";class P extends y{render(k){let M="try"+super.render(k);return this.catch&&(M+=this.catch.render(k)),this.finally&&(M+=this.finally.render(k)),M}optimizeNodes(){var k,M;return super.optimizeNodes(),(k=this.catch)===null||k===void 0||k.optimizeNodes(),(M=this.finally)===null||M===void 0||M.optimizeNodes(),this}optimizeNames(k,M){var I,K;return super.optimizeNames(k,M),(I=this.catch)===null||I===void 0||I.optimizeNames(k,M),(K=this.finally)===null||K===void 0||K.optimizeNames(k,M),this}get names(){const k=super.names;return this.catch&&O(k,this.catch.names),this.finally&&O(k,this.finally.names),k}}class R extends y{constructor(k){super(),this.error=k}render(k){return`catch(${this.error})`+super.render(k)}}R.kind="catch";class $ extends y{render(k){return"finally"+super.render(k)}}$.kind="finally";class j{constructor(k,M={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...M,_n:M.lines?`
483
- `:""},this._extScope=k,this._scope=new n.Scope({parent:k}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(k){return this._scope.name(k)}scopeName(k){return this._extScope.name(k)}scopeValue(k,M){const I=this._extScope.value(k,M);return(this._values[I.prefix]||(this._values[I.prefix]=new Set)).add(I),I}getScopeValue(k,M){return this._extScope.getValue(k,M)}scopeRefs(k){return this._extScope.scopeRefs(k,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(k,M,I,K){const G=this._scope.toName(M);return I!==void 0&&K&&(this._constants[G.str]=I),this._leafNode(new s(k,G,I)),G}const(k,M,I){return this._def(n.varKinds.const,k,M,I)}let(k,M,I){return this._def(n.varKinds.let,k,M,I)}var(k,M,I){return this._def(n.varKinds.var,k,M,I)}assign(k,M,I){return this._leafNode(new o(k,M,I))}add(k,M){return this._leafNode(new l(k,e.operators.ADD,M))}code(k){return typeof k=="function"?k():k!==t.nil&&this._leafNode(new p(k)),this}object(...k){const M=["{"];for(const[I,K]of k)M.length>1&&M.push(","),M.push(I),(I!==K||this.opts.es5)&&(M.push(":"),(0,t.addCodeArg)(M,K));return M.push("}"),new t._Code(M)}if(k,M,I){if(this._blockNode(new g(k)),M&&I)this.code(M).else().code(I).endIf();else if(M)this.code(M).endIf();else if(I)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(k){return this._elseNode(new g(k))}else(){return this._elseNode(new b)}endIf(){return this._endBlockNode(g,b)}_for(k,M){return this._blockNode(k),M&&this.code(M).endFor(),this}for(k,M){return this._for(new w(k),M)}forRange(k,M,I,K,G=this.opts.es5?n.varKinds.var:n.varKinds.let){const re=this._scope.toName(k);return this._for(new S(G,re,M,I),()=>K(re))}forOf(k,M,I,K=n.varKinds.const){const G=this._scope.toName(k);if(this.opts.es5){const re=M instanceof t.Name?M:this.var("_arr",M);return this.forRange("_i",0,(0,t._)`${re}.length`,oe=>{this.var(G,(0,t._)`${re}[${oe}]`),I(G)})}return this._for(new E("of",K,G,M),()=>I(G))}forIn(k,M,I,K=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(k,(0,t._)`Object.keys(${M})`,I);const G=this._scope.toName(k);return this._for(new E("in",K,G,M),()=>I(G))}endFor(){return this._endBlockNode(v)}label(k){return this._leafNode(new u(k))}break(k){return this._leafNode(new d(k))}return(k){const M=new T;if(this._blockNode(M),this.code(k),M.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(T)}try(k,M,I){if(!M&&!I)throw new Error('CodeGen: "try" without "catch" and "finally"');const K=new P;if(this._blockNode(K),this.code(k),M){const G=this.name("e");this._currNode=K.catch=new R(G),M(G)}return I&&(this._currNode=K.finally=new $,this.code(I)),this._endBlockNode(R,$)}throw(k){return this._leafNode(new f(k))}block(k,M){return this._blockStarts.push(this._nodes.length),k&&this.code(k).endBlock(M),this}endBlock(k){const M=this._blockStarts.pop();if(M===void 0)throw new Error("CodeGen: not in self-balancing block");const I=this._nodes.length-M;if(I<0||k!==void 0&&I!==k)throw new Error(`CodeGen: wrong number of nodes: ${I} vs ${k} expected`);return this._nodes.length=M,this}func(k,M=t.nil,I,K){return this._blockNode(new C(k,M,I)),K&&this.code(K).endFunc(),this}endFunc(){return this._endBlockNode(C)}optimize(k=1){for(;k-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(k){return this._currNode.nodes.push(k),this}_blockNode(k){this._currNode.nodes.push(k),this._nodes.push(k)}_endBlockNode(k,M){const I=this._currNode;if(I instanceof k||M&&I instanceof M)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${M?`${k.kind}/${M.kind}`:k.kind}"`)}_elseNode(k){const M=this._currNode;if(!(M instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=M.else=k,this}get _root(){return this._nodes[0]}get _currNode(){const k=this._nodes;return k[k.length-1]}set _currNode(k){const M=this._nodes;M[M.length-1]=k}}e.CodeGen=j;function O(_,k){for(const M in k)_[M]=(_[M]||0)+(k[M]||0);return _}function L(_,k){return k instanceof t._CodeOrName?O(_,k.names):_}function D(_,k,M){if(_ instanceof t.Name)return I(_);if(!K(_))return _;return new t._Code(_._items.reduce((G,re)=>(re instanceof t.Name&&(re=I(re)),re instanceof t._Code?G.push(...re._items):G.push(re),G),[]));function I(G){const re=M[G.str];return re===void 0||k[G.str]!==1?G:(delete k[G.str],re)}function K(G){return G instanceof t._Code&&G._items.some(re=>re instanceof t.Name&&k[re.str]===1&&M[re.str]!==void 0)}}function A(_,k){for(const M in k)_[M]=(_[M]||0)-(k[M]||0)}function H(_){return typeof _=="boolean"||typeof _=="number"||_===null?!_:(0,t._)`!${V(_)}`}e.not=H;const B=F(e.operators.AND);function U(..._){return _.reduce(B)}e.and=U;const Y=F(e.operators.OR);function N(..._){return _.reduce(Y)}e.or=N;function F(_){return(k,M)=>k===t.nil?M:M===t.nil?k:(0,t._)`${V(k)} ${_} ${V(M)}`}function V(_){return _ instanceof t.Name?_:(0,t._)`(${_})`}})(Le);var de={};Object.defineProperty(de,"__esModule",{value:!0});de.checkStrictMode=de.getErrorPath=de.Type=de.useFunc=de.setEvaluated=de.evaluatedPropsToName=de.mergeEvaluated=de.eachItem=de.unescapeJsonPointer=de.escapeJsonPointer=de.escapeFragment=de.unescapeFragment=de.schemaRefOrVal=de.schemaHasRulesButRef=de.schemaHasRules=de.checkUnknownRules=de.alwaysValidSchema=de.toHash=void 0;const ft=Le,Ree=ld;function $ee(e){const t={};for(const n of e)t[n]=!0;return t}de.toHash=$ee;function Oee(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(QM(e,t),!YM(t,e.self.RULES.all))}de.alwaysValidSchema=Oee;function QM(e,t=e.schema){const{opts:n,self:r}=e;if(!n.strictSchema||typeof t=="boolean")return;const a=r.RULES.keywords;for(const i in t)a[i]||JM(e,`unknown keyword: "${i}"`)}de.checkUnknownRules=QM;function YM(e,t){if(typeof e=="boolean")return!e;for(const n in e)if(t[n])return!0;return!1}de.schemaHasRules=YM;function Mee(e,t){if(typeof e=="boolean")return!e;for(const n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}de.schemaHasRulesButRef=Mee;function Pee({topSchemaRef:e,schemaPath:t},n,r,a){if(!a){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return(0,ft._)`${n}`}return(0,ft._)`${e}${t}${(0,ft.getProperty)(r)}`}de.schemaRefOrVal=Pee;function Dee(e){return XM(decodeURIComponent(e))}de.unescapeFragment=Dee;function zee(e){return encodeURIComponent(Aw(e))}de.escapeFragment=zee;function Aw(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}de.escapeJsonPointer=Aw;function XM(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}de.unescapeJsonPointer=XM;function Iee(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)}de.eachItem=Iee;function PE({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(a,i,s,o)=>{const l=s===void 0?i:s instanceof ft.Name?(i instanceof ft.Name?e(a,i,s):t(a,i,s),s):i instanceof ft.Name?(t(a,s,i),i):n(i,s);return o===ft.Name&&!(l instanceof ft.Name)?r(a,l):l}}de.mergeEvaluated={props:PE({mergeNames:(e,t,n)=>e.if((0,ft._)`${n} !== true && ${t} !== undefined`,()=>{e.if((0,ft._)`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,(0,ft._)`${n} || {}`).code((0,ft._)`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if((0,ft._)`${n} !== true`,()=>{t===!0?e.assign(n,!0):(e.assign(n,(0,ft._)`${n} || {}`),Rw(e,n,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:WM}),items:PE({mergeNames:(e,t,n)=>e.if((0,ft._)`${n} !== true && ${t} !== undefined`,()=>e.assign(n,(0,ft._)`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if((0,ft._)`${n} !== true`,()=>e.assign(n,t===!0?!0:(0,ft._)`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function WM(e,t){if(t===!0)return e.var("props",!0);const n=e.var("props",(0,ft._)`{}`);return t!==void 0&&Rw(e,n,t),n}de.evaluatedPropsToName=WM;function Rw(e,t,n){Object.keys(n).forEach(r=>e.assign((0,ft._)`${t}${(0,ft.getProperty)(r)}`,!0))}de.setEvaluated=Rw;const DE={};function Lee(e,t){return e.scopeValue("func",{ref:t,code:DE[t.code]||(DE[t.code]=new Ree._Code(t.code))})}de.useFunc=Lee;var I0;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(I0||(de.Type=I0={}));function Uee(e,t,n){if(e instanceof ft.Name){const r=t===I0.Num;return n?r?(0,ft._)`"[" + ${e} + "]"`:(0,ft._)`"['" + ${e} + "']"`:r?(0,ft._)`"/" + ${e}`:(0,ft._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,ft.getProperty)(e).toString():"/"+Aw(e)}de.getErrorPath=Uee;function JM(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw new Error(t);e.self.logger.warn(t)}}de.checkStrictMode=JM;var $a={};Object.defineProperty($a,"__esModule",{value:!0});const Nn=Le,Fee={data:new Nn.Name("data"),valCxt:new Nn.Name("valCxt"),instancePath:new Nn.Name("instancePath"),parentData:new Nn.Name("parentData"),parentDataProperty:new Nn.Name("parentDataProperty"),rootData:new Nn.Name("rootData"),dynamicAnchors:new Nn.Name("dynamicAnchors"),vErrors:new Nn.Name("vErrors"),errors:new Nn.Name("errors"),this:new Nn.Name("this"),self:new Nn.Name("self"),scope:new Nn.Name("scope"),json:new Nn.Name("json"),jsonPos:new Nn.Name("jsonPos"),jsonLen:new Nn.Name("jsonLen"),jsonPart:new Nn.Name("jsonPart")};$a.default=Fee;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=Le,n=de,r=$a;e.keywordError={message:({keyword:b})=>(0,t.str)`must pass "${b}" keyword validation`},e.keyword$DataError={message:({keyword:b,schemaType:g})=>g?(0,t.str)`"${b}" keyword must be ${g} ($data)`:(0,t.str)`"${b}" keyword is invalid ($data)`};function a(b,g=e.keywordError,v,w){const{it:S}=b,{gen:E,compositeRule:C,allErrors:T}=S,P=f(b,g,v);w??(C||T)?l(E,P):u(S,(0,t._)`[${P}]`)}e.reportError=a;function i(b,g=e.keywordError,v){const{it:w}=b,{gen:S,compositeRule:E,allErrors:C}=w,T=f(b,g,v);l(S,T),E||C||u(w,r.default.vErrors)}e.reportExtraError=i;function s(b,g){b.assign(r.default.errors,g),b.if((0,t._)`${r.default.vErrors} !== null`,()=>b.if(g,()=>b.assign((0,t._)`${r.default.vErrors}.length`,g),()=>b.assign(r.default.vErrors,null)))}e.resetErrorsCount=s;function o({gen:b,keyword:g,schemaValue:v,data:w,errsCount:S,it:E}){if(S===void 0)throw new Error("ajv implementation error");const C=b.name("err");b.forRange("i",S,r.default.errors,T=>{b.const(C,(0,t._)`${r.default.vErrors}[${T}]`),b.if((0,t._)`${C}.instancePath === undefined`,()=>b.assign((0,t._)`${C}.instancePath`,(0,t.strConcat)(r.default.instancePath,E.errorPath))),b.assign((0,t._)`${C}.schemaPath`,(0,t.str)`${E.errSchemaPath}/${g}`),E.opts.verbose&&(b.assign((0,t._)`${C}.schema`,v),b.assign((0,t._)`${C}.data`,w))})}e.extendErrors=o;function l(b,g){const v=b.const("err",g);b.if((0,t._)`${r.default.vErrors} === null`,()=>b.assign(r.default.vErrors,(0,t._)`[${v}]`),(0,t._)`${r.default.vErrors}.push(${v})`),b.code((0,t._)`${r.default.errors}++`)}function u(b,g){const{gen:v,validateName:w,schemaEnv:S}=b;S.$async?v.throw((0,t._)`new ${b.ValidationError}(${g})`):(v.assign((0,t._)`${w}.errors`,g),v.return(!1))}const d={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f(b,g,v){const{createErrors:w}=b.it;return w===!1?(0,t._)`{}`:p(b,g,v)}function p(b,g,v={}){const{gen:w,it:S}=b,E=[h(S,v),y(b,v)];return m(b,g,E),w.object(...E)}function h({errorPath:b},{instancePath:g}){const v=g?(0,t.str)`${b}${(0,n.getErrorPath)(g,n.Type.Str)}`:b;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,v)]}function y({keyword:b,it:{errSchemaPath:g}},{schemaPath:v,parentSchema:w}){let S=w?g:(0,t.str)`${g}/${b}`;return v&&(S=(0,t.str)`${S}${(0,n.getErrorPath)(v,n.Type.Str)}`),[d.schemaPath,S]}function m(b,{params:g,message:v},w){const{keyword:S,data:E,schemaValue:C,it:T}=b,{opts:P,propertyName:R,topSchemaRef:$,schemaPath:j}=T;w.push([d.keyword,S],[d.params,typeof g=="function"?g(b):g||(0,t._)`{}`]),P.messages&&w.push([d.message,typeof v=="function"?v(b):v]),P.verbose&&w.push([d.schema,C],[d.parentSchema,(0,t._)`${$}${j}`],[r.default.data,E]),R&&w.push([d.propertyName,R])}})(Zd);Object.defineProperty(uc,"__esModule",{value:!0});uc.boolOrEmptySchema=uc.topBoolOrEmptySchema=void 0;const qee=Zd,Hee=Le,Bee=$a,Vee={message:"boolean schema is false"};function Zee(e){const{gen:t,schema:n,validateName:r}=e;n===!1?eP(e,!1):typeof n=="object"&&n.$async===!0?t.return(Bee.default.data):(t.assign((0,Hee._)`${r}.errors`,null),t.return(!0))}uc.topBoolOrEmptySchema=Zee;function Kee(e,t){const{gen:n,schema:r}=e;r===!1?(n.var(t,!1),eP(e)):n.var(t,!0)}uc.boolOrEmptySchema=Kee;function eP(e,t){const{gen:n,data:r}=e,a={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,qee.reportError)(a,Vee,void 0,t)}var Wt={},ko={};Object.defineProperty(ko,"__esModule",{value:!0});ko.getRules=ko.isJSONType=void 0;const Gee=["string","number","integer","boolean","null","object","array"],Qee=new Set(Gee);function Yee(e){return typeof e=="string"&&Qee.has(e)}ko.isJSONType=Yee;function Xee(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ko.getRules=Xee;var ii={};Object.defineProperty(ii,"__esModule",{value:!0});ii.shouldUseRule=ii.shouldUseGroup=ii.schemaHasRulesForType=void 0;function Wee({schema:e,self:t},n){const r=t.RULES.types[n];return r&&r!==!0&&tP(e,r)}ii.schemaHasRulesForType=Wee;function tP(e,t){return t.rules.some(n=>nP(e,n))}ii.shouldUseGroup=tP;function nP(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some(r=>e[r]!==void 0))}ii.shouldUseRule=nP;Object.defineProperty(Wt,"__esModule",{value:!0});Wt.reportTypeError=Wt.checkDataTypes=Wt.checkDataType=Wt.coerceAndCheckDataType=Wt.getJSONTypes=Wt.getSchemaTypes=Wt.DataType=void 0;const Jee=ko,ete=ii,tte=Zd,De=Le,rP=de;var Tl;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Tl||(Wt.DataType=Tl={}));function nte(e){const t=aP(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Wt.getSchemaTypes=nte;function aP(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(Jee.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Wt.getJSONTypes=aP;function rte(e,t){const{gen:n,data:r,opts:a}=e,i=ate(t,a.coerceTypes),s=t.length>0&&!(i.length===0&&t.length===1&&(0,ete.schemaHasRulesForType)(e,t[0]));if(s){const o=$w(t,r,a.strictNumbers,Tl.Wrong);n.if(o,()=>{i.length?ite(e,t,i):Ow(e)})}return s}Wt.coerceAndCheckDataType=rte;const iP=new Set(["string","number","integer","boolean","null"]);function ate(e,t){return t?e.filter(n=>iP.has(n)||t==="array"&&n==="array"):[]}function ite(e,t,n){const{gen:r,data:a,opts:i}=e,s=r.let("dataType",(0,De._)`typeof ${a}`),o=r.let("coerced",(0,De._)`undefined`);i.coerceTypes==="array"&&r.if((0,De._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,De._)`${a}[0]`).assign(s,(0,De._)`typeof ${a}`).if($w(t,a,i.strictNumbers),()=>r.assign(o,a))),r.if((0,De._)`${o} !== undefined`);for(const u of n)(iP.has(u)||u==="array"&&i.coerceTypes==="array")&&l(u);r.else(),Ow(e),r.endIf(),r.if((0,De._)`${o} !== undefined`,()=>{r.assign(a,o),ste(e,o)});function l(u){switch(u){case"string":r.elseIf((0,De._)`${s} == "number" || ${s} == "boolean"`).assign(o,(0,De._)`"" + ${a}`).elseIf((0,De._)`${a} === null`).assign(o,(0,De._)`""`);return;case"number":r.elseIf((0,De._)`${s} == "boolean" || ${a} === null
484
- || (${s} == "string" && ${a} && ${a} == +${a})`).assign(o,(0,De._)`+${a}`);return;case"integer":r.elseIf((0,De._)`${s} === "boolean" || ${a} === null
485
- || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(o,(0,De._)`+${a}`);return;case"boolean":r.elseIf((0,De._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(o,!1).elseIf((0,De._)`${a} === "true" || ${a} === 1`).assign(o,!0);return;case"null":r.elseIf((0,De._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(o,null);return;case"array":r.elseIf((0,De._)`${s} === "string" || ${s} === "number"
486
- || ${s} === "boolean" || ${a} === null`).assign(o,(0,De._)`[${a}]`)}}}function ste({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,De._)`${t} !== undefined`,()=>e.assign((0,De._)`${t}[${n}]`,r))}function L0(e,t,n,r=Tl.Correct){const a=r===Tl.Correct?De.operators.EQ:De.operators.NEQ;let i;switch(e){case"null":return(0,De._)`${t} ${a} null`;case"array":i=(0,De._)`Array.isArray(${t})`;break;case"object":i=(0,De._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=s((0,De._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=s();break;default:return(0,De._)`typeof ${t} ${a} ${e}`}return r===Tl.Correct?i:(0,De.not)(i);function s(o=De.nil){return(0,De.and)((0,De._)`typeof ${t} == "number"`,o,n?(0,De._)`isFinite(${t})`:De.nil)}}Wt.checkDataType=L0;function $w(e,t,n,r){if(e.length===1)return L0(e[0],t,n,r);let a;const i=(0,rP.toHash)(e);if(i.array&&i.object){const s=(0,De._)`typeof ${t} != "object"`;a=i.null?s:(0,De._)`!${t} || ${s}`,delete i.null,delete i.array,delete i.object}else a=De.nil;i.number&&delete i.integer;for(const s in i)a=(0,De.and)(a,L0(s,t,n,r));return a}Wt.checkDataTypes=$w;const ote={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,De._)`{type: ${e}}`:(0,De._)`{type: ${t}}`};function Ow(e){const t=lte(e);(0,tte.reportError)(t,ote)}Wt.reportTypeError=Ow;function lte(e){const{gen:t,data:n,schema:r}=e,a=(0,rP.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:a,schemaValue:a,parentSchema:r,params:{},it:e}}var zm={};Object.defineProperty(zm,"__esModule",{value:!0});zm.assignDefaults=void 0;const Ho=Le,cte=de;function ute(e,t){const{properties:n,items:r}=e.schema;if(t==="object"&&n)for(const a in n)zE(e,a,n[a].default);else t==="array"&&Array.isArray(r)&&r.forEach((a,i)=>zE(e,i,a.default))}zm.assignDefaults=ute;function zE(e,t,n){const{gen:r,compositeRule:a,data:i,opts:s}=e;if(n===void 0)return;const o=(0,Ho._)`${i}${(0,Ho.getProperty)(t)}`;if(a){(0,cte.checkStrictMode)(e,`default is ignored for: ${o}`);return}let l=(0,Ho._)`${o} === undefined`;s.useDefaults==="empty"&&(l=(0,Ho._)`${l} || ${o} === null || ${o} === ""`),r.if(l,(0,Ho._)`${o} = ${(0,Ho.stringify)(n)}`)}var ka={},Fe={};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.validateUnion=Fe.validateArray=Fe.usePattern=Fe.callValidateCode=Fe.schemaProperties=Fe.allSchemaProperties=Fe.noPropertyInData=Fe.propertyInData=Fe.isOwnProperty=Fe.hasPropFunc=Fe.reportMissingProp=Fe.checkMissingProp=Fe.checkReportMissingProp=void 0;const kt=Le,Mw=de,Ci=$a,dte=de;function fte(e,t){const{gen:n,data:r,it:a}=e;n.if(Dw(n,r,t,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,kt._)`${t}`},!0),e.error()})}Fe.checkReportMissingProp=fte;function hte({gen:e,data:t,it:{opts:n}},r,a){return(0,kt.or)(...r.map(i=>(0,kt.and)(Dw(e,t,i,n.ownProperties),(0,kt._)`${a} = ${i}`)))}Fe.checkMissingProp=hte;function pte(e,t){e.setParams({missingProperty:t},!0),e.error()}Fe.reportMissingProp=pte;function sP(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,kt._)`Object.prototype.hasOwnProperty`})}Fe.hasPropFunc=sP;function Pw(e,t,n){return(0,kt._)`${sP(e)}.call(${t}, ${n})`}Fe.isOwnProperty=Pw;function mte(e,t,n,r){const a=(0,kt._)`${t}${(0,kt.getProperty)(n)} !== undefined`;return r?(0,kt._)`${a} && ${Pw(e,t,n)}`:a}Fe.propertyInData=mte;function Dw(e,t,n,r){const a=(0,kt._)`${t}${(0,kt.getProperty)(n)} === undefined`;return r?(0,kt.or)(a,(0,kt.not)(Pw(e,t,n))):a}Fe.noPropertyInData=Dw;function oP(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}Fe.allSchemaProperties=oP;function gte(e,t){return oP(t).filter(n=>!(0,Mw.alwaysValidSchema)(e,t[n]))}Fe.schemaProperties=gte;function yte({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:a,errorPath:i},it:s},o,l,u){const d=u?(0,kt._)`${e}, ${t}, ${r}${a}`:t,f=[[Ci.default.instancePath,(0,kt.strConcat)(Ci.default.instancePath,i)],[Ci.default.parentData,s.parentData],[Ci.default.parentDataProperty,s.parentDataProperty],[Ci.default.rootData,Ci.default.rootData]];s.opts.dynamicRef&&f.push([Ci.default.dynamicAnchors,Ci.default.dynamicAnchors]);const p=(0,kt._)`${d}, ${n.object(...f)}`;return l!==kt.nil?(0,kt._)`${o}.call(${l}, ${p})`:(0,kt._)`${o}(${p})`}Fe.callValidateCode=yte;const vte=(0,kt._)`new RegExp`;function bte({gen:e,it:{opts:t}},n){const r=t.unicodeRegExp?"u":"",{regExp:a}=t.code,i=a(n,r);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,kt._)`${a.code==="new RegExp"?vte:(0,dte.useFunc)(e,a)}(${n}, ${r})`})}Fe.usePattern=bte;function xte(e){const{gen:t,data:n,keyword:r,it:a}=e,i=t.name("valid");if(a.allErrors){const o=t.let("valid",!0);return s(()=>t.assign(o,!1)),o}return t.var(i,!0),s(()=>t.break()),i;function s(o){const l=t.const("len",(0,kt._)`${n}.length`);t.forRange("i",0,l,u=>{e.subschema({keyword:r,dataProp:u,dataPropType:Mw.Type.Num},i),t.if((0,kt.not)(i),o)})}}Fe.validateArray=xte;function wte(e){const{gen:t,schema:n,keyword:r,it:a}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(l=>(0,Mw.alwaysValidSchema)(a,l))&&!a.opts.unevaluated)return;const s=t.let("valid",!1),o=t.name("_valid");t.block(()=>n.forEach((l,u)=>{const d=e.subschema({keyword:r,schemaProp:u,compositeRule:!0},o);t.assign(s,(0,kt._)`${s} || ${o}`),e.mergeValidEvaluated(d,o)||t.if((0,kt.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}Fe.validateUnion=wte;Object.defineProperty(ka,"__esModule",{value:!0});ka.validateKeywordUsage=ka.validSchemaType=ka.funcKeywordCode=ka.macroKeywordCode=void 0;const zn=Le,Bs=$a,Ste=Fe,_te=Zd;function kte(e,t){const{gen:n,keyword:r,schema:a,parentSchema:i,it:s}=e,o=t.macro.call(s.self,a,i,s),l=lP(n,r,o);s.opts.validateSchema!==!1&&s.self.validateSchema(o,!0);const u=n.name("valid");e.subschema({schema:o,schemaPath:zn.nil,errSchemaPath:`${s.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}ka.macroKeywordCode=kte;function Ete(e,t){var n;const{gen:r,keyword:a,schema:i,parentSchema:s,$data:o,it:l}=e;Nte(l,t);const u=!o&&t.compile?t.compile.call(l.self,i,s,l):t.validate,d=lP(r,a,u),f=r.let("valid");e.block$data(f,p),e.ok((n=t.valid)!==null&&n!==void 0?n:f);function p(){if(t.errors===!1)m(),t.modifying&&IE(e),b(()=>e.error());else{const g=t.async?h():y();t.modifying&&IE(e),b(()=>Cte(e,g))}}function h(){const g=r.let("ruleErrs",null);return r.try(()=>m((0,zn._)`await `),v=>r.assign(f,!1).if((0,zn._)`${v} instanceof ${l.ValidationError}`,()=>r.assign(g,(0,zn._)`${v}.errors`),()=>r.throw(v))),g}function y(){const g=(0,zn._)`${d}.errors`;return r.assign(g,null),m(zn.nil),g}function m(g=t.async?(0,zn._)`await `:zn.nil){const v=l.opts.passContext?Bs.default.this:Bs.default.self,w=!("compile"in t&&!o||t.schema===!1);r.assign(f,(0,zn._)`${g}${(0,Ste.callValidateCode)(e,d,v,w)}`,t.modifying)}function b(g){var v;r.if((0,zn.not)((v=t.valid)!==null&&v!==void 0?v:f),g)}}ka.funcKeywordCode=Ete;function IE(e){const{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,(0,zn._)`${r.parentData}[${r.parentDataProperty}]`))}function Cte(e,t){const{gen:n}=e;n.if((0,zn._)`Array.isArray(${t})`,()=>{n.assign(Bs.default.vErrors,(0,zn._)`${Bs.default.vErrors} === null ? ${t} : ${Bs.default.vErrors}.concat(${t})`).assign(Bs.default.errors,(0,zn._)`${Bs.default.vErrors}.length`),(0,_te.extendErrors)(e)},()=>e.error())}function Nte({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function lP(e,t,n){if(n===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,zn.stringify)(n)})}function jte(e,t,n=!1){return!t.length||t.some(r=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}ka.validSchemaType=jte;function Tte({schema:e,opts:t,self:n,errSchemaPath:r},a,i){if(Array.isArray(a.keyword)?!a.keyword.includes(i):a.keyword!==i)throw new Error("ajv implementation error");const s=a.dependencies;if(s!=null&&s.some(o=>!Object.prototype.hasOwnProperty.call(e,o)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(a.validateSchema&&!a.validateSchema(e[i])){const l=`keyword "${i}" value is invalid at path "${r}": `+n.errorsText(a.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(l);else throw new Error(l)}}ka.validateKeywordUsage=Tte;var fs={};Object.defineProperty(fs,"__esModule",{value:!0});fs.extendSubschemaMode=fs.extendSubschemaData=fs.getSubschema=void 0;const ba=Le,cP=de;function Ate(e,{keyword:t,schemaProp:n,schema:r,schemaPath:a,errSchemaPath:i,topSchemaRef:s}){if(t!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const o=e.schema[t];return n===void 0?{schema:o,schemaPath:(0,ba._)`${e.schemaPath}${(0,ba.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:o[n],schemaPath:(0,ba._)`${e.schemaPath}${(0,ba.getProperty)(t)}${(0,ba.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,cP.escapeFragment)(n)}`}}if(r!==void 0){if(a===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:a,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}fs.getSubschema=Ate;function Rte(e,t,{dataProp:n,dataPropType:r,data:a,dataTypes:i,propertyName:s}){if(a!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:o}=t;if(n!==void 0){const{errorPath:u,dataPathArr:d,opts:f}=t,p=o.let("data",(0,ba._)`${t.data}${(0,ba.getProperty)(n)}`,!0);l(p),e.errorPath=(0,ba.str)`${u}${(0,cP.getErrorPath)(n,r,f.jsPropertySyntax)}`,e.parentDataProperty=(0,ba._)`${n}`,e.dataPathArr=[...d,e.parentDataProperty]}if(a!==void 0){const u=a instanceof ba.Name?a:o.let("data",a,!0);l(u),s!==void 0&&(e.propertyName=s)}i&&(e.dataTypes=i);function l(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}fs.extendSubschemaData=Rte;function $te(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:a,allErrors:i}){r!==void 0&&(e.compositeRule=r),a!==void 0&&(e.createErrors=a),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=n}fs.extendSubschemaMode=$te;var yn={},uP=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,a,i;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(a=r;a--!==0;)if(!e(t[a],n[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(n).length)return!1;for(a=r;a--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[a]))return!1;for(a=r;a--!==0;){var s=i[a];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n},dP={exports:{}},es=dP.exports=function(e,t,n){typeof t=="function"&&(n=t,t={}),n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},a=n.post||function(){};mh(t,r,a,e,"",e)};es.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};es.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};es.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};es.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function mh(e,t,n,r,a,i,s,o,l,u){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,a,i,s,o,l,u);for(var d in r){var f=r[d];if(Array.isArray(f)){if(d in es.arrayKeywords)for(var p=0;p<f.length;p++)mh(e,t,n,f[p],a+"/"+d+"/"+p,i,a,d,r,p)}else if(d in es.propsKeywords){if(f&&typeof f=="object")for(var h in f)mh(e,t,n,f[h],a+"/"+d+"/"+Ote(h),i,a,d,r,h)}else(d in es.keywords||e.allKeys&&!(d in es.skipKeywords))&&mh(e,t,n,f,a+"/"+d,i,a,d,r)}n(r,a,i,s,o,l,u)}}function Ote(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var Mte=dP.exports;Object.defineProperty(yn,"__esModule",{value:!0});yn.getSchemaRefs=yn.resolveUrl=yn.normalizeId=yn._getFullPath=yn.getFullPath=yn.inlineRef=void 0;const Pte=de,Dte=uP,zte=Mte,Ite=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Lte(e,t=!0){return typeof e=="boolean"?!0:t===!0?!U0(e):t?fP(e)<=t:!1}yn.inlineRef=Lte;const Ute=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function U0(e){for(const t in e){if(Ute.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(U0)||typeof n=="object"&&U0(n))return!0}return!1}function fP(e){let t=0;for(const n in e){if(n==="$ref")return 1/0;if(t++,!Ite.has(n)&&(typeof e[n]=="object"&&(0,Pte.eachItem)(e[n],r=>t+=fP(r)),t===1/0))return 1/0}return t}function hP(e,t="",n){n!==!1&&(t=Al(t));const r=e.parse(t);return pP(e,r)}yn.getFullPath=hP;function pP(e,t){return e.serialize(t).split("#")[0]+"#"}yn._getFullPath=pP;const Fte=/#\/?$/;function Al(e){return e?e.replace(Fte,""):""}yn.normalizeId=Al;function qte(e,t,n){return n=Al(n),e.resolve(t,n)}yn.resolveUrl=qte;const Hte=/^[a-z_][-a-z0-9._]*$/i;function Bte(e,t){if(typeof e=="boolean")return{};const{schemaId:n,uriResolver:r}=this.opts,a=Al(e[n]||t),i={"":a},s=hP(r,a,!1),o={},l=new Set;return zte(e,{allKeys:!0},(f,p,h,y)=>{if(y===void 0)return;const m=s+p;let b=i[y];typeof f[n]=="string"&&(b=g.call(this,f[n])),v.call(this,f.$anchor),v.call(this,f.$dynamicAnchor),i[p]=b;function g(w){const S=this.opts.uriResolver.resolve;if(w=Al(b?S(b,w):w),l.has(w))throw d(w);l.add(w);let E=this.refs[w];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?u(f,E.schema,w):w!==Al(m)&&(w[0]==="#"?(u(f,o[w],w),o[w]=f):this.refs[w]=m),w}function v(w){if(typeof w=="string"){if(!Hte.test(w))throw new Error(`invalid anchor "${w}"`);g.call(this,`#${w}`)}}}),o;function u(f,p,h){if(p!==void 0&&!Dte(f,p))throw d(h)}function d(f){return new Error(`reference "${f}" resolves to more than one schema`)}}yn.getSchemaRefs=Bte;Object.defineProperty(ra,"__esModule",{value:!0});ra.getData=ra.KeywordCxt=ra.validateFunctionCode=void 0;const mP=uc,LE=Wt,zw=ii,Ap=Wt,Vte=zm,Mu=ka,gy=fs,ge=Le,je=$a,Zte=yn,si=de,Gc=Zd;function Kte(e){if(vP(e)&&(bP(e),yP(e))){Yte(e);return}gP(e,()=>(0,mP.topBoolOrEmptySchema)(e))}ra.validateFunctionCode=Kte;function gP({gen:e,validateName:t,schema:n,schemaEnv:r,opts:a},i){a.code.es5?e.func(t,(0,ge._)`${je.default.data}, ${je.default.valCxt}`,r.$async,()=>{e.code((0,ge._)`"use strict"; ${UE(n,a)}`),Qte(e,a),e.code(i)}):e.func(t,(0,ge._)`${je.default.data}, ${Gte(a)}`,r.$async,()=>e.code(UE(n,a)).code(i))}function Gte(e){return(0,ge._)`{${je.default.instancePath}="", ${je.default.parentData}, ${je.default.parentDataProperty}, ${je.default.rootData}=${je.default.data}${e.dynamicRef?(0,ge._)`, ${je.default.dynamicAnchors}={}`:ge.nil}}={}`}function Qte(e,t){e.if(je.default.valCxt,()=>{e.var(je.default.instancePath,(0,ge._)`${je.default.valCxt}.${je.default.instancePath}`),e.var(je.default.parentData,(0,ge._)`${je.default.valCxt}.${je.default.parentData}`),e.var(je.default.parentDataProperty,(0,ge._)`${je.default.valCxt}.${je.default.parentDataProperty}`),e.var(je.default.rootData,(0,ge._)`${je.default.valCxt}.${je.default.rootData}`),t.dynamicRef&&e.var(je.default.dynamicAnchors,(0,ge._)`${je.default.valCxt}.${je.default.dynamicAnchors}`)},()=>{e.var(je.default.instancePath,(0,ge._)`""`),e.var(je.default.parentData,(0,ge._)`undefined`),e.var(je.default.parentDataProperty,(0,ge._)`undefined`),e.var(je.default.rootData,je.default.data),t.dynamicRef&&e.var(je.default.dynamicAnchors,(0,ge._)`{}`)})}function Yte(e){const{schema:t,opts:n,gen:r}=e;gP(e,()=>{n.$comment&&t.$comment&&wP(e),tne(e),r.let(je.default.vErrors,null),r.let(je.default.errors,0),n.unevaluated&&Xte(e),xP(e),ane(e)})}function Xte(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",(0,ge._)`${n}.evaluated`),t.if((0,ge._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,ge._)`${e.evaluated}.props`,(0,ge._)`undefined`)),t.if((0,ge._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,ge._)`${e.evaluated}.items`,(0,ge._)`undefined`))}function UE(e,t){const n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,ge._)`/*# sourceURL=${n} */`:ge.nil}function Wte(e,t){if(vP(e)&&(bP(e),yP(e))){Jte(e,t);return}(0,mP.boolOrEmptySchema)(e,t)}function yP({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const n in e)if(t.RULES.all[n])return!0;return!1}function vP(e){return typeof e.schema!="boolean"}function Jte(e,t){const{schema:n,gen:r,opts:a}=e;a.$comment&&n.$comment&&wP(e),nne(e),rne(e);const i=r.const("_errs",je.default.errors);xP(e,i),r.var(t,(0,ge._)`${i} === ${je.default.errors}`)}function bP(e){(0,si.checkUnknownRules)(e),ene(e)}function xP(e,t){if(e.opts.jtd)return FE(e,[],!1,t);const n=(0,LE.getSchemaTypes)(e.schema),r=(0,LE.coerceAndCheckDataType)(e,n);FE(e,n,!r,t)}function ene(e){const{schema:t,errSchemaPath:n,opts:r,self:a}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,si.schemaHasRulesButRef)(t,a.RULES)&&a.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function tne(e){const{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,si.checkStrictMode)(e,"default is ignored in the schema root")}function nne(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Zte.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function rne(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function wP({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:a}){const i=n.$comment;if(a.$comment===!0)e.code((0,ge._)`${je.default.self}.logger.log(${i})`);else if(typeof a.$comment=="function"){const s=(0,ge.str)`${r}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code((0,ge._)`${je.default.self}.opts.$comment(${i}, ${s}, ${o}.schema)`)}}function ane(e){const{gen:t,schemaEnv:n,validateName:r,ValidationError:a,opts:i}=e;n.$async?t.if((0,ge._)`${je.default.errors} === 0`,()=>t.return(je.default.data),()=>t.throw((0,ge._)`new ${a}(${je.default.vErrors})`)):(t.assign((0,ge._)`${r}.errors`,je.default.vErrors),i.unevaluated&&ine(e),t.return((0,ge._)`${je.default.errors} === 0`))}function ine({gen:e,evaluated:t,props:n,items:r}){n instanceof ge.Name&&e.assign((0,ge._)`${t}.props`,n),r instanceof ge.Name&&e.assign((0,ge._)`${t}.items`,r)}function FE(e,t,n,r){const{gen:a,schema:i,data:s,allErrors:o,opts:l,self:u}=e,{RULES:d}=u;if(i.$ref&&(l.ignoreKeywordsWithRef||!(0,si.schemaHasRulesButRef)(i,d))){a.block(()=>kP(e,"$ref",d.all.$ref.definition));return}l.jtd||sne(e,t),a.block(()=>{for(const p of d.rules)f(p);f(d.post)});function f(p){(0,zw.shouldUseGroup)(i,p)&&(p.type?(a.if((0,Ap.checkDataType)(p.type,s,l.strictNumbers)),qE(e,p),t.length===1&&t[0]===p.type&&n&&(a.else(),(0,Ap.reportTypeError)(e)),a.endIf()):qE(e,p),o||a.if((0,ge._)`${je.default.errors} === ${r||0}`))}}function qE(e,t){const{gen:n,schema:r,opts:{useDefaults:a}}=e;a&&(0,Vte.assignDefaults)(e,t.type),n.block(()=>{for(const i of t.rules)(0,zw.shouldUseRule)(r,i)&&kP(e,i.keyword,i.definition,t.type)})}function sne(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(one(e,t),e.opts.allowUnionTypes||lne(e,t),cne(e,e.dataTypes))}function one(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(n=>{SP(e.dataTypes,n)||Iw(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),dne(e,t)}}function lne(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Iw(e,"use allowUnionTypes to allow union type keyword")}function cne(e,t){const n=e.self.RULES.all;for(const r in n){const a=n[r];if(typeof a=="object"&&(0,zw.shouldUseRule)(e.schema,a)){const{type:i}=a.definition;i.length&&!i.some(s=>une(t,s))&&Iw(e,`missing type "${i.join(",")}" for keyword "${r}"`)}}}function une(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function SP(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function dne(e,t){const n=[];for(const r of e.dataTypes)SP(t,r)?n.push(r):t.includes("integer")&&r==="number"&&n.push("integer");e.dataTypes=n}function Iw(e,t){const n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,si.checkStrictMode)(e,t,e.opts.strictTypes)}class _P{constructor(t,n,r){if((0,Mu.validateKeywordUsage)(t,n,r),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=r,this.data=t.data,this.schema=t.schema[r],this.$data=n.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,si.schemaRefOrVal)(t,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=n,this.$data)this.schemaCode=t.gen.const("vSchema",EP(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Mu.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=t.gen.const("_errs",je.default.errors))}result(t,n,r){this.failResult((0,ge.not)(t),n,r)}failResult(t,n,r){this.gen.if(t),r?r():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,n){this.failResult((0,ge.not)(t),void 0,n)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:n}=this;this.fail((0,ge._)`${n} !== undefined && (${(0,ge.or)(this.invalid$data(),t)})`)}error(t,n,r){if(n){this.setParams(n),this._error(t,r),this.setParams({});return}this._error(t,r)}_error(t,n){(t?Gc.reportExtraError:Gc.reportError)(this,this.def.error,n)}$dataError(){(0,Gc.reportError)(this,this.def.$dataError||Gc.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Gc.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,n){n?Object.assign(this.params,t):this.params=t}block$data(t,n,r=ge.nil){this.gen.block(()=>{this.check$data(t,r),n()})}check$data(t=ge.nil,n=ge.nil){if(!this.$data)return;const{gen:r,schemaCode:a,schemaType:i,def:s}=this;r.if((0,ge.or)((0,ge._)`${a} === undefined`,n)),t!==ge.nil&&r.assign(t,!0),(i.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),t!==ge.nil&&r.assign(t,!1)),r.else()}invalid$data(){const{gen:t,schemaCode:n,schemaType:r,def:a,it:i}=this;return(0,ge.or)(s(),o());function s(){if(r.length){if(!(n instanceof ge.Name))throw new Error("ajv implementation error");const l=Array.isArray(r)?r:[r];return(0,ge._)`${(0,Ap.checkDataTypes)(l,n,i.opts.strictNumbers,Ap.DataType.Wrong)}`}return ge.nil}function o(){if(a.validateSchema){const l=t.scopeValue("validate$data",{ref:a.validateSchema});return(0,ge._)`!${l}(${n})`}return ge.nil}}subschema(t,n){const r=(0,gy.getSubschema)(this.it,t);(0,gy.extendSubschemaData)(r,this.it,t),(0,gy.extendSubschemaMode)(r,t);const a={...this.it,...r,items:void 0,props:void 0};return Wte(a,n),a}mergeEvaluated(t,n){const{it:r,gen:a}=this;r.opts.unevaluated&&(r.props!==!0&&t.props!==void 0&&(r.props=si.mergeEvaluated.props(a,t.props,r.props,n)),r.items!==!0&&t.items!==void 0&&(r.items=si.mergeEvaluated.items(a,t.items,r.items,n)))}mergeValidEvaluated(t,n){const{it:r,gen:a}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return a.if(n,()=>this.mergeEvaluated(t,ge.Name)),!0}}ra.KeywordCxt=_P;function kP(e,t,n,r){const a=new _P(e,n,t);"code"in n?n.code(a,r):a.$data&&n.validate?(0,Mu.funcKeywordCode)(a,n):"macro"in n?(0,Mu.macroKeywordCode)(a,n):(n.compile||n.validate)&&(0,Mu.funcKeywordCode)(a,n)}const fne=/^\/(?:[^~]|~0|~1)*$/,hne=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function EP(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let a,i;if(e==="")return je.default.rootData;if(e[0]==="/"){if(!fne.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);a=e,i=je.default.rootData}else{const u=hne.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);const d=+u[1];if(a=u[2],a==="#"){if(d>=t)throw new Error(l("property/index",d));return r[t-d]}if(d>t)throw new Error(l("data",d));if(i=n[t-d],!a)return i}let s=i;const o=a.split("/");for(const u of o)u&&(i=(0,ge._)`${i}${(0,ge.getProperty)((0,si.unescapeJsonPointer)(u))}`,s=(0,ge._)`${s} && ${i}`);return s;function l(u,d){return`Cannot access ${u} ${d} levels up, current level is ${t}`}}ra.getData=EP;var Kd={};Object.defineProperty(Kd,"__esModule",{value:!0});class pne extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}Kd.default=pne;var Rc={};Object.defineProperty(Rc,"__esModule",{value:!0});const yy=yn;class mne extends Error{constructor(t,n,r,a){super(a||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,yy.resolveUrl)(t,n,r),this.missingSchema=(0,yy.normalizeId)((0,yy.getFullPath)(t,this.missingRef))}}Rc.default=mne;var er={};Object.defineProperty(er,"__esModule",{value:!0});er.resolveSchema=er.getCompilingSchema=er.resolveRef=er.compileSchema=er.SchemaEnv=void 0;const Zr=Le,gne=Kd,Ms=$a,ea=yn,HE=de,yne=ra;class Im{constructor(t){var n;this.refs={},this.dynamicAnchors={};let r;typeof t.schema=="object"&&(r=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(n=t.baseId)!==null&&n!==void 0?n:(0,ea.normalizeId)(r==null?void 0:r[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=r==null?void 0:r.$async,this.refs={}}}er.SchemaEnv=Im;function Lw(e){const t=CP.call(this,e);if(t)return t;const n=(0,ea.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:r,lines:a}=this.opts.code,{ownProperties:i}=this.opts,s=new Zr.CodeGen(this.scope,{es5:r,lines:a,ownProperties:i});let o;e.$async&&(o=s.scopeValue("Error",{ref:gne.default,code:(0,Zr._)`require("ajv/dist/runtime/validation_error").default`}));const l=s.scopeName("validate");e.validateName=l;const u={gen:s,allErrors:this.opts.allErrors,data:Ms.default.data,parentData:Ms.default.parentData,parentDataProperty:Ms.default.parentDataProperty,dataNames:[Ms.default.data],dataPathArr:[Zr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Zr.stringify)(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:o,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:Zr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Zr._)`""`,opts:this.opts,self:this};let d;try{this._compilations.add(e),(0,yne.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);const f=s.toString();d=`${s.scopeRefs(Ms.default.scope)}return ${f}`,this.opts.code.process&&(d=this.opts.code.process(d,e));const h=new Function(`${Ms.default.self}`,`${Ms.default.scope}`,d)(this,this.scope.get());if(this.scope.value(l,{ref:h}),h.errors=null,h.schema=e.schema,h.schemaEnv=e,e.$async&&(h.$async=!0),this.opts.code.source===!0&&(h.source={validateName:l,validateCode:f,scopeValues:s._values}),this.opts.unevaluated){const{props:y,items:m}=u;h.evaluated={props:y instanceof Zr.Name?void 0:y,items:m instanceof Zr.Name?void 0:m,dynamicProps:y instanceof Zr.Name,dynamicItems:m instanceof Zr.Name},h.source&&(h.source.evaluated=(0,Zr.stringify)(h.evaluated))}return e.validate=h,e}catch(f){throw delete e.validate,delete e.validateName,d&&this.logger.error("Error compiling schema, function code:",d),f}finally{this._compilations.delete(e)}}er.compileSchema=Lw;function vne(e,t,n){var r;n=(0,ea.resolveUrl)(this.opts.uriResolver,t,n);const a=e.refs[n];if(a)return a;let i=wne.call(this,e,n);if(i===void 0){const s=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:o}=this.opts;s&&(i=new Im({schema:s,schemaId:o,root:e,baseId:t}))}if(i!==void 0)return e.refs[n]=bne.call(this,i)}er.resolveRef=vne;function bne(e){return(0,ea.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Lw.call(this,e)}function CP(e){for(const t of this._compilations)if(xne(t,e))return t}er.getCompilingSchema=CP;function xne(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function wne(e,t){let n;for(;typeof(n=this.refs[t])=="string";)t=n;return n||this.schemas[t]||Lm.call(this,e,t)}function Lm(e,t){const n=this.opts.uriResolver.parse(t),r=(0,ea._getFullPath)(this.opts.uriResolver,n);let a=(0,ea.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return vy.call(this,n,e);const i=(0,ea.normalizeId)(r),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){const o=Lm.call(this,e,s);return typeof(o==null?void 0:o.schema)!="object"?void 0:vy.call(this,n,o)}if(typeof(s==null?void 0:s.schema)=="object"){if(s.validate||Lw.call(this,s),i===(0,ea.normalizeId)(t)){const{schema:o}=s,{schemaId:l}=this.opts,u=o[l];return u&&(a=(0,ea.resolveUrl)(this.opts.uriResolver,a,u)),new Im({schema:o,schemaId:l,root:e,baseId:a})}return vy.call(this,n,s)}}er.resolveSchema=Lm;const Sne=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function vy(e,{baseId:t,schema:n,root:r}){var a;if(((a=e.fragment)===null||a===void 0?void 0:a[0])!=="/")return;for(const o of e.fragment.slice(1).split("/")){if(typeof n=="boolean")return;const l=n[(0,HE.unescapeFragment)(o)];if(l===void 0)return;n=l;const u=typeof n=="object"&&n[this.opts.schemaId];!Sne.has(o)&&u&&(t=(0,ea.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof n!="boolean"&&n.$ref&&!(0,HE.schemaHasRulesButRef)(n,this.RULES)){const o=(0,ea.resolveUrl)(this.opts.uriResolver,t,n.$ref);i=Lm.call(this,r,o)}const{schemaId:s}=this.opts;if(i=i||new Im({schema:n,schemaId:s,root:r,baseId:t}),i.schema!==i.root.schema)return i}const _ne="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",kne="Meta-schema for $data reference (JSON AnySchema extension proposal)",Ene="object",Cne=["$data"],Nne={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},jne=!1,Tne={$id:_ne,description:kne,type:Ene,required:Cne,properties:Nne,additionalProperties:jne};var Uw={},Um={exports:{}};const Ane=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Fw=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),$c=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),qw=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),NP=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Hw=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Rne=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Wn=new Array(256);{const e="0123456789ABCDEF";for(let t=0;t<256;t++)Wn[t]="%"+e[t>>4]+e[t&15]}function Tn(e){return e<2048?Wn[192|e>>6]+Wn[128|e&63]:e<65536?Wn[224|e>>12]+Wn[128|e>>6&63]+Wn[128|e&63]:Wn[240|e>>18]+Wn[128|e>>12&63]+Wn[128|e>>6&63]+Wn[128|e&63]}const $ne=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),One=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Mne=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Pne=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Dne(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Mne(e[t])){if(e[t]==="%"&&t+2<e.length&&$c(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function BE(e){let t=-1,n=0,r=-1,a=0;for(let o=0;o<e.length;o++)e[o]==="0"?(r===-1&&(r=o),a++,a>n&&(n=a,t=r)):(r=-1,a=0);if(n<2)return e.join(":");const i=e.slice(0,t).join(":"),s=e.slice(t+n).join(":");return i+"::"+s}function zne(e){const t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;const n=t===-1?e.split(":"):e.slice(0,t).split(":"),r=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(n.length===1&&n[0]===""&&(n.length=0),r.length===1&&r[0]===""&&(r.length=0));const a=n.concat(r);let i=0;for(let o=0;o<a.length;o++){const l=a[o];if(l==="")return;if(l.indexOf(".")!==-1){if(o!==a.length-1||t!==-1&&r.length===0||!Fw(l))return;i+=2;continue}if(!$ne(l))return;a[o]=parseInt(l,16).toString(16),i++}if(t===-1)return i!==8?void 0:BE(a);if(i>=8)return;const s=a.slice(0,n.length);for(let o=i;o<8;o++)s.push("0");for(let o=n.length;o<a.length;o++)s.push(a[o]);return BE(s)}function F0(e){const t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let r=t?e.slice(1,-1):e;if(t&&One(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(Ine(r,":")<2)return{host:e,isIPV6:!1,error:t};let a="";const i=r.indexOf("%");if(i!==-1){const o=r.slice(i,i+3).toLowerCase()==="%25"?3:1;if(a=r.slice(i+o),!Dne(a))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,i)}const s=zne(r);return s===void 0?{host:e,isIPV6:!1,error:!0}:{host:s+(a?"%"+a:""),escapedHost:s+(a?"%25"+a:""),isIPV6:!0}}function Ine(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function Lne(e){let t=e;const n=[];let r=-1,a=0;for(;a=t.length;){if(a===1){if(t===".")break;if(t==="/"){n.push("/");break}else{n.push(t);break}}else if(a===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){n.push("/");break}}else if(a===3&&t==="/.."){n.length!==0&&n.pop(),n.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join("")}const Une={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Fne=/[@/?#:]/g,qne=/[@/?#]/g;function jP(e,t){const n=t?qne:Fne;return n.lastIndex=0,e.replace(n,r=>Une[r])}function TP(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){const a=e.slice(r+1,r+3);if($c(a)){const i=a.toUpperCase(),s=String.fromCharCode(parseInt(i,16));t&&qw(s)?n+=s:n+="%"+i,r+=2;continue}}n+=e[r]}return n}function Hne(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];if(r==="%"&&n+2<e.length){const a=e.slice(n+1,n+3);if($c(a)){const i=a.toUpperCase(),s=String.fromCharCode(parseInt(i,16));s!=="."&&qw(s)?t+=s:t+="%"+i,n+=2;continue}}if(NP(r))t+=r;else{const a=e.charCodeAt(n);if(a<128)t+=AP(a)?r:Wn[a];else if(a<55296||a>57343)t+=Tn(a);else if(a<=56319&&n+1<e.length){const i=e.charCodeAt(n+1);i>=56320&&i<=57343?(t+=Tn(65536+(a-55296<<10)+(i-56320)),n++):t+=Tn(65533)}else t+=Tn(65533)}}return t}function Bne(e,t=!1){let n="",r=t&&e[0]!=="/";for(let a=0;a<e.length;a++){const i=e[a];if(i==="%"&&a+2<e.length){const s=e.slice(a+1,a+3);if($c(s)){n+="%"+s.toUpperCase(),a+=2;continue}}if(i==="/"&&(r=!1),NP(i)&&(i!==":"||!r))n+=i;else{const s=e.charCodeAt(a);if(s<128)n+=Wn[s];else if(s<55296||s>57343)n+=Tn(s);else if(s<=56319&&a+1<e.length){const o=e.charCodeAt(a+1);o>=56320&&o<=57343?(n+=Tn(65536+(s-55296<<10)+(o-56320)),a++):n+=Tn(65533)}else n+=Tn(65533)}}return n}function Bw(e,t){let n="";for(let r=0;r<e.length;r++){const a=e[r];if(a==="%"&&r+2<e.length){const i=e.slice(r+1,r+3);if($c(i)){n+="%"+i.toUpperCase(),r+=2;continue}}if(t(a))n+=a;else{const i=e.charCodeAt(r);if(i<128)n+=Wn[i];else if(i<55296||i>57343)n+=Tn(i);else if(i<=56319&&r+1<e.length){const s=e.charCodeAt(r+1);s>=56320&&s<=57343?(n+=Tn(65536+(i-55296<<10)+(s-56320)),r++):n+=Tn(65533)}else n+=Tn(65533)}}return n}function Vne(e){return Bw(e,Rne)}function Zne(e){return Bw(e,Hw)}function Kne(e){return Bw(e,Hw)}function AP(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function Gne(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];if(r==="%"&&n+2<e.length){const a=e.slice(n+1,n+3);if($c(a)){const i=a.toUpperCase(),s=String.fromCharCode(parseInt(i,16));qw(s)?t+=s:t+="%"+i,n+=2;continue}}if(Hw(r))t+=r;else{const a=e.charCodeAt(n);if(a<128)t+=AP(a)?r:Wn[a];else if(a<55296||a>57343)t+=Tn(a);else if(a<=56319&&n+1<e.length){const i=e.charCodeAt(n+1);i>=56320&&i<=57343?(t+=Tn(65536+(a-55296<<10)+(i-56320)),n++):t+=Tn(65533)}else t+=Tn(65533)}}return t}function Qne(e){const t=[];if(e.userinfo!==void 0&&(t.push(Vne(e.userinfo)),t.push("@")),e.host!==void 0){let n=e.host;if(!Fw(n)){let r=F0(n);r.isIPV6!==!0&&r.isIPVFuture!==!0&&(n=TP(n,!0),r=F0(n)),r.isIPV6===!0||r.isIPVFuture===!0?n=`[${r.escapedHost}]`:n=jP(n,!1)}t.push(n)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}var RP={nonSimpleDomain:Pne,recomposeAuthority:Qne,reescapeHostDelimiters:jP,normalizePercentEncoding:TP,normalizePathEncoding:Hne,serializePathEncoding:Bne,normalizeQueryFragmentEncoding:Gne,encodeQuery:Zne,encodeFragment:Kne,removeDotSegments:Lne,isIPv4:Fw,isUUID:Ane,normalizeIPv6:F0};const{isUUID:Yne}=RP,Xne=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;function $P(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function OP(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function MP(e){const t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Wne(e){return e.secure=$P(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Jne(e){if((e.port===($P(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const t=e.resourceName.indexOf("?"),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!=="/"?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function ere(e,t){if(!e.path)return e.error="URN can not be parsed",e;const n=e.path.match(Xne);if(n&&n[0]===e.path){const r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];const a=`${r}:${t.nid||e.nid}`,i=Vw(a);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function tre(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");const n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),a=`${n}:${t.nid||r}`,i=Vw(a);i&&(e=i.serialize(e,t));const s=e,o=e.nss;return s.path=`${r||t.nid}:${o}`,t.skipEscape=!0,s}function nre(e,t){const n=e;return n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!Yne(n.uuid))&&(n.error=n.error||"UUID is not valid."),n}function rre(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t}const PP={scheme:"http",domainHost:!0,parse:OP,serialize:MP},are={scheme:"https",domainHost:PP.domainHost,parse:OP,serialize:MP},gh={scheme:"ws",domainHost:!0,parse:Wne,serialize:Jne},ire={scheme:"wss",domainHost:gh.domainHost,parse:gh.parse,serialize:gh.serialize},sre={scheme:"urn",parse:ere,serialize:tre,skipNormalize:!0},ore={scheme:"urn:uuid",parse:nre,serialize:rre,skipNormalize:!0},Rp={http:PP,https:are,ws:gh,wss:ire,urn:sre,"urn:uuid":ore};Object.setPrototypeOf(Rp,null);function Vw(e){return e&&(Rp[e]||Rp[e.toLowerCase()])||void 0}var lre={SCHEMES:Rp,getSchemeHandler:Vw};const{normalizeIPv6:DP,removeDotSegments:lu,recomposeAuthority:cre,normalizePercentEncoding:zP,normalizePathEncoding:ure,serializePathEncoding:VE,normalizeQueryFragmentEncoding:ZE,encodeQuery:dre,encodeFragment:fre,reescapeHostDelimiters:hre,isIPv4:IP,nonSimpleDomain:pre}=RP,{SCHEMES:LP,getSchemeHandler:Zw}=lre,UP=/^[A-Za-z][A-Za-z0-9+.-]*$/u,FP="URI scheme is malformed.";function KE(e){const t=unescape(String(e));if(!UP.test(t))throw new TypeError(FP);return t}function mre(e,t){return typeof e=="string"?e=_re(e,t):typeof e=="object"&&(e=Op(Eo(e,t),t)),e}function gre(e,t,n){const r=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:a,malformedAuthorityOrPort:i,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:l,malformedScheme:u}=$p(e,r),{parsed:d,malformedAuthorityOrPort:f,malformedPercentEncoding:p,malformedSchemeSpecific:h,malformedHost:y,malformedScheme:m}=$p(t,r);if(i||f||s||p||o||h||l||y||u||m)throw new Error(a.error||d.error||"URI is malformed.");const b=qP(a,d,r,!0),g=Zw(n&&n.scheme||b.scheme),v=b.host,w=v!==void 0&&v!==""&&(IP(v)||DP(v).isIPV6);HP(b,n||{},g,w);const S=v&&v.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(v);if(b.error&&!S)throw new Error(b.error);return r.skipEscape=!0,Eo(b,r)}function qP(e,t,n,r){const a={};return r||(e=Op(Eo(e,n),n),t=Op(Eo(t,n),n)),n=n||{},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=lu(t.path||""),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=lu(t.path||""),a.query=t.query):(t.path?(t.path[0]==="/"?a.path=lu(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path="/"+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:a.path=t.path,a.path=lu(a.path)),a.query=t.query):(a.path=e.path,t.query!==void 0?a.query=t.query:a.query=e.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function yre(e,t,n){const r=GE(e,n),a=GE(t,n);return r!==void 0&&a!==void 0&&r===a}function Eo(e,t){const n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),a=[];n.scheme&&(n.scheme=KE(n.scheme));const i=Zw(r.scheme||n.scheme);i&&i.serialize&&i.serialize(n,r);const s=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,o=!r.skipEscape&&n.scheme===void 0&&!s;n.path!==void 0&&(r.skipEscape?n.path=zP(n.path):n.path=VE(n.path,o)),r.reference!=="suffix"&&n.scheme&&(n.scheme=KE(n.scheme),a.push(n.scheme,":"));const l=cre(n);if(l!==void 0&&(r.reference!=="suffix"&&a.push("//"),a.push(l),n.path&&n.path[0]!=="/"&&a.push("/")),n.path!==void 0){let u=n.path;!r.absolutePath&&(!i||!i.absolutePath)&&(u=lu(u)),o&&(u=VE(u,!0)),l===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),a.push(u)}return n.query!==void 0&&a.push("?",dre(n.query)),n.fragment!==void 0&&a.push("#",fre(n.fragment)),a.join("")}const vre=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,bre=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,xre=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function wre(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function Qc(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Sre(e){const t=e[4];return Qc(e[3])||t!==void 0&&!(t[0]==="["&&t[t.length-1]==="]")&&Qc(t)||Qc(e[6])||Qc(e[7])||Qc(e[8])}function HP(e,t,n,r){if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&e.host[0]!=="["&&(t.domainHost||n&&n.domainHost)&&r===!1&&pre(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(a){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+a,!0}return!1}function $p(e,t){const n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let a=!1,i=!1,s=!1,o=!1,l=!1,u=!1,d=!1;n.reference==="suffix"&&(n.scheme?e=n.scheme+":"+e:e="//"+e);const f=e.match(bre);f!==null&&f[1].indexOf("\\")!==-1&&(r.error="URI authority must not contain a literal backslash.",a=!0);const p=e.match(xre);if(p!==null){const y=p[1],m=y.replace(/[\t\n\r]/g,"");m.length>=2&&(m.slice(0,2)!=="//"?(r.error=r.error||"URI authority must not contain a literal backslash.",a=!0):y.length!==m.length&&(r.error=r.error||"URI authority introducer must not contain whitespace.",a=!0))}const h=e.match(vre);if(h){if(r.scheme=h[1],r.userinfo=h[3],r.host=h[4],r.port=parseInt(h[5],10),r.path=h[6]||"",r.query=h[7],r.fragment=h[8],r.scheme!==void 0){const b=unescape(r.scheme);UP.test(b)?r.scheme=b.toLowerCase():(r.error=r.error||FP,u=!0)}i=Sre(h),i&&(r.error=r.error||"URI contains malformed percent-encoding."),isNaN(r.port)&&(r.port=h[5]);const y=wre(r,h);if(y!==void 0&&(r.error=r.error||y,a=!0),r.host)if(IP(r.host)===!1){const g=r.host[0]==="["&&r.host[r.host.length-1]==="]",v=DP(r.host);d=v.isIPV6||v.isIPVFuture===!0,l=g&&v.error===!0,r.host=d?v.host:v.host.toLowerCase(),l&&(r.error=r.error||"URI host is malformed.",a=!0)}else d=!0;r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path?r.reference="same-document":r.scheme===void 0?r.reference="relative":r.fragment===void 0?r.reference="absolute":r.reference="uri",n.reference&&n.reference!=="suffix"&&n.reference!==r.reference&&(r.error=r.error||"URI is not a "+n.reference+" reference.");const m=Zw(n.scheme||r.scheme);if(o=HP(r,n,m,d),!m||m&&!m.skipNormalize){if(e.indexOf("%")!==-1&&r.host!==void 0&&!l){const b=d?r.host:zP(r.host,!0);r.host=hre(b,d)}r.path&&(r.path=ure(r.path)),r.query&&(r.query=ZE(r.query)),r.fragment&&(r.fragment=ZE(r.fragment))}m&&m.parse&&(m.parse(r,n),m===LP.urn&&r.nid===void 0&&(s=!0))}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:a,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:o,malformedScheme:u}}function Op(e,t){return $p(e,t).parsed}function _re(e,t){return BP(e,t).normalized}function BP(e,t){const{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:a,malformedSchemeSpecific:i,malformedHost:s,malformedScheme:o}=$p(e,t);return{normalized:r||a||i||s||o?e:Eo(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:a,malformedSchemeSpecific:i,malformedHost:s,malformedScheme:o}}function GE(e,t){if(typeof e!="string"&&typeof e!="object")return;let n;try{n=typeof e=="string"?e:Eo(e,t)}catch{return}const{normalized:r,malformedAuthorityOrPort:a,malformedPercentEncoding:i,malformedSchemeSpecific:s,malformedHost:o,malformedScheme:l}=BP(n,t);return a||i||s||o||l?void 0:r}const Kw={SCHEMES:LP,normalize:mre,resolve:gre,resolveComponent:qP,equal:yre,serialize:Eo,parse:Op};Um.exports=Kw;Um.exports.default=Kw;Um.exports.fastUri=Kw;var kre=Um.exports;Object.defineProperty(Uw,"__esModule",{value:!0});const VP=kre;VP.code='require("ajv/dist/runtime/uri").default';Uw.default=VP;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=ra;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Le;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});const r=Kd,a=Rc,i=ko,s=er,o=Le,l=yn,u=Wt,d=de,f=Tne,p=Uw,h=(N,F)=>new RegExp(N,F);h.code="new RegExp";const y=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),b={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},v=200;function w(N){var F,V,_,k,M,I,K,G,re,oe,he,Se,Xe,ot,W,fe,ne,ze,ce,$e,qe,Pt,kr,yt,sr;const Z=N.strict,ee=(F=N.code)===null||F===void 0?void 0:F.optimize,be=ee===!0||ee===void 0?1:ee||0,Ee=(_=(V=N.code)===null||V===void 0?void 0:V.regExp)!==null&&_!==void 0?_:h,We=(k=N.uriResolver)!==null&&k!==void 0?k:p.default;return{strictSchema:(I=(M=N.strictSchema)!==null&&M!==void 0?M:Z)!==null&&I!==void 0?I:!0,strictNumbers:(G=(K=N.strictNumbers)!==null&&K!==void 0?K:Z)!==null&&G!==void 0?G:!0,strictTypes:(oe=(re=N.strictTypes)!==null&&re!==void 0?re:Z)!==null&&oe!==void 0?oe:"log",strictTuples:(Se=(he=N.strictTuples)!==null&&he!==void 0?he:Z)!==null&&Se!==void 0?Se:"log",strictRequired:(ot=(Xe=N.strictRequired)!==null&&Xe!==void 0?Xe:Z)!==null&&ot!==void 0?ot:!1,code:N.code?{...N.code,optimize:be,regExp:Ee}:{optimize:be,regExp:Ee},loopRequired:(W=N.loopRequired)!==null&&W!==void 0?W:v,loopEnum:(fe=N.loopEnum)!==null&&fe!==void 0?fe:v,meta:(ne=N.meta)!==null&&ne!==void 0?ne:!0,messages:(ze=N.messages)!==null&&ze!==void 0?ze:!0,inlineRefs:(ce=N.inlineRefs)!==null&&ce!==void 0?ce:!0,schemaId:($e=N.schemaId)!==null&&$e!==void 0?$e:"$id",addUsedSchema:(qe=N.addUsedSchema)!==null&&qe!==void 0?qe:!0,validateSchema:(Pt=N.validateSchema)!==null&&Pt!==void 0?Pt:!0,validateFormats:(kr=N.validateFormats)!==null&&kr!==void 0?kr:!0,unicodeRegExp:(yt=N.unicodeRegExp)!==null&&yt!==void 0?yt:!0,int32range:(sr=N.int32range)!==null&&sr!==void 0?sr:!0,uriResolver:We}}class S{constructor(F={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,F=this.opts={...F,...w(F)};const{es5:V,lines:_}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:m,es5:V,lines:_}),this.logger=O(F.logger);const k=F.validateFormats;F.validateFormats=!1,this.RULES=(0,i.getRules)(),E.call(this,b,F,"NOT SUPPORTED"),E.call(this,g,F,"DEPRECATED","warn"),this._metaOpts=$.call(this),F.formats&&P.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),F.keywords&&R.call(this,F.keywords),typeof F.meta=="object"&&this.addMetaSchema(F.meta),T.call(this),F.validateFormats=k}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:F,meta:V,schemaId:_}=this.opts;let k=f;_==="id"&&(k={...f},k.id=k.$id,delete k.$id),V&&F&&this.addMetaSchema(k,k[_],!1)}defaultMeta(){const{meta:F,schemaId:V}=this.opts;return this.opts.defaultMeta=typeof F=="object"?F[V]||F:void 0}validate(F,V){let _;if(typeof F=="string"){if(_=this.getSchema(F),!_)throw new Error(`no schema with key or ref "${F}"`)}else _=this.compile(F);const k=_(V);return"$async"in _||(this.errors=_.errors),k}compile(F,V){const _=this._addSchema(F,V);return _.validate||this._compileSchemaEnv(_)}compileAsync(F,V){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:_}=this.opts;return k.call(this,F,V);async function k(oe,he){await M.call(this,oe.$schema);const Se=this._addSchema(oe,he);return Se.validate||I.call(this,Se)}async function M(oe){oe&&!this.getSchema(oe)&&await k.call(this,{$ref:oe},!0)}async function I(oe){try{return this._compileSchemaEnv(oe)}catch(he){if(!(he instanceof a.default))throw he;return K.call(this,he),await G.call(this,he.missingSchema),I.call(this,oe)}}function K({missingSchema:oe,missingRef:he}){if(this.refs[oe])throw new Error(`AnySchema ${oe} is loaded but ${he} cannot be resolved`)}async function G(oe){const he=await re.call(this,oe);this.refs[oe]||await M.call(this,he.$schema),this.refs[oe]||this.addSchema(he,oe,V)}async function re(oe){const he=this._loading[oe];if(he)return he;try{return await(this._loading[oe]=_(oe))}finally{delete this._loading[oe]}}}addSchema(F,V,_,k=this.opts.validateSchema){if(Array.isArray(F)){for(const I of F)this.addSchema(I,void 0,_,k);return this}let M;if(typeof F=="object"){const{schemaId:I}=this.opts;if(M=F[I],M!==void 0&&typeof M!="string")throw new Error(`schema ${I} must be string`)}return V=(0,l.normalizeId)(V||M),this._checkUnique(V),this.schemas[V]=this._addSchema(F,_,V,k,!0),this}addMetaSchema(F,V,_=this.opts.validateSchema){return this.addSchema(F,V,!0,_),this}validateSchema(F,V){if(typeof F=="boolean")return!0;let _;if(_=F.$schema,_!==void 0&&typeof _!="string")throw new Error("$schema must be a string");if(_=_||this.opts.defaultMeta||this.defaultMeta(),!_)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const k=this.validate(_,F);if(!k&&V){const M="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(M);else throw new Error(M)}return k}getSchema(F){let V;for(;typeof(V=C.call(this,F))=="string";)F=V;if(V===void 0){const{schemaId:_}=this.opts,k=new s.SchemaEnv({schema:{},schemaId:_});if(V=s.resolveSchema.call(this,k,F),!V)return;this.refs[F]=V}return V.validate||this._compileSchemaEnv(V)}removeSchema(F){if(F instanceof RegExp)return this._removeAllSchemas(this.schemas,F),this._removeAllSchemas(this.refs,F),this;switch(typeof F){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const V=C.call(this,F);return typeof V=="object"&&this._cache.delete(V.schema),delete this.schemas[F],delete this.refs[F],this}case"object":{const V=F;this._cache.delete(V);let _=F[this.opts.schemaId];return _&&(_=(0,l.normalizeId)(_),delete this.schemas[_],delete this.refs[_]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(F){for(const V of F)this.addKeyword(V);return this}addKeyword(F,V){let _;if(typeof F=="string")_=F,typeof V=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),V.keyword=_);else if(typeof F=="object"&&V===void 0){if(V=F,_=V.keyword,Array.isArray(_)&&!_.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(D.call(this,_,V),!V)return(0,d.eachItem)(_,M=>A.call(this,M)),this;B.call(this,V);const k={...V,type:(0,u.getJSONTypes)(V.type),schemaType:(0,u.getJSONTypes)(V.schemaType)};return(0,d.eachItem)(_,k.type.length===0?M=>A.call(this,M,k):M=>k.type.forEach(I=>A.call(this,M,k,I))),this}getKeyword(F){const V=this.RULES.all[F];return typeof V=="object"?V.definition:!!V}removeKeyword(F){const{RULES:V}=this;delete V.keywords[F],delete V.all[F];for(const _ of V.rules){const k=_.rules.findIndex(M=>M.keyword===F);k>=0&&_.rules.splice(k,1)}return this}addFormat(F,V){return typeof V=="string"&&(V=new RegExp(V)),this.formats[F]=V,this}errorsText(F=this.errors,{separator:V=", ",dataVar:_="data"}={}){return!F||F.length===0?"No errors":F.map(k=>`${_}${k.instancePath} ${k.message}`).reduce((k,M)=>k+V+M)}$dataMetaSchema(F,V){const _=this.RULES.all;F=JSON.parse(JSON.stringify(F));for(const k of V){const M=k.split("/").slice(1);let I=F;for(const K of M)I=I[K];for(const K in _){const G=_[K];if(typeof G!="object")continue;const{$data:re}=G.definition,oe=I[K];re&&oe&&(I[K]=Y(oe))}}return F}_removeAllSchemas(F,V){for(const _ in F){const k=F[_];(!V||V.test(_))&&(typeof k=="string"?delete F[_]:k&&!k.meta&&(this._cache.delete(k.schema),delete F[_]))}}_addSchema(F,V,_,k=this.opts.validateSchema,M=this.opts.addUsedSchema){let I;const{schemaId:K}=this.opts;if(typeof F=="object")I=F[K];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof F!="boolean")throw new Error("schema must be object or boolean")}let G=this._cache.get(F);if(G!==void 0)return G;_=(0,l.normalizeId)(I||_);const re=l.getSchemaRefs.call(this,F,_);return G=new s.SchemaEnv({schema:F,schemaId:K,meta:V,baseId:_,localRefs:re}),this._cache.set(G.schema,G),M&&!_.startsWith("#")&&(_&&this._checkUnique(_),this.refs[_]=G),k&&this.validateSchema(F,!0),G}_checkUnique(F){if(this.schemas[F]||this.refs[F])throw new Error(`schema with key or id "${F}" already exists`)}_compileSchemaEnv(F){if(F.meta?this._compileMetaSchema(F):s.compileSchema.call(this,F),!F.validate)throw new Error("ajv implementation error");return F.validate}_compileMetaSchema(F){const V=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,F)}finally{this.opts=V}}}S.ValidationError=r.default,S.MissingRefError=a.default,e.default=S;function E(N,F,V,_="error"){for(const k in N){const M=k;M in F&&this.logger[_](`${V}: option ${k}. ${N[M]}`)}}function C(N){return N=(0,l.normalizeId)(N),this.schemas[N]||this.refs[N]}function T(){const N=this.opts.schemas;if(N)if(Array.isArray(N))this.addSchema(N);else for(const F in N)this.addSchema(N[F],F)}function P(){for(const N in this.opts.formats){const F=this.opts.formats[N];F&&this.addFormat(N,F)}}function R(N){if(Array.isArray(N)){this.addVocabulary(N);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const F in N){const V=N[F];V.keyword||(V.keyword=F),this.addKeyword(V)}}function $(){const N={...this.opts};for(const F of y)delete N[F];return N}const j={log(){},warn(){},error(){}};function O(N){if(N===!1)return j;if(N===void 0)return console;if(N.log&&N.warn&&N.error)return N;throw new Error("logger must implement log, warn and error methods")}const L=/^[a-z_$][a-z0-9_$:-]*$/i;function D(N,F){const{RULES:V}=this;if((0,d.eachItem)(N,_=>{if(V.keywords[_])throw new Error(`Keyword ${_} is already defined`);if(!L.test(_))throw new Error(`Keyword ${_} has invalid name`)}),!!F&&F.$data&&!("code"in F||"validate"in F))throw new Error('$data keyword must have "code" or "validate" function')}function A(N,F,V){var _;const k=F==null?void 0:F.post;if(V&&k)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:M}=this;let I=k?M.post:M.rules.find(({type:G})=>G===V);if(I||(I={type:V,rules:[]},M.rules.push(I)),M.keywords[N]=!0,!F)return;const K={keyword:N,definition:{...F,type:(0,u.getJSONTypes)(F.type),schemaType:(0,u.getJSONTypes)(F.schemaType)}};F.before?H.call(this,I,K,F.before):I.rules.push(K),M.all[N]=K,(_=F.implements)===null||_===void 0||_.forEach(G=>this.addKeyword(G))}function H(N,F,V){const _=N.rules.findIndex(k=>k.keyword===V);_>=0?N.rules.splice(_,0,F):(N.rules.push(F),this.logger.warn(`rule ${V} is not defined`))}function B(N){let{metaSchema:F}=N;F!==void 0&&(N.$data&&this.opts.$data&&(F=Y(F)),N.validateSchema=this.compile(F,!0))}const U={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Y(N){return{anyOf:[N,U]}}})(GM);var Gw={},Qw={},Yw={};Object.defineProperty(Yw,"__esModule",{value:!0});const Ere={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Yw.default=Ere;var Co={};Object.defineProperty(Co,"__esModule",{value:!0});Co.callRef=Co.getValidate=void 0;const Cre=Rc,QE=Fe,Qn=Le,Bo=$a,YE=er,Pf=de,Nre={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:r}=e,{baseId:a,schemaEnv:i,validateName:s,opts:o,self:l}=r,{root:u}=i;if((n==="#"||n==="#/")&&a===u.baseId)return f();const d=YE.resolveRef.call(l,u,a,n);if(d===void 0)throw new Cre.default(r.opts.uriResolver,a,n);if(d instanceof YE.SchemaEnv)return p(d);return h(d);function f(){if(i===u)return yh(e,s,i,i.$async);const y=t.scopeValue("root",{ref:u});return yh(e,(0,Qn._)`${y}.validate`,u,u.$async)}function p(y){const m=ZP(e,y);yh(e,m,y,y.$async)}function h(y){const m=t.scopeValue("schema",o.code.source===!0?{ref:y,code:(0,Qn.stringify)(y)}:{ref:y}),b=t.name("valid"),g=e.subschema({schema:y,dataTypes:[],schemaPath:Qn.nil,topSchemaRef:m,errSchemaPath:n},b);e.mergeEvaluated(g),e.ok(b)}}};function ZP(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):(0,Qn._)`${n.scopeValue("wrapper",{ref:t})}.validate`}Co.getValidate=ZP;function yh(e,t,n,r){const{gen:a,it:i}=e,{allErrors:s,schemaEnv:o,opts:l}=i,u=l.passContext?Bo.default.this:Qn.nil;r?d():f();function d(){if(!o.$async)throw new Error("async schema referenced by sync schema");const y=a.let("valid");a.try(()=>{a.code((0,Qn._)`await ${(0,QE.callValidateCode)(e,t,u)}`),h(t),s||a.assign(y,!0)},m=>{a.if((0,Qn._)`!(${m} instanceof ${i.ValidationError})`,()=>a.throw(m)),p(m),s||a.assign(y,!1)}),e.ok(y)}function f(){e.result((0,QE.callValidateCode)(e,t,u),()=>h(t),()=>p(t))}function p(y){const m=(0,Qn._)`${y}.errors`;a.assign(Bo.default.vErrors,(0,Qn._)`${Bo.default.vErrors} === null ? ${m} : ${Bo.default.vErrors}.concat(${m})`),a.assign(Bo.default.errors,(0,Qn._)`${Bo.default.vErrors}.length`)}function h(y){var m;if(!i.opts.unevaluated)return;const b=(m=n==null?void 0:n.validate)===null||m===void 0?void 0:m.evaluated;if(i.props!==!0)if(b&&!b.dynamicProps)b.props!==void 0&&(i.props=Pf.mergeEvaluated.props(a,b.props,i.props));else{const g=a.var("props",(0,Qn._)`${y}.evaluated.props`);i.props=Pf.mergeEvaluated.props(a,g,i.props,Qn.Name)}if(i.items!==!0)if(b&&!b.dynamicItems)b.items!==void 0&&(i.items=Pf.mergeEvaluated.items(a,b.items,i.items));else{const g=a.var("items",(0,Qn._)`${y}.evaluated.items`);i.items=Pf.mergeEvaluated.items(a,g,i.items,Qn.Name)}}}Co.callRef=yh;Co.default=Nre;Object.defineProperty(Qw,"__esModule",{value:!0});const jre=Yw,Tre=Co,Are=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",jre.default,Tre.default];Qw.default=Are;var Xw={},Ww={};Object.defineProperty(Ww,"__esModule",{value:!0});const Mp=Le,Ni=Mp.operators,Pp={maximum:{okStr:"<=",ok:Ni.LTE,fail:Ni.GT},minimum:{okStr:">=",ok:Ni.GTE,fail:Ni.LT},exclusiveMaximum:{okStr:"<",ok:Ni.LT,fail:Ni.GTE},exclusiveMinimum:{okStr:">",ok:Ni.GT,fail:Ni.LTE}},Rre={message:({keyword:e,schemaCode:t})=>(0,Mp.str)`must be ${Pp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Mp._)`{comparison: ${Pp[e].okStr}, limit: ${t}}`},$re={keyword:Object.keys(Pp),type:"number",schemaType:"number",$data:!0,error:Rre,code(e){const{keyword:t,data:n,schemaCode:r}=e;e.fail$data((0,Mp._)`${n} ${Pp[t].fail} ${r} || isNaN(${n})`)}};Ww.default=$re;var Jw={};Object.defineProperty(Jw,"__esModule",{value:!0});const Pu=Le,Ore={message:({schemaCode:e})=>(0,Pu.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Pu._)`{multipleOf: ${e}}`},Mre={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Ore,code(e){const{gen:t,data:n,schemaCode:r,it:a}=e,i=a.opts.multipleOfPrecision,s=t.let("res"),o=i?(0,Pu._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Pu._)`${s} !== parseInt(${s})`;e.fail$data((0,Pu._)`(${r} === 0 || (${s} = ${n}/${r}, ${o}))`)}};Jw.default=Mre;var e1={},t1={};Object.defineProperty(t1,"__esModule",{value:!0});function KP(e){const t=e.length;let n=0,r=0,a;for(;r<t;)n++,a=e.charCodeAt(r++),a>=55296&&a<=56319&&r<t&&(a=e.charCodeAt(r),(a&64512)===56320&&r++);return n}t1.default=KP;KP.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(e1,"__esModule",{value:!0});const Vs=Le,Pre=de,Dre=t1,zre={message({keyword:e,schemaCode:t}){const n=e==="maxLength"?"more":"fewer";return(0,Vs.str)`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>(0,Vs._)`{limit: ${e}}`},Ire={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:zre,code(e){const{keyword:t,data:n,schemaCode:r,it:a}=e,i=t==="maxLength"?Vs.operators.GT:Vs.operators.LT,s=a.opts.unicode===!1?(0,Vs._)`${n}.length`:(0,Vs._)`${(0,Pre.useFunc)(e.gen,Dre.default)}(${n})`;e.fail$data((0,Vs._)`${s} ${i} ${r}`)}};e1.default=Ire;var n1={};Object.defineProperty(n1,"__esModule",{value:!0});const Lre=Fe,Ure=de,gl=Le,Fre={message:({schemaCode:e})=>(0,gl.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,gl._)`{pattern: ${e}}`},qre={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Fre,code(e){const{gen:t,data:n,$data:r,schema:a,schemaCode:i,it:s}=e,o=s.opts.unicodeRegExp?"u":"";if(r){const{regExp:l}=s.opts.code,u=l.code==="new RegExp"?(0,gl._)`new RegExp`:(0,Ure.useFunc)(t,l),d=t.let("valid");t.try(()=>t.assign(d,(0,gl._)`${u}(${i}, ${o}).test(${n})`),()=>t.assign(d,!1)),e.fail$data((0,gl._)`!${d}`)}else{const l=(0,Lre.usePattern)(e,a);e.fail$data((0,gl._)`!${l}.test(${n})`)}}};n1.default=qre;var r1={};Object.defineProperty(r1,"__esModule",{value:!0});const Du=Le,Hre={message({keyword:e,schemaCode:t}){const n=e==="maxProperties"?"more":"fewer";return(0,Du.str)`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>(0,Du._)`{limit: ${e}}`},Bre={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Hre,code(e){const{keyword:t,data:n,schemaCode:r}=e,a=t==="maxProperties"?Du.operators.GT:Du.operators.LT;e.fail$data((0,Du._)`Object.keys(${n}).length ${a} ${r}`)}};r1.default=Bre;var a1={};Object.defineProperty(a1,"__esModule",{value:!0});const Yc=Fe,zu=Le,Vre=de,Zre={message:({params:{missingProperty:e}})=>(0,zu.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,zu._)`{missingProperty: ${e}}`},Kre={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Zre,code(e){const{gen:t,schema:n,schemaCode:r,data:a,$data:i,it:s}=e,{opts:o}=s;if(!i&&n.length===0)return;const l=n.length>=o.loopRequired;if(s.allErrors?u():d(),o.strictRequired){const h=e.parentSchema.properties,{definedProperties:y}=e.it;for(const m of n)if((h==null?void 0:h[m])===void 0&&!y.has(m)){const b=s.schemaEnv.baseId+s.errSchemaPath,g=`required property "${m}" is not defined at "${b}" (strictRequired)`;(0,Vre.checkStrictMode)(s,g,s.opts.strictRequired)}}function u(){if(l||i)e.block$data(zu.nil,f);else for(const h of n)(0,Yc.checkReportMissingProp)(e,h)}function d(){const h=t.let("missing");if(l||i){const y=t.let("valid",!0);e.block$data(y,()=>p(h,y)),e.ok(y)}else t.if((0,Yc.checkMissingProp)(e,n,h)),(0,Yc.reportMissingProp)(e,h),t.else()}function f(){t.forOf("prop",r,h=>{e.setParams({missingProperty:h}),t.if((0,Yc.noPropertyInData)(t,a,h,o.ownProperties),()=>e.error())})}function p(h,y){e.setParams({missingProperty:h}),t.forOf(h,r,()=>{t.assign(y,(0,Yc.propertyInData)(t,a,h,o.ownProperties)),t.if((0,zu.not)(y),()=>{e.error(),t.break()})},zu.nil)}}};a1.default=Kre;var i1={};Object.defineProperty(i1,"__esModule",{value:!0});const Iu=Le,Gre={message({keyword:e,schemaCode:t}){const n=e==="maxItems"?"more":"fewer";return(0,Iu.str)`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>(0,Iu._)`{limit: ${e}}`},Qre={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Gre,code(e){const{keyword:t,data:n,schemaCode:r}=e,a=t==="maxItems"?Iu.operators.GT:Iu.operators.LT;e.fail$data((0,Iu._)`${n}.length ${a} ${r}`)}};i1.default=Qre;var s1={},Gd={};Object.defineProperty(Gd,"__esModule",{value:!0});const GP=uP;GP.code='require("ajv/dist/runtime/equal").default';Gd.default=GP;Object.defineProperty(s1,"__esModule",{value:!0});const by=Wt,hn=Le,Yre=de,Xre=Gd,Wre={message:({params:{i:e,j:t}})=>(0,hn.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,hn._)`{i: ${e}, j: ${t}}`},Jre={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Wre,code(e){const{gen:t,data:n,$data:r,schema:a,parentSchema:i,schemaCode:s,it:o}=e;if(!r&&!a)return;const l=t.let("valid"),u=i.items?(0,by.getSchemaTypes)(i.items):[];e.block$data(l,d,(0,hn._)`${s} === false`),e.ok(l);function d(){const y=t.let("i",(0,hn._)`${n}.length`),m=t.let("j");e.setParams({i:y,j:m}),t.assign(l,!0),t.if((0,hn._)`${y} > 1`,()=>(f()?p:h)(y,m))}function f(){return u.length>0&&!u.some(y=>y==="object"||y==="array")}function p(y,m){const b=t.name("item"),g=(0,by.checkDataTypes)(u,b,o.opts.strictNumbers,by.DataType.Wrong),v=t.const("indices",(0,hn._)`{}`);t.for((0,hn._)`;${y}--;`,()=>{t.let(b,(0,hn._)`${n}[${y}]`),t.if(g,(0,hn._)`continue`),u.length>1&&t.if((0,hn._)`typeof ${b} == "string"`,(0,hn._)`${b} += "_"`),t.if((0,hn._)`typeof ${v}[${b}] == "number"`,()=>{t.assign(m,(0,hn._)`${v}[${b}]`),e.error(),t.assign(l,!1).break()}).code((0,hn._)`${v}[${b}] = ${y}`)})}function h(y,m){const b=(0,Yre.useFunc)(t,Xre.default),g=t.name("outer");t.label(g).for((0,hn._)`;${y}--;`,()=>t.for((0,hn._)`${m} = ${y}; ${m}--;`,()=>t.if((0,hn._)`${b}(${n}[${y}], ${n}[${m}])`,()=>{e.error(),t.assign(l,!1).break(g)})))}}};s1.default=Jre;var o1={};Object.defineProperty(o1,"__esModule",{value:!0});const q0=Le,eae=de,tae=Gd,nae={message:"must be equal to constant",params:({schemaCode:e})=>(0,q0._)`{allowedValue: ${e}}`},rae={keyword:"const",$data:!0,error:nae,code(e){const{gen:t,data:n,$data:r,schemaCode:a,schema:i}=e;r||i&&typeof i=="object"?e.fail$data((0,q0._)`!${(0,eae.useFunc)(t,tae.default)}(${n}, ${a})`):e.fail((0,q0._)`${i} !== ${n}`)}};o1.default=rae;var l1={};Object.defineProperty(l1,"__esModule",{value:!0});const cu=Le,aae=de,iae=Gd,sae={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,cu._)`{allowedValues: ${e}}`},oae={keyword:"enum",schemaType:"array",$data:!0,error:sae,code(e){const{gen:t,data:n,$data:r,schema:a,schemaCode:i,it:s}=e;if(!r&&a.length===0)throw new Error("enum must have non-empty array");const o=a.length>=s.opts.loopEnum;let l;const u=()=>l??(l=(0,aae.useFunc)(t,iae.default));let d;if(o||r)d=t.let("valid"),e.block$data(d,f);else{if(!Array.isArray(a))throw new Error("ajv implementation error");const h=t.const("vSchema",i);d=(0,cu.or)(...a.map((y,m)=>p(h,m)))}e.pass(d);function f(){t.assign(d,!1),t.forOf("v",i,h=>t.if((0,cu._)`${u()}(${n}, ${h})`,()=>t.assign(d,!0).break()))}function p(h,y){const m=a[y];return typeof m=="object"&&m!==null?(0,cu._)`${u()}(${n}, ${h}[${y}])`:(0,cu._)`${n} === ${m}`}}};l1.default=oae;Object.defineProperty(Xw,"__esModule",{value:!0});const lae=Ww,cae=Jw,uae=e1,dae=n1,fae=r1,hae=a1,pae=i1,mae=s1,gae=o1,yae=l1,vae=[lae.default,cae.default,uae.default,dae.default,fae.default,hae.default,pae.default,mae.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},gae.default,yae.default];Xw.default=vae;var c1={},Oc={};Object.defineProperty(Oc,"__esModule",{value:!0});Oc.validateAdditionalItems=void 0;const Zs=Le,H0=de,bae={message:({params:{len:e}})=>(0,Zs.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Zs._)`{limit: ${e}}`},xae={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:bae,code(e){const{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){(0,H0.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}QP(e,r)}};function QP(e,t){const{gen:n,schema:r,data:a,keyword:i,it:s}=e;s.items=!0;const o=n.const("len",(0,Zs._)`${a}.length`);if(r===!1)e.setParams({len:t.length}),e.pass((0,Zs._)`${o} <= ${t.length}`);else if(typeof r=="object"&&!(0,H0.alwaysValidSchema)(s,r)){const u=n.var("valid",(0,Zs._)`${o} <= ${t.length}`);n.if((0,Zs.not)(u),()=>l(u)),e.ok(u)}function l(u){n.forRange("i",t.length,o,d=>{e.subschema({keyword:i,dataProp:d,dataPropType:H0.Type.Num},u),s.allErrors||n.if((0,Zs.not)(u),()=>n.break())})}}Oc.validateAdditionalItems=QP;Oc.default=xae;var u1={},Mc={};Object.defineProperty(Mc,"__esModule",{value:!0});Mc.validateTuple=void 0;const XE=Le,vh=de,wae=Fe,Sae={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return YP(e,"additionalItems",t);n.items=!0,!(0,vh.alwaysValidSchema)(n,t)&&e.ok((0,wae.validateArray)(e))}};function YP(e,t,n=e.schema){const{gen:r,parentSchema:a,data:i,keyword:s,it:o}=e;d(a),o.opts.unevaluated&&n.length&&o.items!==!0&&(o.items=vh.mergeEvaluated.items(r,n.length,o.items));const l=r.name("valid"),u=r.const("len",(0,XE._)`${i}.length`);n.forEach((f,p)=>{(0,vh.alwaysValidSchema)(o,f)||(r.if((0,XE._)`${u} > ${p}`,()=>e.subschema({keyword:s,schemaProp:p,dataProp:p},l)),e.ok(l))});function d(f){const{opts:p,errSchemaPath:h}=o,y=n.length,m=y===f.minItems&&(y===f.maxItems||f[t]===!1);if(p.strictTuples&&!m){const b=`"${s}" is ${y}-tuple, but minItems or maxItems/${t} are not specified or different at path "${h}"`;(0,vh.checkStrictMode)(o,b,p.strictTuples)}}}Mc.validateTuple=YP;Mc.default=Sae;Object.defineProperty(u1,"__esModule",{value:!0});const _ae=Mc,kae={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,_ae.validateTuple)(e,"items")};u1.default=kae;var d1={};Object.defineProperty(d1,"__esModule",{value:!0});const WE=Le,Eae=de,Cae=Fe,Nae=Oc,jae={message:({params:{len:e}})=>(0,WE.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,WE._)`{limit: ${e}}`},Tae={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:jae,code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:a}=n;r.items=!0,!(0,Eae.alwaysValidSchema)(r,t)&&(a?(0,Nae.validateAdditionalItems)(e,a):e.ok((0,Cae.validateArray)(e)))}};d1.default=Tae;var f1={};Object.defineProperty(f1,"__esModule",{value:!0});const Tr=Le,Df=de,Aae={message:({params:{min:e,max:t}})=>t===void 0?(0,Tr.str)`must contain at least ${e} valid item(s)`:(0,Tr.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Tr._)`{minContains: ${e}}`:(0,Tr._)`{minContains: ${e}, maxContains: ${t}}`},Rae={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Aae,code(e){const{gen:t,schema:n,parentSchema:r,data:a,it:i}=e;let s,o;const{minContains:l,maxContains:u}=r;i.opts.next?(s=l===void 0?1:l,o=u):s=1;const d=t.const("len",(0,Tr._)`${a}.length`);if(e.setParams({min:s,max:o}),o===void 0&&s===0){(0,Df.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(o!==void 0&&s>o){(0,Df.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Df.alwaysValidSchema)(i,n)){let m=(0,Tr._)`${d} >= ${s}`;o!==void 0&&(m=(0,Tr._)`${m} && ${d} <= ${o}`),e.pass(m);return}i.items=!0;const f=t.name("valid");o===void 0&&s===1?h(f,()=>t.if(f,()=>t.break())):s===0?(t.let(f,!0),o!==void 0&&t.if((0,Tr._)`${a}.length > 0`,p)):(t.let(f,!1),p()),e.result(f,()=>e.reset());function p(){const m=t.name("_valid"),b=t.let("count",0);h(m,()=>t.if(m,()=>y(b)))}function h(m,b){t.forRange("i",0,d,g=>{e.subschema({keyword:"contains",dataProp:g,dataPropType:Df.Type.Num,compositeRule:!0},m),b()})}function y(m){t.code((0,Tr._)`${m}++`),o===void 0?t.if((0,Tr._)`${m} >= ${s}`,()=>t.assign(f,!0).break()):(t.if((0,Tr._)`${m} > ${o}`,()=>t.assign(f,!1).break()),s===1?t.assign(f,!0):t.if((0,Tr._)`${m} >= ${s}`,()=>t.assign(f,!0)))}}};f1.default=Rae;var XP={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=Le,n=de,r=Fe;e.error={message:({params:{property:l,depsCount:u,deps:d}})=>{const f=u===1?"property":"properties";return(0,t.str)`must have ${f} ${d} when property ${l} is present`},params:({params:{property:l,depsCount:u,deps:d,missingProperty:f}})=>(0,t._)`{property: ${l},
487
- missingProperty: ${f},
488
- depsCount: ${u},
489
- deps: ${d}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(l){const[u,d]=i(l);s(l,u),o(l,d)}};function i({schema:l}){const u={},d={};for(const f in l){if(f==="__proto__")continue;const p=Array.isArray(l[f])?u:d;p[f]=l[f]}return[u,d]}function s(l,u=l.schema){const{gen:d,data:f,it:p}=l;if(Object.keys(u).length===0)return;const h=d.let("missing");for(const y in u){const m=u[y];if(m.length===0)continue;const b=(0,r.propertyInData)(d,f,y,p.opts.ownProperties);l.setParams({property:y,depsCount:m.length,deps:m.join(", ")}),p.allErrors?d.if(b,()=>{for(const g of m)(0,r.checkReportMissingProp)(l,g)}):(d.if((0,t._)`${b} && (${(0,r.checkMissingProp)(l,m,h)})`),(0,r.reportMissingProp)(l,h),d.else())}}e.validatePropertyDeps=s;function o(l,u=l.schema){const{gen:d,data:f,keyword:p,it:h}=l,y=d.name("valid");for(const m in u)(0,n.alwaysValidSchema)(h,u[m])||(d.if((0,r.propertyInData)(d,f,m,h.opts.ownProperties),()=>{const b=l.subschema({keyword:p,schemaProp:m},y);l.mergeValidEvaluated(b,y)},()=>d.var(y,!0)),l.ok(y))}e.validateSchemaDeps=o,e.default=a})(XP);var h1={};Object.defineProperty(h1,"__esModule",{value:!0});const WP=Le,$ae=de,Oae={message:"property name must be valid",params:({params:e})=>(0,WP._)`{propertyName: ${e.propertyName}}`},Mae={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Oae,code(e){const{gen:t,schema:n,data:r,it:a}=e;if((0,$ae.alwaysValidSchema)(a,n))return;const i=t.name("valid");t.forIn("key",r,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),t.if((0,WP.not)(i),()=>{e.error(!0),a.allErrors||t.break()})}),e.ok(i)}};h1.default=Mae;var Fm={};Object.defineProperty(Fm,"__esModule",{value:!0});const zf=Fe,Kr=Le,Pae=$a,If=de,Dae={message:"must NOT have additional properties",params:({params:e})=>(0,Kr._)`{additionalProperty: ${e.additionalProperty}}`},zae={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Dae,code(e){const{gen:t,schema:n,parentSchema:r,data:a,errsCount:i,it:s}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:o,opts:l}=s;if(s.props=!0,l.removeAdditional!=="all"&&(0,If.alwaysValidSchema)(s,n))return;const u=(0,zf.allSchemaProperties)(r.properties),d=(0,zf.allSchemaProperties)(r.patternProperties);f(),e.ok((0,Kr._)`${i} === ${Pae.default.errors}`);function f(){t.forIn("key",a,b=>{!u.length&&!d.length?y(b):t.if(p(b),()=>y(b))})}function p(b){let g;if(u.length>8){const v=(0,If.schemaRefOrVal)(s,r.properties,"properties");g=(0,zf.isOwnProperty)(t,v,b)}else u.length?g=(0,Kr.or)(...u.map(v=>(0,Kr._)`${b} === ${v}`)):g=Kr.nil;return d.length&&(g=(0,Kr.or)(g,...d.map(v=>(0,Kr._)`${(0,zf.usePattern)(e,v)}.test(${b})`))),(0,Kr.not)(g)}function h(b){t.code((0,Kr._)`delete ${a}[${b}]`)}function y(b){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){h(b);return}if(n===!1){e.setParams({additionalProperty:b}),e.error(),o||t.break();return}if(typeof n=="object"&&!(0,If.alwaysValidSchema)(s,n)){const g=t.name("valid");l.removeAdditional==="failing"?(m(b,g,!1),t.if((0,Kr.not)(g),()=>{e.reset(),h(b)})):(m(b,g),o||t.if((0,Kr.not)(g),()=>t.break()))}}function m(b,g,v){const w={keyword:"additionalProperties",dataProp:b,dataPropType:If.Type.Str};v===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(w,g)}}};Fm.default=zae;var p1={};Object.defineProperty(p1,"__esModule",{value:!0});const Iae=ra,JE=Fe,xy=de,eC=Fm,Lae={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:r,data:a,it:i}=e;i.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&eC.default.code(new Iae.KeywordCxt(i,eC.default,"additionalProperties"));const s=(0,JE.allSchemaProperties)(n);for(const f of s)i.definedProperties.add(f);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=xy.mergeEvaluated.props(t,(0,xy.toHash)(s),i.props));const o=s.filter(f=>!(0,xy.alwaysValidSchema)(i,n[f]));if(o.length===0)return;const l=t.name("valid");for(const f of o)u(f)?d(f):(t.if((0,JE.propertyInData)(t,a,f,i.opts.ownProperties)),d(f),i.allErrors||t.else().var(l,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(l);function u(f){return i.opts.useDefaults&&!i.compositeRule&&n[f].default!==void 0}function d(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},l)}}};p1.default=Lae;var m1={};Object.defineProperty(m1,"__esModule",{value:!0});const tC=Fe,Lf=Le,nC=de,rC=de,Uae={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:r,parentSchema:a,it:i}=e,{opts:s}=i,o=(0,tC.allSchemaProperties)(n),l=o.filter(m=>(0,nC.alwaysValidSchema)(i,n[m]));if(o.length===0||l.length===o.length&&(!i.opts.unevaluated||i.props===!0))return;const u=s.strictSchema&&!s.allowMatchingProperties&&a.properties,d=t.name("valid");i.props!==!0&&!(i.props instanceof Lf.Name)&&(i.props=(0,rC.evaluatedPropsToName)(t,i.props));const{props:f}=i;p();function p(){for(const m of o)u&&h(m),i.allErrors?y(m):(t.var(d,!0),y(m),t.if(d))}function h(m){for(const b in u)new RegExp(m).test(b)&&(0,nC.checkStrictMode)(i,`property ${b} matches pattern ${m} (use allowMatchingProperties)`)}function y(m){t.forIn("key",r,b=>{t.if((0,Lf._)`${(0,tC.usePattern)(e,m)}.test(${b})`,()=>{const g=l.includes(m);g||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:b,dataPropType:rC.Type.Str},d),i.opts.unevaluated&&f!==!0?t.assign((0,Lf._)`${f}[${b}]`,!0):!g&&!i.allErrors&&t.if((0,Lf.not)(d),()=>t.break())})})}}};m1.default=Uae;var g1={};Object.defineProperty(g1,"__esModule",{value:!0});const Fae=de,qae={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:r}=e;if((0,Fae.alwaysValidSchema)(r,n)){e.fail();return}const a=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};g1.default=qae;var y1={};Object.defineProperty(y1,"__esModule",{value:!0});const Hae=Fe,Bae={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Hae.validateUnion,error:{message:"must match a schema in anyOf"}};y1.default=Bae;var v1={};Object.defineProperty(v1,"__esModule",{value:!0});const bh=Le,Vae=de,Zae={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,bh._)`{passingSchemas: ${e.passing}}`},Kae={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Zae,code(e){const{gen:t,schema:n,parentSchema:r,it:a}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(a.opts.discriminator&&r.discriminator)return;const i=n,s=t.let("valid",!1),o=t.let("passing",null),l=t.name("_valid");e.setParams({passing:o}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((d,f)=>{let p;(0,Vae.alwaysValidSchema)(a,d)?t.var(l,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},l),f>0&&t.if((0,bh._)`${l} && ${s}`).assign(s,!1).assign(o,(0,bh._)`[${o}, ${f}]`).else(),t.if(l,()=>{t.assign(s,!0),t.assign(o,f),p&&e.mergeEvaluated(p,bh.Name)})})}}};v1.default=Kae;var b1={};Object.defineProperty(b1,"__esModule",{value:!0});const Gae=de,Qae={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const a=t.name("valid");n.forEach((i,s)=>{if((0,Gae.alwaysValidSchema)(r,i))return;const o=e.subschema({keyword:"allOf",schemaProp:s},a);e.ok(a),e.mergeEvaluated(o)})}};b1.default=Qae;var x1={};Object.defineProperty(x1,"__esModule",{value:!0});const Dp=Le,JP=de,Yae={message:({params:e})=>(0,Dp.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Dp._)`{failingKeyword: ${e.ifClause}}`},Xae={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Yae,code(e){const{gen:t,parentSchema:n,it:r}=e;n.then===void 0&&n.else===void 0&&(0,JP.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const a=aC(r,"then"),i=aC(r,"else");if(!a&&!i)return;const s=t.let("valid",!0),o=t.name("_valid");if(l(),e.reset(),a&&i){const d=t.let("ifClause");e.setParams({ifClause:d}),t.if(o,u("then",d),u("else",d))}else a?t.if(o,u("then")):t.if((0,Dp.not)(o),u("else"));e.pass(s,()=>e.error(!0));function l(){const d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},o);e.mergeEvaluated(d)}function u(d,f){return()=>{const p=e.subschema({keyword:d},o);t.assign(s,o),e.mergeValidEvaluated(p,s),f?t.assign(f,(0,Dp._)`${d}`):e.setParams({ifClause:d})}}}};function aC(e,t){const n=e.schema[t];return n!==void 0&&!(0,JP.alwaysValidSchema)(e,n)}x1.default=Xae;var w1={};Object.defineProperty(w1,"__esModule",{value:!0});const Wae=de,Jae={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){t.if===void 0&&(0,Wae.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};w1.default=Jae;Object.defineProperty(c1,"__esModule",{value:!0});const eie=Oc,tie=u1,nie=Mc,rie=d1,aie=f1,iie=XP,sie=h1,oie=Fm,lie=p1,cie=m1,uie=g1,die=y1,fie=v1,hie=b1,pie=x1,mie=w1;function gie(e=!1){const t=[uie.default,die.default,fie.default,hie.default,pie.default,mie.default,sie.default,oie.default,iie.default,lie.default,cie.default];return e?t.push(tie.default,rie.default):t.push(eie.default,nie.default),t.push(aie.default),t}c1.default=gie;var S1={},_1={};Object.defineProperty(_1,"__esModule",{value:!0});const qt=Le,yie={message:({schemaCode:e})=>(0,qt.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,qt._)`{format: ${e}}`},vie={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:yie,code(e,t){const{gen:n,data:r,$data:a,schema:i,schemaCode:s,it:o}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=o;if(!l.validateFormats)return;a?p():h();function p(){const y=n.scopeValue("formats",{ref:f.formats,code:l.code.formats}),m=n.const("fDef",(0,qt._)`${y}[${s}]`),b=n.let("fType"),g=n.let("format");n.if((0,qt._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>n.assign(b,(0,qt._)`${m}.type || "string"`).assign(g,(0,qt._)`${m}.validate`),()=>n.assign(b,(0,qt._)`"string"`).assign(g,m)),e.fail$data((0,qt.or)(v(),w()));function v(){return l.strictSchema===!1?qt.nil:(0,qt._)`${s} && !${g}`}function w(){const S=d.$async?(0,qt._)`(${m}.async ? await ${g}(${r}) : ${g}(${r}))`:(0,qt._)`${g}(${r})`,E=(0,qt._)`(typeof ${g} == "function" ? ${S} : ${g}.test(${r}))`;return(0,qt._)`${g} && ${g} !== true && ${b} === ${t} && !${E}`}}function h(){const y=f.formats[i];if(!y){v();return}if(y===!0)return;const[m,b,g]=w(y);m===t&&e.pass(S());function v(){if(l.strictSchema===!1){f.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function w(E){const C=E instanceof RegExp?(0,qt.regexpCode)(E):l.code.formats?(0,qt._)`${l.code.formats}${(0,qt.getProperty)(i)}`:void 0,T=n.scopeValue("formats",{key:i,ref:E,code:C});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,qt._)`${T}.validate`]:["string",E,T]}function S(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!d.$async)throw new Error("async format in sync schema");return(0,qt._)`await ${g}(${r})`}return typeof b=="function"?(0,qt._)`${g}(${r})`:(0,qt._)`${g}.test(${r})`}}}};_1.default=vie;Object.defineProperty(S1,"__esModule",{value:!0});const bie=_1,xie=[bie.default];S1.default=xie;var dc={};Object.defineProperty(dc,"__esModule",{value:!0});dc.contentVocabulary=dc.metadataVocabulary=void 0;dc.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];dc.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Gw,"__esModule",{value:!0});const wie=Qw,Sie=Xw,_ie=c1,kie=S1,iC=dc,Eie=[wie.default,Sie.default,(0,_ie.default)(),kie.default,iC.metadataVocabulary,iC.contentVocabulary];Gw.default=Eie;var k1={},qm={};Object.defineProperty(qm,"__esModule",{value:!0});qm.DiscrError=void 0;var sC;(function(e){e.Tag="tag",e.Mapping="mapping"})(sC||(qm.DiscrError=sC={}));Object.defineProperty(k1,"__esModule",{value:!0});const el=Le,B0=qm,oC=er,Cie=Rc,Nie=de,jie={message:({params:{discrError:e,tagName:t}})=>e===B0.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>(0,el._)`{error: ${e}, tag: ${n}, tagValue: ${t}}`},Tie={keyword:"discriminator",type:"object",schemaType:"object",error:jie,code(e){const{gen:t,data:n,schema:r,parentSchema:a,it:i}=e,{oneOf:s}=a;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");const o=r.propertyName;if(typeof o!="string")throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");const l=t.let("valid",!1),u=t.const("tag",(0,el._)`${n}${(0,el.getProperty)(o)}`);t.if((0,el._)`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:B0.DiscrError.Tag,tag:u,tagName:o})),e.ok(l);function d(){const h=p();t.if(!1);for(const y in h)t.elseIf((0,el._)`${u} === ${y}`),t.assign(l,f(h[y]));t.else(),e.error(!1,{discrError:B0.DiscrError.Mapping,tag:u,tagName:o}),t.endIf()}function f(h){const y=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:h},y);return e.mergeEvaluated(m,el.Name),y}function p(){var h;const y={},m=g(a);let b=!0;for(let S=0;S<s.length;S++){let E=s[S];if(E!=null&&E.$ref&&!(0,Nie.schemaHasRulesButRef)(E,i.self.RULES)){const T=E.$ref;if(E=oC.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,T),E instanceof oC.SchemaEnv&&(E=E.schema),E===void 0)throw new Cie.default(i.opts.uriResolver,i.baseId,T)}const C=(h=E==null?void 0:E.properties)===null||h===void 0?void 0:h[o];if(typeof C!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${o}"`);b=b&&(m||g(E)),v(C,S)}if(!b)throw new Error(`discriminator: "${o}" must be required`);return y;function g({required:S}){return Array.isArray(S)&&S.includes(o)}function v(S,E){if(S.const)w(S.const,E);else if(S.enum)for(const C of S.enum)w(C,E);else throw new Error(`discriminator: "properties/${o}" must have "const" or "enum"`)}function w(S,E){if(typeof S!="string"||S in y)throw new Error(`discriminator: "${o}" values must be unique strings`);y[S]=E}}}};k1.default=Tie;const Aie="http://json-schema.org/draft-07/schema#",Rie="http://json-schema.org/draft-07/schema#",$ie="Core schema meta-schema",Oie={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},Mie=["object","boolean"],Pie={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},Die={$schema:Aie,$id:Rie,title:$ie,definitions:Oie,type:Mie,properties:Pie,default:!0};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const n=GM,r=Gw,a=k1,i=Die,s=["/properties"],o="http://json-schema.org/draft-07/schema";class l extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(y=>this.addVocabulary(y)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const y=this.opts.$data?this.$dataMetaSchema(i,s):i;this.addMetaSchema(y,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}t.Ajv=l,e.exports=t=l,e.exports.Ajv=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var u=ra;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=Le;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var f=Kd;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var p=Rc;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})(D0,D0.exports);var eD=D0.exports;const zie=fc(eD);var V0={exports:{}},tD={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(j,O){return{validate:j,compare:O}}e.fullFormats={date:t(i,s),time:t(l(!0),u),"date-time":t(p(!0),h),"iso-time":t(l(),d),"iso-date-time":t(p(),y),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:g,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:$,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:w,int32:{type:"number",validate:C},int64:{type:"number",validate:T},float:{type:"number",validate:P},double:{type:"number",validate:P},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,y),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(j){return j%4===0&&(j%100!==0||j%400===0)}const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(j){const O=r.exec(j);if(!O)return!1;const L=+O[1],D=+O[2],A=+O[3];return D>=1&&D<=12&&A>=1&&A<=(D===2&&n(L)?29:a[D])}function s(j,O){if(j&&O)return j>O?1:j<O?-1:0}const o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(j){return function(L){const D=o.exec(L);if(!D)return!1;const A=+D[1],H=+D[2],B=+D[3],U=D[4],Y=D[5]==="-"?-1:1,N=+(D[6]||0),F=+(D[7]||0);if(N>23||F>59||j&&!U)return!1;if(A<=23&&H<=59&&B<60)return!0;const V=H-F*Y,_=A-N*Y-(V<0?1:0);return(_===23||_===-1)&&(V===59||V===-1)&&B<61}}function u(j,O){if(!(j&&O))return;const L=new Date("2020-01-01T"+j).valueOf(),D=new Date("2020-01-01T"+O).valueOf();if(L&&D)return L-D}function d(j,O){if(!(j&&O))return;const L=o.exec(j),D=o.exec(O);if(L&&D)return j=L[1]+L[2]+L[3],O=D[1]+D[2]+D[3],j>O?1:j<O?-1:0}const f=/t|\s/i;function p(j){const O=l(j);return function(D){const A=D.split(f);return A.length===2&&i(A[0])&&O(A[1])}}function h(j,O){if(!(j&&O))return;const L=new Date(j).valueOf(),D=new Date(O).valueOf();if(L&&D)return L-D}function y(j,O){if(!(j&&O))return;const[L,D]=j.split(f),[A,H]=O.split(f),B=s(L,A);if(B!==void 0)return B||u(D,H)}const m=/\/|:/,b=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function g(j){return m.test(j)&&b.test(j)}const v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function w(j){return v.lastIndex=0,v.test(j)}const S=-2147483648,E=2**31-1;function C(j){return Number.isInteger(j)&&j<=E&&j>=S}function T(j){return Number.isInteger(j)}function P(){return!0}const R=/[^\\]\\Z/;function $(j){if(R.test(j))return!1;try{return new RegExp(j),!0}catch{return!1}}})(tD);var nD={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=eD,n=Le,r=n.operators,a={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},i={message:({keyword:o,schemaCode:l})=>(0,n.str)`should be ${a[o].okStr} ${l}`,params:({keyword:o,schemaCode:l})=>(0,n._)`{comparison: ${a[o].okStr}, limit: ${l}}`};e.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:i,code(o){const{gen:l,data:u,schemaCode:d,keyword:f,it:p}=o,{opts:h,self:y}=p;if(!h.validateFormats)return;const m=new t.KeywordCxt(p,y.RULES.all.format.definition,"format");m.$data?b():g();function b(){const w=l.scopeValue("formats",{ref:y.formats,code:h.code.formats}),S=l.const("fmt",(0,n._)`${w}[${m.schemaCode}]`);o.fail$data((0,n.or)((0,n._)`typeof ${S} != "object"`,(0,n._)`${S} instanceof RegExp`,(0,n._)`typeof ${S}.compare != "function"`,v(S)))}function g(){const w=m.schema,S=y.formats[w];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${f}": format "${w}" does not define "compare" function`);const E=l.scopeValue("formats",{key:w,ref:S,code:h.code.formats?(0,n._)`${h.code.formats}${(0,n.getProperty)(w)}`:void 0});o.fail$data(v(E))}function v(w){return(0,n._)`${w}.compare(${u}, ${d}) ${a[f].fail} 0`}},dependencies:["format"]};const s=o=>(o.addKeyword(e.formatLimitDefinition),o);e.default=s})(nD);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n=tD,r=nD,a=Le,i=new a.Name("fullFormats"),s=new a.Name("fastFormats"),o=(u,d={keywords:!0})=>{if(Array.isArray(d))return l(u,d,n.fullFormats,i),u;const[f,p]=d.mode==="fast"?[n.fastFormats,s]:[n.fullFormats,i],h=d.formats||n.formatNames;return l(u,h,f,p),d.keywords&&(0,r.default)(u),u};o.get=(u,d="full")=>{const p=(d==="fast"?n.fastFormats:n.fullFormats)[u];if(!p)throw new Error(`Unknown format "${u}"`);return p};function l(u,d,f,p){var h,y;(h=(y=u.opts.code).formats)!==null&&h!==void 0||(y.formats=(0,a._)`require("ajv-formats/dist/formats").${p}`);for(const m of d)u.addFormat(m,f[m])}e.exports=t=o,Object.defineProperty(t,"__esModule",{value:!0}),t.default=o})(V0,V0.exports);var Iie=V0.exports;const Lie=fc(Iie);function Uie(){const e=new zie({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Lie(e),e}class Fie{constructor(t){this._ajv=t??Uie()}getValidator(t){const n="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return r=>n(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}}class qie{constructor(t){this._client=t}async*callToolStream(t,n=Vd,r){const a=this._client,i={...r,task:(r==null?void 0:r.task)??(a.isToolTask(t.name)?{}:void 0)},s=a.requestStream({method:"tools/call",params:t},n,i),o=a.getToolOutputValidator(t.name);for await(const l of s){if(l.type==="result"&&o){const u=l.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new ke(Ae.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{const d=o(u.structuredContent);if(!d.valid){yield{type:"error",error:new ke(Ae.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof ke){yield{type:"error",error:d};return}yield{type:"error",error:new ke(Ae.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield l}}async getTask(t,n){return this._client.getTask({taskId:t},n)}async getTaskResult(t,n,r){return this._client.getTaskResult({taskId:t},n,r)}async listTasks(t,n){return this._client.listTasks(t?{cursor:t}:void 0,n)}async cancelTask(t,n){return this._client.cancelTask({taskId:t},n)}requestStream(t,n,r){return this._client.requestStream(t,n,r)}}function Hie(e,t,n){var r;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!((r=e.tools)!=null&&r.call))throw new Error(`${n} does not support task creation for tools/call (required for ${t})`);break}}function Bie(e,t,n){var r,a;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!((r=e.sampling)!=null&&r.createMessage))throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!((a=e.elicitation)!=null&&a.create))throw new Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break}}function xh(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){const n=t,r=e.properties;for(const a of Object.keys(r)){const i=r[a];n[a]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(n[a]=i.default),n[a]!==void 0&&xh(i,n[a])}}if(Array.isArray(e.anyOf))for(const n of e.anyOf)typeof n!="boolean"&&xh(n,t);if(Array.isArray(e.oneOf))for(const n of e.oneOf)typeof n!="boolean"&&xh(n,t)}}function Vie(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};const t=e.form!==void 0,n=e.url!==void 0;return{supportsFormMode:t||!t&&!n,supportsUrlMode:n}}class Zie extends Tee{constructor(t,n){super(n),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=(n==null?void 0:n.capabilities)??{},this._jsonSchemaValidator=(n==null?void 0:n.jsonSchemaValidator)??new Fie,n!=null&&n.listChanged&&(this._pendingListChangedConfig=n.listChanged)}_setupListChangedHandlers(t){var n,r,a,i,s,o;t.tools&&((r=(n=this._serverCapabilities)==null?void 0:n.tools)!=null&&r.listChanged)&&this._setupListChangedHandler("tools",RM,t.tools,async()=>(await this.listTools()).tools),t.prompts&&((i=(a=this._serverCapabilities)==null?void 0:a.prompts)!=null&&i.listChanged)&&this._setupListChangedHandler("prompts",TM,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&((o=(s=this._serverCapabilities)==null?void 0:s.resources)!=null&&o.listChanged)&&this._setupListChangedHandler("resources",jM,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new qie(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Aee(this._capabilities,t)}setRequestHandler(t,n){var o;const r=KM(t),a=r==null?void 0:r.method;if(!a)throw new Error("Schema is missing a method literal");let i;if(Dm(a)){const l=a,u=(o=l._zod)==null?void 0:o.def;i=(u==null?void 0:u.value)??l.value}else{const l=a,u=l._def;i=(u==null?void 0:u.value)??l.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");const s=i;if(s==="elicitation/create"){const l=async(u,d)=>{var w,S;const f=Mi(DM,u);if(!f.success){const E=f.error instanceof Error?f.error.message:String(f.error);throw new ke(Ae.InvalidParams,`Invalid elicitation request: ${E}`)}const{params:p}=f.data;p.mode=p.mode??"form";const{supportsFormMode:h,supportsUrlMode:y}=Vie(this._capabilities.elicitation);if(p.mode==="form"&&!h)throw new ke(Ae.InvalidParams,"Client does not support form-mode elicitation requests");if(p.mode==="url"&&!y)throw new ke(Ae.InvalidParams,"Client does not support URL-mode elicitation requests");const m=await Promise.resolve(n(u,d));if(p.task){const E=Mi(od,m);if(!E.success){const C=E.error instanceof Error?E.error.message:String(E.error);throw new ke(Ae.InvalidParams,`Invalid task creation result: ${C}`)}return E.data}const b=Mi(zM,m);if(!b.success){const E=b.error instanceof Error?b.error.message:String(b.error);throw new ke(Ae.InvalidParams,`Invalid elicitation result: ${E}`)}const g=b.data,v=p.mode==="form"?p.requestedSchema:void 0;if(p.mode==="form"&&g.action==="accept"&&g.content&&v&&(S=(w=this._capabilities.elicitation)==null?void 0:w.form)!=null&&S.applyDefaults)try{xh(v,g.content)}catch{}return g};return super.setRequestHandler(t,l)}if(s==="sampling/createMessage"){const l=async(u,d)=>{const f=Mi(OM,u);if(!f.success){const g=f.error instanceof Error?f.error.message:String(f.error);throw new ke(Ae.InvalidParams,`Invalid sampling request: ${g}`)}const{params:p}=f.data,h=await Promise.resolve(n(u,d));if(p.task){const g=Mi(od,h);if(!g.success){const v=g.error instanceof Error?g.error.message:String(g.error);throw new ke(Ae.InvalidParams,`Invalid task creation result: ${v}`)}return g.data}const m=p.tools||p.toolChoice?PM:MM,b=Mi(m,h);if(!b.success){const g=b.error instanceof Error?b.error.message:String(b.error);throw new ke(Ae.InvalidParams,`Invalid sampling result: ${g}`)}return b.data};return super.setRequestHandler(t,l)}return super.setRequestHandler(t,n)}assertCapability(t,n){var r;if(!((r=this._serverCapabilities)!=null&&r[t]))throw new Error(`Server does not support ${t} (required for ${n})`)}async connect(t,n){if(await super.connect(t),t.sessionId===void 0)try{const r=await this.request({method:"initialize",params:{protocolVersion:Om,capabilities:this._capabilities,clientInfo:this._clientInfo}},wM,n);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!oW.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var n,r,a,i,s;switch(t){case"logging/setLevel":if(!((n=this._serverCapabilities)!=null&&n.logging))throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!((r=this._serverCapabilities)!=null&&r.prompts))throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!((a=this._serverCapabilities)!=null&&a.resources))throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!((i=this._serverCapabilities)!=null&&i.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!((s=this._serverCapabilities)!=null&&s.completions))throw new Error(`Server does not support completions (required for ${t})`);break}}assertNotificationCapability(t){var n;switch(t){case"notifications/roots/list_changed":if(!((n=this._capabilities.roots)!=null&&n.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${t})`);break}}assertTaskCapability(t){var n,r;Hie((r=(n=this._serverCapabilities)==null?void 0:n.tasks)==null?void 0:r.requests,t,"Server")}assertTaskHandlerCapability(t){var n;this._capabilities&&Bie((n=this._capabilities.tasks)==null?void 0:n.requests,t,"Client")}async ping(t){return this.request({method:"ping"},pl,t)}async complete(t,n){return this.request({method:"completion/complete",params:t},IM,n)}async setLoggingLevel(t,n){return this.request({method:"logging/setLevel",params:{level:t}},pl,n)}async getPrompt(t,n){return this.request({method:"prompts/get",params:t},Ew,n)}async listPrompts(t,n){return this.request({method:"prompts/list",params:t},wp,n)}async listResources(t,n){return this.request({method:"resources/list",params:t},xp,n)}async listResourceTemplates(t,n){return this.request({method:"resources/templates/list",params:t},NM,n)}async readResource(t,n){return this.request({method:"resources/read",params:t},xw,n)}async subscribeResource(t,n){return this.request({method:"resources/subscribe",params:t},pl,n)}async unsubscribeResource(t,n){return this.request({method:"resources/unsubscribe",params:t},pl,n)}async callTool(t,n=Vd,r){if(this.isToolTaskRequired(t.name))throw new ke(Ae.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const a=await this.request({method:"tools/call",params:t},n,r),i=this.getToolOutputValidator(t.name);if(i){if(!a.structuredContent&&!a.isError)throw new ke(Ae.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(a.structuredContent)try{const s=i(a.structuredContent);if(!s.valid)throw new ke(Ae.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof ke?s:new ke(Ae.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return a}isToolTask(t){var n,r,a,i;return(i=(a=(r=(n=this._serverCapabilities)==null?void 0:n.tasks)==null?void 0:r.requests)==null?void 0:a.tools)!=null&&i.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){var n;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const r of t){if(r.outputSchema){const i=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,i)}const a=(n=r.execution)==null?void 0:n.taskSupport;(a==="required"||a==="optional")&&this._cachedKnownTaskTools.add(r.name),a==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,n){const r=await this.request({method:"tools/list",params:t},Cw,n);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(t,n,r,a){const i=tJ.safeParse(r);if(!i.success)throw new Error(`Invalid ${t} listChanged options: ${i.error.message}`);if(typeof r.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);const{autoRefresh:s,debounceMs:o}=i.data,{onChanged:l}=r,u=async()=>{if(!s){l(null,null);return}try{const f=await a();l(null,f)}catch(f){const p=f instanceof Error?f:new Error(String(f));l(p,null)}},d=()=>{if(o){const f=this._listChangedDebounceTimers.get(t);f&&clearTimeout(f);const p=setTimeout(u,o);this._listChangedDebounceTimers.set(t,p)}else u()};this.setNotificationHandler(n,d)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function Xc(e,t){if(!e)throw new Error(t)}var lC=3e3,Kie=5e3,wy=5*60*1e3;function Gie(e){const{url:t,clientName:n,clientUri:r,callbackUrl:a=typeof window<"u"?hl(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:i="mcp:auth",clientConfig:s={},customHeaders:o={},autoRetry:l=!1,autoReconnect:u=lC,transportType:d="auto",preventAutoAuth:f=!1,onPopupWindow:p}=e,[h,y]=x.useState("discovering"),[m,b]=x.useState([]),[g,v]=x.useState([]),[w,S]=x.useState([]),[E,C]=x.useState([]),[T,P]=x.useState(void 0),[R,$]=x.useState([]),[j,O]=x.useState(void 0),L=x.useRef(null),D=x.useRef(null),A=x.useRef(null),H=x.useRef(!1),B=x.useRef(!0),U=x.useRef(0),Y=x.useRef(null),N=x.useRef(h),F=x.useRef(u),V=x.useRef(null);x.useEffect(()=>{N.current=h,F.current=u},[h,u]);const _=x.useCallback((W,fe,...ne)=>{const ze=ne.length>0?`${fe} ${ne.map(ce=>JSON.stringify(ce)).join(" ")}`:fe;console[W](`[useMcp] ${ze}`),B.current&&$(ce=>[...ce.slice(-100),{level:W,message:ze,timestamp:Date.now()}])},[]),k=x.useCallback(async(W=!1)=>{W||_("info","Disconnecting..."),H.current=!1,Y.current&&clearTimeout(Y.current),Y.current=null;const fe=D.current;if(L.current=null,D.current=null,B.current&&!W&&(y("discovering"),b([]),v([]),S([]),C([]),P(void 0),O(void 0)),fe)try{await fe.close(),W||_("debug","Transport closed")}catch(ne){W||_("warn","Error closing transport:",ne)}},[_]),M=x.useCallback((W,fe)=>{var ne;if(_("error",W,fe??""),B.current){y("failed"),P(W);const ze=(ne=A.current)==null?void 0:ne.getLastAttemptedAuthUrl();ze&&(O(ze),_("info","Manual authentication URL may be available.",ze))}H.current=!1},[_]),I=x.useCallback(async()=>{if(H.current){_("debug","Connection attempt already in progress.");return}if(!B.current){_("debug","Connect called after unmount, aborting.");return}H.current=!0,U.current+=1,P(void 0),O(void 0),V.current=null,y("discovering"),_("info",`Connecting attempt #${U.current} to ${t}...`),A.current||(A.current=new lE(t,{storageKeyPrefix:i,clientName:n,clientUri:r,callbackUrl:a,preventAutoAuth:f,onPopupWindow:p}),_("debug","BrowserOAuthClientProvider initialized in connect.")),L.current||(L.current=new Zie({name:s.name||"use-mcp-react-client",version:s.version||"0.1.0"},{capabilities:{}}),_("debug","MCP Client initialized in connect."));const W=async ne=>{_("info",`Attempting connection with ${ne.toUpperCase()} transport...`),N.current!=="authenticating"&&y("connecting");let ze;try{Xc(A.current,"Auth Provider must be initialized"),Xc(L.current,"Client must be initialized"),D.current&&(await D.current.close().catch(Pt=>_("warn",`Error closing previous transport: ${Pt.message}`)),D.current=null);const ce={authProvider:A.current,requestInit:{headers:{Accept:"application/json, text/event-stream",...o}}},$e=hl(t),qe=new URL($e);_("debug",`Creating ${ne.toUpperCase()} transport for URL: ${qe.toString()}`),_("debug","Transport options:",{authProvider:!!A.current,headers:o,url:qe.toString()}),ne==="http"?(_("debug","Creating StreamableHTTPClientTransport..."),ze=new Cee(qe,ce),_("debug","StreamableHTTPClientTransport created successfully")):(_("debug","Creating SSEClientTransport..."),ze=new _ee(qe,ce),_("debug","SSEClientTransport created successfully")),D.current=ze,_("debug",`${ne.toUpperCase()} transport created and assigned to ref.`)}catch(ce){return M(`Failed to create ${ne.toUpperCase()} transport: ${ce instanceof Error?ce.message:String(ce)}`,ce instanceof Error?ce:void 0),"failed"}ze.onmessage=ce=>{var $e,qe;_("debug",`[Transport] Received: ${JSON.stringify(ce)}`),(qe=($e=L.current)==null?void 0:$e.handleMessage)==null||qe.call($e,ce)},ze.onerror=ce=>{_("warn",`Transport error event (${ne.toUpperCase()}):`,ce),_("debug","Error details:",{message:ce.message,stack:ce.stack,name:ce.name,cause:ce.cause}),M(`Transport error (${ne.toUpperCase()}): ${ce.message}`,ce)},ze.onclose=()=>{if(!B.current||H.current)return;_("info",`Transport connection closed (${V.current||"unknown"} type).`);const ce=N.current,$e=F.current;if(ce==="ready"&&$e){const qe=typeof $e=="number"?$e:lC;_("info",`Attempting to reconnect in ${qe}ms...`),y("connecting"),setTimeout(()=>{B.current&&I()},qe)}else ce!=="failed"&&ce!=="authenticating"&&M("Connection closed unexpectedly.")};try{_("info",`Connecting client via ${ne.toUpperCase()}...`),_("debug","About to call client.connect() with transport instance"),_("debug",`Transport instance type: ${ze.constructor.name}`),await L.current.connect(ze),_("info",`Client connected via ${ne.toUpperCase()}. Loading tools, resources, and prompts...`),V.current=ne,y("loading");const ce=await L.current.request({method:"tools/list"},Cw);let $e={resources:[],resourceTemplates:[]};try{$e=await L.current.request({method:"resources/list"},xp)}catch(Pt){_("debug","Server does not support resources/list method",Pt)}let qe={prompts:[]};try{qe=await L.current.request({method:"prompts/list"},wp)}catch(Pt){_("debug","Server does not support prompts/list method",Pt)}if(B.current){b(ce.tools),v($e.resources),S(Array.isArray($e.resourceTemplates)?$e.resourceTemplates:[]),C(qe.prompts);const Pt=[`Loaded ${ce.tools.length} tools`];return($e.resources.length>0||$e.resourceTemplates&&$e.resourceTemplates.length>0)&&(Pt.push(`${$e.resources.length} resources`),Array.isArray($e.resourceTemplates)&&$e.resourceTemplates.length>0&&Pt.push(`${$e.resourceTemplates.length} resource templates`)),qe.prompts.length>0&&Pt.push(`${qe.prompts.length} prompts`),_("info",Pt.join(", ")+"."),y("ready"),U.current=0,"success"}else return"failed"}catch(ce){_("debug",`Client connect error via ${ne.toUpperCase()}:`,ce),_("debug","Connect error details:",{message:ce instanceof Error?ce.message:String(ce),stack:ce instanceof Error?ce.stack:"N/A",name:ce instanceof Error?ce.name:"Unknown",cause:ce instanceof Error?ce.cause:void 0});const $e=ce instanceof Error?ce:new Error(String(ce)),qe=$e.message,Pt=qe.includes("404")||qe.includes("Not Found"),kr=qe.includes("405")||qe.includes("Method Not Allowed"),yt=qe==="Failed to fetch"||qe==="NetworkError when attempting to fetch resource."||qe==="Load failed";if(ne==="http"&&(Pt||kr||yt))return _("warn",`HTTP transport failed (${yt?"CORS":Pt?"404":"405"}).`),"fallback";if($e instanceof dr||qe.includes("Unauthorized")||qe.includes("401")){_("info","Authentication required."),Xc(A.current,"Auth Provider not available for auth flow");const sr=await A.current.tokens();if(f&&!sr)return _("info","Authentication required but auto-auth prevented. User action needed."),y("pending_auth"),"auth_redirect";N.current!=="authenticating"&&N.current!=="pending_auth"&&(y("authenticating"),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{},wy));try{const Z=await ta(A.current,{serverUrl:t});if(!B.current)return"failed";if(Z==="AUTHORIZED")return _("info","Authentication successful via existing token or refresh. Re-attempting connection..."),Y.current&&clearTimeout(Y.current),H.current=!1,I(),"failed";if(Z==="REDIRECT")return _("info","Redirecting for authentication. Waiting for callback..."),"auth_redirect"}catch(Z){return B.current&&(Y.current&&clearTimeout(Y.current),M(`Failed to initiate authentication: ${Z instanceof Error?Z.message:String(Z)}`,Z instanceof Error?Z:void 0)),"failed"}}return M(`Failed to connect via ${ne.toUpperCase()}: ${qe}`,$e),"failed"}};let fe="failed";if(console.log({transportType:d}),d==="sse")_("debug","Using SSE-only transport mode"),fe=await W("sse");else if(d==="http")_("debug","Using HTTP-only transport mode"),fe=await W("http");else{_("debug","Using auto transport mode (HTTP with SSE fallback)");const ne=await W("http");if(ne==="fallback"&&B.current&&N.current!=="authenticating"){_("info","HTTP failed, attempting SSE fallback...");const ze=await W("sse");fe=ze,ze==="failed"&&B.current}else fe=ne}(fe==="success"||fe==="failed")&&(H.current=!1),_("debug",`Connection sequence finished with status: ${fe}`)},[_,M,k,ta,t,i,n,r,a,s.name,s.version]),K=x.useCallback(async(W,fe)=>{if(N.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot call tool "${W}".`);_("info",`Calling tool: ${W}`,fe);try{const ne=await L.current.request({method:"tools/call",params:{name:W,arguments:fe}},Vd);return _("info",`Tool "${W}" call successful:`,ne),ne}catch(ne){_("error",`Error calling tool "${W}": ${ne instanceof Error?ne.message:String(ne)}`,ne);const ze=ne instanceof Error?ne:new Error(String(ne));if(ze instanceof dr||ze.message.includes("Unauthorized")||ze.message.includes("401")){_("warn","Tool call unauthorized, attempting re-authentication..."),y("authenticating"),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{},wy);try{Xc(A.current,"Auth Provider not available for tool re-auth");const ce=await ta(A.current,{serverUrl:t});if(!B.current)return;ce==="AUTHORIZED"?(_("info","Re-authentication successful. Retrying tool call is recommended, or reconnecting."),Y.current&&clearTimeout(Y.current),H.current=!1,I()):ce==="REDIRECT"&&_("info","Redirecting for re-authentication for tool call.")}catch(ce){if(!B.current)return;Y.current&&clearTimeout(Y.current),M(`Re-authentication failed: ${ce instanceof Error?ce.message:String(ce)}`,ce instanceof Error?ce:void 0)}}if(N.current!=="authenticating")throw ne;return}},[h,t,_,M,I]),G=x.useCallback(()=>{N.current==="failed"?(_("info","Retry requested..."),I()):_("warn",`Retry called but state is not 'failed' (state: ${N.current}). Ignoring.`)},[_,I]),re=x.useCallback(async()=>{var fe;_("info","Manual authentication requested...");const W=N.current;if(W==="failed")_("info","Attempting to reconnect and authenticate via retry..."),G();else if(W==="pending_auth"){_("info","Proceeding with authentication from pending state..."),y("authenticating"),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{},wy);try{Xc(A.current,"Auth Provider not available for manual auth");const ne=await ta(A.current,{serverUrl:t});if(!B.current)return;ne==="AUTHORIZED"?(_("info","Manual authentication successful. Re-attempting connection..."),Y.current&&clearTimeout(Y.current),H.current=!1,I()):ne==="REDIRECT"&&_("info","Redirecting for manual authentication. Waiting for callback...")}catch(ne){if(!B.current)return;Y.current&&clearTimeout(Y.current),M(`Manual authentication failed: ${ne instanceof Error?ne.message:String(ne)}`,ne instanceof Error?ne:void 0)}}else if(W==="authenticating"){_("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const ne=(fe=A.current)==null?void 0:fe.getLastAttemptedAuthUrl();ne&&!j&&(O(ne),_("info","Manual authentication URL retrieved:",ne))}else _("info",`Client not in a state requiring manual authentication trigger (state: ${W}). If needed, try disconnecting and reconnecting.`)},[_,G,j,t,M,I]),oe=x.useCallback(()=>{if(A.current){const W=A.current.clearStorage();_("info",`Cleared ${W} item(s) from localStorage for ${t}.`),O(void 0),k()}else _("warn","Auth provider not initialized, cannot clear storage.")},[t,_,k]),he=x.useCallback(async()=>{if(N.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot list resources.`);_("info","Listing resources...");try{const W=await L.current.request({method:"resources/list"},xp);B.current&&(v(W.resources),S(Array.isArray(W.resourceTemplates)?W.resourceTemplates:[]),_("info",`Listed ${W.resources.length} resources, ${Array.isArray(W.resourceTemplates)?W.resourceTemplates.length:0} resource templates.`))}catch(W){throw _("error",`Error listing resources: ${W instanceof Error?W.message:String(W)}`,W),W}},[h,_]),Se=x.useCallback(async W=>{if(N.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot read resource "${W}".`);_("info",`Reading resource: ${W}`);try{const fe=await L.current.request({method:"resources/read",params:{uri:W}},xw);return _("info",`Resource "${W}" read successfully`),fe}catch(fe){throw _("error",`Error reading resource "${W}": ${fe instanceof Error?fe.message:String(fe)}`,fe),fe}},[h,_]),Xe=x.useCallback(async()=>{if(N.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot list prompts.`);_("info","Listing prompts...");try{const W=await L.current.request({method:"prompts/list"},wp);B.current&&(C(W.prompts),_("info",`Listed ${W.prompts.length} prompts.`))}catch(W){throw _("error",`Error listing prompts: ${W instanceof Error?W.message:String(W)}`,W),W}},[h,_]),ot=x.useCallback(async(W,fe)=>{if(N.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot get prompt "${W}".`);_("info",`Getting prompt: ${W}`,fe);try{const ne=await L.current.request({method:"prompts/get",params:{name:W,arguments:fe}},Ew);return _("info",`Prompt "${W}" retrieved successfully`),ne}catch(ne){throw _("error",`Error getting prompt "${W}": ${ne instanceof Error?ne.message:String(ne)}`,ne),ne}},[h,_]);return x.useEffect(()=>{const W=fe=>{var ne;fe.origin===window.location.origin&&((ne=fe.data)==null?void 0:ne.type)==="mcp_auth_callback"&&(_("info","Received auth callback message.",fe.data),Y.current&&clearTimeout(Y.current),fe.data.success?(_("info","Authentication successful via popup. Reconnecting client..."),H.current=!1,I()):M(`Authentication failed in callback: ${fe.data.error||"Unknown reason."}`))};return window.addEventListener("message",W),_("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",W),_("debug","Auth callback message listener removed."),Y.current&&clearTimeout(Y.current)}},[_,M,I]),x.useEffect(()=>(B.current=!0,_("debug","useMcp mounted, initiating connection."),U.current=0,(!A.current||A.current.serverUrl!==t)&&(A.current=new lE(t,{storageKeyPrefix:i,clientName:n,clientUri:r,callbackUrl:a,preventAutoAuth:f,onPopupWindow:p}),_("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),I(),()=>{B.current=!1,_("debug","useMcp unmounting, disconnecting."),k(!0)}),[t,i,a,n,r,s.name,s.version,I,k]),x.useEffect(()=>{let W=null;if(h==="failed"&&l&&U.current>0){const fe=typeof l=="number"?l:Kie;_("info",`Connection failed, auto-retrying in ${fe}ms...`),W=setTimeout(()=>{B.current&&N.current==="failed"&&G()},fe)}return()=>{W&&clearTimeout(W)}},[h,l,G,_]),{state:h,tools:m,resources:g,resourceTemplates:w,prompts:E,error:T,log:R,authUrl:j,callTool:K,listResources:he,readResource:Se,listPrompts:Xe,getPrompt:ot,retry:G,disconnect:k,authenticate:re,clearStorage:oe}}function Qie({service:e,autoConnect:t=!1,onConnected:n,onError:r}){const{toast:a}=rn(),{state:i,tools:s,resources:o,prompts:l,error:u,authUrl:d,callTool:f,readResource:p,listResources:h,getPrompt:y,listPrompts:m,retry:b,disconnect:g,authenticate:v,clearStorage:w}=Gie({url:e.url,clientName:"AgentDeck",clientUri:window.location.origin,callbackUrl:`${window.location.origin}/oauth/callback`,storageKeyPrefix:`mcp:auth:${e.id}`,autoRetry:3,autoReconnect:5e3,transportType:"auto",preventAutoAuth:!t}),S=i==="ready",E=i==="connecting"||i==="loading",C=i==="authenticating"||i==="pending_auth",T=i==="failed";return fa.useEffect(()=>{S&&n&&(n(),a({title:"Connected to MCP service",description:`Successfully connected to ${e.name}`}))},[S,n,e.name,a]),fa.useEffect(()=>{T&&u&&r&&(r(u),a({title:"MCP connection failed",description:u,variant:"destructive"}))},[T,u,r,a]),{isConnected:S,isConnecting:E,isAuthenticating:C,hasError:T,error:u,tools:s,resources:o,prompts:l,connect:()=>{b()},disconnect:g,retry:b,authenticate:v,callTool:async(L,D)=>{try{return await f(L,D)}catch(A){const H=A instanceof Error?A.message:"Unknown error";throw a({title:"Tool call failed",description:H,variant:"destructive"}),A}},readResource:async L=>{try{return await p(L)}catch(D){const A=D instanceof Error?D.message:"Unknown error";throw a({title:"Resource read failed",description:A,variant:"destructive"}),D}},listResources:async()=>{try{await h()}catch(L){const D=L instanceof Error?L.message:"Unknown error";throw a({title:"Resource listing failed",description:D,variant:"destructive"}),L}},getPrompt:async(L,D)=>{try{return await y(L,D)}catch(A){const H=A instanceof Error?A.message:"Unknown error";throw a({title:"Prompt retrieval failed",description:H,variant:"destructive"}),A}},listPrompts:async()=>{try{await m()}catch(L){const D=L instanceof Error?L.message:"Unknown error";throw a({title:"Prompt listing failed",description:D,variant:"destructive"}),L}},authUrl:d,clearStorage:w}}function Yie(){const[e,t]=x.useState("https://api.githubcopilot.com/mcp"),[n,r]=x.useState("get_me"),[a,i]=x.useState("{}"),[s,o]=x.useState(""),l={id:"test-mcp-service",name:"Test MCP Service",url:e,registeredAt:new Date().toISOString(),updatedAt:new Date().toISOString()},{isConnected:u,isConnecting:d,isAuthenticating:f,hasError:p,error:h,tools:y,resources:m,prompts:b,connect:g,disconnect:v,retry:w,authenticate:S,callTool:E,authUrl:C,clearStorage:T}=Qie({service:l,autoConnect:!1,onConnected:()=>{console.log("Connected to test MCP service")},onError:j=>{console.error("Test MCP service error:",j)}}),R=d?{status:"connecting",icon:A_,color:"text-yellow-500"}:f?{status:"authenticating",icon:gf,color:"text-blue-500"}:u?{status:"connected",icon:Dv,color:"text-green-500"}:p?{status:"error",icon:j_,color:"text-red-500"}:{status:"disconnected",icon:j_,color:"text-gray-500"},$=async()=>{try{let j={};a.trim()&&(j=JSON.parse(a));const O=await E(n,j);o(JSON.stringify(O,null,2))}catch(j){o(`Error: ${j instanceof Error?j.message:"Unknown error"}`)}};return c.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"text-3xl font-bold mb-2",children:"use-mcp Integration Test"}),c.jsx("p",{className:"text-muted-foreground",children:"Testing the new use-mcp library integration with OAuth support"})]}),c.jsxs(Ba,{children:[c.jsxs($i,{children:[c.jsxs(Oi,{className:"flex items-center gap-2",children:[c.jsx(R.icon,{className:`w-5 h-5 ${R.color}`}),"Connection Status: ",R.status]}),c.jsx(Au,{children:"Current connection state and available actions"})]}),c.jsxs(Va,{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx(Qe,{children:"Service URL"}),c.jsx(it,{value:e,onChange:j=>t(j.target.value),placeholder:"Enter MCP service URL"})]}),c.jsxs("div",{className:"flex gap-2",children:[!u&&!d&&c.jsx(te,{onClick:g,children:"Connect"}),u&&c.jsx(te,{onClick:v,variant:"outline",children:"Disconnect"}),p&&c.jsxs(te,{onClick:w,variant:"outline",children:[c.jsx(A_,{className:"w-4 h-4 mr-1"}),"Retry"]}),C&&!u&&c.jsxs(te,{onClick:S,variant:"outline",children:[c.jsx(gf,{className:"w-4 h-4 mr-1"}),"Authenticate"]})]})]}),h&&c.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[c.jsx(jT,{className:"w-4 h-4 text-destructive"}),c.jsx("span",{className:"text-sm text-destructive",children:h})]})]})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[c.jsxs(Ba,{children:[c.jsx($i,{children:c.jsxs(Oi,{className:"flex items-center gap-2",children:[c.jsx(ix,{className:"w-4 h-4"}),"Tools (",y.length,")"]})}),c.jsx(Va,{children:y.length===0?c.jsx("p",{className:"text-sm text-muted-foreground",children:u?"No tools available":"Connect to see tools"}):c.jsxs("div",{className:"space-y-2",children:[y.slice(0,5).map((j,O)=>c.jsx("div",{className:"text-sm",children:c.jsx(mn,{variant:"outline",className:"text-xs",children:j.name})},O)),y.length>5&&c.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",y.length-5," more tools"]})]})})]}),c.jsxs(Ba,{children:[c.jsx($i,{children:c.jsxs(Oi,{children:["Resources (",m.length,")"]})}),c.jsx(Va,{children:c.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${m.length} resources available`:"Connect to see resources"})})]}),c.jsxs(Ba,{children:[c.jsx($i,{children:c.jsxs(Oi,{children:["Prompts (",b.length,")"]})}),c.jsx(Va,{children:c.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${b.length} prompts available`:"Connect to see prompts"})})]})]}),u&&c.jsxs(Ba,{children:[c.jsxs($i,{children:[c.jsx(Oi,{children:"Test Tool Call"}),c.jsx(Au,{children:"Test calling a tool on the connected MCP service"})]}),c.jsxs(Va,{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"toolName",children:"Tool Name"}),c.jsx(it,{id:"toolName",value:n,onChange:j=>r(j.target.value),placeholder:"e.g., get_me"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{htmlFor:"toolArgs",children:"Arguments (JSON)"}),c.jsx(it,{id:"toolArgs",value:a,onChange:j=>i(j.target.value),placeholder:'{"key": "value"}'})]})]}),c.jsxs(te,{onClick:$,disabled:!u,children:[c.jsx(SL,{className:"w-4 h-4 mr-1"}),"Call Tool"]}),s&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qe,{children:"Result"}),c.jsx(Ya,{value:s,readOnly:!0,rows:10,className:"font-mono text-sm"})]})]})]}),C&&c.jsxs(Ba,{children:[c.jsxs($i,{children:[c.jsxs(Oi,{className:"flex items-center gap-2",children:[c.jsx(gf,{className:"w-4 h-4"}),"OAuth Authentication"]}),c.jsx(Au,{children:"This service requires OAuth authentication"})]}),c.jsxs(Va,{className:"space-y-4",children:[c.jsx("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-md",children:c.jsx("p",{className:"text-sm text-blue-800",children:'This MCP service requires OAuth authentication. Click the "Authenticate" button above to start the OAuth flow.'})}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs(te,{onClick:S,variant:"outline",children:[c.jsx(gf,{className:"w-4 h-4 mr-1"}),"Start OAuth Flow"]}),c.jsx(te,{onClick:T,variant:"outline",children:"Clear OAuth Data"})]})]})]})]})}function rD(e){return e.before.title!==e.after.title||e.before.body!==e.after.body||e.before.triggers.join(`
490
- `)!==e.after.triggers.join(`
491
- `)}class Xie{diff(t,n,r={}){let a;typeof r=="function"?(a=r,r={}):"callback"in r&&(a=r.callback);const i=this.castInput(t,r),s=this.castInput(n,r),o=this.removeEmpty(this.tokenize(i,r)),l=this.removeEmpty(this.tokenize(s,r));return this.diffWithOptionsObj(o,l,r,a)}diffWithOptionsObj(t,n,r,a){var i;const s=v=>{if(v=this.postProcess(v,r),a){setTimeout(function(){a(v)},0);return}else return v},o=n.length,l=t.length;let u=1,d=o+l;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const f=(i=r.timeout)!==null&&i!==void 0?i:1/0,p=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}];let y=this.extractCommon(h[0],n,t,0,r);if(h[0].oldPos+1>=l&&y+1>=o)return s(this.buildValues(h[0].lastComponent,n,t));let m=-1/0,b=1/0;const g=()=>{for(let v=Math.max(m,-u);v<=Math.min(b,u);v+=2){let w;const S=h[v-1],E=h[v+1];S&&(h[v-1]=void 0);let C=!1;if(E){const P=E.oldPos-v;C=E&&0<=P&&P<o}const T=S&&S.oldPos+1<l;if(!C&&!T){h[v]=void 0;continue}if(!T||C&&S.oldPos<E.oldPos?w=this.addToPath(E,!0,!1,0,r):w=this.addToPath(S,!1,!0,1,r),y=this.extractCommon(w,n,t,v,r),w.oldPos+1>=l&&y+1>=o)return s(this.buildValues(w.lastComponent,n,t))||!0;h[v]=w,w.oldPos+1>=l&&(b=Math.min(b,v-1)),y+1>=o&&(m=Math.max(m,v+1))}u++};if(a)(function v(){setTimeout(function(){if(u>d||Date.now()>p)return a(void 0);g()||v()},0)})();else for(;u<=d&&Date.now()<=p;){const v=g();if(v)return v}}addToPath(t,n,r,a,i){const s=t.lastComponent;return s&&!i.oneChangePerToken&&s.added===n&&s.removed===r?{oldPos:t.oldPos+a,lastComponent:{count:s.count+1,added:n,removed:r,previousComponent:s.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:r,previousComponent:s}}}extractCommon(t,n,r,a,i){const s=n.length,o=r.length;let l=t.oldPos,u=l-a,d=0;for(;u+1<s&&l+1<o&&this.equals(r[l+1],n[u+1],i);)u++,l++,d++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!i.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=l,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const a=[];let i;for(;t;)a.push(t),i=t.previousComponent,delete t.previousComponent,t=i;a.reverse();const s=a.length;let o=0,l=0,u=0;for(;o<s;o++){const d=a[o];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(l,l+d.count);f=f.map(function(p,h){const y=r[u+h];return y.length>p.length?y:p}),d.value=this.join(f)}else d.value=this.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}}return a}}class Wie extends Xie{constructor(){super(...arguments),this.tokenize=tse}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
492
- `))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
493
- `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
494
- `)&&(t=t.slice(0,-1)),n.endsWith(`
495
- `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const Jie=new Wie;function ese(e,t,n){return Jie.diff(e,t,n)}function tse(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
496
- `));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let a=0;a<r.length;a++){const i=r[a];a%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}const Sy=3,nse=10;function rse(e){return e===""?[]:e.replace(/\n$/,"").split(`
497
- `)}function ase(e,t){const n=ese(e,t),r=[];let a=1,i=1;for(const s of n){const o=rse(s.value);if(!s.added&&!s.removed&&o.length>=nse){const u=o.slice(0,Sy),d=o.slice(-Sy),f=o.length-Sy*2;for(const p of u)r.push({kind:"unchanged",text:p,oldLine:a++,newLine:i++});f>0&&(r.push({kind:"ellipsis",text:`${f} unchanged lines`}),a+=f,i+=f);for(const p of d)r.push({kind:"unchanged",text:p,oldLine:a++,newLine:i++});continue}for(const u of o)s.added?r.push({kind:"added",text:u,newLine:i++}):s.removed?r.push({kind:"removed",text:u,oldLine:a++}):r.push({kind:"unchanged",text:u,oldLine:a++,newLine:i++})}return r}function ise(e){return e.some(t=>t.kind==="added"||t.kind==="removed")}const E1="max-w-full overflow-x-auto rounded-md border border-gray-800 bg-gray-950 font-mono text-xs leading-5";function sse(e){switch(e){case"added":return"bg-emerald-950/70 text-emerald-100";case"removed":return"bg-rose-950/70 text-rose-100";case"ellipsis":return"bg-gray-900 text-gray-500 italic";default:return"bg-gray-950 text-gray-300"}}function ose(e){switch(e){case"added":return"+";case"removed":return"-";case"ellipsis":return"…";default:return" "}}function lse({rows:e,emptyLabel:t}){return e.length===0?c.jsx("p",{className:"text-sm text-gray-500",children:t}):c.jsx("div",{className:E1,children:e.map((n,r)=>c.jsxs("div",{className:`grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] gap-0 ${sse(n.kind)}`,children:[c.jsx("span",{className:"select-none border-r border-gray-800/80 px-2 py-0.5 text-right text-gray-600",children:n.oldLine??""}),c.jsx("span",{className:"select-none border-r border-gray-800/80 px-2 py-0.5 text-right text-gray-600",children:n.newLine??""}),c.jsxs("div",{className:"flex min-w-0 gap-2 px-2 py-0.5",children:[c.jsx("span",{className:"w-3 shrink-0 select-none text-gray-500",children:ose(n.kind)}),c.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words",children:n.text||" "})]})]},`${n.kind}-${r}-${n.oldLine??""}-${n.newLine??""}`))})}function cse({before:e,after:t}){const n=e.filter(a=>!t.includes(a)),r=t.filter(a=>!e.includes(a));return n.length===0&&r.length===0?null:c.jsxs("div",{className:"space-y-2",children:[c.jsx("h4",{className:"text-sm font-medium text-gray-400",children:"Triggers"}),c.jsxs("div",{className:`${E1} p-0`,children:[n.map(a=>c.jsxs("div",{className:"grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-rose-950/70 text-rose-100",children:[c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsxs("div",{className:"flex gap-2 px-2 py-0.5",children:[c.jsx("span",{className:"w-3 shrink-0 text-gray-500",children:"-"}),c.jsx("span",{children:a})]})]},`removed-${a}`)),r.map(a=>c.jsxs("div",{className:"grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-emerald-950/70 text-emerald-100",children:[c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsxs("div",{className:"flex gap-2 px-2 py-0.5",children:[c.jsx("span",{className:"w-3 shrink-0 text-gray-500",children:"+"}),c.jsx("span",{children:a})]})]},`added-${a}`))]})]})}function use({preview:e}){const t=rD(e),n=ase(e.before.body,e.after.body),r=e.before.body.trim()!==e.after.body.trim()&&e.after.body.length>0&&!e.after.body.includes(e.before.body.slice(0,40))&&ise(n),a=e.before.title!==e.after.title,i=e.before.triggers.join(`
498
- `)!==e.after.triggers.join(`
499
- `);return c.jsxs("div",{className:"min-w-0 space-y-4",children:[!t&&c.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 text-sm text-amber-100",children:["No change detected — ops did not alter the playbook body or triggers. Reject this proposal and re-propose with a matching list anchor or ",c.jsx("code",{children:"rewrite_body"}),"."]}),r&&c.jsx("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 text-sm text-amber-100",children:"Full-body rewrite proposed — review carefully."}),a&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("h4",{className:"text-sm font-medium text-gray-400",children:"Title"}),c.jsxs("div",{className:`${E1} p-0`,children:[e.before.title&&c.jsxs("div",{className:"grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-rose-950/70 text-rose-100",children:[c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsxs("div",{className:"flex gap-2 px-2 py-0.5",children:[c.jsx("span",{className:"w-3 shrink-0 text-gray-500",children:"-"}),c.jsx("span",{children:e.before.title})]})]}),e.after.title&&c.jsxs("div",{className:"grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-emerald-950/70 text-emerald-100",children:[c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsxs("div",{className:"flex gap-2 px-2 py-0.5",children:[c.jsx("span",{className:"w-3 shrink-0 text-gray-500",children:"+"}),c.jsx("span",{children:e.after.title})]})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("h4",{className:"text-sm font-medium text-gray-400",children:"Body"}),c.jsx(lse,{rows:n,emptyLabel:"No body changes."})]}),i&&c.jsx(cse,{before:e.before.triggers,after:e.after.triggers})]})}function dse(e){if(!e)return[];try{return JSON.parse(e)}catch{return[]}}function fse({conflicts:e,title:t="Trigger overlap warnings"}){return e.length===0?null:c.jsxs("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/10 p-4 text-sm text-amber-50",children:[c.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-amber-200/90",children:t}),c.jsx("p",{className:"mt-2 text-amber-100/90",children:"These triggers overlap with other playbooks on the deck. Accept is still allowed — disambiguate triggers or propose a merge if the wrong playbook keeps firing."}),c.jsx("ul",{className:"mt-3 space-y-2",children:e.map(n=>c.jsxs("li",{className:"rounded border border-amber-500/20 bg-gray-950/60 p-3",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(mn,{variant:"outline",className:"border-amber-400/40 text-amber-100",children:n.level}),c.jsx("span",{className:"font-medium text-amber-50",children:n.otherPlaybookTitle}),c.jsx("span",{className:"font-mono text-xs text-amber-200/70",children:n.otherPlaybookId})]}),c.jsxs("p",{className:"mt-2 text-amber-100/90",children:[c.jsx("span",{className:"text-amber-200/80",children:"Candidate:"})," ",n.trigger]}),c.jsxs("p",{className:"text-amber-100/80",children:[c.jsx("span",{className:"text-amber-200/80",children:"Other:"})," ",n.otherTrigger]})]},`${n.trigger}-${n.otherPlaybookId}-${n.level}`))})]})}const Uf=8,hse=[{value:"proposed",label:"Waiting"},{value:"accepted",label:"Accepted"},{value:"rejected",label:"Rejected"},{value:"superseded",label:"Superseded"},{value:"stale",label:"Stale"},{value:"all",label:"All"}];function pse(e){if(!e.evidenceJson)return null;try{return JSON.parse(e.evidenceJson)}catch{return null}}function cC(e){switch(e){case"proposed":return"border-blue-500/40 text-blue-200";case"accepted":return"border-emerald-500/40 text-emerald-200";case"rejected":return"border-rose-500/40 text-rose-200";case"superseded":return"border-violet-500/40 text-violet-200";case"stale":return"border-amber-500/40 text-amber-200"}}function mse(){const[e,t]=x.useState(null),[n,r]=x.useState("proposed"),[a,i]=x.useState(0),{toast:s}=rn(),o=un();function l(j){t(j)}function u(j){r(j),i(0),t(null)}const{data:d=[]}=St({queryKey:["/api/playbook-patches","proposed"],queryFn:()=>Gv("proposed")}),f=n==="all"?void 0:n,{data:p=[],isLoading:h}=St({queryKey:["/api/playbook-patches",n],queryFn:()=>Gv(f)}),y=Math.max(1,Math.ceil(p.length/Uf)),m=Math.min(a,y-1),b=x.useMemo(()=>{const j=m*Uf;return p.slice(j,j+Uf)},[p,m]);x.useEffect(()=>{a!==m&&i(m)},[a,m]);const{data:g,isLoading:v,isError:w,error:S}=St({queryKey:["/api/playbook-patches",e,"preview"],queryFn:()=>_F(e),enabled:!!e}),E=g?rD(g):!1,C=p.find(j=>j.id===e)??null,T=(C==null?void 0:C.status)==="proposed",P=_t({mutationFn:j=>kF(j),onSuccess:()=>{s({title:"Patch accepted"}),t(null),o.invalidateQueries({queryKey:["/api/playbook-patches"]}),o.invalidateQueries({queryKey:["/api/playbooks"]}),o.invalidateQueries({queryKey:["/api/feedback-signals"]})},onError:j=>{s({title:"Accept failed",description:j.message,variant:"destructive"})}}),R=_t({mutationFn:j=>EF(j),onSuccess:()=>{s({title:"Patch rejected"}),t(null),o.invalidateQueries({queryKey:["/api/playbook-patches"]}),o.invalidateQueries({queryKey:["/api/feedback-signals"]})},onError:j=>{s({title:"Reject failed",description:j.message,variant:"destructive"})}}),$=n==="proposed"?"No proposals waiting for review.":n==="all"?"No playbook patches yet.":`No ${n} patches.`;return c.jsxs("div",{className:"flex h-dvh flex-col overflow-hidden bg-gray-950 text-gray-100",children:[c.jsx("header",{className:"shrink-0 border-b border-gray-800 px-4 py-4 sm:px-6",children:c.jsxs("div",{className:"mx-auto flex max-w-7xl flex-wrap items-center gap-3",children:[c.jsx(nc,{href:"/",children:c.jsxs(te,{variant:"ghost",size:"sm",className:"text-gray-300",children:[c.jsx(_T,{className:"mr-1 h-4 w-4"}),"Deck"]})}),c.jsx("h1",{className:"text-lg font-semibold",children:"Playbook review queue"}),c.jsxs(mn,{variant:"secondary",children:[d.length," waiting"]}),c.jsx(nc,{href:"/feedback-signals",className:"ml-auto text-sm hover:underline",style:{color:"#92E4DD"},children:"Feedback data →"})]})}),c.jsxs("main",{className:"mx-auto grid w-full max-w-7xl min-h-0 flex-1 gap-6 overflow-hidden px-4 py-6 sm:px-6 lg:grid-cols-[minmax(18rem,20rem)_minmax(0,1fr)] lg:items-stretch",children:[c.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col",children:[c.jsx("h2",{className:"mb-3 shrink-0 text-sm font-medium text-gray-400",children:"Proposals"}),c.jsx("div",{className:"mb-3 flex shrink-0 flex-wrap gap-1",children:hse.map(({value:j,label:O})=>{const L=n===j;return c.jsx(te,{size:"sm",variant:L?"gold":"outline",className:L?void 0:"border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800 hover:text-gray-100","aria-pressed":L,onClick:()=>u(j),children:O},j)})}),c.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[h&&c.jsx("p",{className:"text-sm text-gray-500",children:"Loading…"}),!h&&p.length===0&&c.jsx("p",{className:"text-sm text-gray-500",children:$}),c.jsx("ul",{className:"space-y-2",children:b.map(j=>c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>l(j.id),className:`w-full rounded-lg border p-3 text-left transition ${e===j.id?"border-blue-500 bg-gray-900":"border-gray-800 bg-gray-900/50 hover:border-gray-700"}`,children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("span",{className:"block font-medium leading-snug",children:j.kind==="create"?`New: ${j.displayTitle}`:j.displayTitle}),j.playbookId&&j.kind!=="create"&&c.jsx("span",{className:"mt-0.5 block truncate font-mono text-xs text-gray-600",children:j.playbookId}),ak(j.deckNames)&&c.jsxs("span",{className:"mt-1 block text-xs text-gray-500",children:["Decks: ",ak(j.deckNames)]})]}),c.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[c.jsx(mn,{variant:"outline",className:"shrink-0",children:j.kind}),n!=="proposed"&&c.jsx(mn,{variant:"outline",className:`shrink-0 ${cC(j.status)}`,children:j.status})]})]}),c.jsx("p",{className:"mt-1 line-clamp-2 text-sm text-gray-400",children:j.rationale}),c.jsxs("p",{className:"mt-1 text-xs text-gray-600",children:[j.source," · ",new Date(j.createdAt).toLocaleString()]})]})},j.id))})]}),p.length>Uf&&c.jsxs("div",{className:"mt-3 flex shrink-0 items-center justify-between gap-2 border-t border-gray-800 pt-3",children:[c.jsxs(te,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800",disabled:m<=0,onClick:()=>i(j=>Math.max(0,j-1)),children:[c.jsx(CT,{className:"mr-1 h-4 w-4"}),"Newer"]}),c.jsxs("span",{className:"text-xs text-gray-500",children:[m+1," / ",y,c.jsxs("span",{className:"ml-1 text-gray-600",children:["(",p.length,")"]})]}),c.jsxs(te,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800",disabled:m>=y-1,onClick:()=>i(j=>Math.min(y-1,j+1)),children:["Older",c.jsx(NT,{className:"ml-1 h-4 w-4"})]})]})]}),c.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:[c.jsx("h2",{className:"mb-3 shrink-0 text-sm font-medium text-gray-400",children:"Detail"}),!C&&c.jsx("p",{className:"text-sm text-gray-500",children:"Select a proposal to preview the diff."}),C&&c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-800 bg-gray-900/50",children:[c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 sm:p-5",children:c.jsxs("div",{className:"min-w-0 space-y-4",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(mn,{variant:"outline",className:cC(C.status),children:C.status}),C.resolvedAt&&c.jsxs("span",{className:"text-xs text-gray-500",children:["Resolved ",new Date(C.resolvedAt).toLocaleString()]})]}),c.jsx("p",{className:"text-sm leading-relaxed text-gray-300",children:C.rationale}),C.status==="rejected"&&C.rejectionReason&&c.jsxs("div",{className:"rounded-md border border-rose-500/40 bg-rose-500/10 p-3 text-sm text-rose-100",children:[c.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-rose-300/80",children:"Rejection reason"}),c.jsx("p",{className:"mt-1",children:C.rejectionReason})]}),C.status==="superseded"&&C.supersededBy&&c.jsxs("div",{className:"rounded-md border border-violet-500/40 bg-violet-500/10 p-3 text-sm text-violet-100",children:[c.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-violet-300/80",children:"Superseded by"}),c.jsx("button",{type:"button",className:"mt-1 font-mono text-sm underline-offset-2 hover:underline",onClick:()=>{const j=C.supersededBy;r("all"),i(0),l(j)},children:C.supersededBy})]}),(()=>{const j=pse(C);return j?c.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-4 text-sm",children:[c.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:"Your correction"}),c.jsxs("p",{className:"mt-2 italic text-gray-200",children:["“",j.user_feedback_excerpt,"”"]}),j.failure_summary&&c.jsx("p",{className:"mt-2 text-gray-400",children:j.failure_summary})]}):null})(),(()=>{const j=dse(C.conflictsJson),O=(g==null?void 0:g.trigger_conflicts)??[],L=O.length>0?O:j;return c.jsx(fse,{conflicts:L})})(),v&&c.jsx("p",{className:"text-sm text-gray-500",children:"Loading preview…"}),w&&c.jsxs("div",{className:"rounded-md border border-rose-500/50 bg-rose-500/10 p-3 text-sm text-rose-100",children:["Preview failed —"," ",(S==null?void 0:S.message)??"could not apply ops to the current playbook.",T?" Reject and re-propose with exact list anchors or rewrite_body.":" Historical preview may be incomplete if the playbook changed."]}),g&&c.jsx(use,{preview:g}),C.status==="stale"&&c.jsx("p",{className:"text-sm text-amber-400",children:"Stale — playbook changed since proposal. Re-propose from a fresh session."})]})}),T?c.jsxs("div",{className:"relative z-10 shrink-0 space-y-3 border-t border-gray-800 bg-gray-950 p-4 shadow-[0_-16px_32px_rgba(0,0,0,0.55)] sm:p-5",children:[c.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Your decision"}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx(te,{variant:"gold",onClick:()=>P.mutate(C.id),disabled:P.isPending||w||!E,children:"Accept"}),c.jsx(te,{variant:"destructive",onClick:()=>R.mutate(C.id),disabled:R.isPending,children:"Reject"})]})]}):c.jsxs("div",{className:"shrink-0 border-t border-gray-800 bg-gray-950 px-4 py-3 text-sm text-gray-500 sm:px-5",children:["Read-only — already ",C.status,". Switch to Waiting to review open proposals."]})]})]})]})]})}const uC="border-[#C4B643] data-[state=checked]:bg-[#C4B643] data-[state=checked]:text-[#0A0A07] data-[state=indeterminate]:bg-[#C4B643] data-[state=indeterminate]:text-[#0A0A07]";function gse(){const{toast:e}=rn(),t=un(),[n,r]=x.useState("open"),[a,i]=x.useState(""),[s,o]=x.useState(!1),[l,u]=x.useState(new Set),{data:d}=St({queryKey:["/api/playbooks/vault"]}),f=(d==null?void 0:d.data)??[],p=x.useMemo(()=>{const T=new Map;for(const P of f)T.set(P.id,P.title);return T},[f]),h={status:n==="all"?void 0:n,playbookId:a||void 0,excludeInProposal:n==="open"?!s:void 0},{data:y=[],isLoading:m}=St({queryKey:["/api/feedback-signals",h],queryFn:()=>NF(h)}),b=_t({mutationFn:T=>jF(T),onSuccess:T=>{e({title:`Discarded ${T.discarded} signal(s)`}),u(new Set),t.invalidateQueries({queryKey:["/api/feedback-signals"]})},onError:T=>{e({title:"Discard failed",description:T.message,variant:"destructive"})}}),g=T=>{u(P=>{const R=new Set(P);return R.has(T)?R.delete(T):R.add(T),R})},v=async()=>{const T=l.size>0?y.filter(P=>l.has(P.id)):y;if(T.length!==0){if(T.some(P=>!P.id)){e({title:"Copy blocked",description:"Every signal must include an id for tracking.",variant:"destructive"});return}try{await navigator.clipboard.writeText(RF(T)),e({title:"Copied curation prompt",description:`${T.length} signal id(s) included — paste into your IDE agent.`})}catch(P){e({title:"Copy failed",description:P instanceof Error?P.message:"Clipboard unavailable",variant:"destructive"})}}},w=[...l].filter(T=>{const P=y.find(R=>R.id===T);return(P==null?void 0:P.status)==="open"}),S=y.length>0&&y.every(T=>l.has(T.id)),E=y.some(T=>l.has(T.id)),C=()=>{if(S){u(new Set);return}u(new Set(y.map(T=>T.id)))};return c.jsxs("div",{className:"flex min-h-dvh flex-col bg-gray-950 text-gray-100",children:[c.jsx("header",{className:"shrink-0 border-b border-gray-800 px-4 py-4 sm:px-6",children:c.jsxs("div",{className:"mx-auto flex max-w-7xl flex-wrap items-center gap-3",children:[c.jsx(nc,{href:"/",children:c.jsxs(te,{variant:"ghost",size:"sm",className:"text-gray-300",children:[c.jsx(_T,{className:"mr-1 h-4 w-4"}),"Home"]})}),c.jsx("h1",{className:"text-lg font-semibold",children:"Feedback"}),c.jsx(mn,{variant:"outline",children:y.length}),c.jsx(nc,{href:"/playbook-patches",className:"ml-auto text-sm hover:underline",style:{color:"#92E4DD"},children:"Playbook proposals →"})]})}),c.jsxs("main",{className:"mx-auto w-full max-w-7xl flex-1 space-y-4 px-4 py-6 sm:px-6",children:[c.jsx("p",{className:"text-sm text-gray-400",children:"Durable correction data for playbook enhancement. Filter by playbook, copy rows (with ids) for an IDE agent to propose, then accept the proposal to mark feedback solved."}),c.jsxs("div",{className:"flex flex-wrap items-end gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-3",children:[c.jsxs("label",{className:"text-xs text-gray-500",children:["Playbook",c.jsxs("select",{className:"mt-1 block min-w-[12rem] rounded border border-gray-700 bg-gray-950 px-2 py-1.5 text-sm text-gray-100",value:a,onChange:T=>{i(T.target.value),u(new Set)},children:[c.jsx("option",{value:"",children:"All"}),f.map(T=>c.jsx("option",{value:T.id,children:T.title},T.id))]})]}),c.jsx("div",{className:"flex flex-wrap gap-1",children:[["open","Open"],["actioned","Actioned"],["discarded","Discarded"],["all","All"]].map(([T,P])=>{const R=n===T;return c.jsx(te,{size:"sm",variant:R?"gold":"outline",className:R?void 0:"border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800 hover:text-gray-100","aria-pressed":R,onClick:()=>{r(T),u(new Set)},children:P},T)})}),n==="open"&&c.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-400",children:[c.jsx("input",{type:"checkbox",checked:s,onChange:T=>o(T.target.checked)}),"Include already in an open proposal"]}),c.jsxs("div",{className:"ml-auto flex flex-wrap gap-2",children:[c.jsxs(te,{size:"sm",variant:"outline",disabled:y.length===0,onClick:()=>void v(),children:[c.jsx(ax,{className:"mr-1 h-3.5 w-3.5"}),"Copy for agent",l.size>0?` (${l.size})`:""]}),c.jsxs(te,{size:"sm",variant:"destructive",disabled:w.length===0||b.isPending,onClick:()=>b.mutate(w),children:[c.jsx(Td,{className:"mr-1 h-3.5 w-3.5"}),"Discard selected"]})]})]}),m&&c.jsx("p",{className:"text-sm text-gray-500",children:"Loading…"}),!m&&y.length===0&&c.jsx("p",{className:"text-sm text-gray-500",children:"No signals match these filters."}),!m&&y.length>0&&c.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-800",children:c.jsxs("table",{className:"w-full min-w-[48rem] text-left text-sm",children:[c.jsx("thead",{className:"border-b border-gray-800 bg-gray-900/80 text-xs uppercase text-gray-500",children:c.jsxs("tr",{children:[c.jsx("th",{className:"w-10 px-3 py-2",children:c.jsx(cp,{checked:S?!0:E?"indeterminate":!1,onCheckedChange:C,"aria-label":"Select all visible signals",disabled:y.length===0,className:uC})}),c.jsx("th",{className:"px-3 py-2",children:"Excerpt"}),c.jsx("th",{className:"px-3 py-2",children:"Failure"}),c.jsx("th",{className:"px-3 py-2",children:"Playbook"}),c.jsx("th",{className:"px-3 py-2",children:"Source"}),c.jsx("th",{className:"px-3 py-2",children:"When"})]})}),c.jsx("tbody",{children:y.map(T=>{const P=TF(T);return c.jsxs("tr",{className:"border-b border-gray-800/80 align-top",children:[c.jsx("td",{className:"px-3 py-2",children:c.jsx(cp,{checked:l.has(T.id),onCheckedChange:()=>g(T.id),"aria-label":`Select ${T.id}`,className:uC})}),c.jsxs("td",{className:"px-3 py-2",children:[c.jsx("p",{className:"font-mono text-[11px] text-gray-600",children:T.id}),c.jsxs("p",{className:"text-gray-200",children:["“",T.userFeedbackExcerpt,"”"]}),P&&c.jsx(mn,{variant:"outline",className:"mt-1 text-[10px]",children:"In proposal"})]}),c.jsx("td",{className:"px-3 py-2 text-gray-400",children:T.failureSummary}),c.jsx("td",{className:"px-3 py-2 text-gray-300",children:T.candidatePlaybookId?p.get(T.candidatePlaybookId)??T.candidatePlaybookId:"—"}),c.jsx("td",{className:"px-3 py-2 text-gray-500",children:T.source}),c.jsx("td",{className:"px-3 py-2 whitespace-nowrap text-gray-500",children:new Date(T.createdAt).toLocaleString()})]},T.id)})})]})})]})]})}function yse(){const e=new URLSearchParams(window.location.search),t=e.get("challenge")??"",n=e.get("session")??"",[r,a]=x.useState("idle"),[i,s]=x.useState("");x.useEffect(()=>{(!t||!n)&&(a("error"),s("Missing challenge or session in URL."))},[t,n]);async function o(){if(!(!t||!n)){a("loading");try{await we("POST","/api/trusted-session/admin/approve",{challengeId:t,runtimeSessionId:n}),a("success"),s("Admin elevation approved for this MCP session. Return to the agent.")}catch(l){a("error"),s(l instanceof Error?l.message:"Approval failed")}}}return c.jsx("div",{className:"min-h-screen flex items-center justify-center p-6 bg-muted/30",children:c.jsxs(Ba,{className:"w-full max-w-md",children:[c.jsxs($i,{children:[c.jsx(Oi,{children:"Approve agent-admin elevation"}),c.jsx(Au,{children:"Grants ephemeral deck-admin mode to one MCP session (30-minute lease). This does not change the persistent workspace grant."})]}),c.jsxs(Va,{className:"space-y-4",children:[t&&n?c.jsxs("dl",{className:"text-sm space-y-1 text-muted-foreground",children:[c.jsxs("div",{children:[c.jsx("dt",{className:"inline font-medium text-foreground",children:"Session "}),c.jsx("dd",{className:"inline font-mono text-xs",children:n})]}),c.jsxs("div",{children:[c.jsx("dt",{className:"inline font-medium text-foreground",children:"Challenge "}),c.jsx("dd",{className:"inline font-mono text-xs",children:t})]})]}):null,r==="success"?c.jsx("p",{className:"text-sm text-green-700 dark:text-green-400",children:i}):r==="error"?c.jsx("p",{className:"text-sm text-destructive",children:i}):null,r!=="success"&&t&&n?c.jsx(te,{onClick:()=>void o(),disabled:r==="loading",className:"w-full",children:r==="loading"?"Approving…":"Approve elevation"}):null]})]})})}function vse(){return c.jsxs(M3,{children:[c.jsx(Rs,{path:"/",component:JK}),c.jsx(Rs,{path:"/oauth/callback",component:nG}),c.jsx(Rs,{path:"/playbook-patches",component:mse}),c.jsx(Rs,{path:"/feedback-signals",component:gse}),c.jsx(Rs,{path:"/admin/approve",component:yse}),c.jsx(Rs,{path:"/mcp-test",component:Yie}),c.jsx(Rs,{component:tG})]})}function bse(){const[e,t]=x.useState(!1);return x.useEffect(()=>{let n=!1;return mI().finally(()=>{n||t(!0)}),()=>{n=!0}},[]),e?c.jsx(tI,{client:pI,children:c.jsxs(GU,{children:[c.jsx(c5,{}),c.jsx(vse,{})]})}):c.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[#0B1220] text-sm text-gray-300",children:"Loading AgentDeck..."})}r3.createRoot(document.getElementById("root")).render(c.jsx(x.StrictMode,{children:c.jsx(bse,{})}));