@agent-deck/backend 1.5.3 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,481 +0,0 @@
1
- var vR=Object.defineProperty;var mw=e=>{throw TypeError(e)};var xR=(e,t,n)=>t in e?vR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var po=(e,t,n)=>xR(e,typeof t!="symbol"?t+"":t,n),ap=(e,t,n)=>t.has(e)||mw("Cannot "+n);var L=(e,t,n)=>(ap(e,t,"read from private field"),n?n.call(e):t.get(e)),we=(e,t,n)=>t.has(e)?mw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ce=(e,t,n,r)=>(ap(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Oe=(e,t,n)=>(ap(e,t,"access private method"),n);var Eu=(e,t,n,r)=>({set _(o){ce(e,t,o,n)},get _(){return L(e,t,r)}});function wR(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();var Zd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ll(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var I_={exports:{}},oh={},A_={exports:{}},Ve={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its 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 Jc=Symbol.for("react.element"),bR=Symbol.for("react.portal"),kR=Symbol.for("react.fragment"),_R=Symbol.for("react.strict_mode"),SR=Symbol.for("react.profiler"),CR=Symbol.for("react.provider"),ER=Symbol.for("react.context"),NR=Symbol.for("react.forward_ref"),jR=Symbol.for("react.suspense"),PR=Symbol.for("react.memo"),TR=Symbol.for("react.lazy"),gw=Symbol.iterator;function $R(e){return e===null||typeof e!="object"?null:(e=gw&&e[gw]||e["@@iterator"],typeof e=="function"?e:null)}var O_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M_=Object.assign,D_={};function cl(e,t,n){this.props=e,this.context=t,this.refs=D_,this.updater=n||O_}cl.prototype.isReactComponent={};cl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): 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")};cl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function L_(){}L_.prototype=cl.prototype;function Wy(e,t,n){this.props=e,this.context=t,this.refs=D_,this.updater=n||O_}var Zy=Wy.prototype=new L_;Zy.constructor=Wy;M_(Zy,cl.prototype);Zy.isPureReactComponent=!0;var yw=Array.isArray,z_=Object.prototype.hasOwnProperty,Qy={current:null},F_={key:!0,ref:!0,__self:!0,__source:!0};function U_(e,t,n){var r,o={},s=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(s=""+t.key),t)z_.call(t,r)&&!F_.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];o.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:Jc,type:e,key:s,ref:i,props:o,_owner:Qy.current}}function RR(e,t){return{$$typeof:Jc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Gy(e){return typeof e=="object"&&e!==null&&e.$$typeof===Jc}function IR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var vw=/\/+/g;function lp(e,t){return typeof e=="object"&&e!==null&&e.key!=null?IR(""+e.key):t.toString(36)}function gd(e,t,n,r,o){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(s){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case Jc:case bR:i=!0}}if(i)return i=e,o=o(i),e=r===""?"."+lp(i,0):r,yw(o)?(n="",e!=null&&(n=e.replace(vw,"$&/")+"/"),gd(o,t,n,"",function(u){return u})):o!=null&&(Gy(o)&&(o=RR(o,n+(!o.key||i&&i.key===o.key?"":(""+o.key).replace(vw,"$&/")+"/")+e)),t.push(o)),1;if(i=0,r=r===""?".":r+":",yw(e))for(var a=0;a<e.length;a++){s=e[a];var l=r+lp(s,a);i+=gd(s,t,n,l,o)}else if(l=$R(e),typeof l=="function")for(e=l.call(e),a=0;!(s=e.next()).done;)s=s.value,l=r+lp(s,a++),i+=gd(s,t,n,l,o);else if(s==="object")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 i}function Nu(e,t,n){if(e==null)return e;var r=[],o=0;return gd(e,r,"","",function(s){return t.call(n,s,o++)}),r}function AR(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 Cn={current:null},yd={transition:null},OR={ReactCurrentDispatcher:Cn,ReactCurrentBatchConfig:yd,ReactCurrentOwner:Qy};function q_(){throw Error("act(...) is not supported in production builds of React.")}Ve.Children={map:Nu,forEach:function(e,t,n){Nu(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Nu(e,function(){t++}),t},toArray:function(e){return Nu(e,function(t){return t})||[]},only:function(e){if(!Gy(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ve.Component=cl;Ve.Fragment=kR;Ve.Profiler=SR;Ve.PureComponent=Wy;Ve.StrictMode=_R;Ve.Suspense=jR;Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=OR;Ve.act=q_;Ve.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=M_({},e.props),o=e.key,s=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,i=Qy.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)z_.call(t,l)&&!F_.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:Jc,type:e.type,key:o,ref:s,props:r,_owner:i}};Ve.createContext=function(e){return e={$$typeof:ER,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:CR,_context:e},e.Consumer=e};Ve.createElement=U_;Ve.createFactory=function(e){var t=U_.bind(null,e);return t.type=e,t};Ve.createRef=function(){return{current:null}};Ve.forwardRef=function(e){return{$$typeof:NR,render:e}};Ve.isValidElement=Gy;Ve.lazy=function(e){return{$$typeof:TR,_payload:{_status:-1,_result:e},_init:AR}};Ve.memo=function(e,t){return{$$typeof:PR,type:e,compare:t===void 0?null:t}};Ve.startTransition=function(e){var t=yd.transition;yd.transition={};try{e()}finally{yd.transition=t}};Ve.unstable_act=q_;Ve.useCallback=function(e,t){return Cn.current.useCallback(e,t)};Ve.useContext=function(e){return Cn.current.useContext(e)};Ve.useDebugValue=function(){};Ve.useDeferredValue=function(e){return Cn.current.useDeferredValue(e)};Ve.useEffect=function(e,t){return Cn.current.useEffect(e,t)};Ve.useId=function(){return Cn.current.useId()};Ve.useImperativeHandle=function(e,t,n){return Cn.current.useImperativeHandle(e,t,n)};Ve.useInsertionEffect=function(e,t){return Cn.current.useInsertionEffect(e,t)};Ve.useLayoutEffect=function(e,t){return Cn.current.useLayoutEffect(e,t)};Ve.useMemo=function(e,t){return Cn.current.useMemo(e,t)};Ve.useReducer=function(e,t,n){return Cn.current.useReducer(e,t,n)};Ve.useRef=function(e){return Cn.current.useRef(e)};Ve.useState=function(e){return Cn.current.useState(e)};Ve.useSyncExternalStore=function(e,t,n){return Cn.current.useSyncExternalStore(e,t,n)};Ve.useTransition=function(){return Cn.current.useTransition()};Ve.version="18.3.1";A_.exports=Ve;var b=A_.exports;const Kr=ll(b),Jy=wR({__proto__:null,default:Kr},[b]);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var MR=b,DR=Symbol.for("react.element"),LR=Symbol.for("react.fragment"),zR=Object.prototype.hasOwnProperty,FR=MR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,UR={key:!0,ref:!0,__self:!0,__source:!0};function V_(e,t,n){var r,o={},s=null,i=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)zR.call(t,r)&&!UR.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:DR,type:e,key:s,ref:i,props:o,_owner:FR.current}}oh.Fragment=LR;oh.jsx=V_;oh.jsxs=V_;I_.exports=oh;var c=I_.exports,H_={exports:{}},Yn={},B_={exports:{}},K_={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its 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
- */(function(e){function t(q,H){var N=q.length;q.push(H);e:for(;0<N;){var O=N-1>>>1,V=q[O];if(0<o(V,H))q[O]=H,q[N]=V,N=O;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var H=q[0],N=q.pop();if(N!==H){q[0]=N;e:for(var O=0,V=q.length,S=V>>>1;O<S;){var E=2*(O+1)-1,R=q[E],M=E+1,K=q[M];if(0>o(R,N))M<V&&0>o(K,R)?(q[O]=K,q[M]=N,O=M):(q[O]=R,q[E]=N,O=E);else if(M<V&&0>o(K,N))q[O]=K,q[M]=N,O=M;else break e}}return H}function o(q,H){var N=q.sortIndex-H.sortIndex;return N!==0?N:q.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var l=[],u=[],d=1,f=null,p=3,h=!1,y=!1,m=!1,x=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(q){for(var H=n(u);H!==null;){if(H.callback===null)r(u);else if(H.startTime<=q)r(u),H.sortIndex=H.expirationTime,t(l,H);else break;H=n(u)}}function k(q){if(m=!1,w(q),!y)if(n(l)!==null)y=!0,Z(C);else{var H=n(u);H!==null&&B(k,H.startTime-q)}}function C(q,H){y=!1,m&&(m=!1,g(I),I=-1),h=!0;var N=p;try{for(w(H),f=n(l);f!==null&&(!(f.expirationTime>H)||q&&!T());){var O=f.callback;if(typeof O=="function"){f.callback=null,p=f.priorityLevel;var V=O(f.expirationTime<=H);H=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(l)&&r(l),w(H)}else r(l);f=n(l)}if(f!==null)var S=!0;else{var E=n(u);E!==null&&B(k,E.startTime-H),S=!1}return S}finally{f=null,p=N,h=!1}}var j=!1,_=null,I=-1,P=5,$=-1;function T(){return!(e.unstable_now()-$<P)}function A(){if(_!==null){var q=e.unstable_now();$=q;var H=!0;try{H=_(!0,q)}finally{H?U():(j=!1,_=null)}}else j=!1}var U;if(typeof v=="function")U=function(){v(A)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,D=z.port2;z.port1.onmessage=A,U=function(){D.postMessage(null)}}else U=function(){x(A,0)};function Z(q){_=q,j||(j=!0,U())}function B(q,H){I=x(function(){q(e.unstable_now())},H)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_continueExecution=function(){y||h||(y=!0,Z(C))},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(q){switch(p){case 1:case 2:case 3:var H=3;break;default:H=p}var N=p;p=H;try{return q()}finally{p=N}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(q,H){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var N=p;p=q;try{return H()}finally{p=N}},e.unstable_scheduleCallback=function(q,H,N){var O=e.unstable_now();switch(typeof N=="object"&&N!==null?(N=N.delay,N=typeof N=="number"&&0<N?O+N:O):N=O,q){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=N+V,q={id:d++,callback:H,priorityLevel:q,startTime:N,expirationTime:V,sortIndex:-1},N>O?(q.sortIndex=N,t(u,q),n(l)===null&&q===n(u)&&(m?(g(I),I=-1):m=!0,B(k,N-O))):(q.sortIndex=V,t(l,q),y||h||(y=!0,Z(C))),q},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(q){var H=p;return function(){var N=p;p=H;try{return q.apply(this,arguments)}finally{p=N}}}})(K_);B_.exports=K_;var qR=B_.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its 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 VR=b,Jn=qR;function Y(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;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."}var W_=new Set,wc={};function Oi(e,t){Ha(e,t),Ha(e+"Capture",t)}function Ha(e,t){for(wc[e]=t,e=0;e<t.length;e++)W_.add(t[e])}var Ro=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pm=Object.prototype.hasOwnProperty,HR=/^[: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]*$/,xw={},ww={};function BR(e){return Pm.call(ww,e)?!0:Pm.call(xw,e)?!1:HR.test(e)?ww[e]=!0:(xw[e]=!0,!1)}function KR(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function WR(e,t,n,r){if(t===null||typeof t>"u"||KR(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function En(e,t,n,r,o,s,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=i}var on={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){on[e]=new En(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];on[t]=new En(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){on[e]=new En(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){on[e]=new En(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){on[e]=new En(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){on[e]=new En(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){on[e]=new En(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){on[e]=new En(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){on[e]=new En(e,5,!1,e.toLowerCase(),null,!1,!1)});var Yy=/[\-:]([a-z])/g;function Xy(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Yy,Xy);on[t]=new En(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Yy,Xy);on[t]=new En(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Yy,Xy);on[t]=new En(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){on[e]=new En(e,1,!1,e.toLowerCase(),null,!1,!1)});on.xlinkHref=new En("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){on[e]=new En(e,1,!1,e.toLowerCase(),null,!0,!0)});function ev(e,t,n,r){var o=on.hasOwnProperty(t)?on[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(WR(t,n,o,r)&&(n=null),r||o===null?BR(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var zo=VR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ju=Symbol.for("react.element"),ra=Symbol.for("react.portal"),oa=Symbol.for("react.fragment"),tv=Symbol.for("react.strict_mode"),Tm=Symbol.for("react.profiler"),Z_=Symbol.for("react.provider"),Q_=Symbol.for("react.context"),nv=Symbol.for("react.forward_ref"),$m=Symbol.for("react.suspense"),Rm=Symbol.for("react.suspense_list"),rv=Symbol.for("react.memo"),Yo=Symbol.for("react.lazy"),G_=Symbol.for("react.offscreen"),bw=Symbol.iterator;function Cl(e){return e===null||typeof e!="object"?null:(e=bw&&e[bw]||e["@@iterator"],typeof e=="function"?e:null)}var jt=Object.assign,cp;function Ul(e){if(cp===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);cp=t&&t[1]||""}return`
34
- `+cp+e}var up=!1;function dp(e,t){if(!e||up)return"";up=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var o=u.stack.split(`
35
- `),s=r.stack.split(`
36
- `),i=o.length-1,a=s.length-1;1<=i&&0<=a&&o[i]!==s[a];)a--;for(;1<=i&&0<=a;i--,a--)if(o[i]!==s[a]){if(i!==1||a!==1)do if(i--,a--,0>a||o[i]!==s[a]){var l=`
37
- `+o[i].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=i&&0<=a);break}}}finally{up=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ul(e):""}function ZR(e){switch(e.tag){case 5:return Ul(e.type);case 16:return Ul("Lazy");case 13:return Ul("Suspense");case 19:return Ul("SuspenseList");case 0:case 2:case 15:return e=dp(e.type,!1),e;case 11:return e=dp(e.type.render,!1),e;case 1:return e=dp(e.type,!0),e;default:return""}}function Im(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case oa:return"Fragment";case ra:return"Portal";case Tm:return"Profiler";case tv:return"StrictMode";case $m:return"Suspense";case Rm:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Q_:return(e.displayName||"Context")+".Consumer";case Z_:return(e._context.displayName||"Context")+".Provider";case nv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rv:return t=e.displayName||null,t!==null?t:Im(e.type)||"Memo";case Yo:t=e._payload,e=e._init;try{return Im(e(t))}catch{}}return null}function QR(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Im(t);case 8:return t===tv?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ps(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function J_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function GR(e){var t=J_(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(i){r=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Pu(e){e._valueTracker||(e._valueTracker=GR(e))}function Y_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=J_(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Qd(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}}function Am(e,t){var n=t.checked;return jt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function kw(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ps(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function X_(e,t){t=t.checked,t!=null&&ev(e,"checked",t,!1)}function Om(e,t){X_(e,t);var n=Ps(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Mm(e,t.type,n):t.hasOwnProperty("defaultValue")&&Mm(e,t.type,Ps(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _w(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Mm(e,t,n){(t!=="number"||Qd(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ql=Array.isArray;function va(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Ps(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Dm(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Y(91));return jt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Sw(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Y(92));if(ql(n)){if(1<n.length)throw Error(Y(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ps(n)}}function eS(e,t){var n=Ps(t.value),r=Ps(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Cw(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function tS(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Lm(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?tS(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Tu,nS=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Tu=Tu||document.createElement("div"),Tu.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Tu.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function bc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},JR=["Webkit","ms","Moz","O"];Object.keys(Yl).forEach(function(e){JR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Yl[t]=Yl[e]})});function rS(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Yl.hasOwnProperty(e)&&Yl[e]?(""+t).trim():t+"px"}function oS(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=rS(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var YR=jt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function zm(e,t){if(t){if(YR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Y(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Y(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Y(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Y(62))}}function Fm(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Um=null;function ov(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qm=null,xa=null,wa=null;function Ew(e){if(e=eu(e)){if(typeof qm!="function")throw Error(Y(280));var t=e.stateNode;t&&(t=ch(t),qm(e.stateNode,e.type,t))}}function sS(e){xa?wa?wa.push(e):wa=[e]:xa=e}function iS(){if(xa){var e=xa,t=wa;if(wa=xa=null,Ew(e),t)for(e=0;e<t.length;e++)Ew(t[e])}}function aS(e,t){return e(t)}function lS(){}var fp=!1;function cS(e,t,n){if(fp)return e(t,n);fp=!0;try{return aS(e,t,n)}finally{fp=!1,(xa!==null||wa!==null)&&(lS(),iS())}}function kc(e,t){var n=e.stateNode;if(n===null)return null;var r=ch(n);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(Y(231,t,typeof n));return n}var Vm=!1;if(Ro)try{var El={};Object.defineProperty(El,"passive",{get:function(){Vm=!0}}),window.addEventListener("test",El,El),window.removeEventListener("test",El,El)}catch{Vm=!1}function XR(e,t,n,r,o,s,i,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var Xl=!1,Gd=null,Jd=!1,Hm=null,eI={onError:function(e){Xl=!0,Gd=e}};function tI(e,t,n,r,o,s,i,a,l){Xl=!1,Gd=null,XR.apply(eI,arguments)}function nI(e,t,n,r,o,s,i,a,l){if(tI.apply(this,arguments),Xl){if(Xl){var u=Gd;Xl=!1,Gd=null}else throw Error(Y(198));Jd||(Jd=!0,Hm=u)}}function Mi(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 uS(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 Nw(e){if(Mi(e)!==e)throw Error(Y(188))}function rI(e){var t=e.alternate;if(!t){if(t=Mi(e),t===null)throw Error(Y(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var s=o.alternate;if(s===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===s.child){for(s=o.child;s;){if(s===n)return Nw(o),e;if(s===r)return Nw(o),t;s=s.sibling}throw Error(Y(188))}if(n.return!==r.return)n=o,r=s;else{for(var i=!1,a=o.child;a;){if(a===n){i=!0,n=o,r=s;break}if(a===r){i=!0,r=o,n=s;break}a=a.sibling}if(!i){for(a=s.child;a;){if(a===n){i=!0,n=s,r=o;break}if(a===r){i=!0,r=s,n=o;break}a=a.sibling}if(!i)throw Error(Y(189))}}if(n.alternate!==r)throw Error(Y(190))}if(n.tag!==3)throw Error(Y(188));return n.stateNode.current===n?e:t}function dS(e){return e=rI(e),e!==null?fS(e):null}function fS(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=fS(e);if(t!==null)return t;e=e.sibling}return null}var hS=Jn.unstable_scheduleCallback,jw=Jn.unstable_cancelCallback,oI=Jn.unstable_shouldYield,sI=Jn.unstable_requestPaint,It=Jn.unstable_now,iI=Jn.unstable_getCurrentPriorityLevel,sv=Jn.unstable_ImmediatePriority,pS=Jn.unstable_UserBlockingPriority,Yd=Jn.unstable_NormalPriority,aI=Jn.unstable_LowPriority,mS=Jn.unstable_IdlePriority,sh=null,oo=null;function lI(e){if(oo&&typeof oo.onCommitFiberRoot=="function")try{oo.onCommitFiberRoot(sh,e,void 0,(e.current.flags&128)===128)}catch{}}var Rr=Math.clz32?Math.clz32:dI,cI=Math.log,uI=Math.LN2;function dI(e){return e>>>=0,e===0?32:31-(cI(e)/uI|0)|0}var $u=64,Ru=4194304;function Vl(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Xd(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~o;a!==0?r=Vl(a):(s&=i,s!==0&&(r=Vl(s)))}else i=n&~o,i!==0?r=Vl(i):s!==0&&(r=Vl(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,s=t&-t,o>=s||o===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Rr(t),o=1<<n,r|=e[n],t&=~o;return r}function fI(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function hI(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,s=e.pendingLanes;0<s;){var i=31-Rr(s),a=1<<i,l=o[i];l===-1?(!(a&n)||a&r)&&(o[i]=fI(a,t)):l<=t&&(e.expiredLanes|=a),s&=~a}}function Bm(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function gS(){var e=$u;return $u<<=1,!($u&4194240)&&($u=64),e}function hp(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Yc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Rr(t),e[t]=n}function pI(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Rr(n),s=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~s}}function iv(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Rr(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var et=0;function yS(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var vS,av,xS,wS,bS,Km=!1,Iu=[],vs=null,xs=null,ws=null,_c=new Map,Sc=new Map,rs=[],mI="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 submit".split(" ");function Pw(e,t){switch(e){case"focusin":case"focusout":vs=null;break;case"dragenter":case"dragleave":xs=null;break;case"mouseover":case"mouseout":ws=null;break;case"pointerover":case"pointerout":_c.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sc.delete(t.pointerId)}}function Nl(e,t,n,r,o,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[o]},t!==null&&(t=eu(t),t!==null&&av(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function gI(e,t,n,r,o){switch(t){case"focusin":return vs=Nl(vs,e,t,n,r,o),!0;case"dragenter":return xs=Nl(xs,e,t,n,r,o),!0;case"mouseover":return ws=Nl(ws,e,t,n,r,o),!0;case"pointerover":var s=o.pointerId;return _c.set(s,Nl(_c.get(s)||null,e,t,n,r,o)),!0;case"gotpointercapture":return s=o.pointerId,Sc.set(s,Nl(Sc.get(s)||null,e,t,n,r,o)),!0}return!1}function kS(e){var t=oi(e.target);if(t!==null){var n=Mi(t);if(n!==null){if(t=n.tag,t===13){if(t=uS(n),t!==null){e.blockedOn=t,bS(e.priority,function(){xS(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 vd(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Wm(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Um=r,n.target.dispatchEvent(r),Um=null}else return t=eu(n),t!==null&&av(t),e.blockedOn=n,!1;t.shift()}return!0}function Tw(e,t,n){vd(e)&&n.delete(t)}function yI(){Km=!1,vs!==null&&vd(vs)&&(vs=null),xs!==null&&vd(xs)&&(xs=null),ws!==null&&vd(ws)&&(ws=null),_c.forEach(Tw),Sc.forEach(Tw)}function jl(e,t){e.blockedOn===t&&(e.blockedOn=null,Km||(Km=!0,Jn.unstable_scheduleCallback(Jn.unstable_NormalPriority,yI)))}function Cc(e){function t(o){return jl(o,e)}if(0<Iu.length){jl(Iu[0],e);for(var n=1;n<Iu.length;n++){var r=Iu[n];r.blockedOn===e&&(r.blockedOn=null)}}for(vs!==null&&jl(vs,e),xs!==null&&jl(xs,e),ws!==null&&jl(ws,e),_c.forEach(t),Sc.forEach(t),n=0;n<rs.length;n++)r=rs[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<rs.length&&(n=rs[0],n.blockedOn===null);)kS(n),n.blockedOn===null&&rs.shift()}var ba=zo.ReactCurrentBatchConfig,ef=!0;function vI(e,t,n,r){var o=et,s=ba.transition;ba.transition=null;try{et=1,lv(e,t,n,r)}finally{et=o,ba.transition=s}}function xI(e,t,n,r){var o=et,s=ba.transition;ba.transition=null;try{et=4,lv(e,t,n,r)}finally{et=o,ba.transition=s}}function lv(e,t,n,r){if(ef){var o=Wm(e,t,n,r);if(o===null)_p(e,t,r,tf,n),Pw(e,r);else if(gI(o,e,t,n,r))r.stopPropagation();else if(Pw(e,r),t&4&&-1<mI.indexOf(e)){for(;o!==null;){var s=eu(o);if(s!==null&&vS(s),s=Wm(e,t,n,r),s===null&&_p(e,t,r,tf,n),s===o)break;o=s}o!==null&&r.stopPropagation()}else _p(e,t,r,null,n)}}var tf=null;function Wm(e,t,n,r){if(tf=null,e=ov(r),e=oi(e),e!==null)if(t=Mi(e),t===null)e=null;else if(n=t.tag,n===13){if(e=uS(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 tf=e,null}function _S(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(iI()){case sv:return 1;case pS:return 4;case Yd:case aI:return 16;case mS:return 536870912;default:return 16}default:return 16}}var ms=null,cv=null,xd=null;function SS(){if(xd)return xd;var e,t=cv,n=t.length,r,o="value"in ms?ms.value:ms.textContent,s=o.length;for(e=0;e<n&&t[e]===o[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===o[s-r];r++);return xd=o.slice(e,1<r?1-r:void 0)}function wd(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 Au(){return!0}function $w(){return!1}function Xn(e){function t(n,r,o,s,i){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=s,this.target=i,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Au:$w,this.isPropagationStopped=$w,this}return jt(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=Au)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Au)},persist:function(){},isPersistent:Au}),t}var ul={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},uv=Xn(ul),Xc=jt({},ul,{view:0,detail:0}),wI=Xn(Xc),pp,mp,Pl,ih=jt({},Xc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dv,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!==Pl&&(Pl&&e.type==="mousemove"?(pp=e.screenX-Pl.screenX,mp=e.screenY-Pl.screenY):mp=pp=0,Pl=e),pp)},movementY:function(e){return"movementY"in e?e.movementY:mp}}),Rw=Xn(ih),bI=jt({},ih,{dataTransfer:0}),kI=Xn(bI),_I=jt({},Xc,{relatedTarget:0}),gp=Xn(_I),SI=jt({},ul,{animationName:0,elapsedTime:0,pseudoElement:0}),CI=Xn(SI),EI=jt({},ul,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),NI=Xn(EI),jI=jt({},ul,{data:0}),Iw=Xn(jI),PI={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},TI={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"},$I={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RI(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=$I[e])?!!t[e]:!1}function dv(){return RI}var II=jt({},Xc,{key:function(e){if(e.key){var t=PI[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=wd(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?TI[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dv,charCode:function(e){return e.type==="keypress"?wd(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?wd(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),AI=Xn(II),OI=jt({},ih,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Aw=Xn(OI),MI=jt({},Xc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dv}),DI=Xn(MI),LI=jt({},ul,{propertyName:0,elapsedTime:0,pseudoElement:0}),zI=Xn(LI),FI=jt({},ih,{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}),UI=Xn(FI),qI=[9,13,27,32],fv=Ro&&"CompositionEvent"in window,ec=null;Ro&&"documentMode"in document&&(ec=document.documentMode);var VI=Ro&&"TextEvent"in window&&!ec,CS=Ro&&(!fv||ec&&8<ec&&11>=ec),Ow=" ",Mw=!1;function ES(e,t){switch(e){case"keyup":return qI.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function NS(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var sa=!1;function HI(e,t){switch(e){case"compositionend":return NS(t);case"keypress":return t.which!==32?null:(Mw=!0,Ow);case"textInput":return e=t.data,e===Ow&&Mw?null:e;default:return null}}function BI(e,t){if(sa)return e==="compositionend"||!fv&&ES(e,t)?(e=SS(),xd=cv=ms=null,sa=!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 CS&&t.locale!=="ko"?null:t.data;default:return null}}var KI={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 Dw(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!KI[e.type]:t==="textarea"}function jS(e,t,n,r){sS(r),t=nf(t,"onChange"),0<t.length&&(n=new uv("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var tc=null,Ec=null;function WI(e){zS(e,0)}function ah(e){var t=la(e);if(Y_(t))return e}function ZI(e,t){if(e==="change")return t}var PS=!1;if(Ro){var yp;if(Ro){var vp="oninput"in document;if(!vp){var Lw=document.createElement("div");Lw.setAttribute("oninput","return;"),vp=typeof Lw.oninput=="function"}yp=vp}else yp=!1;PS=yp&&(!document.documentMode||9<document.documentMode)}function zw(){tc&&(tc.detachEvent("onpropertychange",TS),Ec=tc=null)}function TS(e){if(e.propertyName==="value"&&ah(Ec)){var t=[];jS(t,Ec,e,ov(e)),cS(WI,t)}}function QI(e,t,n){e==="focusin"?(zw(),tc=t,Ec=n,tc.attachEvent("onpropertychange",TS)):e==="focusout"&&zw()}function GI(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ah(Ec)}function JI(e,t){if(e==="click")return ah(t)}function YI(e,t){if(e==="input"||e==="change")return ah(t)}function XI(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Mr=typeof Object.is=="function"?Object.is:XI;function Nc(e,t){if(Mr(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 o=n[r];if(!Pm.call(t,o)||!Mr(e[o],t[o]))return!1}return!0}function Fw(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Uw(e,t){var n=Fw(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=Fw(n)}}function $S(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$S(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function RS(){for(var e=window,t=Qd();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Qd(e.document)}return t}function hv(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")}function eA(e){var t=RS(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&$S(n.ownerDocument.documentElement,n)){if(r!==null&&hv(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,s=Math.min(r.start,o);r=r.end===void 0?s:Math.min(r.end,o),!e.extend&&s>r&&(o=r,r=s,s=o),o=Uw(n,s);var i=Uw(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var tA=Ro&&"documentMode"in document&&11>=document.documentMode,ia=null,Zm=null,nc=null,Qm=!1;function qw(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qm||ia==null||ia!==Qd(r)||(r=ia,"selectionStart"in r&&hv(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}),nc&&Nc(nc,r)||(nc=r,r=nf(Zm,"onSelect"),0<r.length&&(t=new uv("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ia)))}function Ou(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var aa={animationend:Ou("Animation","AnimationEnd"),animationiteration:Ou("Animation","AnimationIteration"),animationstart:Ou("Animation","AnimationStart"),transitionend:Ou("Transition","TransitionEnd")},xp={},IS={};Ro&&(IS=document.createElement("div").style,"AnimationEvent"in window||(delete aa.animationend.animation,delete aa.animationiteration.animation,delete aa.animationstart.animation),"TransitionEvent"in window||delete aa.transitionend.transition);function lh(e){if(xp[e])return xp[e];if(!aa[e])return e;var t=aa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in IS)return xp[e]=t[n];return e}var AS=lh("animationend"),OS=lh("animationiteration"),MS=lh("animationstart"),DS=lh("transitionend"),LS=new Map,Vw="abort auxClick 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(" ");function Ms(e,t){LS.set(e,t),Oi(t,[e])}for(var wp=0;wp<Vw.length;wp++){var bp=Vw[wp],nA=bp.toLowerCase(),rA=bp[0].toUpperCase()+bp.slice(1);Ms(nA,"on"+rA)}Ms(AS,"onAnimationEnd");Ms(OS,"onAnimationIteration");Ms(MS,"onAnimationStart");Ms("dblclick","onDoubleClick");Ms("focusin","onFocus");Ms("focusout","onBlur");Ms(DS,"onTransitionEnd");Ha("onMouseEnter",["mouseout","mouseover"]);Ha("onMouseLeave",["mouseout","mouseover"]);Ha("onPointerEnter",["pointerout","pointerover"]);Ha("onPointerLeave",["pointerout","pointerover"]);Oi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Oi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Oi("onBeforeInput",["compositionend","keypress","textInput","paste"]);Oi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Oi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Oi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hl="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(" "),oA=new Set("cancel close invalid load scroll toggle".split(" ").concat(Hl));function Hw(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,nI(r,t,void 0,e),e.currentTarget=null}function zS(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var i=r.length-1;0<=i;i--){var a=r[i],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==s&&o.isPropagationStopped())break e;Hw(o,a,u),s=l}else for(i=0;i<r.length;i++){if(a=r[i],l=a.instance,u=a.currentTarget,a=a.listener,l!==s&&o.isPropagationStopped())break e;Hw(o,a,u),s=l}}}if(Jd)throw e=Hm,Jd=!1,Hm=null,e}function ct(e,t){var n=t[eg];n===void 0&&(n=t[eg]=new Set);var r=e+"__bubble";n.has(r)||(FS(t,e,2,!1),n.add(r))}function kp(e,t,n){var r=0;t&&(r|=4),FS(n,e,r,t)}var Mu="_reactListening"+Math.random().toString(36).slice(2);function jc(e){if(!e[Mu]){e[Mu]=!0,W_.forEach(function(n){n!=="selectionchange"&&(oA.has(n)||kp(n,!1,e),kp(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Mu]||(t[Mu]=!0,kp("selectionchange",!1,t))}}function FS(e,t,n,r){switch(_S(t)){case 1:var o=vI;break;case 4:o=xI;break;default:o=lv}n=o.bind(null,t,n,e),o=void 0,!Vm||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function _p(e,t,n,r,o){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(i===4)for(i=r.return;i!==null;){var l=i.tag;if((l===3||l===4)&&(l=i.stateNode.containerInfo,l===o||l.nodeType===8&&l.parentNode===o))return;i=i.return}for(;a!==null;){if(i=oi(a),i===null)return;if(l=i.tag,l===5||l===6){r=s=i;continue e}a=a.parentNode}}r=r.return}cS(function(){var u=s,d=ov(n),f=[];e:{var p=LS.get(e);if(p!==void 0){var h=uv,y=e;switch(e){case"keypress":if(wd(n)===0)break e;case"keydown":case"keyup":h=AI;break;case"focusin":y="focus",h=gp;break;case"focusout":y="blur",h=gp;break;case"beforeblur":case"afterblur":h=gp;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=Rw;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=kI;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=DI;break;case AS:case OS:case MS:h=CI;break;case DS:h=zI;break;case"scroll":h=wI;break;case"wheel":h=UI;break;case"copy":case"cut":case"paste":h=NI;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Aw}var m=(t&4)!==0,x=!m&&e==="scroll",g=m?p!==null?p+"Capture":null:p;m=[];for(var v=u,w;v!==null;){w=v;var k=w.stateNode;if(w.tag===5&&k!==null&&(w=k,g!==null&&(k=kc(v,g),k!=null&&m.push(Pc(v,k,w)))),x)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!==Um&&(y=n.relatedTarget||n.fromElement)&&(oi(y)||y[Io]))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?oi(y):null,y!==null&&(x=Mi(y),y!==x||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=u),h!==y)){if(m=Rw,k="onMouseLeave",g="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(m=Aw,k="onPointerLeave",g="onPointerEnter",v="pointer"),x=h==null?p:la(h),w=y==null?p:la(y),p=new m(k,v+"leave",h,n,d),p.target=x,p.relatedTarget=w,k=null,oi(d)===u&&(m=new m(g,v+"enter",y,n,d),m.target=w,m.relatedTarget=x,k=m),x=k,h&&y)t:{for(m=h,g=y,v=0,w=m;w;w=Ui(w))v++;for(w=0,k=g;k;k=Ui(k))w++;for(;0<v-w;)m=Ui(m),v--;for(;0<w-v;)g=Ui(g),w--;for(;v--;){if(m===g||g!==null&&m===g.alternate)break t;m=Ui(m),g=Ui(g)}m=null}else m=null;h!==null&&Bw(f,p,h,m,!1),y!==null&&x!==null&&Bw(f,x,y,m,!0)}}e:{if(p=u?la(u):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var C=ZI;else if(Dw(p))if(PS)C=YI;else{C=GI;var j=QI}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(C=JI);if(C&&(C=C(e,u))){jS(f,C,n,d);break e}j&&j(e,p,u),e==="focusout"&&(j=p._wrapperState)&&j.controlled&&p.type==="number"&&Mm(p,"number",p.value)}switch(j=u?la(u):window,e){case"focusin":(Dw(j)||j.contentEditable==="true")&&(ia=j,Zm=u,nc=null);break;case"focusout":nc=Zm=ia=null;break;case"mousedown":Qm=!0;break;case"contextmenu":case"mouseup":case"dragend":Qm=!1,qw(f,n,d);break;case"selectionchange":if(tA)break;case"keydown":case"keyup":qw(f,n,d)}var _;if(fv)e:{switch(e){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else sa?ES(e,n)&&(I="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(CS&&n.locale!=="ko"&&(sa||I!=="onCompositionStart"?I==="onCompositionEnd"&&sa&&(_=SS()):(ms=d,cv="value"in ms?ms.value:ms.textContent,sa=!0)),j=nf(u,I),0<j.length&&(I=new Iw(I,e,null,n,d),f.push({event:I,listeners:j}),_?I.data=_:(_=NS(n),_!==null&&(I.data=_)))),(_=VI?HI(e,n):BI(e,n))&&(u=nf(u,"onBeforeInput"),0<u.length&&(d=new Iw("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=_))}zS(f,t)})}function Pc(e,t,n){return{instance:e,listener:t,currentTarget:n}}function nf(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,s=o.stateNode;o.tag===5&&s!==null&&(o=s,s=kc(e,n),s!=null&&r.unshift(Pc(e,s,o)),s=kc(e,t),s!=null&&r.push(Pc(e,s,o))),e=e.return}return r}function Ui(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Bw(e,t,n,r,o){for(var s=t._reactName,i=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,o?(l=kc(n,s),l!=null&&i.unshift(Pc(n,l,a))):o||(l=kc(n,s),l!=null&&i.push(Pc(n,l,a)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var sA=/\r\n?/g,iA=/\u0000|\uFFFD/g;function Kw(e){return(typeof e=="string"?e:""+e).replace(sA,`
38
- `).replace(iA,"")}function Du(e,t,n){if(t=Kw(t),Kw(e)!==t&&n)throw Error(Y(425))}function rf(){}var Gm=null,Jm=null;function Ym(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xm=typeof setTimeout=="function"?setTimeout:void 0,aA=typeof clearTimeout=="function"?clearTimeout:void 0,Ww=typeof Promise=="function"?Promise:void 0,lA=typeof queueMicrotask=="function"?queueMicrotask:typeof Ww<"u"?function(e){return Ww.resolve(null).then(e).catch(cA)}:Xm;function cA(e){setTimeout(function(){throw e})}function Sp(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),Cc(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Cc(t)}function bs(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==="$?")break;if(t==="/$")return null}}return e}function Zw(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var dl=Math.random().toString(36).slice(2),Gr="__reactFiber$"+dl,Tc="__reactProps$"+dl,Io="__reactContainer$"+dl,eg="__reactEvents$"+dl,uA="__reactListeners$"+dl,dA="__reactHandles$"+dl;function oi(e){var t=e[Gr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Io]||n[Gr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Zw(e);e!==null;){if(n=e[Gr])return n;e=Zw(e)}return t}e=n,n=e.parentNode}return null}function eu(e){return e=e[Gr]||e[Io],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function la(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Y(33))}function ch(e){return e[Tc]||null}var tg=[],ca=-1;function Ds(e){return{current:e}}function pt(e){0>ca||(e.current=tg[ca],tg[ca]=null,ca--)}function it(e,t){ca++,tg[ca]=e.current,e.current=t}var Ts={},pn=Ds(Ts),Ln=Ds(!1),wi=Ts;function Ba(e,t){var n=e.type.contextTypes;if(!n)return Ts;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},s;for(s in n)o[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function zn(e){return e=e.childContextTypes,e!=null}function of(){pt(Ln),pt(pn)}function Qw(e,t,n){if(pn.current!==Ts)throw Error(Y(168));it(pn,t),it(Ln,n)}function US(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(Y(108,QR(e)||"Unknown",o));return jt({},n,r)}function sf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ts,wi=pn.current,it(pn,e),it(Ln,Ln.current),!0}function Gw(e,t,n){var r=e.stateNode;if(!r)throw Error(Y(169));n?(e=US(e,t,wi),r.__reactInternalMemoizedMergedChildContext=e,pt(Ln),pt(pn),it(pn,e)):pt(Ln),it(Ln,n)}var xo=null,uh=!1,Cp=!1;function qS(e){xo===null?xo=[e]:xo.push(e)}function fA(e){uh=!0,qS(e)}function Ls(){if(!Cp&&xo!==null){Cp=!0;var e=0,t=et;try{var n=xo;for(et=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}xo=null,uh=!1}catch(o){throw xo!==null&&(xo=xo.slice(e+1)),hS(sv,Ls),o}finally{et=t,Cp=!1}}return null}var ua=[],da=0,af=null,lf=0,lr=[],cr=0,bi=null,So=1,Co="";function Ws(e,t){ua[da++]=lf,ua[da++]=af,af=e,lf=t}function VS(e,t,n){lr[cr++]=So,lr[cr++]=Co,lr[cr++]=bi,bi=e;var r=So;e=Co;var o=32-Rr(r)-1;r&=~(1<<o),n+=1;var s=32-Rr(t)+o;if(30<s){var i=o-o%5;s=(r&(1<<i)-1).toString(32),r>>=i,o-=i,So=1<<32-Rr(t)+o|n<<o|r,Co=s+e}else So=1<<s|n<<o|r,Co=e}function pv(e){e.return!==null&&(Ws(e,1),VS(e,1,0))}function mv(e){for(;e===af;)af=ua[--da],ua[da]=null,lf=ua[--da],ua[da]=null;for(;e===bi;)bi=lr[--cr],lr[cr]=null,Co=lr[--cr],lr[cr]=null,So=lr[--cr],lr[cr]=null}var Zn=null,Wn=null,wt=!1,jr=null;function HS(e,t){var n=dr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Jw(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Zn=e,Wn=bs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Zn=e,Wn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=bi!==null?{id:So,overflow:Co}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=dr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Zn=e,Wn=null,!0):!1;default:return!1}}function ng(e){return(e.mode&1)!==0&&(e.flags&128)===0}function rg(e){if(wt){var t=Wn;if(t){var n=t;if(!Jw(e,t)){if(ng(e))throw Error(Y(418));t=bs(n.nextSibling);var r=Zn;t&&Jw(e,t)?HS(r,n):(e.flags=e.flags&-4097|2,wt=!1,Zn=e)}}else{if(ng(e))throw Error(Y(418));e.flags=e.flags&-4097|2,wt=!1,Zn=e}}}function Yw(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Zn=e}function Lu(e){if(e!==Zn)return!1;if(!wt)return Yw(e),wt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ym(e.type,e.memoizedProps)),t&&(t=Wn)){if(ng(e))throw BS(),Error(Y(418));for(;t;)HS(e,t),t=bs(t.nextSibling)}if(Yw(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Y(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Wn=bs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Wn=null}}else Wn=Zn?bs(e.stateNode.nextSibling):null;return!0}function BS(){for(var e=Wn;e;)e=bs(e.nextSibling)}function Ka(){Wn=Zn=null,wt=!1}function gv(e){jr===null?jr=[e]:jr.push(e)}var hA=zo.ReactCurrentBatchConfig;function Tl(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Y(309));var r=n.stateNode}if(!r)throw Error(Y(147,e));var o=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(i){var a=o.refs;i===null?delete a[s]:a[s]=i},t._stringRef=s,t)}if(typeof e!="string")throw Error(Y(284));if(!n._owner)throw Error(Y(290,e))}return e}function zu(e,t){throw e=Object.prototype.toString.call(t),Error(Y(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Xw(e){var t=e._init;return t(e._payload)}function KS(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,v){for(g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function o(g,v){return g=Cs(g,v),g.index=0,g.sibling=null,g}function s(g,v,w){return g.index=w,e?(w=g.alternate,w!==null?(w=w.index,w<v?(g.flags|=2,v):w):(g.flags|=2,v)):(g.flags|=1048576,v)}function i(g){return e&&g.alternate===null&&(g.flags|=2),g}function a(g,v,w,k){return v===null||v.tag!==6?(v=Rp(w,g.mode,k),v.return=g,v):(v=o(v,w),v.return=g,v)}function l(g,v,w,k){var C=w.type;return C===oa?d(g,v,w.props.children,k,w.key):v!==null&&(v.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Yo&&Xw(C)===v.type)?(k=o(v,w.props),k.ref=Tl(g,v,w),k.return=g,k):(k=Nd(w.type,w.key,w.props,null,g.mode,k),k.ref=Tl(g,v,w),k.return=g,k)}function u(g,v,w,k){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=Ip(w,g.mode,k),v.return=g,v):(v=o(v,w.children||[]),v.return=g,v)}function d(g,v,w,k,C){return v===null||v.tag!==7?(v=vi(w,g.mode,k,C),v.return=g,v):(v=o(v,w),v.return=g,v)}function f(g,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Rp(""+v,g.mode,w),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ju:return w=Nd(v.type,v.key,v.props,null,g.mode,w),w.ref=Tl(g,null,v),w.return=g,w;case ra:return v=Ip(v,g.mode,w),v.return=g,v;case Yo:var k=v._init;return f(g,k(v._payload),w)}if(ql(v)||Cl(v))return v=vi(v,g.mode,w,null),v.return=g,v;zu(g,v)}return null}function p(g,v,w,k){var C=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:a(g,v,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case ju:return w.key===C?l(g,v,w,k):null;case ra:return w.key===C?u(g,v,w,k):null;case Yo:return C=w._init,p(g,v,C(w._payload),k)}if(ql(w)||Cl(w))return C!==null?null:d(g,v,w,k,null);zu(g,w)}return null}function h(g,v,w,k,C){if(typeof k=="string"&&k!==""||typeof k=="number")return g=g.get(w)||null,a(v,g,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case ju:return g=g.get(k.key===null?w:k.key)||null,l(v,g,k,C);case ra:return g=g.get(k.key===null?w:k.key)||null,u(v,g,k,C);case Yo:var j=k._init;return h(g,v,w,j(k._payload),C)}if(ql(k)||Cl(k))return g=g.get(w)||null,d(v,g,k,C,null);zu(v,k)}return null}function y(g,v,w,k){for(var C=null,j=null,_=v,I=v=0,P=null;_!==null&&I<w.length;I++){_.index>I?(P=_,_=null):P=_.sibling;var $=p(g,_,w[I],k);if($===null){_===null&&(_=P);break}e&&_&&$.alternate===null&&t(g,_),v=s($,v,I),j===null?C=$:j.sibling=$,j=$,_=P}if(I===w.length)return n(g,_),wt&&Ws(g,I),C;if(_===null){for(;I<w.length;I++)_=f(g,w[I],k),_!==null&&(v=s(_,v,I),j===null?C=_:j.sibling=_,j=_);return wt&&Ws(g,I),C}for(_=r(g,_);I<w.length;I++)P=h(_,g,I,w[I],k),P!==null&&(e&&P.alternate!==null&&_.delete(P.key===null?I:P.key),v=s(P,v,I),j===null?C=P:j.sibling=P,j=P);return e&&_.forEach(function(T){return t(g,T)}),wt&&Ws(g,I),C}function m(g,v,w,k){var C=Cl(w);if(typeof C!="function")throw Error(Y(150));if(w=C.call(w),w==null)throw Error(Y(151));for(var j=C=null,_=v,I=v=0,P=null,$=w.next();_!==null&&!$.done;I++,$=w.next()){_.index>I?(P=_,_=null):P=_.sibling;var T=p(g,_,$.value,k);if(T===null){_===null&&(_=P);break}e&&_&&T.alternate===null&&t(g,_),v=s(T,v,I),j===null?C=T:j.sibling=T,j=T,_=P}if($.done)return n(g,_),wt&&Ws(g,I),C;if(_===null){for(;!$.done;I++,$=w.next())$=f(g,$.value,k),$!==null&&(v=s($,v,I),j===null?C=$:j.sibling=$,j=$);return wt&&Ws(g,I),C}for(_=r(g,_);!$.done;I++,$=w.next())$=h(_,g,I,$.value,k),$!==null&&(e&&$.alternate!==null&&_.delete($.key===null?I:$.key),v=s($,v,I),j===null?C=$:j.sibling=$,j=$);return e&&_.forEach(function(A){return t(g,A)}),wt&&Ws(g,I),C}function x(g,v,w,k){if(typeof w=="object"&&w!==null&&w.type===oa&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ju:e:{for(var C=w.key,j=v;j!==null;){if(j.key===C){if(C=w.type,C===oa){if(j.tag===7){n(g,j.sibling),v=o(j,w.props.children),v.return=g,g=v;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Yo&&Xw(C)===j.type){n(g,j.sibling),v=o(j,w.props),v.ref=Tl(g,j,w),v.return=g,g=v;break e}n(g,j);break}else t(g,j);j=j.sibling}w.type===oa?(v=vi(w.props.children,g.mode,k,w.key),v.return=g,g=v):(k=Nd(w.type,w.key,w.props,null,g.mode,k),k.ref=Tl(g,v,w),k.return=g,g=k)}return i(g);case ra:e:{for(j=w.key;v!==null;){if(v.key===j)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(g,v.sibling),v=o(v,w.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else t(g,v);v=v.sibling}v=Ip(w,g.mode,k),v.return=g,g=v}return i(g);case Yo:return j=w._init,x(g,v,j(w._payload),k)}if(ql(w))return y(g,v,w,k);if(Cl(w))return m(g,v,w,k);zu(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(g,v.sibling),v=o(v,w),v.return=g,g=v):(n(g,v),v=Rp(w,g.mode,k),v.return=g,g=v),i(g)):n(g,v)}return x}var Wa=KS(!0),WS=KS(!1),cf=Ds(null),uf=null,fa=null,yv=null;function vv(){yv=fa=uf=null}function xv(e){var t=cf.current;pt(cf),e._currentValue=t}function og(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 ka(e,t){uf=e,yv=fa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Dn=!0),e.firstContext=null)}function hr(e){var t=e._currentValue;if(yv!==e)if(e={context:e,memoizedValue:t,next:null},fa===null){if(uf===null)throw Error(Y(308));fa=e,uf.dependencies={lanes:0,firstContext:e}}else fa=fa.next=e;return t}var si=null;function wv(e){si===null?si=[e]:si.push(e)}function ZS(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,wv(t)):(n.next=o.next,o.next=n),t.interleaved=n,Ao(e,r)}function Ao(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Xo=!1;function bv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function QS(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function No(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ks(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ze&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Ao(e,n)}return o=r.interleaved,o===null?(t.next=t,wv(r)):(t.next=o.next,o.next=t),r.interleaved=t,Ao(e,n)}function bd(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,iv(e,n)}}function eb(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?o=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?o=s=t:s=s.next=t}else o=s=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function df(e,t,n,r){var o=e.updateQueue;Xo=!1;var s=o.firstBaseUpdate,i=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,u=l.next;l.next=null,i===null?s=u:i.next=u,i=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==i&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(s!==null){var f=o.baseState;i=0,d=u=l=null,a=s;do{var p=a.lane,h=a.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=e,m=a;switch(p=t,h=n,m.tag){case 1:if(y=m.payload,typeof y=="function"){f=y.call(h,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(h,f,p):y,p==null)break e;f=jt({},f,p);break e;case 2:Xo=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,p=o.effects,p===null?o.effects=[a]:p.push(a))}else h={eventTime:h,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=h,l=f):d=d.next=h,i|=p;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;p=a,a=p.next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}while(!0);if(d===null&&(l=f),o.baseState=l,o.firstBaseUpdate=u,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else s===null&&(o.shared.lanes=0);_i|=i,e.lanes=i,e.memoizedState=f}}function tb(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(Y(191,o));o.call(r)}}}var tu={},so=Ds(tu),$c=Ds(tu),Rc=Ds(tu);function ii(e){if(e===tu)throw Error(Y(174));return e}function kv(e,t){switch(it(Rc,t),it($c,e),it(so,tu),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Lm(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Lm(t,e)}pt(so),it(so,t)}function Za(){pt(so),pt($c),pt(Rc)}function GS(e){ii(Rc.current);var t=ii(so.current),n=Lm(t,e.type);t!==n&&(it($c,e),it(so,n))}function _v(e){$c.current===e&&(pt(so),pt($c))}var St=Ds(0);function ff(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){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 Ep=[];function Sv(){for(var e=0;e<Ep.length;e++)Ep[e]._workInProgressVersionPrimary=null;Ep.length=0}var kd=zo.ReactCurrentDispatcher,Np=zo.ReactCurrentBatchConfig,ki=0,Et=null,zt=null,Kt=null,hf=!1,rc=!1,Ic=0,pA=0;function cn(){throw Error(Y(321))}function Cv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Mr(e[n],t[n]))return!1;return!0}function Ev(e,t,n,r,o,s){if(ki=s,Et=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,kd.current=e===null||e.memoizedState===null?vA:xA,e=n(r,o),rc){s=0;do{if(rc=!1,Ic=0,25<=s)throw Error(Y(301));s+=1,Kt=zt=null,t.updateQueue=null,kd.current=wA,e=n(r,o)}while(rc)}if(kd.current=pf,t=zt!==null&&zt.next!==null,ki=0,Kt=zt=Et=null,hf=!1,t)throw Error(Y(300));return e}function Nv(){var e=Ic!==0;return Ic=0,e}function Vr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kt===null?Et.memoizedState=Kt=e:Kt=Kt.next=e,Kt}function pr(){if(zt===null){var e=Et.alternate;e=e!==null?e.memoizedState:null}else e=zt.next;var t=Kt===null?Et.memoizedState:Kt.next;if(t!==null)Kt=t,zt=e;else{if(e===null)throw Error(Y(310));zt=e,e={memoizedState:zt.memoizedState,baseState:zt.baseState,baseQueue:zt.baseQueue,queue:zt.queue,next:null},Kt===null?Et.memoizedState=Kt=e:Kt=Kt.next=e}return Kt}function Ac(e,t){return typeof t=="function"?t(e):t}function jp(e){var t=pr(),n=t.queue;if(n===null)throw Error(Y(311));n.lastRenderedReducer=e;var r=zt,o=r.baseQueue,s=n.pending;if(s!==null){if(o!==null){var i=o.next;o.next=s.next,s.next=i}r.baseQueue=o=s,n.pending=null}if(o!==null){s=o.next,r=r.baseState;var a=i=null,l=null,u=s;do{var d=u.lane;if((ki&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=f,i=r):l=l.next=f,Et.lanes|=d,_i|=d}u=u.next}while(u!==null&&u!==s);l===null?i=r:l.next=a,Mr(r,t.memoizedState)||(Dn=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do s=o.lane,Et.lanes|=s,_i|=s,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Pp(e){var t=pr(),n=t.queue;if(n===null)throw Error(Y(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,s=t.memoizedState;if(o!==null){n.pending=null;var i=o=o.next;do s=e(s,i.action),i=i.next;while(i!==o);Mr(s,t.memoizedState)||(Dn=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function JS(){}function YS(e,t){var n=Et,r=pr(),o=t(),s=!Mr(r.memoizedState,o);if(s&&(r.memoizedState=o,Dn=!0),r=r.queue,jv(tC.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||Kt!==null&&Kt.memoizedState.tag&1){if(n.flags|=2048,Oc(9,eC.bind(null,n,r,o,t),void 0,null),Wt===null)throw Error(Y(349));ki&30||XS(n,t,o)}return o}function XS(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Et.updateQueue,t===null?(t={lastEffect:null,stores:null},Et.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function eC(e,t,n,r){t.value=n,t.getSnapshot=r,nC(t)&&rC(e)}function tC(e,t,n){return n(function(){nC(t)&&rC(e)})}function nC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Mr(e,n)}catch{return!0}}function rC(e){var t=Ao(e,1);t!==null&&Ir(t,e,1,-1)}function nb(e){var t=Vr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ac,lastRenderedState:e},t.queue=e,e=e.dispatch=yA.bind(null,Et,e),[t.memoizedState,e]}function Oc(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Et.updateQueue,t===null?(t={lastEffect:null,stores:null},Et.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function oC(){return pr().memoizedState}function _d(e,t,n,r){var o=Vr();Et.flags|=e,o.memoizedState=Oc(1|t,n,void 0,r===void 0?null:r)}function dh(e,t,n,r){var o=pr();r=r===void 0?null:r;var s=void 0;if(zt!==null){var i=zt.memoizedState;if(s=i.destroy,r!==null&&Cv(r,i.deps)){o.memoizedState=Oc(t,n,s,r);return}}Et.flags|=e,o.memoizedState=Oc(1|t,n,s,r)}function rb(e,t){return _d(8390656,8,e,t)}function jv(e,t){return dh(2048,8,e,t)}function sC(e,t){return dh(4,2,e,t)}function iC(e,t){return dh(4,4,e,t)}function aC(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function lC(e,t,n){return n=n!=null?n.concat([e]):null,dh(4,4,aC.bind(null,t,e),n)}function Pv(){}function cC(e,t){var n=pr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Cv(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function uC(e,t){var n=pr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Cv(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function dC(e,t,n){return ki&21?(Mr(n,t)||(n=gS(),Et.lanes|=n,_i|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Dn=!0),e.memoizedState=n)}function mA(e,t){var n=et;et=n!==0&&4>n?n:4,e(!0);var r=Np.transition;Np.transition={};try{e(!1),t()}finally{et=n,Np.transition=r}}function fC(){return pr().memoizedState}function gA(e,t,n){var r=Ss(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},hC(e))pC(t,n);else if(n=ZS(e,t,n,r),n!==null){var o=Sn();Ir(n,e,r,o),mC(n,t,r)}}function yA(e,t,n){var r=Ss(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(hC(e))pC(t,o);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,a=s(i,n);if(o.hasEagerState=!0,o.eagerState=a,Mr(a,i)){var l=t.interleaved;l===null?(o.next=o,wv(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=ZS(e,t,o,r),n!==null&&(o=Sn(),Ir(n,e,r,o),mC(n,t,r))}}function hC(e){var t=e.alternate;return e===Et||t!==null&&t===Et}function pC(e,t){rc=hf=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function mC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,iv(e,n)}}var pf={readContext:hr,useCallback:cn,useContext:cn,useEffect:cn,useImperativeHandle:cn,useInsertionEffect:cn,useLayoutEffect:cn,useMemo:cn,useReducer:cn,useRef:cn,useState:cn,useDebugValue:cn,useDeferredValue:cn,useTransition:cn,useMutableSource:cn,useSyncExternalStore:cn,useId:cn,unstable_isNewReconciler:!1},vA={readContext:hr,useCallback:function(e,t){return Vr().memoizedState=[e,t===void 0?null:t],e},useContext:hr,useEffect:rb,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,_d(4194308,4,aC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return _d(4194308,4,e,t)},useInsertionEffect:function(e,t){return _d(4,2,e,t)},useMemo:function(e,t){var n=Vr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Vr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=gA.bind(null,Et,e),[r.memoizedState,e]},useRef:function(e){var t=Vr();return e={current:e},t.memoizedState=e},useState:nb,useDebugValue:Pv,useDeferredValue:function(e){return Vr().memoizedState=e},useTransition:function(){var e=nb(!1),t=e[0];return e=mA.bind(null,e[1]),Vr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Et,o=Vr();if(wt){if(n===void 0)throw Error(Y(407));n=n()}else{if(n=t(),Wt===null)throw Error(Y(349));ki&30||XS(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,rb(tC.bind(null,r,s,e),[e]),r.flags|=2048,Oc(9,eC.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Vr(),t=Wt.identifierPrefix;if(wt){var n=Co,r=So;n=(r&~(1<<32-Rr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ic++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=pA++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},xA={readContext:hr,useCallback:cC,useContext:hr,useEffect:jv,useImperativeHandle:lC,useInsertionEffect:sC,useLayoutEffect:iC,useMemo:uC,useReducer:jp,useRef:oC,useState:function(){return jp(Ac)},useDebugValue:Pv,useDeferredValue:function(e){var t=pr();return dC(t,zt.memoizedState,e)},useTransition:function(){var e=jp(Ac)[0],t=pr().memoizedState;return[e,t]},useMutableSource:JS,useSyncExternalStore:YS,useId:fC,unstable_isNewReconciler:!1},wA={readContext:hr,useCallback:cC,useContext:hr,useEffect:jv,useImperativeHandle:lC,useInsertionEffect:sC,useLayoutEffect:iC,useMemo:uC,useReducer:Pp,useRef:oC,useState:function(){return Pp(Ac)},useDebugValue:Pv,useDeferredValue:function(e){var t=pr();return zt===null?t.memoizedState=e:dC(t,zt.memoizedState,e)},useTransition:function(){var e=Pp(Ac)[0],t=pr().memoizedState;return[e,t]},useMutableSource:JS,useSyncExternalStore:YS,useId:fC,unstable_isNewReconciler:!1};function _r(e,t){if(e&&e.defaultProps){t=jt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function sg(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:jt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var fh={isMounted:function(e){return(e=e._reactInternals)?Mi(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Sn(),o=Ss(e),s=No(r,o);s.payload=t,n!=null&&(s.callback=n),t=ks(e,s,o),t!==null&&(Ir(t,e,o,r),bd(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Sn(),o=Ss(e),s=No(r,o);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=ks(e,s,o),t!==null&&(Ir(t,e,o,r),bd(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Sn(),r=Ss(e),o=No(n,r);o.tag=2,t!=null&&(o.callback=t),t=ks(e,o,r),t!==null&&(Ir(t,e,r,n),bd(t,e,r))}};function ob(e,t,n,r,o,s,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,i):t.prototype&&t.prototype.isPureReactComponent?!Nc(n,r)||!Nc(o,s):!0}function gC(e,t,n){var r=!1,o=Ts,s=t.contextType;return typeof s=="object"&&s!==null?s=hr(s):(o=zn(t)?wi:pn.current,r=t.contextTypes,s=(r=r!=null)?Ba(e,o):Ts),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=fh,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=s),t}function sb(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&&fh.enqueueReplaceState(t,t.state,null)}function ig(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},bv(e);var s=t.contextType;typeof s=="object"&&s!==null?o.context=hr(s):(s=zn(t)?wi:pn.current,o.context=Ba(e,s)),o.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(sg(e,t,s,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&fh.enqueueReplaceState(o,o.state,null),df(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Qa(e,t){try{var n="",r=t;do n+=ZR(r),r=r.return;while(r);var o=n}catch(s){o=`
39
- Error generating stack: `+s.message+`
40
- `+s.stack}return{value:e,source:t,stack:o,digest:null}}function Tp(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ag(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var bA=typeof WeakMap=="function"?WeakMap:Map;function yC(e,t,n){n=No(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){gf||(gf=!0,yg=r),ag(e,t)},n}function vC(e,t,n){n=No(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){ag(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){ag(e,t),typeof r!="function"&&(_s===null?_s=new Set([this]):_s.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function ib(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new bA;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=OA.bind(null,e,t,n),t.then(e,e))}function ab(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function lb(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=No(-1,1),t.tag=2,ks(n,t,1))),n.lanes|=1),e)}var kA=zo.ReactCurrentOwner,Dn=!1;function xn(e,t,n,r){t.child=e===null?WS(t,null,n,r):Wa(t,e.child,n,r)}function cb(e,t,n,r,o){n=n.render;var s=t.ref;return ka(t,o),r=Ev(e,t,n,r,s,o),n=Nv(),e!==null&&!Dn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Oo(e,t,o)):(wt&&n&&pv(t),t.flags|=1,xn(e,t,r,o),t.child)}function ub(e,t,n,r,o){if(e===null){var s=n.type;return typeof s=="function"&&!Dv(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,xC(e,t,s,r,o)):(e=Nd(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&o)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:Nc,n(i,r)&&e.ref===t.ref)return Oo(e,t,o)}return t.flags|=1,e=Cs(s,r),e.ref=t.ref,e.return=t,t.child=e}function xC(e,t,n,r,o){if(e!==null){var s=e.memoizedProps;if(Nc(s,r)&&e.ref===t.ref)if(Dn=!1,t.pendingProps=r=s,(e.lanes&o)!==0)e.flags&131072&&(Dn=!0);else return t.lanes=e.lanes,Oo(e,t,o)}return lg(e,t,n,r,o)}function wC(e,t,n){var r=t.pendingProps,o=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},it(pa,Hn),Hn|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,it(pa,Hn),Hn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,it(pa,Hn),Hn|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,it(pa,Hn),Hn|=r;return xn(e,t,o,n),t.child}function bC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function lg(e,t,n,r,o){var s=zn(n)?wi:pn.current;return s=Ba(t,s),ka(t,o),n=Ev(e,t,n,r,s,o),r=Nv(),e!==null&&!Dn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Oo(e,t,o)):(wt&&r&&pv(t),t.flags|=1,xn(e,t,n,o),t.child)}function db(e,t,n,r,o){if(zn(n)){var s=!0;sf(t)}else s=!1;if(ka(t,o),t.stateNode===null)Sd(e,t),gC(t,n,r),ig(t,n,r,o),r=!0;else if(e===null){var i=t.stateNode,a=t.memoizedProps;i.props=a;var l=i.context,u=n.contextType;typeof u=="object"&&u!==null?u=hr(u):(u=zn(n)?wi:pn.current,u=Ba(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==r||l!==u)&&sb(t,i,r,u),Xo=!1;var p=t.memoizedState;i.state=p,df(t,r,i,o),l=t.memoizedState,a!==r||p!==l||Ln.current||Xo?(typeof d=="function"&&(sg(t,n,d,r),l=t.memoizedState),(a=Xo||ob(t,n,a,r,p,l,u))?(f||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=l),i.props=r,i.state=l,i.context=u,r=a):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,QS(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:_r(t.type,a),i.props=u,f=t.pendingProps,p=i.context,l=n.contextType,typeof l=="object"&&l!==null?l=hr(l):(l=zn(n)?wi:pn.current,l=Ba(t,l));var h=n.getDerivedStateFromProps;(d=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==f||p!==l)&&sb(t,i,r,l),Xo=!1,p=t.memoizedState,i.state=p,df(t,r,i,o);var y=t.memoizedState;a!==f||p!==y||Ln.current||Xo?(typeof h=="function"&&(sg(t,n,h,r),y=t.memoizedState),(u=Xo||ob(t,n,u,r,p,y,l)||!1)?(d||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,y,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,y,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),i.props=r,i.state=y,i.context=l,r=u):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return cg(e,t,n,r,s,o)}function cg(e,t,n,r,o,s){bC(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return o&&Gw(t,n,!1),Oo(e,t,s);r=t.stateNode,kA.current=t;var a=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=Wa(t,e.child,null,s),t.child=Wa(t,null,a,s)):xn(e,t,a,s),t.memoizedState=r.state,o&&Gw(t,n,!0),t.child}function kC(e){var t=e.stateNode;t.pendingContext?Qw(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Qw(e,t.context,!1),kv(e,t.containerInfo)}function fb(e,t,n,r,o){return Ka(),gv(o),t.flags|=256,xn(e,t,n,r),t.child}var ug={dehydrated:null,treeContext:null,retryLane:0};function dg(e){return{baseLanes:e,cachePool:null,transitions:null}}function _C(e,t,n){var r=t.pendingProps,o=St.current,s=!1,i=(t.flags&128)!==0,a;if((a=i)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),it(St,o&1),e===null)return rg(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,s?(r=t.mode,s=t.child,i={mode:"hidden",children:i},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=i):s=mh(i,r,0,null),e=vi(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=dg(n),t.memoizedState=ug,e):Tv(t,i));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return _A(e,t,i,r,a,o,n);if(s){s=r.fallback,i=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(i&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Cs(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?s=Cs(a,s):(s=vi(s,i,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,i=e.child.memoizedState,i=i===null?dg(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},s.memoizedState=i,s.childLanes=e.childLanes&~n,t.memoizedState=ug,r}return s=e.child,e=s.sibling,r=Cs(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Tv(e,t){return t=mh({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Fu(e,t,n,r){return r!==null&&gv(r),Wa(t,e.child,null,n),e=Tv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _A(e,t,n,r,o,s,i){if(n)return t.flags&256?(t.flags&=-257,r=Tp(Error(Y(422))),Fu(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,o=t.mode,r=mh({mode:"visible",children:r.children},o,0,null),s=vi(s,o,i,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Wa(t,e.child,null,i),t.child.memoizedState=dg(i),t.memoizedState=ug,s);if(!(t.mode&1))return Fu(e,t,i,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(Y(419)),r=Tp(s,r,void 0),Fu(e,t,i,r)}if(a=(i&e.childLanes)!==0,Dn||a){if(r=Wt,r!==null){switch(i&-i){case 4:o=2;break;case 16:o=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|i)?0:o,o!==0&&o!==s.retryLane&&(s.retryLane=o,Ao(e,o),Ir(r,e,o,-1))}return Mv(),r=Tp(Error(Y(421))),Fu(e,t,i,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=MA.bind(null,e),o._reactRetry=t,null):(e=s.treeContext,Wn=bs(o.nextSibling),Zn=t,wt=!0,jr=null,e!==null&&(lr[cr++]=So,lr[cr++]=Co,lr[cr++]=bi,So=e.id,Co=e.overflow,bi=t),t=Tv(t,r.children),t.flags|=4096,t)}function hb(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),og(e.return,t,n)}function $p(e,t,n,r,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=o)}function SC(e,t,n){var r=t.pendingProps,o=r.revealOrder,s=r.tail;if(xn(e,t,r.children,n),r=St.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&hb(e,n,t);else if(e.tag===19)hb(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}r&=1}if(it(St,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&ff(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),$p(t,!1,o,n,s);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&ff(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}$p(t,!0,n,null,s);break;case"together":$p(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Sd(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Oo(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),_i|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Y(153));if(t.child!==null){for(e=t.child,n=Cs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Cs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function SA(e,t,n){switch(t.tag){case 3:kC(t),Ka();break;case 5:GS(t);break;case 1:zn(t.type)&&sf(t);break;case 4:kv(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;it(cf,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(it(St,St.current&1),t.flags|=128,null):n&t.child.childLanes?_C(e,t,n):(it(St,St.current&1),e=Oo(e,t,n),e!==null?e.sibling:null);it(St,St.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return SC(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),it(St,St.current),r)break;return null;case 22:case 23:return t.lanes=0,wC(e,t,n)}return Oo(e,t,n)}var CC,fg,EC,NC;CC=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};fg=function(){};EC=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,ii(so.current);var s=null;switch(n){case"input":o=Am(e,o),r=Am(e,r),s=[];break;case"select":o=jt({},o,{value:void 0}),r=jt({},r,{value:void 0}),s=[];break;case"textarea":o=Dm(e,o),r=Dm(e,r),s=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=rf)}zm(n,r);var i;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var a=o[u];for(i in a)a.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(wc.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(a=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(i in a)!a.hasOwnProperty(i)||l&&l.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in l)l.hasOwnProperty(i)&&a[i]!==l[i]&&(n||(n={}),n[i]=l[i])}else n||(s||(s=[]),s.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(wc.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&ct("scroll",e),s||a===l||(s=[])):(s=s||[]).push(u,l))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};NC=function(e,t,n,r){n!==r&&(t.flags|=4)};function $l(e,t){if(!wt)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 un(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function CA(e,t,n){var r=t.pendingProps;switch(mv(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return un(t),null;case 1:return zn(t.type)&&of(),un(t),null;case 3:return r=t.stateNode,Za(),pt(Ln),pt(pn),Sv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Lu(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,jr!==null&&(wg(jr),jr=null))),fg(e,t),un(t),null;case 5:_v(t);var o=ii(Rc.current);if(n=t.type,e!==null&&t.stateNode!=null)EC(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Y(166));return un(t),null}if(e=ii(so.current),Lu(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Gr]=t,r[Tc]=s,e=(t.mode&1)!==0,n){case"dialog":ct("cancel",r),ct("close",r);break;case"iframe":case"object":case"embed":ct("load",r);break;case"video":case"audio":for(o=0;o<Hl.length;o++)ct(Hl[o],r);break;case"source":ct("error",r);break;case"img":case"image":case"link":ct("error",r),ct("load",r);break;case"details":ct("toggle",r);break;case"input":kw(r,s),ct("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},ct("invalid",r);break;case"textarea":Sw(r,s),ct("invalid",r)}zm(n,s),o=null;for(var i in s)if(s.hasOwnProperty(i)){var a=s[i];i==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Du(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Du(r.textContent,a,e),o=["children",""+a]):wc.hasOwnProperty(i)&&a!=null&&i==="onScroll"&&ct("scroll",r)}switch(n){case"input":Pu(r),_w(r,s,!0);break;case"textarea":Pu(r),Cw(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=rf)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=tS(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Gr]=t,e[Tc]=r,CC(e,t,!1,!1),t.stateNode=e;e:{switch(i=Fm(n,r),n){case"dialog":ct("cancel",e),ct("close",e),o=r;break;case"iframe":case"object":case"embed":ct("load",e),o=r;break;case"video":case"audio":for(o=0;o<Hl.length;o++)ct(Hl[o],e);o=r;break;case"source":ct("error",e),o=r;break;case"img":case"image":case"link":ct("error",e),ct("load",e),o=r;break;case"details":ct("toggle",e),o=r;break;case"input":kw(e,r),o=Am(e,r),ct("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=jt({},r,{value:void 0}),ct("invalid",e);break;case"textarea":Sw(e,r),o=Dm(e,r),ct("invalid",e);break;default:o=r}zm(n,o),a=o;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?oS(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&nS(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&bc(e,l):typeof l=="number"&&bc(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(wc.hasOwnProperty(s)?l!=null&&s==="onScroll"&&ct("scroll",e):l!=null&&ev(e,s,l,i))}switch(n){case"input":Pu(e),_w(e,r,!1);break;case"textarea":Pu(e),Cw(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ps(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?va(e,!!r.multiple,s,!1):r.defaultValue!=null&&va(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=rf)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return un(t),null;case 6:if(e&&t.stateNode!=null)NC(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Y(166));if(n=ii(Rc.current),ii(so.current),Lu(t)){if(r=t.stateNode,n=t.memoizedProps,r[Gr]=t,(s=r.nodeValue!==n)&&(e=Zn,e!==null))switch(e.tag){case 3:Du(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Du(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Gr]=t,t.stateNode=r}return un(t),null;case 13:if(pt(St),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wt&&Wn!==null&&t.mode&1&&!(t.flags&128))BS(),Ka(),t.flags|=98560,s=!1;else if(s=Lu(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(Y(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Y(317));s[Gr]=t}else Ka(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;un(t),s=!1}else jr!==null&&(wg(jr),jr=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||St.current&1?qt===0&&(qt=3):Mv())),t.updateQueue!==null&&(t.flags|=4),un(t),null);case 4:return Za(),fg(e,t),e===null&&jc(t.stateNode.containerInfo),un(t),null;case 10:return xv(t.type._context),un(t),null;case 17:return zn(t.type)&&of(),un(t),null;case 19:if(pt(St),s=t.memoizedState,s===null)return un(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)$l(s,!1);else{if(qt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=ff(e),i!==null){for(t.flags|=128,$l(s,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,i=s.alternate,i===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=i.childLanes,s.lanes=i.lanes,s.child=i.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=i.memoizedProps,s.memoizedState=i.memoizedState,s.updateQueue=i.updateQueue,s.type=i.type,e=i.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return it(St,St.current&1|2),t.child}e=e.sibling}s.tail!==null&&It()>Ga&&(t.flags|=128,r=!0,$l(s,!1),t.lanes=4194304)}else{if(!r)if(e=ff(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),$l(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!wt)return un(t),null}else 2*It()-s.renderingStartTime>Ga&&n!==1073741824&&(t.flags|=128,r=!0,$l(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(n=s.last,n!==null?n.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=It(),t.sibling=null,n=St.current,it(St,r?n&1|2:n&1),t):(un(t),null);case 22:case 23:return Ov(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Hn&1073741824&&(un(t),t.subtreeFlags&6&&(t.flags|=8192)):un(t),null;case 24:return null;case 25:return null}throw Error(Y(156,t.tag))}function EA(e,t){switch(mv(t),t.tag){case 1:return zn(t.type)&&of(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Za(),pt(Ln),pt(pn),Sv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _v(t),null;case 13:if(pt(St),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Y(340));Ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pt(St),null;case 4:return Za(),null;case 10:return xv(t.type._context),null;case 22:case 23:return Ov(),null;case 24:return null;default:return null}}var Uu=!1,fn=!1,NA=typeof WeakSet=="function"?WeakSet:Set,de=null;function ha(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){$t(e,t,r)}else n.current=null}function hg(e,t,n){try{n()}catch(r){$t(e,t,r)}}var pb=!1;function jA(e,t){if(Gm=ef,e=RS(),hv(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 o=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,a=-1,l=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||o!==0&&f.nodeType!==3||(a=i+o),f!==s||r!==0&&f.nodeType!==3||(l=i+r),f.nodeType===3&&(i+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===o&&(a=i),p===s&&++d===r&&(l=i),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Jm={focusedElem:e,selectionRange:n},ef=!1,de=t;de!==null;)if(t=de,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,de=e;else for(;de!==null;){t=de;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var m=y.memoizedProps,x=y.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?m:_r(t.type,m),x);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Y(163))}}catch(k){$t(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return y=pb,pb=!1,y}function oc(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var s=o.destroy;o.destroy=void 0,s!==void 0&&hg(t,n,s)}o=o.next}while(o!==r)}}function hh(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function pg(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function jC(e){var t=e.alternate;t!==null&&(e.alternate=null,jC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Gr],delete t[Tc],delete t[eg],delete t[uA],delete t[dA])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function PC(e){return e.tag===5||e.tag===3||e.tag===4}function mb(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||PC(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.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 mg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=rf));else if(r!==4&&(e=e.child,e!==null))for(mg(e,t,n),e=e.sibling;e!==null;)mg(e,t,n),e=e.sibling}function gg(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&&(e=e.child,e!==null))for(gg(e,t,n),e=e.sibling;e!==null;)gg(e,t,n),e=e.sibling}var Yt=null,Nr=!1;function Ho(e,t,n){for(n=n.child;n!==null;)TC(e,t,n),n=n.sibling}function TC(e,t,n){if(oo&&typeof oo.onCommitFiberUnmount=="function")try{oo.onCommitFiberUnmount(sh,n)}catch{}switch(n.tag){case 5:fn||ha(n,t);case 6:var r=Yt,o=Nr;Yt=null,Ho(e,t,n),Yt=r,Nr=o,Yt!==null&&(Nr?(e=Yt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Yt.removeChild(n.stateNode));break;case 18:Yt!==null&&(Nr?(e=Yt,n=n.stateNode,e.nodeType===8?Sp(e.parentNode,n):e.nodeType===1&&Sp(e,n),Cc(e)):Sp(Yt,n.stateNode));break;case 4:r=Yt,o=Nr,Yt=n.stateNode.containerInfo,Nr=!0,Ho(e,t,n),Yt=r,Nr=o;break;case 0:case 11:case 14:case 15:if(!fn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var s=o,i=s.destroy;s=s.tag,i!==void 0&&(s&2||s&4)&&hg(n,t,i),o=o.next}while(o!==r)}Ho(e,t,n);break;case 1:if(!fn&&(ha(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){$t(n,t,a)}Ho(e,t,n);break;case 21:Ho(e,t,n);break;case 22:n.mode&1?(fn=(r=fn)||n.memoizedState!==null,Ho(e,t,n),fn=r):Ho(e,t,n);break;default:Ho(e,t,n)}}function gb(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new NA),t.forEach(function(r){var o=DA.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function vr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var s=e,i=t,a=i;e:for(;a!==null;){switch(a.tag){case 5:Yt=a.stateNode,Nr=!1;break e;case 3:Yt=a.stateNode.containerInfo,Nr=!0;break e;case 4:Yt=a.stateNode.containerInfo,Nr=!0;break e}a=a.return}if(Yt===null)throw Error(Y(160));TC(s,i,o),Yt=null,Nr=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(u){$t(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)$C(t,e),t=t.sibling}function $C(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(vr(t,e),qr(e),r&4){try{oc(3,e,e.return),hh(3,e)}catch(m){$t(e,e.return,m)}try{oc(5,e,e.return)}catch(m){$t(e,e.return,m)}}break;case 1:vr(t,e),qr(e),r&512&&n!==null&&ha(n,n.return);break;case 5:if(vr(t,e),qr(e),r&512&&n!==null&&ha(n,n.return),e.flags&32){var o=e.stateNode;try{bc(o,"")}catch(m){$t(e,e.return,m)}}if(r&4&&(o=e.stateNode,o!=null)){var s=e.memoizedProps,i=n!==null?n.memoizedProps:s,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&X_(o,s),Fm(a,i);var u=Fm(a,s);for(i=0;i<l.length;i+=2){var d=l[i],f=l[i+1];d==="style"?oS(o,f):d==="dangerouslySetInnerHTML"?nS(o,f):d==="children"?bc(o,f):ev(o,d,f,u)}switch(a){case"input":Om(o,s);break;case"textarea":eS(o,s);break;case"select":var p=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?va(o,!!s.multiple,h,!1):p!==!!s.multiple&&(s.defaultValue!=null?va(o,!!s.multiple,s.defaultValue,!0):va(o,!!s.multiple,s.multiple?[]:"",!1))}o[Tc]=s}catch(m){$t(e,e.return,m)}}break;case 6:if(vr(t,e),qr(e),r&4){if(e.stateNode===null)throw Error(Y(162));o=e.stateNode,s=e.memoizedProps;try{o.nodeValue=s}catch(m){$t(e,e.return,m)}}break;case 3:if(vr(t,e),qr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Cc(t.containerInfo)}catch(m){$t(e,e.return,m)}break;case 4:vr(t,e),qr(e);break;case 13:vr(t,e),qr(e),o=e.child,o.flags&8192&&(s=o.memoizedState!==null,o.stateNode.isHidden=s,!s||o.alternate!==null&&o.alternate.memoizedState!==null||(Iv=It())),r&4&&gb(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(fn=(u=fn)||d,vr(t,e),fn=u):vr(t,e),qr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(de=e,d=e.child;d!==null;){for(f=de=d;de!==null;){switch(p=de,h=p.child,p.tag){case 0:case 11:case 14:case 15:oc(4,p,p.return);break;case 1:ha(p,p.return);var y=p.stateNode;if(typeof y.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(m){$t(r,n,m)}}break;case 5:ha(p,p.return);break;case 22:if(p.memoizedState!==null){vb(f);continue}}h!==null?(h.return=p,de=h):vb(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{o=f.stateNode,u?(s=o.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=f.stateNode,l=f.memoizedProps.style,i=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=rS("display",i))}catch(m){$t(e,e.return,m)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(m){$t(e,e.return,m)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:vr(t,e),qr(e),r&4&&gb(e);break;case 21:break;default:vr(t,e),qr(e)}}function qr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(PC(n)){var r=n;break e}n=n.return}throw Error(Y(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(bc(o,""),r.flags&=-33);var s=mb(e);gg(e,s,o);break;case 3:case 4:var i=r.stateNode.containerInfo,a=mb(e);mg(e,a,i);break;default:throw Error(Y(161))}}catch(l){$t(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function PA(e,t,n){de=e,RC(e)}function RC(e,t,n){for(var r=(e.mode&1)!==0;de!==null;){var o=de,s=o.child;if(o.tag===22&&r){var i=o.memoizedState!==null||Uu;if(!i){var a=o.alternate,l=a!==null&&a.memoizedState!==null||fn;a=Uu;var u=fn;if(Uu=i,(fn=l)&&!u)for(de=o;de!==null;)i=de,l=i.child,i.tag===22&&i.memoizedState!==null?xb(o):l!==null?(l.return=i,de=l):xb(o);for(;s!==null;)de=s,RC(s),s=s.sibling;de=o,Uu=a,fn=u}yb(e)}else o.subtreeFlags&8772&&s!==null?(s.return=o,de=s):yb(e)}}function yb(e){for(;de!==null;){var t=de;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:fn||hh(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!fn)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:_r(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&tb(t,s,r);break;case 3:var i=t.updateQueue;if(i!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}tb(t,i,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&Cc(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Y(163))}fn||t.flags&512&&pg(t)}catch(p){$t(t,t.return,p)}}if(t===e){de=null;break}if(n=t.sibling,n!==null){n.return=t.return,de=n;break}de=t.return}}function vb(e){for(;de!==null;){var t=de;if(t===e){de=null;break}var n=t.sibling;if(n!==null){n.return=t.return,de=n;break}de=t.return}}function xb(e){for(;de!==null;){var t=de;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{hh(4,t)}catch(l){$t(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){$t(t,o,l)}}var s=t.return;try{pg(t)}catch(l){$t(t,s,l)}break;case 5:var i=t.return;try{pg(t)}catch(l){$t(t,i,l)}}}catch(l){$t(t,t.return,l)}if(t===e){de=null;break}var a=t.sibling;if(a!==null){a.return=t.return,de=a;break}de=t.return}}var TA=Math.ceil,mf=zo.ReactCurrentDispatcher,$v=zo.ReactCurrentOwner,fr=zo.ReactCurrentBatchConfig,Ze=0,Wt=null,Mt=null,rn=0,Hn=0,pa=Ds(0),qt=0,Mc=null,_i=0,ph=0,Rv=0,sc=null,On=null,Iv=0,Ga=1/0,vo=null,gf=!1,yg=null,_s=null,qu=!1,gs=null,yf=0,ic=0,vg=null,Cd=-1,Ed=0;function Sn(){return Ze&6?It():Cd!==-1?Cd:Cd=It()}function Ss(e){return e.mode&1?Ze&2&&rn!==0?rn&-rn:hA.transition!==null?(Ed===0&&(Ed=gS()),Ed):(e=et,e!==0||(e=window.event,e=e===void 0?16:_S(e.type)),e):1}function Ir(e,t,n,r){if(50<ic)throw ic=0,vg=null,Error(Y(185));Yc(e,n,r),(!(Ze&2)||e!==Wt)&&(e===Wt&&(!(Ze&2)&&(ph|=n),qt===4&&os(e,rn)),Fn(e,r),n===1&&Ze===0&&!(t.mode&1)&&(Ga=It()+500,uh&&Ls()))}function Fn(e,t){var n=e.callbackNode;hI(e,t);var r=Xd(e,e===Wt?rn:0);if(r===0)n!==null&&jw(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&jw(n),t===1)e.tag===0?fA(wb.bind(null,e)):qS(wb.bind(null,e)),lA(function(){!(Ze&6)&&Ls()}),n=null;else{switch(yS(r)){case 1:n=sv;break;case 4:n=pS;break;case 16:n=Yd;break;case 536870912:n=mS;break;default:n=Yd}n=FC(n,IC.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function IC(e,t){if(Cd=-1,Ed=0,Ze&6)throw Error(Y(327));var n=e.callbackNode;if(_a()&&e.callbackNode!==n)return null;var r=Xd(e,e===Wt?rn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=vf(e,r);else{t=r;var o=Ze;Ze|=2;var s=OC();(Wt!==e||rn!==t)&&(vo=null,Ga=It()+500,yi(e,t));do try{IA();break}catch(a){AC(e,a)}while(!0);vv(),mf.current=s,Ze=o,Mt!==null?t=0:(Wt=null,rn=0,t=qt)}if(t!==0){if(t===2&&(o=Bm(e),o!==0&&(r=o,t=xg(e,o))),t===1)throw n=Mc,yi(e,0),os(e,r),Fn(e,It()),n;if(t===6)os(e,r);else{if(o=e.current.alternate,!(r&30)&&!$A(o)&&(t=vf(e,r),t===2&&(s=Bm(e),s!==0&&(r=s,t=xg(e,s))),t===1))throw n=Mc,yi(e,0),os(e,r),Fn(e,It()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(Y(345));case 2:Zs(e,On,vo);break;case 3:if(os(e,r),(r&130023424)===r&&(t=Iv+500-It(),10<t)){if(Xd(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Sn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Xm(Zs.bind(null,e,On,vo),t);break}Zs(e,On,vo);break;case 4:if(os(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var i=31-Rr(r);s=1<<i,i=t[i],i>o&&(o=i),r&=~s}if(r=o,r=It()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*TA(r/1960))-r,10<r){e.timeoutHandle=Xm(Zs.bind(null,e,On,vo),r);break}Zs(e,On,vo);break;case 5:Zs(e,On,vo);break;default:throw Error(Y(329))}}}return Fn(e,It()),e.callbackNode===n?IC.bind(null,e):null}function xg(e,t){var n=sc;return e.current.memoizedState.isDehydrated&&(yi(e,t).flags|=256),e=vf(e,t),e!==2&&(t=On,On=n,t!==null&&wg(t)),e}function wg(e){On===null?On=e:On.push.apply(On,e)}function $A(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],s=o.getSnapshot;o=o.value;try{if(!Mr(s(),o))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 os(e,t){for(t&=~Rv,t&=~ph,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Rr(t),r=1<<n;e[n]=-1,t&=~r}}function wb(e){if(Ze&6)throw Error(Y(327));_a();var t=Xd(e,0);if(!(t&1))return Fn(e,It()),null;var n=vf(e,t);if(e.tag!==0&&n===2){var r=Bm(e);r!==0&&(t=r,n=xg(e,r))}if(n===1)throw n=Mc,yi(e,0),os(e,t),Fn(e,It()),n;if(n===6)throw Error(Y(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Zs(e,On,vo),Fn(e,It()),null}function Av(e,t){var n=Ze;Ze|=1;try{return e(t)}finally{Ze=n,Ze===0&&(Ga=It()+500,uh&&Ls())}}function Si(e){gs!==null&&gs.tag===0&&!(Ze&6)&&_a();var t=Ze;Ze|=1;var n=fr.transition,r=et;try{if(fr.transition=null,et=1,e)return e()}finally{et=r,fr.transition=n,Ze=t,!(Ze&6)&&Ls()}}function Ov(){Hn=pa.current,pt(pa)}function yi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,aA(n)),Mt!==null)for(n=Mt.return;n!==null;){var r=n;switch(mv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&of();break;case 3:Za(),pt(Ln),pt(pn),Sv();break;case 5:_v(r);break;case 4:Za();break;case 13:pt(St);break;case 19:pt(St);break;case 10:xv(r.type._context);break;case 22:case 23:Ov()}n=n.return}if(Wt=e,Mt=e=Cs(e.current,null),rn=Hn=t,qt=0,Mc=null,Rv=ph=_i=0,On=sc=null,si!==null){for(t=0;t<si.length;t++)if(n=si[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,s=n.pending;if(s!==null){var i=s.next;s.next=o,r.next=i}n.pending=r}si=null}return e}function AC(e,t){do{var n=Mt;try{if(vv(),kd.current=pf,hf){for(var r=Et.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}hf=!1}if(ki=0,Kt=zt=Et=null,rc=!1,Ic=0,$v.current=null,n===null||n.return===null){qt=1,Mc=t,Mt=null;break}e:{var s=e,i=n.return,a=n,l=t;if(t=rn,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,d=a,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var h=ab(i);if(h!==null){h.flags&=-257,lb(h,i,a,s,t),h.mode&1&&ib(s,u,t),t=h,l=u;var y=t.updateQueue;if(y===null){var m=new Set;m.add(l),t.updateQueue=m}else y.add(l);break e}else{if(!(t&1)){ib(s,u,t),Mv();break e}l=Error(Y(426))}}else if(wt&&a.mode&1){var x=ab(i);if(x!==null){!(x.flags&65536)&&(x.flags|=256),lb(x,i,a,s,t),gv(Qa(l,a));break e}}s=l=Qa(l,a),qt!==4&&(qt=2),sc===null?sc=[s]:sc.push(s),s=i;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var g=yC(s,l,t);eb(s,g);break e;case 1:a=l;var v=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(_s===null||!_s.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var k=vC(s,a,t);eb(s,k);break e}}s=s.return}while(s!==null)}DC(n)}catch(C){t=C,Mt===n&&n!==null&&(Mt=n=n.return);continue}break}while(!0)}function OC(){var e=mf.current;return mf.current=pf,e===null?pf:e}function Mv(){(qt===0||qt===3||qt===2)&&(qt=4),Wt===null||!(_i&268435455)&&!(ph&268435455)||os(Wt,rn)}function vf(e,t){var n=Ze;Ze|=2;var r=OC();(Wt!==e||rn!==t)&&(vo=null,yi(e,t));do try{RA();break}catch(o){AC(e,o)}while(!0);if(vv(),Ze=n,mf.current=r,Mt!==null)throw Error(Y(261));return Wt=null,rn=0,qt}function RA(){for(;Mt!==null;)MC(Mt)}function IA(){for(;Mt!==null&&!oI();)MC(Mt)}function MC(e){var t=zC(e.alternate,e,Hn);e.memoizedProps=e.pendingProps,t===null?DC(e):Mt=t,$v.current=null}function DC(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=EA(n,t),n!==null){n.flags&=32767,Mt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{qt=6,Mt=null;return}}else if(n=CA(n,t,Hn),n!==null){Mt=n;return}if(t=t.sibling,t!==null){Mt=t;return}Mt=t=e}while(t!==null);qt===0&&(qt=5)}function Zs(e,t,n){var r=et,o=fr.transition;try{fr.transition=null,et=1,AA(e,t,n,r)}finally{fr.transition=o,et=r}return null}function AA(e,t,n,r){do _a();while(gs!==null);if(Ze&6)throw Error(Y(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Y(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(pI(e,s),e===Wt&&(Mt=Wt=null,rn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||qu||(qu=!0,FC(Yd,function(){return _a(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=fr.transition,fr.transition=null;var i=et;et=1;var a=Ze;Ze|=4,$v.current=null,jA(e,n),$C(n,e),eA(Jm),ef=!!Gm,Jm=Gm=null,e.current=n,PA(n),sI(),Ze=a,et=i,fr.transition=s}else e.current=n;if(qu&&(qu=!1,gs=e,yf=o),s=e.pendingLanes,s===0&&(_s=null),lI(n.stateNode),Fn(e,It()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(gf)throw gf=!1,e=yg,yg=null,e;return yf&1&&e.tag!==0&&_a(),s=e.pendingLanes,s&1?e===vg?ic++:(ic=0,vg=e):ic=0,Ls(),null}function _a(){if(gs!==null){var e=yS(yf),t=fr.transition,n=et;try{if(fr.transition=null,et=16>e?16:e,gs===null)var r=!1;else{if(e=gs,gs=null,yf=0,Ze&6)throw Error(Y(331));var o=Ze;for(Ze|=4,de=e.current;de!==null;){var s=de,i=s.child;if(de.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(de=u;de!==null;){var d=de;switch(d.tag){case 0:case 11:case 15:oc(8,d,s)}var f=d.child;if(f!==null)f.return=d,de=f;else for(;de!==null;){d=de;var p=d.sibling,h=d.return;if(jC(d),d===u){de=null;break}if(p!==null){p.return=h,de=p;break}de=h}}}var y=s.alternate;if(y!==null){var m=y.child;if(m!==null){y.child=null;do{var x=m.sibling;m.sibling=null,m=x}while(m!==null)}}de=s}}if(s.subtreeFlags&2064&&i!==null)i.return=s,de=i;else e:for(;de!==null;){if(s=de,s.flags&2048)switch(s.tag){case 0:case 11:case 15:oc(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,de=g;break e}de=s.return}}var v=e.current;for(de=v;de!==null;){i=de;var w=i.child;if(i.subtreeFlags&2064&&w!==null)w.return=i,de=w;else e:for(i=v;de!==null;){if(a=de,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:hh(9,a)}}catch(C){$t(a,a.return,C)}if(a===i){de=null;break e}var k=a.sibling;if(k!==null){k.return=a.return,de=k;break e}de=a.return}}if(Ze=o,Ls(),oo&&typeof oo.onPostCommitFiberRoot=="function")try{oo.onPostCommitFiberRoot(sh,e)}catch{}r=!0}return r}finally{et=n,fr.transition=t}}return!1}function bb(e,t,n){t=Qa(n,t),t=yC(e,t,1),e=ks(e,t,1),t=Sn(),e!==null&&(Yc(e,1,t),Fn(e,t))}function $t(e,t,n){if(e.tag===3)bb(e,e,n);else for(;t!==null;){if(t.tag===3){bb(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(_s===null||!_s.has(r))){e=Qa(n,e),e=vC(t,e,1),t=ks(t,e,1),e=Sn(),t!==null&&(Yc(t,1,e),Fn(t,e));break}}t=t.return}}function OA(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Sn(),e.pingedLanes|=e.suspendedLanes&n,Wt===e&&(rn&n)===n&&(qt===4||qt===3&&(rn&130023424)===rn&&500>It()-Iv?yi(e,0):Rv|=n),Fn(e,t)}function LC(e,t){t===0&&(e.mode&1?(t=Ru,Ru<<=1,!(Ru&130023424)&&(Ru=4194304)):t=1);var n=Sn();e=Ao(e,t),e!==null&&(Yc(e,t,n),Fn(e,n))}function MA(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),LC(e,n)}function DA(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Y(314))}r!==null&&r.delete(t),LC(e,n)}var zC;zC=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ln.current)Dn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Dn=!1,SA(e,t,n);Dn=!!(e.flags&131072)}else Dn=!1,wt&&t.flags&1048576&&VS(t,lf,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Sd(e,t),e=t.pendingProps;var o=Ba(t,pn.current);ka(t,n),o=Ev(null,t,r,e,o,n);var s=Nv();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,zn(r)?(s=!0,sf(t)):s=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,bv(t),o.updater=fh,t.stateNode=o,o._reactInternals=t,ig(t,r,e,n),t=cg(null,t,r,!0,s,n)):(t.tag=0,wt&&s&&pv(t),xn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Sd(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=zA(r),e=_r(r,e),o){case 0:t=lg(null,t,r,e,n);break e;case 1:t=db(null,t,r,e,n);break e;case 11:t=cb(null,t,r,e,n);break e;case 14:t=ub(null,t,r,_r(r.type,e),n);break e}throw Error(Y(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:_r(r,o),lg(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:_r(r,o),db(e,t,r,o,n);case 3:e:{if(kC(t),e===null)throw Error(Y(387));r=t.pendingProps,s=t.memoizedState,o=s.element,QS(e,t),df(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){o=Qa(Error(Y(423)),t),t=fb(e,t,r,n,o);break e}else if(r!==o){o=Qa(Error(Y(424)),t),t=fb(e,t,r,n,o);break e}else for(Wn=bs(t.stateNode.containerInfo.firstChild),Zn=t,wt=!0,jr=null,n=WS(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ka(),r===o){t=Oo(e,t,n);break e}xn(e,t,r,n)}t=t.child}return t;case 5:return GS(t),e===null&&rg(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,i=o.children,Ym(r,o)?i=null:s!==null&&Ym(r,s)&&(t.flags|=32),bC(e,t),xn(e,t,i,n),t.child;case 6:return e===null&&rg(t),null;case 13:return _C(e,t,n);case 4:return kv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Wa(t,null,r,n):xn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:_r(r,o),cb(e,t,r,o,n);case 7:return xn(e,t,t.pendingProps,n),t.child;case 8:return xn(e,t,t.pendingProps.children,n),t.child;case 12:return xn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,i=o.value,it(cf,r._currentValue),r._currentValue=i,s!==null)if(Mr(s.value,i)){if(s.children===o.children&&!Ln.current){t=Oo(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){i=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=No(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),og(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)i=s.type===t.type?null:s.child;else if(s.tag===18){if(i=s.return,i===null)throw Error(Y(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),og(i,n,t),i=s.sibling}else i=s.child;if(i!==null)i.return=s;else for(i=s;i!==null;){if(i===t){i=null;break}if(s=i.sibling,s!==null){s.return=i.return,i=s;break}i=i.return}s=i}xn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,ka(t,n),o=hr(o),r=r(o),t.flags|=1,xn(e,t,r,n),t.child;case 14:return r=t.type,o=_r(r,t.pendingProps),o=_r(r.type,o),ub(e,t,r,o,n);case 15:return xC(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:_r(r,o),Sd(e,t),t.tag=1,zn(r)?(e=!0,sf(t)):e=!1,ka(t,n),gC(t,r,o),ig(t,r,o,n),cg(null,t,r,!0,e,n);case 19:return SC(e,t,n);case 22:return wC(e,t,n)}throw Error(Y(156,t.tag))};function FC(e,t){return hS(e,t)}function LA(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.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 dr(e,t,n,r){return new LA(e,t,n,r)}function Dv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function zA(e){if(typeof e=="function")return Dv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===nv)return 11;if(e===rv)return 14}return 2}function Cs(e,t){var n=e.alternate;return n===null?(n=dr(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&14680064,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}function Nd(e,t,n,r,o,s){var i=2;if(r=e,typeof e=="function")Dv(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case oa:return vi(n.children,o,s,t);case tv:i=8,o|=8;break;case Tm:return e=dr(12,n,t,o|2),e.elementType=Tm,e.lanes=s,e;case $m:return e=dr(13,n,t,o),e.elementType=$m,e.lanes=s,e;case Rm:return e=dr(19,n,t,o),e.elementType=Rm,e.lanes=s,e;case G_:return mh(n,o,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Z_:i=10;break e;case Q_:i=9;break e;case nv:i=11;break e;case rv:i=14;break e;case Yo:i=16,r=null;break e}throw Error(Y(130,e==null?e:typeof e,""))}return t=dr(i,n,t,o),t.elementType=e,t.type=r,t.lanes=s,t}function vi(e,t,n,r){return e=dr(7,e,r,t),e.lanes=n,e}function mh(e,t,n,r){return e=dr(22,e,r,t),e.elementType=G_,e.lanes=n,e.stateNode={isHidden:!1},e}function Rp(e,t,n){return e=dr(6,e,null,t),e.lanes=n,e}function Ip(e,t,n){return t=dr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function FA(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=hp(0),this.expirationTimes=hp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hp(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Lv(e,t,n,r,o,s,i,a,l){return e=new FA(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=dr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},bv(s),e}function UA(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ra,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function UC(e){if(!e)return Ts;e=e._reactInternals;e:{if(Mi(e)!==e||e.tag!==1)throw Error(Y(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(zn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Y(171))}if(e.tag===1){var n=e.type;if(zn(n))return US(e,n,t)}return t}function qC(e,t,n,r,o,s,i,a,l){return e=Lv(n,r,!0,e,o,s,i,a,l),e.context=UC(null),n=e.current,r=Sn(),o=Ss(n),s=No(r,o),s.callback=t??null,ks(n,s,o),e.current.lanes=o,Yc(e,o,r),Fn(e,r),e}function gh(e,t,n,r){var o=t.current,s=Sn(),i=Ss(o);return n=UC(n),t.context===null?t.context=n:t.pendingContext=n,t=No(s,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ks(o,t,i),e!==null&&(Ir(e,o,i,s),bd(e,o,i)),i}function xf(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function kb(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function zv(e,t){kb(e,t),(e=e.alternate)&&kb(e,t)}function qA(){return null}var VC=typeof reportError=="function"?reportError:function(e){console.error(e)};function Fv(e){this._internalRoot=e}yh.prototype.render=Fv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Y(409));gh(e,t,null,null)};yh.prototype.unmount=Fv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Si(function(){gh(null,e,null,null)}),t[Io]=null}};function yh(e){this._internalRoot=e}yh.prototype.unstable_scheduleHydration=function(e){if(e){var t=wS();e={blockedOn:null,target:e,priority:t};for(var n=0;n<rs.length&&t!==0&&t<rs[n].priority;n++);rs.splice(n,0,e),n===0&&kS(e)}};function Uv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function vh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function _b(){}function VA(e,t,n,r,o){if(o){if(typeof r=="function"){var s=r;r=function(){var u=xf(i);s.call(u)}}var i=qC(t,r,e,0,null,!1,!1,"",_b);return e._reactRootContainer=i,e[Io]=i.current,jc(e.nodeType===8?e.parentNode:e),Si(),i}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var u=xf(l);a.call(u)}}var l=Lv(e,0,!1,null,null,!1,!1,"",_b);return e._reactRootContainer=l,e[Io]=l.current,jc(e.nodeType===8?e.parentNode:e),Si(function(){gh(t,l,n,r)}),l}function xh(e,t,n,r,o){var s=n._reactRootContainer;if(s){var i=s;if(typeof o=="function"){var a=o;o=function(){var l=xf(i);a.call(l)}}gh(t,i,e,o)}else i=VA(n,t,e,o,r);return xf(i)}vS=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Vl(t.pendingLanes);n!==0&&(iv(t,n|1),Fn(t,It()),!(Ze&6)&&(Ga=It()+500,Ls()))}break;case 13:Si(function(){var r=Ao(e,1);if(r!==null){var o=Sn();Ir(r,e,1,o)}}),zv(e,1)}};av=function(e){if(e.tag===13){var t=Ao(e,134217728);if(t!==null){var n=Sn();Ir(t,e,134217728,n)}zv(e,134217728)}};xS=function(e){if(e.tag===13){var t=Ss(e),n=Ao(e,t);if(n!==null){var r=Sn();Ir(n,e,t,r)}zv(e,t)}};wS=function(){return et};bS=function(e,t){var n=et;try{return et=e,t()}finally{et=n}};qm=function(e,t,n){switch(t){case"input":if(Om(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=ch(r);if(!o)throw Error(Y(90));Y_(r),Om(r,o)}}}break;case"textarea":eS(e,n);break;case"select":t=n.value,t!=null&&va(e,!!n.multiple,t,!1)}};aS=Av;lS=Si;var HA={usingClientEntryPoint:!1,Events:[eu,la,ch,sS,iS,Av]},Rl={findFiberByHostInstance:oi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},BA={bundleType:Rl.bundleType,version:Rl.version,rendererPackageName:Rl.rendererPackageName,rendererConfig:Rl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:zo.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=dS(e),e===null?null:e.stateNode},findFiberByHostInstance:Rl.findFiberByHostInstance||qA,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vu.isDisabled&&Vu.supportsFiber)try{sh=Vu.inject(BA),oo=Vu}catch{}}Yn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=HA;Yn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Uv(t))throw Error(Y(200));return UA(e,t,null,n)};Yn.createRoot=function(e,t){if(!Uv(e))throw Error(Y(299));var n=!1,r="",o=VC;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Lv(e,1,!1,null,null,n,!1,r,o),e[Io]=t.current,jc(e.nodeType===8?e.parentNode:e),new Fv(t)};Yn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Y(188)):(e=Object.keys(e).join(","),Error(Y(268,e)));return e=dS(t),e=e===null?null:e.stateNode,e};Yn.flushSync=function(e){return Si(e)};Yn.hydrate=function(e,t,n){if(!vh(t))throw Error(Y(200));return xh(null,e,t,!0,n)};Yn.hydrateRoot=function(e,t,n){if(!Uv(e))throw Error(Y(405));var r=n!=null&&n.hydratedSources||null,o=!1,s="",i=VC;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=qC(t,null,e,1,n??null,o,!1,s,i),e[Io]=t.current,jc(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new yh(t)};Yn.render=function(e,t,n){if(!vh(t))throw Error(Y(200));return xh(null,e,t,!1,n)};Yn.unmountComponentAtNode=function(e){if(!vh(e))throw Error(Y(40));return e._reactRootContainer?(Si(function(){xh(null,null,e,!1,function(){e._reactRootContainer=null,e[Io]=null})}),!0):!1};Yn.unstable_batchedUpdates=Av;Yn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!vh(n))throw Error(Y(200));if(e==null||e._reactInternals===void 0)throw Error(Y(38));return xh(e,t,n,!1,r)};Yn.version="18.3.1-next-f1338f8080-20240426";function HC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(HC)}catch(e){console.error(e)}}HC(),H_.exports=Yn;var Di=H_.exports;const KA=ll(Di);var BC,Sb=Di;BC=Sb.createRoot,Sb.hydrateRoot;function WA(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,o,s,i=[],a="",l=e.split("/");for(l[0]||l.shift();o=l.shift();)n=o[0],n==="*"?(i.push(n),a+=o[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(r=o.indexOf("?",1),s=o.indexOf(".",1),i.push(o.substring(1,~r?r:~s?s:o.length)),a+=~r&&!~s?"(?:/([^/]+?))?":"/([^/]+?)",~s&&(a+=(~r?"?":"")+"\\"+o.substring(s))):a+="/"+o;return{keys:i,pattern:new RegExp("^"+a+(t?"(?=$|/)":"/?$"),"i")}}var KC={exports:{}},WC={};/**
41
- * @license React
42
- * use-sync-external-store-shim.production.js
43
- *
44
- * Copyright (c) Meta Platforms, Inc. and affiliates.
45
- *
46
- * This source code is licensed under the MIT license found in the
47
- * LICENSE file in the root directory of this source tree.
48
- */var Ja=b;function ZA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var QA=typeof Object.is=="function"?Object.is:ZA,GA=Ja.useState,JA=Ja.useEffect,YA=Ja.useLayoutEffect,XA=Ja.useDebugValue;function eO(e,t){var n=t(),r=GA({inst:{value:n,getSnapshot:t}}),o=r[0].inst,s=r[1];return YA(function(){o.value=n,o.getSnapshot=t,Ap(o)&&s({inst:o})},[e,n,t]),JA(function(){return Ap(o)&&s({inst:o}),e(function(){Ap(o)&&s({inst:o})})},[e]),XA(n),n}function Ap(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!QA(e,n)}catch{return!0}}function tO(e,t){return t()}var nO=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?tO:eO;WC.useSyncExternalStore=Ja.useSyncExternalStore!==void 0?Ja.useSyncExternalStore:nO;KC.exports=WC;var rO=KC.exports;const oO=Jy.useInsertionEffect,sO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",iO=sO?b.useLayoutEffect:b.useEffect,aO=oO||iO,ZC=e=>{const t=b.useRef([e,(...n)=>t[0](...n)]).current;return aO(()=>{t[0]=e}),t[1]},lO="popstate",qv="pushState",Vv="replaceState",cO="hashchange",Cb=[lO,qv,Vv,cO],uO=e=>{for(const t of Cb)addEventListener(t,e);return()=>{for(const t of Cb)removeEventListener(t,e)}},QC=(e,t)=>rO.useSyncExternalStore(uO,e,t),dO=()=>location.search,fO=({ssrSearch:e=""}={})=>QC(dO,()=>e),Eb=()=>location.pathname,hO=({ssrPath:e}={})=>QC(Eb,e?()=>e:Eb),pO=(e,{replace:t=!1,state:n=null}={})=>history[t?Vv:qv](n,"",e),mO=(e={})=>[hO(e),pO],Nb=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Nb]>"u"){for(const e of[qv,Vv]){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,Nb,{value:!0})}const gO=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",GC=(e="")=>e==="/"?"":e,yO=(e,t)=>e[0]==="~"?e.slice(1):GC(t)+e,vO=(e="",t)=>gO(jb(GC(e)),jb(t)),jb=e=>{try{return decodeURI(e)}catch{return e}},JC={hook:mO,searchHook:fO,parser:WA,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},YC=b.createContext(JC),nu=()=>b.useContext(YC),XC={},eE=b.createContext(XC),xO=()=>b.useContext(eE),wh=e=>{const[t,n]=e.hook(e);return[vO(e.base,t),ZC((r,o)=>n(yO(r,e.base),o))]},wO=()=>wh(nu()),tE=(e,t,n,r)=>{const{pattern:o,keys:s}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",r),i=o.exec(n)||[],[a,...l]=i;return a!==void 0?[!0,(()=>{const u=s!==!1?Object.fromEntries(s.map((f,p)=>[f,l[p]])):i.groups;let d={...l};return u&&Object.assign(d,u),d})(),...r?[a]:[]]:[!1,null]},bO=({children:e,...t})=>{var d,f;const n=nu(),r=t.hook?JC:n;let o=r;const[s,i]=((d=t.ssrPath)==null?void 0:d.split("?"))??[];i&&(t.ssrSearch=i,t.ssrPath=s),t.hrefs=t.hrefs??((f=t.hook)==null?void 0:f.hrefs);let a=b.useRef({}),l=a.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]&&(a.current=u={...u}),u[p]=h,(h!==r[p]||h!==o[p])&&(o=u)}return b.createElement(YC.Provider,{value:o,children:e})},Pb=({children:e,component:t},n)=>t?b.createElement(t,{params:n}):typeof e=="function"?e(n):e,kO=e=>{let t=b.useRef(XC);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([r,o])=>o!==n[r])?e:n},qi=({path:e,nest:t,match:n,...r})=>{const o=nu(),[s]=wh(o),[i,a,l]=n??tE(o.parser,e,s,t),u=kO({...xO(),...a});if(!i)return null;const d=l?b.createElement(bO,{base:l},Pb(r,u)):Pb(r,u);return b.createElement(eE.Provider,{value:u,children:d})},Ya=b.forwardRef((e,t)=>{const n=nu(),[r,o]=wh(n),{to:s="",href:i=s,onClick:a,asChild:l,children:u,className:d,replace:f,state:p,...h}=e,y=ZC(x=>{x.ctrlKey||x.metaKey||x.altKey||x.shiftKey||x.button!==0||(a==null||a(x),x.defaultPrevented||(x.preventDefault(),o(i,e)))}),m=n.hrefs(i[0]==="~"?i.slice(1):n.base+i,n);return l&&b.isValidElement(u)?b.cloneElement(u,{onClick:y,href:m}):b.createElement("a",{...h,onClick:y,href:m,className:d!=null&&d.call?d(r===i):d,children:u,ref:t})}),nE=e=>Array.isArray(e)?e.flatMap(t=>nE(t&&t.type===b.Fragment?t.props.children:t)):[e],_O=({children:e,location:t})=>{const n=nu(),[r]=wh(n);for(const o of nE(e)){let s=0;if(b.isValidElement(o)&&(s=tE(n.parser,o.props.path,t||r,o.props.nest))[0])return b.cloneElement(o,{match:s})}return null};var fl=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(){}},Ci=typeof window>"u"||"Deno"in globalThis;function kn(){}function SO(e,t){return typeof e=="function"?e(t):e}function bg(e){return typeof e=="number"&&e>=0&&e!==1/0}function rE(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Es(e,t){return typeof e=="function"?e(t):e}function ar(e,t){return typeof e=="function"?e(t):e}function Tb(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:i,stale:a}=e;if(i){if(r){if(t.queryHash!==Hv(i,t.options))return!1}else if(!Dc(t.queryKey,i))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||s&&!s(t))}function $b(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(Ei(t.options.mutationKey)!==Ei(s))return!1}else if(!Dc(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Hv(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ei)(e)}function Ei(e){return JSON.stringify(e,(t,n)=>kg(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Dc(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Dc(e[n],t[n])):!1}function oE(e,t){if(e===t)return e;const n=Rb(e)&&Rb(t);if(n||kg(e)&&kg(t)){const r=n?e:Object.keys(e),o=r.length,s=n?t:Object.keys(t),i=s.length,a=n?[]:{},l=new Set(r);let u=0;for(let d=0;d<i;d++){const f=n?d:s[d];(!n&&l.has(f)||n)&&e[f]===void 0&&t[f]===void 0?(a[f]=void 0,u++):(a[f]=oE(e[f],t[f]),a[f]===e[f]&&e[f]!==void 0&&u++)}return o===i&&u===o?e:a}return t}function wf(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 Rb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function kg(e){if(!Ib(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ib(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ib(e){return Object.prototype.toString.call(e)==="[object Object]"}function CO(e){return new Promise(t=>{setTimeout(t,e)})}function _g(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?oE(e,t):t}function EO(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function NO(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Bv=Symbol();function sE(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Bv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function iE(e,t){return typeof e=="function"?e(...t):!!e}var ci,is,$a,__,jO=(__=class extends fl{constructor(){super();we(this,ci);we(this,is);we(this,$a);ce(this,$a,t=>{if(!Ci&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){L(this,is)||this.setEventListener(L(this,$a))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,is))==null||t.call(this),ce(this,is,void 0))}setEventListener(t){var n;ce(this,$a,t),(n=L(this,is))==null||n.call(this),ce(this,is,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){L(this,ci)!==t&&(ce(this,ci,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof L(this,ci)=="boolean"?L(this,ci):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ci=new WeakMap,is=new WeakMap,$a=new WeakMap,__),Kv=new jO,Ra,as,Ia,S_,PO=(S_=class extends fl{constructor(){super();we(this,Ra,!0);we(this,as);we(this,Ia);ce(this,Ia,t=>{if(!Ci&&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(){L(this,as)||this.setEventListener(L(this,Ia))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,as))==null||t.call(this),ce(this,as,void 0))}setEventListener(t){var n;ce(this,Ia,t),(n=L(this,as))==null||n.call(this),ce(this,as,t(this.setOnline.bind(this)))}setOnline(t){L(this,Ra)!==t&&(ce(this,Ra,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return L(this,Ra)}},Ra=new WeakMap,as=new WeakMap,Ia=new WeakMap,S_),bf=new PO;function Sg(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function TO(e){return Math.min(1e3*2**e,3e4)}function aE(e){return(e??"online")==="online"?bf.isOnline():!0}var lE=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function cE(e){let t=!1,n=0,r;const o=Sg(),s=()=>o.status!=="pending",i=m=>{var x;s()||(p(new lE(m)),(x=e.abort)==null||x.call(e))},a=()=>{t=!0},l=()=>{t=!1},u=()=>Kv.isFocused()&&(e.networkMode==="always"||bf.isOnline())&&e.canRun(),d=()=>aE(e.networkMode)&&e.canRun(),f=m=>{s()||(r==null||r(),o.resolve(m))},p=m=>{s()||(r==null||r(),o.reject(m))},h=()=>new Promise(m=>{var x;r=g=>{(s()||u())&&m(g)},(x=e.onPause)==null||x.call(e)}).then(()=>{var m;r=void 0,s()||(m=e.onContinue)==null||m.call(e)}),y=()=>{if(s())return;let m;const x=n===0?e.initialPromise:void 0;try{m=x??e.fn()}catch(g){m=Promise.reject(g)}Promise.resolve(m).then(f).catch(g=>{var j;if(s())return;const v=e.retry??(Ci?0:3),w=e.retryDelay??TO,k=typeof w=="function"?w(n,g):w,C=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,g);if(t||!C){p(g);return}n++,(j=e.onFail)==null||j.call(e,n,g),CO(k).then(()=>u()?void 0:h()).then(()=>{t?p(g):y()})})};return{promise:o,status:()=>o.status,cancel:i,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?y():h().then(y),o)}}var $O=e=>setTimeout(e,0);function RO(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=$O;const s=a=>{t?e.push(a):o(()=>{n(a)})},i=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||i()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Ut=RO(),ui,C_,uE=(C_=class{constructor(){we(this,ui)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),bg(this.gcTime)&&ce(this,ui,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ci?1/0:5*60*1e3))}clearGcTimeout(){L(this,ui)&&(clearTimeout(L(this,ui)),ce(this,ui,void 0))}},ui=new WeakMap,C_),Aa,Oa,sr,di,Bt,Wc,fi,Cr,go,E_,IO=(E_=class extends uE{constructor(t){super();we(this,Cr);we(this,Aa);we(this,Oa);we(this,sr);we(this,di);we(this,Bt);we(this,Wc);we(this,fi);ce(this,fi,!1),ce(this,Wc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ce(this,di,t.client),ce(this,sr,L(this,di).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ce(this,Aa,AO(this.options)),this.state=t.state??L(this,Aa),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=L(this,Bt))==null?void 0:t.promise}setOptions(t){this.options={...L(this,Wc),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,sr).remove(this)}setData(t,n){const r=_g(this.state.data,t,this.options);return Oe(this,Cr,go).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Oe(this,Cr,go).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=L(this,Bt))==null?void 0:r.promise;return(o=L(this,Bt))==null||o.cancel(t),n?n.then(kn).catch(kn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(L(this,Aa))}isActive(){return this.observers.some(t=>ar(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Bv||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Es(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:!rE(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=L(this,Bt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=L(this,Bt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),L(this,sr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(L(this,Bt)&&(L(this,fi)?L(this,Bt).cancel({revert:!0}):L(this,Bt).cancelRetry()),this.scheduleGc()),L(this,sr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Oe(this,Cr,go).call(this,{type:"invalidate"})}async fetch(t,n){var l,u,d,f,p,h,y,m,x,g,v,w;if(this.state.fetchStatus!=="idle"&&((l=L(this,Bt))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(L(this,Bt))return L(this,Bt).continueRetry(),L(this,Bt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(C=>C.options.queryFn);k&&this.setOptions(k.options)}const r=new AbortController,o=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(ce(this,fi,!0),r.signal)})},s=()=>{const k=sE(this.options,n),j=(()=>{const _={client:L(this,di),queryKey:this.queryKey,meta:this.meta};return o(_),_})();return ce(this,fi,!1),this.options.persister?this.options.persister(k,j,this):k(j)},a=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:L(this,di),state:this.state,fetchFn:s};return o(k),k})();(u=this.options.behavior)==null||u.onFetch(a,this),ce(this,Oa,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Oe(this,Cr,go).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),ce(this,Bt,cE({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onFail:(k,C)=>{Oe(this,Cr,go).call(this,{type:"failed",failureCount:k,error:C})},onPause:()=>{Oe(this,Cr,go).call(this,{type:"pause"})},onContinue:()=>{Oe(this,Cr,go).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const k=await L(this,Bt).start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(h=(p=L(this,sr).config).onSuccess)==null||h.call(p,k,this),(m=(y=L(this,sr).config).onSettled)==null||m.call(y,k,this.state.error,this),k}catch(k){if(k instanceof lE){if(k.silent)return L(this,Bt).promise;if(k.revert){if(this.setState({...L(this,Oa),fetchStatus:"idle"}),this.state.data===void 0)throw k;return this.state.data}}throw Oe(this,Cr,go).call(this,{type:"error",error:k}),(g=(x=L(this,sr).config).onError)==null||g.call(x,k,this),(w=(v=L(this,sr).config).onSettled)==null||w.call(v,this.state.data,k,this),k}finally{this.scheduleGc()}}},Aa=new WeakMap,Oa=new WeakMap,sr=new WeakMap,di=new WeakMap,Bt=new WeakMap,Wc=new WeakMap,fi=new WeakMap,Cr=new WeakSet,go=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,...dE(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...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 ce(this,Oa,t.manual?o:void 0),o;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ut.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),L(this,sr).notify({query:this,type:"updated",action:t})})},E_);function dE(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:aE(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function AO(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 Wr,N_,OO=(N_=class extends fl{constructor(t={}){super();we(this,Wr);this.config=t,ce(this,Wr,new Map)}build(t,n,r){const o=n.queryKey,s=n.queryHash??Hv(o,n);let i=this.get(s);return i||(i=new IO({client:t,queryKey:o,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(i)),i}add(t){L(this,Wr).has(t.queryHash)||(L(this,Wr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=L(this,Wr).get(t.queryHash);n&&(t.destroy(),n===t&&L(this,Wr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ut.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return L(this,Wr).get(t)}getAll(){return[...L(this,Wr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Tb(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Tb(t,r)):n}notify(t){Ut.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ut.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ut.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Wr=new WeakMap,N_),Zr,yn,hi,Qr,Go,j_,MO=(j_=class extends uE{constructor(t){super();we(this,Qr);we(this,Zr);we(this,yn);we(this,hi);this.mutationId=t.mutationId,ce(this,yn,t.mutationCache),ce(this,Zr,[]),this.state=t.state||fE(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){L(this,Zr).includes(t)||(L(this,Zr).push(t),this.clearGcTimeout(),L(this,yn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ce(this,Zr,L(this,Zr).filter(n=>n!==t)),this.scheduleGc(),L(this,yn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){L(this,Zr).length||(this.state.status==="pending"?this.scheduleGc():L(this,yn).remove(this))}continue(){var t;return((t=L(this,hi))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,i,a,l,u,d,f,p,h,y,m,x,g,v,w,k,C,j,_,I;const n=()=>{Oe(this,Qr,Go).call(this,{type:"continue"})};ce(this,hi,cE({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(P,$)=>{Oe(this,Qr,Go).call(this,{type:"failed",failureCount:P,error:$})},onPause:()=>{Oe(this,Qr,Go).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,yn).canRun(this)}));const r=this.state.status==="pending",o=!L(this,hi).canStart();try{if(r)n();else{Oe(this,Qr,Go).call(this,{type:"pending",variables:t,isPaused:o}),await((i=(s=L(this,yn).config).onMutate)==null?void 0:i.call(s,t,this));const $=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,t));$!==this.state.context&&Oe(this,Qr,Go).call(this,{type:"pending",context:$,variables:t,isPaused:o})}const P=await L(this,hi).start();return await((d=(u=L(this,yn).config).onSuccess)==null?void 0:d.call(u,P,t,this.state.context,this)),await((p=(f=this.options).onSuccess)==null?void 0:p.call(f,P,t,this.state.context)),await((y=(h=L(this,yn).config).onSettled)==null?void 0:y.call(h,P,null,this.state.variables,this.state.context,this)),await((x=(m=this.options).onSettled)==null?void 0:x.call(m,P,null,t,this.state.context)),Oe(this,Qr,Go).call(this,{type:"success",data:P}),P}catch(P){try{throw await((v=(g=L(this,yn).config).onError)==null?void 0:v.call(g,P,t,this.state.context,this)),await((k=(w=this.options).onError)==null?void 0:k.call(w,P,t,this.state.context)),await((j=(C=L(this,yn).config).onSettled)==null?void 0:j.call(C,void 0,P,this.state.variables,this.state.context,this)),await((I=(_=this.options).onSettled)==null?void 0:I.call(_,void 0,P,t,this.state.context)),P}finally{Oe(this,Qr,Go).call(this,{type:"error",error:P})}}finally{L(this,yn).runNext(this)}}},Zr=new WeakMap,yn=new WeakMap,hi=new WeakMap,Qr=new WeakSet,Go=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),Ut.batch(()=>{L(this,Zr).forEach(r=>{r.onMutationUpdate(t)}),L(this,yn).notify({mutation:this,type:"updated",action:t})})},j_);function fE(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wo,Er,Zc,P_,DO=(P_=class extends fl{constructor(t={}){super();we(this,wo);we(this,Er);we(this,Zc);this.config=t,ce(this,wo,new Set),ce(this,Er,new Map),ce(this,Zc,0)}build(t,n,r){const o=new MO({mutationCache:this,mutationId:++Eu(this,Zc)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){L(this,wo).add(t);const n=Hu(t);if(typeof n=="string"){const r=L(this,Er).get(n);r?r.push(t):L(this,Er).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(L(this,wo).delete(t)){const n=Hu(t);if(typeof n=="string"){const r=L(this,Er).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&L(this,Er).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Hu(t);if(typeof n=="string"){const r=L(this,Er).get(n),o=r==null?void 0:r.find(s=>s.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Hu(t);if(typeof n=="string"){const o=(r=L(this,Er).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ut.batch(()=>{L(this,wo).forEach(t=>{this.notify({type:"removed",mutation:t})}),L(this,wo).clear(),L(this,Er).clear()})}getAll(){return Array.from(L(this,wo))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>$b(n,r))}findAll(t={}){return this.getAll().filter(n=>$b(t,n))}notify(t){Ut.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ut.batch(()=>Promise.all(t.map(n=>n.continue().catch(kn))))}},wo=new WeakMap,Er=new WeakMap,Zc=new WeakMap,P_);function Hu(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Ab(e){return{onFetch:(t,n)=>{var d,f,p,h,y;const r=t.options,o=(p=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,s=((h=t.state.data)==null?void 0:h.pages)||[],i=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const x=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},g=sE(t.options,t.fetchOptions),v=async(w,k,C)=>{if(m)return Promise.reject();if(k==null&&w.pages.length)return Promise.resolve(w);const _=(()=>{const T={client:t.client,queryKey:t.queryKey,pageParam:k,direction:C?"backward":"forward",meta:t.options.meta};return x(T),T})(),I=await g(_),{maxPages:P}=t.options,$=C?NO:EO;return{pages:$(w.pages,I,P),pageParams:$(w.pageParams,k,P)}};if(o&&s.length){const w=o==="backward",k=w?LO:Ob,C={pages:s,pageParams:i},j=k(r,C);a=await v(C,j,w)}else{const w=e??s.length;do{const k=l===0?i[0]??r.initialPageParam:Ob(r,a);if(l>0&&k==null)break;a=await v(a,k),l++}while(l<w)}return a};t.options.persister?t.fetchFn=()=>{var m,x;return(x=(m=t.options).persister)==null?void 0:x.call(m,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Ob(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 LO(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 Tt,ls,cs,Ma,Da,us,La,za,T_,zO=(T_=class{constructor(e={}){we(this,Tt);we(this,ls);we(this,cs);we(this,Ma);we(this,Da);we(this,us);we(this,La);we(this,za);ce(this,Tt,e.queryCache||new OO),ce(this,ls,e.mutationCache||new DO),ce(this,cs,e.defaultOptions||{}),ce(this,Ma,new Map),ce(this,Da,new Map),ce(this,us,0)}mount(){Eu(this,us)._++,L(this,us)===1&&(ce(this,La,Kv.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,Tt).onFocus())})),ce(this,za,bf.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,Tt).onOnline())})))}unmount(){var e,t;Eu(this,us)._--,L(this,us)===0&&((e=L(this,La))==null||e.call(this),ce(this,La,void 0),(t=L(this,za))==null||t.call(this),ce(this,za,void 0))}isFetching(e){return L(this,Tt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return L(this,ls).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=L(this,Tt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=L(this,Tt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Es(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return L(this,Tt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=L(this,Tt).get(r.queryHash),s=o==null?void 0:o.state.data,i=SO(t,s);if(i!==void 0)return L(this,Tt).build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Ut.batch(()=>L(this,Tt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=L(this,Tt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=L(this,Tt);Ut.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=L(this,Tt);return Ut.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ut.batch(()=>L(this,Tt).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(kn).catch(kn)}invalidateQueries(e,t={}){return Ut.batch(()=>(L(this,Tt).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=Ut.batch(()=>L(this,Tt).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(kn)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(kn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=L(this,Tt).build(this,t);return n.isStaleByTime(Es(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(kn).catch(kn)}fetchInfiniteQuery(e){return e.behavior=Ab(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(kn).catch(kn)}ensureInfiniteQueryData(e){return e.behavior=Ab(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return bf.isOnline()?L(this,ls).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,Tt)}getMutationCache(){return L(this,ls)}getDefaultOptions(){return L(this,cs)}setDefaultOptions(e){ce(this,cs,e)}setQueryDefaults(e,t){L(this,Ma).set(Ei(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...L(this,Ma).values()],n={};return t.forEach(r=>{Dc(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){L(this,Da).set(Ei(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...L(this,Da).values()],n={};return t.forEach(r=>{Dc(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...L(this,cs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Hv(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===Bv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...L(this,cs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){L(this,Tt).clear(),L(this,ls).clear()}},Tt=new WeakMap,ls=new WeakMap,cs=new WeakMap,Ma=new WeakMap,Da=new WeakMap,us=new WeakMap,La=new WeakMap,za=new WeakMap,T_),Tn,He,Qc,vn,pi,Fa,bo,ds,Gc,Ua,qa,mi,gi,fs,Va,Je,Bl,Cg,Eg,Ng,jg,Pg,Tg,$g,hE,$_,FO=($_=class extends fl{constructor(t,n){super();we(this,Je);we(this,Tn);we(this,He);we(this,Qc);we(this,vn);we(this,pi);we(this,Fa);we(this,bo);we(this,ds);we(this,Gc);we(this,Ua);we(this,qa);we(this,mi);we(this,gi);we(this,fs);we(this,Va,new Set);this.options=n,ce(this,Tn,t),ce(this,ds,null),ce(this,bo,Sg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,He).addObserver(this),Mb(L(this,He),this.options)?Oe(this,Je,Bl).call(this):this.updateResult(),Oe(this,Je,jg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Rg(L(this,He),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Rg(L(this,He),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Oe(this,Je,Pg).call(this),Oe(this,Je,Tg).call(this),L(this,He).removeObserver(this)}setOptions(t){const n=this.options,r=L(this,He);if(this.options=L(this,Tn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ar(this.options.enabled,L(this,He))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Oe(this,Je,$g).call(this),L(this,He).setOptions(this.options),n._defaulted&&!wf(this.options,n)&&L(this,Tn).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,He),observer:this});const o=this.hasListeners();o&&Db(L(this,He),r,this.options,n)&&Oe(this,Je,Bl).call(this),this.updateResult(),o&&(L(this,He)!==r||ar(this.options.enabled,L(this,He))!==ar(n.enabled,L(this,He))||Es(this.options.staleTime,L(this,He))!==Es(n.staleTime,L(this,He)))&&Oe(this,Je,Cg).call(this);const s=Oe(this,Je,Eg).call(this);o&&(L(this,He)!==r||ar(this.options.enabled,L(this,He))!==ar(n.enabled,L(this,He))||s!==L(this,fs))&&Oe(this,Je,Ng).call(this,s)}getOptimisticResult(t){const n=L(this,Tn).getQueryCache().build(L(this,Tn),t),r=this.createResult(n,t);return qO(this,r)&&(ce(this,vn,r),ce(this,Fa,this.options),ce(this,pi,L(this,He).state)),r}getCurrentResult(){return L(this,vn)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&!this.options.experimental_prefetchInRender&&L(this,bo).status==="pending"&&L(this,bo).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(r,o))})}trackProp(t){L(this,Va).add(t)}getCurrentQuery(){return L(this,He)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=L(this,Tn).defaultQueryOptions(t),r=L(this,Tn).getQueryCache().build(L(this,Tn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Oe(this,Je,Bl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,vn)))}createResult(t,n){var P;const r=L(this,He),o=this.options,s=L(this,vn),i=L(this,pi),a=L(this,Fa),u=t!==r?t.state:L(this,Qc),{state:d}=t;let f={...d},p=!1,h;if(n._optimisticResults){const $=this.hasListeners(),T=!$&&Mb(t,n),A=$&&Db(t,r,n,o);(T||A)&&(f={...f,...dE(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:m,status:x}=f;h=f.data;let g=!1;if(n.placeholderData!==void 0&&h===void 0&&x==="pending"){let $;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?($=s.data,g=!0):$=typeof n.placeholderData=="function"?n.placeholderData((P=L(this,qa))==null?void 0:P.state.data,L(this,qa)):n.placeholderData,$!==void 0&&(x="success",h=_g(s==null?void 0:s.data,$,n),p=!0)}if(n.select&&h!==void 0&&!g)if(s&&h===(i==null?void 0:i.data)&&n.select===L(this,Gc))h=L(this,Ua);else try{ce(this,Gc,n.select),h=n.select(h),h=_g(s==null?void 0:s.data,h,n),ce(this,Ua,h),ce(this,ds,null)}catch($){ce(this,ds,$)}L(this,ds)&&(y=L(this,ds),h=L(this,Ua),m=Date.now(),x="error");const v=f.fetchStatus==="fetching",w=x==="pending",k=x==="error",C=w&&v,j=h!==void 0,I={status:x,fetchStatus:f.fetchStatus,isPending:w,isSuccess:x==="success",isError:k,isInitialLoading:C,isLoading:C,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:k&&!j,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:k&&j,isStale:Wv(t,n),refetch:this.refetch,promise:L(this,bo),isEnabled:ar(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const $=U=>{I.status==="error"?U.reject(I.error):I.data!==void 0&&U.resolve(I.data)},T=()=>{const U=ce(this,bo,I.promise=Sg());$(U)},A=L(this,bo);switch(A.status){case"pending":t.queryHash===r.queryHash&&$(A);break;case"fulfilled":(I.status==="error"||I.data!==A.value)&&T();break;case"rejected":(I.status!=="error"||I.error!==A.reason)&&T();break}}return I}updateResult(){const t=L(this,vn),n=this.createResult(L(this,He),this.options);if(ce(this,pi,L(this,He).state),ce(this,Fa,this.options),L(this,pi).data!==void 0&&ce(this,qa,L(this,He)),wf(n,t))return;ce(this,vn,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,s=typeof o=="function"?o():o;if(s==="all"||!s&&!L(this,Va).size)return!0;const i=new Set(s??L(this,Va));return this.options.throwOnError&&i.add("error"),Object.keys(L(this,vn)).some(a=>{const l=a;return L(this,vn)[l]!==t[l]&&i.has(l)})};Oe(this,Je,hE).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Oe(this,Je,jg).call(this)}},Tn=new WeakMap,He=new WeakMap,Qc=new WeakMap,vn=new WeakMap,pi=new WeakMap,Fa=new WeakMap,bo=new WeakMap,ds=new WeakMap,Gc=new WeakMap,Ua=new WeakMap,qa=new WeakMap,mi=new WeakMap,gi=new WeakMap,fs=new WeakMap,Va=new WeakMap,Je=new WeakSet,Bl=function(t){Oe(this,Je,$g).call(this);let n=L(this,He).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(kn)),n},Cg=function(){Oe(this,Je,Pg).call(this);const t=Es(this.options.staleTime,L(this,He));if(Ci||L(this,vn).isStale||!bg(t))return;const r=rE(L(this,vn).dataUpdatedAt,t)+1;ce(this,mi,setTimeout(()=>{L(this,vn).isStale||this.updateResult()},r))},Eg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,He)):this.options.refetchInterval)??!1},Ng=function(t){Oe(this,Je,Tg).call(this),ce(this,fs,t),!(Ci||ar(this.options.enabled,L(this,He))===!1||!bg(L(this,fs))||L(this,fs)===0)&&ce(this,gi,setInterval(()=>{(this.options.refetchIntervalInBackground||Kv.isFocused())&&Oe(this,Je,Bl).call(this)},L(this,fs)))},jg=function(){Oe(this,Je,Cg).call(this),Oe(this,Je,Ng).call(this,Oe(this,Je,Eg).call(this))},Pg=function(){L(this,mi)&&(clearTimeout(L(this,mi)),ce(this,mi,void 0))},Tg=function(){L(this,gi)&&(clearInterval(L(this,gi)),ce(this,gi,void 0))},$g=function(){const t=L(this,Tn).getQueryCache().build(L(this,Tn),this.options);if(t===L(this,He))return;const n=L(this,He);ce(this,He,t),ce(this,Qc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},hE=function(t){Ut.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(L(this,vn))}),L(this,Tn).getQueryCache().notify({query:L(this,He),type:"observerResultsUpdated"})})},$_);function UO(e,t){return ar(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Mb(e,t){return UO(e,t)||e.state.data!==void 0&&Rg(e,t,t.refetchOnMount)}function Rg(e,t,n){if(ar(t.enabled,e)!==!1&&Es(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Wv(e,t)}return!1}function Db(e,t,n,r){return(e!==t||ar(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Wv(e,n)}function Wv(e,t){return ar(t.enabled,e)!==!1&&e.isStaleByTime(Es(t.staleTime,e))}function qO(e,t){return!wf(e.getCurrentResult(),t)}var hs,ps,$n,ko,$o,jd,Ig,R_,VO=(R_=class extends fl{constructor(n,r){super();we(this,$o);we(this,hs);we(this,ps);we(this,$n);we(this,ko);ce(this,hs,n),this.setOptions(r),this.bindMethods(),Oe(this,$o,jd).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=L(this,hs).defaultMutationOptions(n),wf(this.options,r)||L(this,hs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:L(this,$n),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ei(r.mutationKey)!==Ei(this.options.mutationKey)?this.reset():((o=L(this,$n))==null?void 0:o.state.status)==="pending"&&L(this,$n).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=L(this,$n))==null||n.removeObserver(this)}onMutationUpdate(n){Oe(this,$o,jd).call(this),Oe(this,$o,Ig).call(this,n)}getCurrentResult(){return L(this,ps)}reset(){var n;(n=L(this,$n))==null||n.removeObserver(this),ce(this,$n,void 0),Oe(this,$o,jd).call(this),Oe(this,$o,Ig).call(this)}mutate(n,r){var o;return ce(this,ko,r),(o=L(this,$n))==null||o.removeObserver(this),ce(this,$n,L(this,hs).getMutationCache().build(L(this,hs),this.options)),L(this,$n).addObserver(this),L(this,$n).execute(n)}},hs=new WeakMap,ps=new WeakMap,$n=new WeakMap,ko=new WeakMap,$o=new WeakSet,jd=function(){var r;const n=((r=L(this,$n))==null?void 0:r.state)??fE();ce(this,ps,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Ig=function(n){Ut.batch(()=>{var r,o,s,i,a,l,u,d;if(L(this,ko)&&this.hasListeners()){const f=L(this,ps).variables,p=L(this,ps).context;(n==null?void 0:n.type)==="success"?((o=(r=L(this,ko)).onSuccess)==null||o.call(r,n.data,f,p),(i=(s=L(this,ko)).onSettled)==null||i.call(s,n.data,null,f,p)):(n==null?void 0:n.type)==="error"&&((l=(a=L(this,ko)).onError)==null||l.call(a,n.error,f,p),(d=(u=L(this,ko)).onSettled)==null||d.call(u,void 0,n.error,f,p))}this.listeners.forEach(f=>{f(L(this,ps))})})},R_),pE=b.createContext(void 0),Zt=e=>{const t=b.useContext(pE);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},HO=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(pE.Provider,{value:e,children:t})),mE=b.createContext(!1),BO=()=>b.useContext(mE);mE.Provider;function KO(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var WO=b.createContext(KO()),ZO=()=>b.useContext(WO),QO=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},GO=e=>{b.useEffect(()=>{e.clearReset()},[e])},JO=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||iE(n,[e.error,r])),YO=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))}},XO=(e,t)=>e.isLoading&&e.isFetching&&!t,eM=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Lb=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function tM(e,t,n){var f,p,h,y,m;const r=BO(),o=ZO(),s=Zt(),i=s.defaultQueryOptions(e);(p=(f=s.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,i),i._optimisticResults=r?"isRestoring":"optimistic",YO(i),QO(i,o),GO(o);const a=!s.getQueryCache().get(i.queryHash),[l]=b.useState(()=>new t(s,i)),u=l.getOptimisticResult(i),d=!r&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(x=>{const g=d?l.subscribe(Ut.batchCalls(x)):kn;return l.updateResult(),g},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),b.useEffect(()=>{l.setOptions(i)},[i,l]),eM(i,u))throw Lb(i,l,o);if(JO({result:u,errorResetBoundary:o,throwOnError:i.throwOnError,query:s.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw u.error;if((y=(h=s.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,i,u),i.experimental_prefetchInRender&&!Ci&&XO(u,r)){const x=a?Lb(i,l,o):(m=s.getQueryCache().get(i.queryHash))==null?void 0:m.promise;x==null||x.catch(kn).finally(()=>{l.updateResult()})}return i.notifyOnChangeProps?u:l.trackResult(u)}function ut(e,t){return tM(e,FO)}function dt(e,t){const n=Zt(),[r]=b.useState(()=>new VO(n,e));b.useEffect(()=>{r.setOptions(e)},[r,e]);const o=b.useSyncExternalStore(b.useCallback(i=>r.subscribe(Ut.batchCalls(i)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=b.useCallback((i,a)=>{r.mutate(i,a).catch(kn)},[r]);if(o.error&&iE(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}const nM="x-agent-deck-client",rM="dashboard",gE={[nM]:rM};async function yE(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 _e(e,t,n){const r=await fetch(t,{method:e,headers:{...gE,...n?{"Content-Type":"application/json"}:{}},body:n?JSON.stringify(n):void 0});return await yE(r),r}const oM=({on401:e})=>async({queryKey:t})=>{const n=t.join("/"),r=await fetch(n,{headers:gE});return await yE(r),await r.json()},sM=new zO({defaultOptions:{queries:{queryFn:oM({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:10*60*1e3,retry:!1},mutations:{retry:!1}}}),iM=1,aM=1e6;let Op=0;function lM(){return Op=(Op+1)%Number.MAX_SAFE_INTEGER,Op.toString()}const Mp=new Map,zb=e=>{if(Mp.has(e))return;const t=setTimeout(()=>{Mp.delete(e),ac({type:"REMOVE_TOAST",toastId:e})},aM);Mp.set(e,t)},cM=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,iM)};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?zb(n):e.toasts.forEach(r=>{zb(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)}}},Pd=[];let Td={toasts:[]};function ac(e){Td=cM(Td,e),Pd.forEach(t=>{t(Td)})}function uM({...e}){const t=lM(),n=o=>ac({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>ac({type:"DISMISS_TOAST",toastId:t});return ac({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function Ht(){const[e,t]=b.useState(Td);return b.useEffect(()=>(Pd.push(t),()=>{const n=Pd.indexOf(t);n>-1&&Pd.splice(n,1)}),[e]),{...e,toast:uM,dismiss:n=>ac({type:"DISMISS_TOAST",toastId:n})}}function ve(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Fb(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function vE(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Fb(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Fb(e[o],null)}}}}function Ye(...e){return b.useCallback(vE(...e),e)}function dM(e,t){const n=b.createContext(t),r=s=>{const{children:i,...a}=s,l=b.useMemo(()=>a,Object.values(a));return c.jsx(n.Provider,{value:l,children:i})};r.displayName=e+"Provider";function o(s){const i=b.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function lo(e,t=[]){let n=[];function r(s,i){const a=b.createContext(i),l=n.length;n=[...n,i];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])||a,x=b.useMemo(()=>y,Object.values(y));return c.jsx(m.Provider,{value:x,children:h})};u.displayName=s+"Provider";function d(f,p){var m;const h=((m=p==null?void 0:p[e])==null?void 0:m[l])||a,y=b.useContext(h);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>b.createContext(i));return function(a){const l=(a==null?void 0:a[e])||s;return b.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,fM(o,...t)]}function fM(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:u})=>{const f=l(s)[`__scope${u}`];return{...a,...f}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ni(e){const t=pM(e),n=b.forwardRef((r,o)=>{const{children:s,...i}=r,a=b.Children.toArray(s),l=a.find(gM);if(l){const u=l.props.children,d=a.map(f=>f===l?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return c.jsx(t,{...i,ref:o,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return c.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var hM=Ni("Slot");function pM(e){const t=b.forwardRef((n,r)=>{const{children:o,...s}=n;if(b.isValidElement(o)){const i=vM(o),a=yM(s,o.props);return o.type!==b.Fragment&&(a.ref=r?vE(r,i):i),b.cloneElement(o,a)}return b.Children.count(o)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var xE=Symbol("radix.slottable");function mM(e){const t=({children:n})=>c.jsx(c.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=xE,t}function gM(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===xE}function yM(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function vM(e){var r,o;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=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Zv(e){const t=e+"CollectionProvider",[n,r]=lo(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:x,children:g}=m,v=Kr.useRef(null),w=Kr.useRef(new Map).current;return c.jsx(o,{scope:x,itemMap:w,collectionRef:v,children:g})};i.displayName=t;const a=e+"CollectionSlot",l=Ni(a),u=Kr.forwardRef((m,x)=>{const{scope:g,children:v}=m,w=s(a,g),k=Ye(x,w.collectionRef);return c.jsx(l,{ref:k,children:v})});u.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",p=Ni(d),h=Kr.forwardRef((m,x)=>{const{scope:g,children:v,...w}=m,k=Kr.useRef(null),C=Ye(x,k),j=s(d,g);return Kr.useEffect(()=>(j.itemMap.set(k,{ref:k,...w}),()=>void j.itemMap.delete(k))),c.jsx(p,{[f]:"",ref:C,children:v})});h.displayName=d;function y(m){const x=s(e+"CollectionConsumer",m);return Kr.useCallback(()=>{const v=x.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((j,_)=>w.indexOf(j.ref.current)-w.indexOf(_.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:h},y,r]}var xM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Te=xM.reduce((e,t)=>{const n=Ni(`Primitive.${t}`),r=b.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function wE(e,t){e&&Di.flushSync(()=>e.dispatchEvent(t))}function mr(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function wM(e,t=globalThis==null?void 0:globalThis.document){const n=mr(e);b.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var bM="DismissableLayer",Ag="dismissableLayer.update",kM="dismissableLayer.pointerDownOutside",_M="dismissableLayer.focusOutside",Ub,bE=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hl=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...l}=e,u=b.useContext(bE),[d,f]=b.useState(null),p=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=b.useState({}),y=Ye(t,_=>f(_)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(x),v=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,k=v>=g,C=CM(_=>{const I=_.target,P=[...u.branches].some($=>$.contains(I));!k||P||(o==null||o(_),i==null||i(_),_.defaultPrevented||a==null||a())},p),j=EM(_=>{const I=_.target;[...u.branches].some($=>$.contains(I))||(s==null||s(_),i==null||i(_),_.defaultPrevented||a==null||a())},p);return wM(_=>{v===u.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&a&&(_.preventDefault(),a()))},p),b.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ub=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),qb(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Ub)}},[d,p,n,u]),b.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),qb())},[d,u]),b.useEffect(()=>{const _=()=>h({});return document.addEventListener(Ag,_),()=>document.removeEventListener(Ag,_)},[]),c.jsx(Te.div,{...l,ref:y,style:{pointerEvents:w?k?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,j.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,C.onPointerDownCapture)})});hl.displayName=bM;var SM="DismissableLayerBranch",kE=b.forwardRef((e,t)=>{const n=b.useContext(bE),r=b.useRef(null),o=Ye(t,r);return b.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),c.jsx(Te.div,{...e,ref:o})});kE.displayName=SM;function CM(e,t=globalThis==null?void 0:globalThis.document){const n=mr(e),r=b.useRef(!1),o=b.useRef(()=>{});return b.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){_E(kM,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function EM(e,t=globalThis==null?void 0:globalThis.document){const n=mr(e),r=b.useRef(!1);return b.useEffect(()=>{const o=s=>{s.target&&!r.current&&_E(_M,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function qb(){const e=new CustomEvent(Ag);document.dispatchEvent(e)}function _E(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?wE(o,s):o.dispatchEvent(s)}var NM=hl,jM=kE,sn=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},PM="Portal",ru=b.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=b.useState(!1);sn(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?KA.createPortal(c.jsx(Te.div,{...r,ref:t}),i):null});ru.displayName=PM;function TM(e,t){return b.useReducer((n,r)=>t[n][r]??n,e)}var co=e=>{const{present:t,children:n}=e,r=$M(t),o=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),s=Ye(r.ref,RM(o));return typeof n=="function"||r.isPresent?b.cloneElement(o,{ref:s}):null};co.displayName="Presence";function $M(e){const[t,n]=b.useState(),r=b.useRef(null),o=b.useRef(e),s=b.useRef("none"),i=e?"mounted":"unmounted",[a,l]=TM(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const u=Bu(r.current);s.current=a==="mounted"?u:"none"},[a]),sn(()=>{const u=r.current,d=o.current;if(d!==e){const p=s.current,h=Bu(u);e?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&p!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),sn(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=h=>{const m=Bu(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&m&&(l("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},p=h=>{h.target===t&&(s.current=Bu(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(a),ref:b.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Bu(e){return(e==null?void 0:e.animationName)||"none"}function RM(e){var r,o;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=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var IM=Jy[" useInsertionEffect ".trim().toString()]||sn;function $s({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=AM({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const d=b.useRef(e!==void 0);b.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"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=a},[a,r])}const u=b.useCallback(d=>{var f;if(a){const p=OM(d)?d(e):d;p!==e&&((f=i.current)==null||f.call(i,p))}else s(d)},[a,e,s,i]);return[l,u]}function AM({defaultProp:e,onChange:t}){const[n,r]=b.useState(e),o=b.useRef(n),s=b.useRef(t);return IM(()=>{s.current=t},[t]),b.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function OM(e){return typeof e=="function"}var SE=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"}),MM="VisuallyHidden",bh=b.forwardRef((e,t)=>c.jsx(Te.span,{...e,ref:t,style:{...SE,...e.style}}));bh.displayName=MM;var DM=bh,Qv="ToastProvider",[Gv,LM,zM]=Zv("Toast"),[CE,mte]=lo("Toast",[zM]),[FM,kh]=CE(Qv),EE=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:i}=e,[a,l]=b.useState(null),[u,d]=b.useState(0),f=b.useRef(!1),p=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Qv}\`. Expected non-empty \`string\`.`),c.jsx(Gv.Provider,{scope:t,children:c.jsx(FM,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:s,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:b.useCallback(()=>d(h=>h+1),[]),onToastRemove:b.useCallback(()=>d(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:p,children:i})})};EE.displayName=Qv;var NE="ToastViewport",UM=["F8"],Og="toast.viewportPause",Mg="toast.viewportResume",jE=b.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=UM,label:o="Notifications ({hotkey})",...s}=e,i=kh(NE,n),a=LM(n),l=b.useRef(null),u=b.useRef(null),d=b.useRef(null),f=b.useRef(null),p=Ye(t,f,i.onViewportChange),h=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=i.toastCount>0;b.useEffect(()=>{const x=g=>{var w;r.length!==0&&r.every(k=>g[k]||g.code===k)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]),b.useEffect(()=>{const x=l.current,g=f.current;if(y&&x&&g){const v=()=>{if(!i.isClosePausedRef.current){const j=new CustomEvent(Og);g.dispatchEvent(j),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const j=new CustomEvent(Mg);g.dispatchEvent(j),i.isClosePausedRef.current=!1}},k=j=>{!x.contains(j.relatedTarget)&&w()},C=()=>{x.contains(document.activeElement)||w()};return x.addEventListener("focusin",v),x.addEventListener("focusout",k),x.addEventListener("pointermove",v),x.addEventListener("pointerleave",C),window.addEventListener("blur",v),window.addEventListener("focus",w),()=>{x.removeEventListener("focusin",v),x.removeEventListener("focusout",k),x.removeEventListener("pointermove",v),x.removeEventListener("pointerleave",C),window.removeEventListener("blur",v),window.removeEventListener("focus",w)}}},[y,i.isClosePausedRef]);const m=b.useCallback(({tabbingDirection:x})=>{const v=a().map(w=>{const k=w.ref.current,C=[k,...e4(k)];return x==="forwards"?C:C.reverse()});return(x==="forwards"?v.reverse():v).flat()},[a]);return b.useEffect(()=>{const x=f.current;if(x){const g=v=>{var C,j,_;const w=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!w){const I=document.activeElement,P=v.shiftKey;if(v.target===x&&P){(C=u.current)==null||C.focus();return}const A=m({tabbingDirection:P?"backwards":"forwards"}),U=A.findIndex(z=>z===I);Dp(A.slice(U+1))?v.preventDefault():P?(j=u.current)==null||j.focus():(_=d.current)==null||_.focus()}};return x.addEventListener("keydown",g),()=>x.removeEventListener("keydown",g)}},[a,m]),c.jsxs(jM,{ref:l,role:"region","aria-label":o.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&c.jsx(Dg,{ref:u,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"forwards"});Dp(x)}}),c.jsx(Gv.Slot,{scope:n,children:c.jsx(Te.ol,{tabIndex:-1,...s,ref:p})}),y&&c.jsx(Dg,{ref:d,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"backwards"});Dp(x)}})]})});jE.displayName=NE;var PE="ToastFocusProxy",Dg=b.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,s=kh(PE,n);return c.jsx(bh,{tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=s.viewport)!=null&&u.contains(a))&&r()}})});Dg.displayName=PE;var ou="Toast",qM="toast.swipeStart",VM="toast.swipeMove",HM="toast.swipeCancel",BM="toast.swipeEnd",TE=b.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:s,...i}=e,[a,l]=$s({prop:r,defaultProp:o??!0,onChange:s,caller:ou});return c.jsx(co,{present:n||a,children:c.jsx(ZM,{open:a,...i,ref:t,onClose:()=>l(!1),onPause:mr(e.onPause),onResume:mr(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)})})})});TE.displayName=ou;var[KM,WM]=CE(ou,{onClose(){}}),ZM=b.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:s,onClose:i,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:p,onSwipeEnd:h,...y}=e,m=kh(ou,n),[x,g]=b.useState(null),v=Ye(t,z=>g(z)),w=b.useRef(null),k=b.useRef(null),C=o||m.duration,j=b.useRef(0),_=b.useRef(C),I=b.useRef(0),{onToastAdd:P,onToastRemove:$}=m,T=mr(()=>{var D;(x==null?void 0:x.contains(document.activeElement))&&((D=m.viewport)==null||D.focus()),i()}),A=b.useCallback(z=>{!z||z===1/0||(window.clearTimeout(I.current),j.current=new Date().getTime(),I.current=window.setTimeout(T,z))},[T]);b.useEffect(()=>{const z=m.viewport;if(z){const D=()=>{A(_.current),u==null||u()},Z=()=>{const B=new Date().getTime()-j.current;_.current=_.current-B,window.clearTimeout(I.current),l==null||l()};return z.addEventListener(Og,Z),z.addEventListener(Mg,D),()=>{z.removeEventListener(Og,Z),z.removeEventListener(Mg,D)}}},[m.viewport,C,l,u,A]),b.useEffect(()=>{s&&!m.isClosePausedRef.current&&A(C)},[s,C,m.isClosePausedRef,A]),b.useEffect(()=>(P(),()=>$()),[P,$]);const U=b.useMemo(()=>x?DE(x):null,[x]);return m.viewport?c.jsxs(c.Fragment,{children:[U&&c.jsx(QM,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:U}),c.jsx(KM,{scope:n,onClose:T,children:Di.createPortal(c.jsx(Gv.ItemSlot,{scope:n,children:c.jsx(NM,{asChild:!0,onEscapeKeyDown:ve(a,()=>{m.isFocusedToastEscapeKeyDownRef.current||T(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(Te.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":m.swipeDirection,...y,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ve(e.onKeyDown,z=>{z.key==="Escape"&&(a==null||a(z.nativeEvent),z.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,T()))}),onPointerDown:ve(e.onPointerDown,z=>{z.button===0&&(w.current={x:z.clientX,y:z.clientY})}),onPointerMove:ve(e.onPointerMove,z=>{if(!w.current)return;const D=z.clientX-w.current.x,Z=z.clientY-w.current.y,B=!!k.current,q=["left","right"].includes(m.swipeDirection),H=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,N=q?H(0,D):0,O=q?0:H(0,Z),V=z.pointerType==="touch"?10:2,S={x:N,y:O},E={originalEvent:z,delta:S};B?(k.current=S,Ku(VM,f,E,{discrete:!1})):Vb(S,m.swipeDirection,V)?(k.current=S,Ku(qM,d,E,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(D)>V||Math.abs(Z)>V)&&(w.current=null)}),onPointerUp:ve(e.onPointerUp,z=>{const D=k.current,Z=z.target;if(Z.hasPointerCapture(z.pointerId)&&Z.releasePointerCapture(z.pointerId),k.current=null,w.current=null,D){const B=z.currentTarget,q={originalEvent:z,delta:D};Vb(D,m.swipeDirection,m.swipeThreshold)?Ku(BM,h,q,{discrete:!0}):Ku(HM,p,q,{discrete:!0}),B.addEventListener("click",H=>H.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),QM=e=>{const{__scopeToast:t,children:n,...r}=e,o=kh(ou,t),[s,i]=b.useState(!1),[a,l]=b.useState(!1);return YM(()=>i(!0)),b.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:c.jsx(ru,{asChild:!0,children:c.jsx(bh,{...r,children:s&&c.jsxs(c.Fragment,{children:[o.label," ",n]})})})},GM="ToastTitle",$E=b.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(Te.div,{...r,ref:t})});$E.displayName=GM;var JM="ToastDescription",RE=b.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(Te.div,{...r,ref:t})});RE.displayName=JM;var IE="ToastAction",AE=b.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(ME,{altText:n,asChild:!0,children:c.jsx(Jv,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${IE}\`. Expected non-empty \`string\`.`),null)});AE.displayName=IE;var OE="ToastClose",Jv=b.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=WM(OE,n);return c.jsx(ME,{asChild:!0,children:c.jsx(Te.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,o.onClose)})})});Jv.displayName=OE;var ME=b.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return c.jsx(Te.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function DE(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),XM(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...DE(r))}}),t}function Ku(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?wE(o,s):o.dispatchEvent(s)}var Vb=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),s=r>o;return t==="left"||t==="right"?s&&r>n:!s&&o>n};function YM(e=()=>{}){const t=mr(e);sn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function XM(e){return e.nodeType===e.ELEMENT_NODE}function e4(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Dp(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var t4=EE,LE=jE,zE=TE,FE=$E,UE=RE,qE=AE,VE=Jv;function HE(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=HE(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function BE(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=HE(e))&&(r&&(r+=" "),r+=t);return r}const Hb=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Bb=BE,_h=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Bb(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n==null?void 0:n[u],f=s==null?void 0:s[u];if(d===null)return null;const p=Hb(d)||Hb(f);return o[u][p]}),a=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,x]=y;return Array.isArray(x)?x.includes({...s,...a}[m]):{...s,...a}[m]===x})?[...u,f,p]:u},[]);return Bb(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)};/**
49
- * @license lucide-react v0.453.0 - ISC
50
- *
51
- * This source code is licensed under the ISC license.
52
- * See the LICENSE file in the root directory of this source tree.
53
- */const n4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),KE=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
54
- * @license lucide-react v0.453.0 - ISC
55
- *
56
- * This source code is licensed under the ISC license.
57
- * See the LICENSE file in the root directory of this source tree.
58
- */var r4={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"};/**
59
- * @license lucide-react v0.453.0 - ISC
60
- *
61
- * This source code is licensed under the ISC license.
62
- * See the LICENSE file in the root directory of this source tree.
63
- */const o4=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},l)=>b.createElement("svg",{ref:l,...r4,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:KE("lucide",o),...a},[...i.map(([u,d])=>b.createElement(u,d)),...Array.isArray(s)?s:[s]]));/**
64
- * @license lucide-react v0.453.0 - ISC
65
- *
66
- * This source code is licensed under the ISC license.
67
- * See the LICENSE file in the root directory of this source tree.
68
- */const ze=(e,t)=>{const n=b.forwardRef(({className:r,...o},s)=>b.createElement(o4,{ref:s,iconNode:t,className:KE(`lucide-${n4(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
69
- * @license lucide-react v0.453.0 - ISC
70
- *
71
- * This source code is licensed under the ISC license.
72
- * See the LICENSE file in the root directory of this source tree.
73
- */const s4=ze("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"}]]);/**
74
- * @license lucide-react v0.453.0 - ISC
75
- *
76
- * This source code is licensed under the ISC license.
77
- * See the LICENSE file in the root directory of this source tree.
78
- */const WE=ze("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
79
- * @license lucide-react v0.453.0 - ISC
80
- *
81
- * This source code is licensed under the ISC license.
82
- * See the LICENSE file in the root directory of this source tree.
83
- */const ZE=ze("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"}]]);/**
84
- * @license lucide-react v0.453.0 - ISC
85
- *
86
- * This source code is licensed under the ISC license.
87
- * See the LICENSE file in the root directory of this source tree.
88
- */const Yv=ze("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"}]]);/**
89
- * @license lucide-react v0.453.0 - ISC
90
- *
91
- * This source code is licensed under the ISC license.
92
- * See the LICENSE file in the root directory of this source tree.
93
- */const i4=ze("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"}]]);/**
94
- * @license lucide-react v0.453.0 - ISC
95
- *
96
- * This source code is licensed under the ISC license.
97
- * See the LICENSE file in the root directory of this source tree.
98
- */const Lp=ze("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"}]]);/**
99
- * @license lucide-react v0.453.0 - ISC
100
- *
101
- * This source code is licensed under the ISC license.
102
- * See the LICENSE file in the root directory of this source tree.
103
- */const QE=ze("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
104
- * @license lucide-react v0.453.0 - ISC
105
- *
106
- * This source code is licensed under the ISC license.
107
- * See the LICENSE file in the root directory of this source tree.
108
- */const Sh=ze("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
109
- * @license lucide-react v0.453.0 - ISC
110
- *
111
- * This source code is licensed under the ISC license.
112
- * See the LICENSE file in the root directory of this source tree.
113
- */const GE=ze("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
114
- * @license lucide-react v0.453.0 - ISC
115
- *
116
- * This source code is licensed under the ISC license.
117
- * See the LICENSE file in the root directory of this source tree.
118
- */const JE=ze("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
119
- * @license lucide-react v0.453.0 - ISC
120
- *
121
- * This source code is licensed under the ISC license.
122
- * See the LICENSE file in the root directory of this source tree.
123
- */const a4=ze("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
124
- * @license lucide-react v0.453.0 - ISC
125
- *
126
- * This source code is licensed under the ISC license.
127
- * See the LICENSE file in the root directory of this source tree.
128
- */const YE=ze("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"}]]);/**
129
- * @license lucide-react v0.453.0 - ISC
130
- *
131
- * This source code is licensed under the ISC license.
132
- * See the LICENSE file in the root directory of this source tree.
133
- */const Lg=ze("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
134
- * @license lucide-react v0.453.0 - ISC
135
- *
136
- * This source code is licensed under the ISC license.
137
- * See the LICENSE file in the root directory of this source tree.
138
- */const Kb=ze("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"}]]);/**
139
- * @license lucide-react v0.453.0 - ISC
140
- *
141
- * This source code is licensed under the ISC license.
142
- * See the LICENSE file in the root directory of this source tree.
143
- */const l4=ze("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"}]]);/**
144
- * @license lucide-react v0.453.0 - ISC
145
- *
146
- * This source code is licensed under the ISC license.
147
- * See the LICENSE file in the root directory of this source tree.
148
- */const Xv=ze("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"}]]);/**
149
- * @license lucide-react v0.453.0 - ISC
150
- *
151
- * This source code is licensed under the ISC license.
152
- * See the LICENSE file in the root directory of this source tree.
153
- */const Wb=ze("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"}]]);/**
154
- * @license lucide-react v0.453.0 - ISC
155
- *
156
- * This source code is licensed under the ISC license.
157
- * See the LICENSE file in the root directory of this source tree.
158
- */const XE=ze("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"}]]);/**
159
- * @license lucide-react v0.453.0 - ISC
160
- *
161
- * This source code is licensed under the ISC license.
162
- * See the LICENSE file in the root directory of this source tree.
163
- */const Eo=ze("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"}]]);/**
164
- * @license lucide-react v0.453.0 - ISC
165
- *
166
- * This source code is licensed under the ISC license.
167
- * See the LICENSE file in the root directory of this source tree.
168
- */const c4=ze("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
169
- * @license lucide-react v0.453.0 - ISC
170
- *
171
- * This source code is licensed under the ISC license.
172
- * See the LICENSE file in the root directory of this source tree.
173
- */const u4=ze("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"}]]);/**
174
- * @license lucide-react v0.453.0 - ISC
175
- *
176
- * This source code is licensed under the ISC license.
177
- * See the LICENSE file in the root directory of this source tree.
178
- */const zg=ze("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"}]]);/**
179
- * @license lucide-react v0.453.0 - ISC
180
- *
181
- * This source code is licensed under the ISC license.
182
- * See the LICENSE file in the root directory of this source tree.
183
- */const Wu=ze("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"}]]);/**
184
- * @license lucide-react v0.453.0 - ISC
185
- *
186
- * This source code is licensed under the ISC license.
187
- * See the LICENSE file in the root directory of this source tree.
188
- */const kf=ze("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"}]]);/**
189
- * @license lucide-react v0.453.0 - ISC
190
- *
191
- * This source code is licensed under the ISC license.
192
- * See the LICENSE file in the root directory of this source tree.
193
- */const d4=ze("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"}]]);/**
194
- * @license lucide-react v0.453.0 - ISC
195
- *
196
- * This source code is licensed under the ISC license.
197
- * See the LICENSE file in the root directory of this source tree.
198
- */const Zb=ze("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
199
- * @license lucide-react v0.453.0 - ISC
200
- *
201
- * This source code is licensed under the ISC license.
202
- * See the LICENSE file in the root directory of this source tree.
203
- */const f4=ze("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
204
- * @license lucide-react v0.453.0 - ISC
205
- *
206
- * This source code is licensed under the ISC license.
207
- * See the LICENSE file in the root directory of this source tree.
208
- */const ai=ze("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
209
- * @license lucide-react v0.453.0 - ISC
210
- *
211
- * This source code is licensed under the ISC license.
212
- * See the LICENSE file in the root directory of this source tree.
213
- */const h4=ze("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"}]]);/**
214
- * @license lucide-react v0.453.0 - ISC
215
- *
216
- * This source code is licensed under the ISC license.
217
- * See the LICENSE file in the root directory of this source tree.
218
- */const eN=ze("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
219
- * @license lucide-react v0.453.0 - ISC
220
- *
221
- * This source code is licensed under the ISC license.
222
- * See the LICENSE file in the root directory of this source tree.
223
- */const _f=ze("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"}]]);/**
224
- * @license lucide-react v0.453.0 - ISC
225
- *
226
- * This source code is licensed under the ISC license.
227
- * See the LICENSE file in the root directory of this source tree.
228
- */const p4=ze("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
229
- * @license lucide-react v0.453.0 - ISC
230
- *
231
- * This source code is licensed under the ISC license.
232
- * See the LICENSE file in the root directory of this source tree.
233
- */const su=ze("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"}]]);/**
234
- * @license lucide-react v0.453.0 - ISC
235
- *
236
- * This source code is licensed under the ISC license.
237
- * See the LICENSE file in the root directory of this source tree.
238
- */const Pr=ze("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"}]]);/**
239
- * @license lucide-react v0.453.0 - ISC
240
- *
241
- * This source code is licensed under the ISC license.
242
- * See the LICENSE file in the root directory of this source tree.
243
- */const m4=ze("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"}]]);/**
244
- * @license lucide-react v0.453.0 - ISC
245
- *
246
- * This source code is licensed under the ISC license.
247
- * See the LICENSE file in the root directory of this source tree.
248
- */const g4=ze("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"}]]);/**
249
- * @license lucide-react v0.453.0 - ISC
250
- *
251
- * This source code is licensed under the ISC license.
252
- * See the LICENSE file in the root directory of this source tree.
253
- */const e0=ze("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"}]]);/**
254
- * @license lucide-react v0.453.0 - ISC
255
- *
256
- * This source code is licensed under the ISC license.
257
- * See the LICENSE file in the root directory of this source tree.
258
- */const Sf=ze("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),t0="-",y4=e=>{const t=x4(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(t0);return a[0]===""&&a.length!==1&&a.shift(),tN(a,t)||v4(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},tN=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?tN(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(t0);return(i=t.validators.find(({validator:a})=>a(s)))==null?void 0:i.classGroupId},Qb=/^\[(.+)\]$/,v4=e=>{if(Qb.test(e)){const t=Qb.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},x4=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return b4(Object.entries(e.classGroups),n).forEach(([s,i])=>{Fg(i,r,s,t)}),r},Fg=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Gb(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(w4(o)){Fg(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Fg(i,Gb(t,s),n,r)})})},Gb=(e,t)=>{let n=e;return t.split(t0).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},w4=e=>e.isThemeGetter,b4=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([i,a])=>[t+i,a])):s);return[n,o]}):e,k4=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},nN="!",_4=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,i=a=>{const l=[];let u=0,d=0,f;for(let x=0;x<a.length;x++){let g=a[x];if(u===0){if(g===o&&(r||a.slice(x,x+s)===t)){l.push(a.slice(d,x)),d=x+s;continue}if(g==="/"){f=x;continue}}g==="["?u++:g==="]"&&u--}const p=l.length===0?a:a.substring(d),h=p.startsWith(nN),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?a=>n({className:a,parseClassName:i}):i},S4=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},C4=e=>({cache:k4(e.cacheSize),parseClassName:_4(e),...y4(e)}),E4=/\s+/,N4=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],i=e.trim().split(E4);let a="";for(let l=i.length-1;l>=0;l-=1){const u=i[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){a=u+(a.length>0?" "+a:a);continue}if(m=r(p),!m){a=u+(a.length>0?" "+a:a);continue}y=!1}const x=S4(d).join(":"),g=f?x+nN:x,v=g+m;if(s.includes(v))continue;s.push(v);const w=o(m,y);for(let k=0;k<w.length;++k){const C=w[k];s.push(g+C)}a=u+(a.length>0?" "+a:a)}return a};function j4(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=rN(t))&&(r&&(r+=" "),r+=n);return r}const rN=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=rN(e[r]))&&(n&&(n+=" "),n+=t);return n};function P4(e,...t){let n,r,o,s=i;function i(l){const u=t.reduce((d,f)=>f(d),e());return n=C4(u),r=n.cache.get,o=n.cache.set,s=a,a(l)}function a(l){const u=r(l);if(u)return u;const d=N4(l,n);return o(l,d),d}return function(){return s(j4.apply(null,arguments))}}const lt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},oN=/^\[(?:([a-z-]+):)?(.+)\]$/i,T4=/^\d+\/\d+$/,$4=new Set(["px","full","screen"]),R4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I4=/\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$/,A4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,O4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,M4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mo=e=>Sa(e)||$4.has(e)||T4.test(e),Bo=e=>pl(e,"length",H4),Sa=e=>!!e&&!Number.isNaN(Number(e)),zp=e=>pl(e,"number",Sa),Il=e=>!!e&&Number.isInteger(Number(e)),D4=e=>e.endsWith("%")&&Sa(e.slice(0,-1)),Ie=e=>oN.test(e),Ko=e=>R4.test(e),L4=new Set(["length","size","percentage"]),z4=e=>pl(e,L4,sN),F4=e=>pl(e,"position",sN),U4=new Set(["image","url"]),q4=e=>pl(e,U4,K4),V4=e=>pl(e,"",B4),Al=()=>!0,pl=(e,t,n)=>{const r=oN.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},H4=e=>I4.test(e)&&!A4.test(e),sN=()=>!1,B4=e=>O4.test(e),K4=e=>M4.test(e),W4=()=>{const e=lt("colors"),t=lt("spacing"),n=lt("blur"),r=lt("brightness"),o=lt("borderColor"),s=lt("borderRadius"),i=lt("borderSpacing"),a=lt("borderWidth"),l=lt("contrast"),u=lt("grayscale"),d=lt("hueRotate"),f=lt("invert"),p=lt("gap"),h=lt("gradientColorStops"),y=lt("gradientColorStopPositions"),m=lt("inset"),x=lt("margin"),g=lt("opacity"),v=lt("padding"),w=lt("saturate"),k=lt("scale"),C=lt("sepia"),j=lt("skew"),_=lt("space"),I=lt("translate"),P=()=>["auto","contain","none"],$=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",Ie,t],A=()=>[Ie,t],U=()=>["",mo,Bo],z=()=>["auto",Sa,Ie],D=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Z=()=>["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"],q=()=>["start","end","center","between","around","evenly","stretch"],H=()=>["","0",Ie],N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],O=()=>[Sa,Ie];return{cacheSize:500,separator:":",theme:{colors:[Al],spacing:[mo,Bo],blur:["none","",Ko,Ie],brightness:O(),borderColor:[e],borderRadius:["none","","full",Ko,Ie],borderSpacing:A(),borderWidth:U(),contrast:O(),grayscale:H(),hueRotate:O(),invert:H(),gap:A(),gradientColorStops:[e],gradientColorStopPositions:[D4,Bo],inset:T(),margin:T(),opacity:O(),padding:A(),saturate:O(),scale:O(),sepia:H(),skew:O(),space:A(),translate:A()},classGroups:{aspect:[{aspect:["auto","square","video",Ie]}],container:["container"],columns:[{columns:[Ko]}],"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:[...D(),Ie]}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],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",Il,Ie]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ie]}],grow:[{grow:H()}],shrink:[{shrink:H()}],order:[{order:["first","last","none",Il,Ie]}],"grid-cols":[{"grid-cols":[Al]}],"col-start-end":[{col:["auto",{span:["full",Il,Ie]},Ie]}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":[Al]}],"row-start-end":[{row:["auto",{span:[Il,Ie]},Ie]}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ie]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ie]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...q(),"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:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ie,t]}],"min-w":[{"min-w":[Ie,t,"min","max","fit"]}],"max-w":[{"max-w":[Ie,t,"none","full","min","max","fit","prose",{screen:[Ko]},Ko]}],h:[{h:[Ie,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ie,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ie,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ie,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ko,Bo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",zp]}],"font-family":[{font:[Al]}],"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",Ie]}],"line-clamp":[{"line-clamp":["none",Sa,zp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",mo,Ie]}],"list-image":[{"list-image":["none",Ie]}],"list-style-type":[{list:["none","disc","decimal",Ie]}],"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:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",mo,Bo]}],"underline-offset":[{"underline-offset":["auto",mo,Ie]}],"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:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ie]}],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",Ie]}],"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:[...D(),F4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",z4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},q4]}],"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:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...Z(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:Z()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...Z()]}],"outline-offset":[{"outline-offset":[mo,Ie]}],"outline-w":[{outline:[mo,Bo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[mo,Bo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ko,V4]}],"shadow-color":[{shadow:[Al]}],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",Ko,Ie]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"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":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ie]}],duration:[{duration:O()}],ease:[{ease:["linear","in","out","in-out",Ie]}],delay:[{delay:O()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ie]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Il,Ie]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[j]}],"skew-y":[{"skew-y":[j]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ie]}],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",Ie]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",Ie]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[mo,Bo,zp]}],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"]}}},Z4=P4(W4);function Ne(...e){return Z4(BE(e))}const Q4=t4,iN=b.forwardRef(({className:e,...t},n)=>c.jsx(LE,{ref:n,className:Ne("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}));iN.displayName=LE.displayName;const G4=_h("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"}}),aN=b.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(zE,{ref:r,className:Ne(G4({variant:t}),e),...n}));aN.displayName=zE.displayName;const J4=b.forwardRef(({className:e,...t},n)=>c.jsx(qE,{ref:n,className:Ne("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}));J4.displayName=qE.displayName;const lN=b.forwardRef(({className:e,...t},n)=>c.jsx(VE,{ref:n,className:Ne("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(Sf,{className:"h-4 w-4"})}));lN.displayName=VE.displayName;const cN=b.forwardRef(({className:e,...t},n)=>c.jsx(FE,{ref:n,className:Ne("text-sm font-semibold",e),...t}));cN.displayName=FE.displayName;const uN=b.forwardRef(({className:e,...t},n)=>c.jsx(UE,{ref:n,className:Ne("text-sm opacity-90",e),...t}));uN.displayName=UE.displayName;function Y4(){const{toasts:e}=Ht();return c.jsxs(Q4,{children:[e.map(function({id:t,title:n,description:r,action:o,...s}){return c.jsxs(aN,{...s,children:[c.jsxs("div",{className:"grid gap-1",children:[n&&c.jsx(cN,{children:n}),r&&c.jsx(uN,{children:r})]}),o,c.jsx(lN,{})]},t)}),c.jsx(iN,{})]})}var X4=Jy[" useId ".trim().toString()]||(()=>{}),eD=0;function jo(e){const[t,n]=b.useState(X4());return sn(()=>{n(r=>r??String(eD++))},[e]),t?`radix-${t}`:""}const tD=["top","right","bottom","left"],Rs=Math.min,Bn=Math.max,Cf=Math.round,Zu=Math.floor,io=e=>({x:e,y:e}),nD={left:"right",right:"left",bottom:"top",top:"bottom"},rD={start:"end",end:"start"};function Ug(e,t,n){return Bn(e,Rs(t,n))}function Mo(e,t){return typeof e=="function"?e(t):e}function Do(e){return e.split("-")[0]}function ml(e){return e.split("-")[1]}function n0(e){return e==="x"?"y":"x"}function r0(e){return e==="y"?"height":"width"}const oD=new Set(["top","bottom"]);function to(e){return oD.has(Do(e))?"y":"x"}function o0(e){return n0(to(e))}function sD(e,t,n){n===void 0&&(n=!1);const r=ml(e),o=o0(e),s=r0(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Ef(i)),[i,Ef(i)]}function iD(e){const t=Ef(e);return[qg(e),t,qg(t)]}function qg(e){return e.replace(/start|end/g,t=>rD[t])}const Jb=["left","right"],Yb=["right","left"],aD=["top","bottom"],lD=["bottom","top"];function cD(e,t,n){switch(e){case"top":case"bottom":return n?t?Yb:Jb:t?Jb:Yb;case"left":case"right":return t?aD:lD;default:return[]}}function uD(e,t,n,r){const o=ml(e);let s=cD(Do(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(qg)))),s}function Ef(e){return e.replace(/left|right|bottom|top/g,t=>nD[t])}function dD(e){return{top:0,right:0,bottom:0,left:0,...e}}function dN(e){return typeof e!="number"?dD(e):{top:e,right:e,bottom:e,left:e}}function Nf(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Xb(e,t,n){let{reference:r,floating:o}=e;const s=to(t),i=o0(t),a=r0(i),l=Do(t),u=s==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:d,y:r.y-o.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-o.width,y:f};break;default:h={x:r.x,y:r.y}}switch(ml(t)){case"start":h[i]-=p*(n&&u?-1:1);break;case"end":h[i]+=p*(n&&u?-1:1);break}return h}const fD=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=Xb(u,r,l),p=r,h={},y=0;for(let m=0;m<a.length;m++){const{name:x,fn:g}=a[m],{x:v,y:w,data:k,reset:C}=await g({x:d,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:u,platform:i,elements:{reference:e,floating:t}});d=v??d,f=w??f,h={...h,[x]:{...h[x],...k}},C&&y<=50&&(y++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:d,y:f}=Xb(u,p,l)),m=-1)}return{x:d,y:f,placement:p,strategy:o,middlewareData:h}};async function Lc(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=Mo(t,e),y=dN(h),x=a[p?f==="floating"?"reference":"floating":f],g=Nf(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:l})),v=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),k=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},C=Nf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:w,strategy:l}):v);return{top:(g.top-C.top+y.top)/k.y,bottom:(C.bottom-g.bottom+y.bottom)/k.y,left:(g.left-C.left+y.left)/k.x,right:(C.right-g.right+y.right)/k.x}}const hD=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:u,padding:d=0}=Mo(e,t)||{};if(u==null)return{};const f=dN(d),p={x:n,y:r},h=o0(o),y=r0(h),m=await i.getDimensions(u),x=h==="y",g=x?"top":"left",v=x?"bottom":"right",w=x?"clientHeight":"clientWidth",k=s.reference[y]+s.reference[h]-p[h]-s.floating[y],C=p[h]-s.reference[h],j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let _=j?j[w]:0;(!_||!await(i.isElement==null?void 0:i.isElement(j)))&&(_=a.floating[w]||s.floating[y]);const I=k/2-C/2,P=_/2-m[y]/2-1,$=Rs(f[g],P),T=Rs(f[v],P),A=$,U=_-m[y]-T,z=_/2-m[y]/2+I,D=Ug(A,z,U),Z=!l.arrow&&ml(o)!=null&&z!==D&&s.reference[y]/2-(z<A?$:T)-m[y]/2<0,B=Z?z<A?z-A:z-U:0;return{[h]:p[h]+B,data:{[h]:D,centerOffset:z-D-B,...Z&&{alignmentOffset:B}},reset:Z}}}),pD=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...x}=Mo(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const g=Do(o),v=to(a),w=Do(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(u.floating)),C=p||(w||!m?[Ef(a)]:iD(a)),j=y!=="none";!p&&j&&C.push(...uD(a,m,y,k));const _=[a,...C],I=await Lc(t,x),P=[];let $=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&P.push(I[g]),f){const z=sD(o,i,k);P.push(I[z[0]],I[z[1]])}if($=[...$,{placement:o,overflows:P}],!P.every(z=>z<=0)){var T,A;const z=(((T=s.flip)==null?void 0:T.index)||0)+1,D=_[z];if(D&&(!(f==="alignment"?v!==to(D):!1)||$.every(q=>to(q.placement)===v?q.overflows[0]>0:!0)))return{data:{index:z,overflows:$},reset:{placement:D}};let Z=(A=$.filter(B=>B.overflows[0]<=0).sort((B,q)=>B.overflows[1]-q.overflows[1])[0])==null?void 0:A.placement;if(!Z)switch(h){case"bestFit":{var U;const B=(U=$.filter(q=>{if(j){const H=to(q.placement);return H===v||H==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(H=>H>0).reduce((H,N)=>H+N,0)]).sort((q,H)=>q[1]-H[1])[0])==null?void 0:U[0];B&&(Z=B);break}case"initialPlacement":Z=a;break}if(o!==Z)return{reset:{placement:Z}}}return{}}}};function ek(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tk(e){return tD.some(t=>e[t]>=0)}const mD=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Mo(e,t);switch(r){case"referenceHidden":{const s=await Lc(t,{...o,elementContext:"reference"}),i=ek(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:tk(i)}}}case"escaped":{const s=await Lc(t,{...o,altBoundary:!0}),i=ek(s,n.floating);return{data:{escapedOffsets:i,escaped:tk(i)}}}default:return{}}}}},fN=new Set(["left","top"]);async function gD(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Do(n),a=ml(n),l=to(n)==="y",u=fN.has(i)?-1:1,d=s&&l?-1:1,f=Mo(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 a&&typeof y=="number"&&(h=a==="end"?y*-1:y),l?{x:h*d,y:p*u}:{x:p*u,y:h*d}}const yD=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,l=await gD(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},vD=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:x=>{let{x:g,y:v}=x;return{x:g,y:v}}},...l}=Mo(e,t),u={x:n,y:r},d=await Lc(t,l),f=to(Do(o)),p=n0(f);let h=u[p],y=u[f];if(s){const x=p==="y"?"top":"left",g=p==="y"?"bottom":"right",v=h+d[x],w=h-d[g];h=Ug(v,h,w)}if(i){const x=f==="y"?"top":"left",g=f==="y"?"bottom":"right",v=y+d[x],w=y-d[g];y=Ug(v,y,w)}const m=a.fn({...t,[p]:h,[f]:y});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},xD=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=Mo(e,t),d={x:n,y:r},f=to(o),p=n0(f);let h=d[p],y=d[f];const m=Mo(a,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const w=p==="y"?"height":"width",k=s.reference[p]-s.floating[w]+x.mainAxis,C=s.reference[p]+s.reference[w]-x.mainAxis;h<k?h=k:h>C&&(h=C)}if(u){var g,v;const w=p==="y"?"width":"height",k=fN.has(Do(o)),C=s.reference[f]-s.floating[w]+(k&&((g=i.offset)==null?void 0:g[f])||0)+(k?0:x.crossAxis),j=s.reference[f]+s.reference[w]+(k?0:((v=i.offset)==null?void 0:v[f])||0)-(k?x.crossAxis:0);y<C?y=C:y>j&&(y=j)}return{[p]:h,[f]:y}}}},wD=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...u}=Mo(e,t),d=await Lc(t,u),f=Do(o),p=ml(o),h=to(o)==="y",{width:y,height:m}=s.floating;let x,g;f==="top"||f==="bottom"?(x=f,g=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(g=f,x=p==="end"?"top":"bottom");const v=m-d.top-d.bottom,w=y-d.left-d.right,k=Rs(m-d[x],v),C=Rs(y-d[g],w),j=!t.middlewareData.shift;let _=k,I=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(_=v),j&&!p){const $=Bn(d.left,0),T=Bn(d.right,0),A=Bn(d.top,0),U=Bn(d.bottom,0);h?I=y-2*($!==0||T!==0?$+T:Bn(d.left,d.right)):_=m-2*(A!==0||U!==0?A+U:Bn(d.top,d.bottom))}await l({...t,availableWidth:I,availableHeight:_});const P=await i.getDimensions(a.floating);return y!==P.width||m!==P.height?{reset:{rects:!0}}:{}}}};function Ch(){return typeof window<"u"}function gl(e){return hN(e)?(e.nodeName||"").toLowerCase():"#document"}function Qn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function uo(e){var t;return(t=(hN(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function hN(e){return Ch()?e instanceof Node||e instanceof Qn(e).Node:!1}function Dr(e){return Ch()?e instanceof Element||e instanceof Qn(e).Element:!1}function ao(e){return Ch()?e instanceof HTMLElement||e instanceof Qn(e).HTMLElement:!1}function nk(e){return!Ch()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qn(e).ShadowRoot}const bD=new Set(["inline","contents"]);function iu(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Lr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!bD.has(o)}const kD=new Set(["table","td","th"]);function _D(e){return kD.has(gl(e))}const SD=[":popover-open",":modal"];function Eh(e){return SD.some(t=>{try{return e.matches(t)}catch{return!1}})}const CD=["transform","translate","scale","rotate","perspective"],ED=["transform","translate","scale","rotate","perspective","filter"],ND=["paint","layout","strict","content"];function s0(e){const t=i0(),n=Dr(e)?Lr(e):e;return CD.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)||ED.some(r=>(n.willChange||"").includes(r))||ND.some(r=>(n.contain||"").includes(r))}function jD(e){let t=Is(e);for(;ao(t)&&!Xa(t);){if(s0(t))return t;if(Eh(t))return null;t=Is(t)}return null}function i0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const PD=new Set(["html","body","#document"]);function Xa(e){return PD.has(gl(e))}function Lr(e){return Qn(e).getComputedStyle(e)}function Nh(e){return Dr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Is(e){if(gl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||nk(e)&&e.host||uo(e);return nk(t)?t.host:t}function pN(e){const t=Is(e);return Xa(t)?e.ownerDocument?e.ownerDocument.body:e.body:ao(t)&&iu(t)?t:pN(t)}function zc(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=pN(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Qn(o);if(s){const a=Vg(i);return t.concat(i,i.visualViewport||[],iu(o)?o:[],a&&n?zc(a):[])}return t.concat(o,zc(o,[],n))}function Vg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mN(e){const t=Lr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ao(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Cf(n)!==s||Cf(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function a0(e){return Dr(e)?e:e.contextElement}function Ca(e){const t=a0(e);if(!ao(t))return io(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=mN(t);let i=(s?Cf(n.width):n.width)/r,a=(s?Cf(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const TD=io(0);function gN(e){const t=Qn(e);return!i0()||!t.visualViewport?TD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $D(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Qn(e)?!1:t}function ji(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=a0(e);let i=io(1);t&&(r?Dr(r)&&(i=Ca(r)):i=Ca(e));const a=$D(s,n,r)?gN(s):io(0);let l=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,d=o.width/i.x,f=o.height/i.y;if(s){const p=Qn(s),h=r&&Dr(r)?Qn(r):r;let y=p,m=Vg(y);for(;m&&r&&h!==y;){const x=Ca(m),g=m.getBoundingClientRect(),v=Lr(m),w=g.left+(m.clientLeft+parseFloat(v.paddingLeft))*x.x,k=g.top+(m.clientTop+parseFloat(v.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,f*=x.y,l+=w,u+=k,y=Qn(m),m=Vg(y)}}return Nf({width:d,height:f,x:l,y:u})}function jh(e,t){const n=Nh(e).scrollLeft;return t?t.left+n:ji(uo(e)).left+n}function yN(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-jh(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function RD(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=uo(r),a=t?Eh(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=io(1);const d=io(0),f=ao(r);if((f||!f&&!s)&&((gl(r)!=="body"||iu(i))&&(l=Nh(r)),ao(r))){const h=ji(r);u=Ca(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const p=i&&!f&&!s?yN(i,l):io(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 ID(e){return Array.from(e.getClientRects())}function AD(e){const t=uo(e),n=Nh(e),r=e.ownerDocument.body,o=Bn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Bn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+jh(e);const a=-n.scrollTop;return Lr(r).direction==="rtl"&&(i+=Bn(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const rk=25;function OD(e,t){const n=Qn(e),r=uo(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const d=i0();(!d||d&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const u=jh(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<=rk&&(s-=y)}else u<=rk&&(s+=u);return{width:s,height:i,x:a,y:l}}const MD=new Set(["absolute","fixed"]);function DD(e,t){const n=ji(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=ao(e)?Ca(e):io(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,u=r*s.y;return{width:i,height:a,x:l,y:u}}function ok(e,t,n){let r;if(t==="viewport")r=OD(e,n);else if(t==="document")r=AD(uo(e));else if(Dr(t))r=DD(t,n);else{const o=gN(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Nf(r)}function vN(e,t){const n=Is(e);return n===t||!Dr(n)||Xa(n)?!1:Lr(n).position==="fixed"||vN(n,t)}function LD(e,t){const n=t.get(e);if(n)return n;let r=zc(e,[],!1).filter(a=>Dr(a)&&gl(a)!=="body"),o=null;const s=Lr(e).position==="fixed";let i=s?Is(e):e;for(;Dr(i)&&!Xa(i);){const a=Lr(i),l=s0(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&MD.has(o.position)||iu(i)&&!l&&vN(e,i))?r=r.filter(d=>d!==i):o=a,i=Is(i)}return t.set(e,r),r}function zD(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Eh(t)?[]:LD(t,this._c):[].concat(n),r],a=i[0],l=i.reduce((u,d)=>{const f=ok(t,d,o);return u.top=Bn(f.top,u.top),u.right=Rs(f.right,u.right),u.bottom=Rs(f.bottom,u.bottom),u.left=Bn(f.left,u.left),u},ok(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function FD(e){const{width:t,height:n}=mN(e);return{width:t,height:n}}function UD(e,t,n){const r=ao(t),o=uo(t),s=n==="fixed",i=ji(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=io(0);function u(){l.x=jh(o)}if(r||!r&&!s)if((gl(t)!=="body"||iu(o))&&(a=Nh(t)),r){const h=ji(t,!0,s,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?yN(o,a):io(0),f=i.left+a.scrollLeft-l.x-d.x,p=i.top+a.scrollTop-l.y-d.y;return{x:f,y:p,width:i.width,height:i.height}}function Fp(e){return Lr(e).position==="static"}function sk(e,t){if(!ao(e)||Lr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return uo(e)===n&&(n=n.ownerDocument.body),n}function xN(e,t){const n=Qn(e);if(Eh(e))return n;if(!ao(e)){let o=Is(e);for(;o&&!Xa(o);){if(Dr(o)&&!Fp(o))return o;o=Is(o)}return n}let r=sk(e,t);for(;r&&_D(r)&&Fp(r);)r=sk(r,t);return r&&Xa(r)&&Fp(r)&&!s0(r)?n:r||jD(e)||n}const qD=async function(e){const t=this.getOffsetParent||xN,n=this.getDimensions,r=await n(e.floating);return{reference:UD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function VD(e){return Lr(e).direction==="rtl"}const HD={convertOffsetParentRelativeRectToViewportRelativeRect:RD,getDocumentElement:uo,getClippingRect:zD,getOffsetParent:xN,getElementRects:qD,getClientRects:ID,getDimensions:FD,getScale:Ca,isElement:Dr,isRTL:VD};function wN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BD(e,t){let n=null,r;const o=uo(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const u=e.getBoundingClientRect(),{left:d,top:f,width:p,height:h}=u;if(a||t(),!p||!h)return;const y=Zu(f),m=Zu(o.clientWidth-(d+p)),x=Zu(o.clientHeight-(f+h)),g=Zu(d),w={rootMargin:-y+"px "+-m+"px "+-x+"px "+-g+"px",threshold:Bn(0,Rs(1,l))||1};let k=!0;function C(j){const _=j[0].intersectionRatio;if(_!==l){if(!k)return i();_?i(!1,_):r=setTimeout(()=>{i(!1,1e-7)},1e3)}_===1&&!wN(u,e.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return i(!0),s}function KD(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=a0(e),d=o||s?[...u?zc(u):[],...zc(t)]:[];d.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),s&&g.addEventListener("resize",n)});const f=u&&a?BD(u,n):null;let p=-1,h=null;i&&(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?ji(e):null;l&&x();function x(){const g=ji(e);m&&!wN(m,g)&&n(),m=g,y=requestAnimationFrame(x)}return n(),()=>{var g;d.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,l&&cancelAnimationFrame(y)}}const WD=yD,ZD=vD,QD=pD,GD=wD,JD=mD,ik=hD,YD=xD,XD=(e,t,n)=>{const r=new Map,o={platform:HD,...n},s={...o.platform,_c:r};return fD(e,t,{...o,platform:s})};var eL=typeof document<"u",tL=function(){},$d=eL?b.useLayoutEffect:tL;function jf(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,o;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(!jf(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!jf(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function bN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ak(e,t){const n=bN(e);return Math.round(t*n)/n}function Up(e){const t=b.useRef(e);return $d(()=>{t.current=e}),t}function nL(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[d,f]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=b.useState(r);jf(p,r)||h(r);const[y,m]=b.useState(null),[x,g]=b.useState(null),v=b.useCallback(q=>{q!==j.current&&(j.current=q,m(q))},[]),w=b.useCallback(q=>{q!==_.current&&(_.current=q,g(q))},[]),k=s||y,C=i||x,j=b.useRef(null),_=b.useRef(null),I=b.useRef(d),P=l!=null,$=Up(l),T=Up(o),A=Up(u),U=b.useCallback(()=>{if(!j.current||!_.current)return;const q={placement:t,strategy:n,middleware:p};T.current&&(q.platform=T.current),XD(j.current,_.current,q).then(H=>{const N={...H,isPositioned:A.current!==!1};z.current&&!jf(I.current,N)&&(I.current=N,Di.flushSync(()=>{f(N)}))})},[p,t,n,T,A]);$d(()=>{u===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,f(q=>({...q,isPositioned:!1})))},[u]);const z=b.useRef(!1);$d(()=>(z.current=!0,()=>{z.current=!1}),[]),$d(()=>{if(k&&(j.current=k),C&&(_.current=C),k&&C){if($.current)return $.current(k,C,U);U()}},[k,C,U,$,P]);const D=b.useMemo(()=>({reference:j,floating:_,setReference:v,setFloating:w}),[v,w]),Z=b.useMemo(()=>({reference:k,floating:C}),[k,C]),B=b.useMemo(()=>{const q={position:n,left:0,top:0};if(!Z.floating)return q;const H=ak(Z.floating,d.x),N=ak(Z.floating,d.y);return a?{...q,transform:"translate("+H+"px, "+N+"px)",...bN(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:N}},[n,a,Z.floating,d.x,d.y]);return b.useMemo(()=>({...d,update:U,refs:D,elements:Z,floatingStyles:B}),[d,U,D,Z,B])}const rL=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?ik({element:r.current,padding:o}).fn(n):{}:r?ik({element:r,padding:o}).fn(n):{}}}},oL=(e,t)=>({...WD(e),options:[e,t]}),sL=(e,t)=>({...ZD(e),options:[e,t]}),iL=(e,t)=>({...YD(e),options:[e,t]}),aL=(e,t)=>({...QD(e),options:[e,t]}),lL=(e,t)=>({...GD(e),options:[e,t]}),cL=(e,t)=>({...JD(e),options:[e,t]}),uL=(e,t)=>({...rL(e),options:[e,t]});var dL="Arrow",kN=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return c.jsx(Te.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});kN.displayName=dL;var fL=kN;function _N(e){const[t,n]=b.useState(void 0);return sn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var l0="Popper",[SN,yl]=lo(l0),[hL,CN]=SN(l0),EN=e=>{const{__scopePopper:t,children:n}=e,[r,o]=b.useState(null);return c.jsx(hL,{scope:t,anchor:r,onAnchorChange:o,children:n})};EN.displayName=l0;var NN="PopperAnchor",jN=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=CN(NN,n),i=b.useRef(null),a=Ye(t,i),l=b.useRef(null);return b.useEffect(()=>{const u=l.current;l.current=(r==null?void 0:r.current)||i.current,u!==l.current&&s.onAnchorChange(l.current)}),r?null:c.jsx(Te.div,{...o,ref:a})});jN.displayName=NN;var c0="PopperContent",[pL,mL]=SN(c0),PN=b.forwardRef((e,t)=>{var K,G,le,se,he,ke;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:y,...m}=e,x=CN(c0,n),[g,v]=b.useState(null),w=Ye(t,tt=>v(tt)),[k,C]=b.useState(null),j=_N(k),_=(j==null?void 0:j.width)??0,I=(j==null?void 0:j.height)??0,P=r+(s!=="center"?"-"+s:""),$=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],A=T.length>0,U={padding:$,boundary:T.filter(yL),altBoundary:A},{refs:z,floatingStyles:D,placement:Z,isPositioned:B,middlewareData:q}=nL({strategy:"fixed",placement:P,whileElementsMounted:(...tt)=>KD(...tt,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[oL({mainAxis:o+I,alignmentAxis:i}),l&&sL({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?iL():void 0,...U}),l&&aL({...U}),lL({...U,apply:({elements:tt,rects:yt,availableWidth:ee,availableHeight:pe})=>{const{width:re,height:Fe}=yt.reference,ae=tt.floating.style;ae.setProperty("--radix-popper-available-width",`${ee}px`),ae.setProperty("--radix-popper-available-height",`${pe}px`),ae.setProperty("--radix-popper-anchor-width",`${re}px`),ae.setProperty("--radix-popper-anchor-height",`${Fe}px`)}}),k&&uL({element:k,padding:a}),vL({arrowWidth:_,arrowHeight:I}),p&&cL({strategy:"referenceHidden",...U})]}),[H,N]=RN(Z),O=mr(y);sn(()=>{B&&(O==null||O())},[B,O]);const V=(K=q.arrow)==null?void 0:K.x,S=(G=q.arrow)==null?void 0:G.y,E=((le=q.arrow)==null?void 0:le.centerOffset)!==0,[R,M]=b.useState();return sn(()=>{g&&M(window.getComputedStyle(g).zIndex)},[g]),c.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:B?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(se=q.transformOrigin)==null?void 0:se.x,(he=q.transformOrigin)==null?void 0:he.y].join(" "),...((ke=q.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(pL,{scope:n,placedSide:H,onArrowChange:C,arrowX:V,arrowY:S,shouldHideArrow:E,children:c.jsx(Te.div,{"data-side":H,"data-align":N,...m,ref:w,style:{...m.style,animation:B?void 0:"none"}})})})});PN.displayName=c0;var TN="PopperArrow",gL={top:"bottom",right:"left",bottom:"top",left:"right"},$N=b.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=mL(TN,r),i=gL[s.placedSide];return c.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:c.jsx(fL,{...o,ref:n,style:{...o.style,display:"block"}})})});$N.displayName=TN;function yL(e){return e!==null}var vL=e=>({name:"transformOrigin",options:e,fn(t){var x,g,v;const{placement:n,rects:r,middlewareData:o}=t,i=((x=o.arrow)==null?void 0:x.centerOffset)!==0,a=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[u,d]=RN(n),f={start:"0%",center:"50%",end:"100%"}[d],p=(((g=o.arrow)==null?void 0:g.x)??0)+a/2,h=(((v=o.arrow)==null?void 0:v.y)??0)+l/2;let y="",m="";return u==="bottom"?(y=i?f:`${p}px`,m=`${-l}px`):u==="top"?(y=i?f:`${p}px`,m=`${r.floating.height+l}px`):u==="right"?(y=`${-l}px`,m=i?f:`${h}px`):u==="left"&&(y=`${r.floating.width+l}px`,m=i?f:`${h}px`),{data:{x:y,y:m}}}});function RN(e){const[t,n="center"]=e.split("-");return[t,n]}var IN=EN,Ph=jN,u0=PN,d0=$N,[Th,gte]=lo("Tooltip",[yl]),f0=yl(),AN="TooltipProvider",xL=700,lk="tooltip.open",[wL,ON]=Th(AN),MN=e=>{const{__scopeTooltip:t,delayDuration:n=xL,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=b.useRef(!0),a=b.useRef(!1),l=b.useRef(0);return b.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),c.jsx(wL,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(l.current),i.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:b.useCallback(u=>{a.current=u},[]),disableHoverableContent:o,children:s})};MN.displayName=AN;var DN="Tooltip",[yte,$h]=Th(DN),Hg="TooltipTrigger",bL=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=$h(Hg,n),s=ON(Hg,n),i=f0(n),a=b.useRef(null),l=Ye(t,a,o.onTriggerChange),u=b.useRef(!1),d=b.useRef(!1),f=b.useCallback(()=>u.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),c.jsx(Ph,{asChild:!0,...i,children:c.jsx(Te.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:ve(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:ve(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:ve(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ve(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:ve(e.onBlur,o.onClose),onClick:ve(e.onClick,o.onClose)})})});bL.displayName=Hg;var kL="TooltipPortal",[vte,_L]=Th(kL,{forceMount:void 0}),el="TooltipContent",LN=b.forwardRef((e,t)=>{const n=_L(el,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=$h(el,e.__scopeTooltip);return c.jsx(co,{present:r||i.open,children:i.disableHoverableContent?c.jsx(zN,{side:o,...s,ref:t}):c.jsx(SL,{side:o,...s,ref:t})})}),SL=b.forwardRef((e,t)=>{const n=$h(el,e.__scopeTooltip),r=ON(el,e.__scopeTooltip),o=b.useRef(null),s=Ye(t,o),[i,a]=b.useState(null),{trigger:l,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,p=b.useCallback(()=>{a(null),f(!1)},[f]),h=b.useCallback((y,m)=>{const x=y.currentTarget,g={x:y.clientX,y:y.clientY},v=PL(g,x.getBoundingClientRect()),w=TL(g,v),k=$L(m.getBoundingClientRect()),C=IL([...w,...k]);a(C),f(!0)},[f]);return b.useEffect(()=>()=>p(),[p]),b.useEffect(()=>{if(l&&d){const y=x=>h(x,d),m=x=>h(x,l);return l.addEventListener("pointerleave",y),d.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",m)}}},[l,d,h,p]),b.useEffect(()=>{if(i){const y=m=>{const x=m.target,g={x:m.clientX,y:m.clientY},v=(l==null?void 0:l.contains(x))||(d==null?void 0:d.contains(x)),w=!RL(g,i);v?p():w&&(p(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[l,d,i,u,p]),c.jsx(zN,{...e,ref:s})}),[CL,EL]=Th(DN,{isInside:!1}),NL=mM("TooltipContent"),zN=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,l=$h(el,n),u=f0(n),{onClose:d}=l;return b.useEffect(()=>(document.addEventListener(lk,d),()=>document.removeEventListener(lk,d)),[d]),b.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(hl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:c.jsxs(u0,{"data-state":l.stateAttribute,...u,...a,ref:t,style:{...a.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(NL,{children:r}),c.jsx(CL,{scope:n,isInside:!0,children:c.jsx(DM,{id:l.contentId,role:"tooltip",children:o||r})})]})})});LN.displayName=el;var FN="TooltipArrow",jL=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=f0(n);return EL(FN,n).isInside?null:c.jsx(d0,{...o,...r,ref:t})});jL.displayName=FN;function PL(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function TL(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 $L(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function RL(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],l=t[i],u=a.x,d=a.y,f=l.x,p=l.y;d>r!=p>r&&n<(f-u)*(r-d)/(p-d)+u&&(o=!o)}return o}function IL(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),AL(t)}function AL(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}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 OL=MN,UN=LN;const ML=OL,DL=b.forwardRef(({className:e,sideOffset:t=4,...n},r)=>c.jsx(UN,{ref:r,sideOffset:t,className:Ne("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}));DL.displayName=UN.displayName;const LL={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 zL(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))}:LL}const wn="#92E4DD",In="#F9386D",Sr="#FFFFFF",Jr="bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900";function Hr(e){return wn}function Yr(e){return{borderColor:e,color:e,boxShadow:`0 0 20px ${e}20`}}const FL=_h("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"}}),ne=b.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const i=r?hM:"button";return c.jsx(i,{className:Ne(FL({variant:t,size:n,className:e})),ref:s,...o})});ne.displayName="Button";function Ea({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(Pr,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"max-w-[72px] truncate",children:t.message})]})}const ck="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 UL(e){return e.iconUrl?e.iconUrl:null}function qN({service:e}){const t=Hr(),n=UL(e),[r,o]=b.useState(!1);return n&&!r?c.jsx("img",{src:n,alt:"",className:"w-7 h-7 object-contain rounded-sm",draggable:!1,onError:()=>o(!0)}):c.jsx("div",{style:{width:28,height:28,backgroundColor:t,WebkitMask:`url(${ck}) no-repeat center / contain`,mask:`url(${ck}) no-repeat center / contain`},"aria-hidden":!0})}function h0(e){return e?"ring-2 ring-inset ring-yellow-400/90 shadow-[0_0_10px_rgba(250,204,21,0.2)]":""}function p0(){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 qL({service:e,onDragStart:t,onDragEnd:n,isInActiveDeck:r,onCardClick:o,isInCollection:s=!1,onMouseEnter:i,onMouseLeave:a,activeDeck:l,warnings:u}){const d=Zt(),{toast:f}=Ht(),p=Hr(),h=dt({mutationFn:async()=>{if(!l)throw new Error("No active deck found");return _e("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=dt({mutationFn:async()=>_e("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()},x=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:()=>o==null?void 0:o(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:c.jsxs("div",{className:`
259
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
260
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
261
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
262
- relative overflow-hidden
263
- ${h0(r)}
264
- ${s?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
265
- `,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[c.jsx(Ea,{warnings:u}),r&&c.jsx(p0,{}),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(ne,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:x,title:`Delete ${e.name}`,children:c.jsx(su,{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(qN,{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(ne,{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 VL=b.memo(qL);function HL(e){return e.iconUrl?e.iconUrl:null}function VN({credential:e,color:t}){const n=HL(e);return n?c.jsx("img",{src:n,alt:"",className:"h-7 w-7 object-contain rounded-sm",draggable:!1}):c.jsx(zg,{className:"h-7 w-7",strokeWidth:2.25,style:{color:t}})}function BL({credential:e,isInActiveDeck:t,activeDeck:n,isInCollection:r=!0,onDragStart:o,onDragEnd:s,onMouseEnter:i,onMouseLeave:a,onCardClick:l,warnings:u}){const d=Zt(),{toast:f}=Ht(),p=In,h=dt({mutationFn:async()=>{if(!n)throw new Error("No active deck found");return _e("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=dt({mutationFn:async()=>_e("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&&!!o,onDragStart:o?m=>o(m,e):void 0,onDragEnd:s,onClick:()=>l==null?void 0:l(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:c.jsxs("div",{className:`
266
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
267
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
268
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
269
- relative overflow-hidden
270
- ${h0(t)}
271
- ${r?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
272
- `,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[c.jsx(Ea,{warnings:u}),t&&c.jsx(p0,{}),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(ne,{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(su,{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(VN,{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(ne,{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 KL=b.memo(BL);function WL({playbook:e,isInActiveDeck:t,activeDeck:n,isInCollection:r=!0,onDragStart:o,onDragEnd:s,onMouseEnter:i,onMouseLeave:a,onCardClick:l,warnings:u}){const d=Zt(),{toast:f}=Ht(),p=Sr,h=e.dependsOnCredentialIds.length+e.dependsOnServiceIds.length,y=dt({mutationFn:async()=>{if(!n)throw new Error("No deck selected");return _e("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:x=>{f({title:"Failed to add playbook",description:x.message,variant:"destructive"})}}),m=dt({mutationFn:async()=>_e("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:x=>{f({title:"Failed to delete playbook",description:x.message,variant:"destructive"})}});return c.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!o,onDragStart:o?x=>o(x,e):void 0,onDragEnd:s,onClick:()=>l==null?void 0:l(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,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
- ${h0(t)}
278
- ${r?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
279
- `,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[c.jsx(Ea,{warnings:u}),t&&c.jsx(p0,{}),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(ne,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:x=>{x.stopPropagation(),window.confirm(`Delete playbook "${e.title}"?`)&&m.mutate()},title:`Delete ${e.title}`,children:c.jsx(su,{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(Yv,{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(ne,{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:x=>{x.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 ZL=b.memo(WL),Fc=128,HN=192,tl=48,QL=10,Pf=12,Qu=64,Gu=4,uk=14,BN=12,KN=1.08;function GL(e=BN,t=KN){const n=e*Math.PI/180,r=Fc*Math.sin(n)+HN*Math.cos(n);return Math.ceil(r*t)+8}const Bg=GL();function WN(e,t=tl){return e===0?0:Fc+Math.max(0,e-1)*(Fc-t)}function JL(e=QL,t=tl,n=Pf){return WN(e,t)+2*n}function YL(e,t=tl){return WN(e,t)+2*Pf}const XL=JL();function ez(e,t,n,r=BN){const o=t+n/2,s=n/2;if(s<=0)return 0;const i=(e-o)/s;return Math.max(-r,Math.min(r,i*r))}function tz(e){return{flexShrink:0,marginLeft:e===0?0:`-${tl}px`}}function nz(e,t,n){return n===e?999999:t-e}function rz({cardCount:e,children:t}){const n=b.useRef(null),r=b.useRef([]),o=b.useRef(0),s=b.useRef(void 0),[i,a]=b.useState(!1),[l,u]=b.useState(!1),[d,f]=b.useState(!1),[p,h]=b.useState(!1),[y,m]=b.useState(!1),x=b.useRef(!1),g=b.useRef(!1),[v,w]=b.useState(null),k=b.useRef(null);k.current=v;const C=b.useCallback(()=>{const T=n.current;if(!T)return;const A=T.getBoundingClientRect(),U=k.current;r.current.forEach((z,D)=>{if(!z)return;const Z=z.getBoundingClientRect(),B=Z.left+Z.width/2,q=U===D?0:ez(B,A.left,A.width),H=U===D?KN:1;z.style.transform=`rotate(${q}deg) scale(${H})`,z.style.transformOrigin="center center",z.style.zIndex=String(nz(D,e,U))})},[e]),j=b.useCallback(T=>{const A=n.current;if(!A)return;const U=Fc-tl;A.scrollBy({left:T==="left"?-U:U,behavior:"smooth"})},[]),_=b.useCallback(()=>{const T=n.current;if(!T)return;const U=YL(e,tl)>T.clientWidth+2;a(U),u(U&&T.scrollLeft>4),f(U&&T.scrollLeft+T.clientWidth<T.scrollWidth-4),C()},[e,C]);b.useLayoutEffect(()=>{const T=n.current;if(!T)return;_();const A=new ResizeObserver(_);return A.observe(T),T.addEventListener("scroll",_,{passive:!0}),()=>{A.disconnect(),T.removeEventListener("scroll",_)}},[e,_]),b.useEffect(()=>{const T=()=>{const A=n.current,U=o.current;if(A&&U!==0){A.scrollLeft+=U,C();const Z=A.scrollLeft>4,B=A.scrollLeft+A.clientWidth<A.scrollWidth-4;u(Z),f(B)}const z=U<0,D=U>0;z!==x.current&&(x.current=z,h(z)),D!==g.current&&(g.current=D,m(D)),s.current=requestAnimationFrame(T)};return s.current=requestAnimationFrame(T),()=>{s.current!==void 0&&cancelAnimationFrame(s.current)}},[C]);const I=T=>{const A=n.current;if(!A||!i){o.current=0;return}const U=A.getBoundingClientRect(),z=T.clientX-U.left;if(z<Qu&&l){const D=1-z/Qu;o.current=-(Gu+D*(uk-Gu))}else if(z>U.width-Qu&&d){const D=1-(U.width-z)/Qu;o.current=Gu+D*(uk-Gu)}else o.current=0;C()},P=()=>{o.current=0,x.current=!1,g.current=!1,h(!1),m(!1)};if(b.useLayoutEffect(()=>{r.current.length=e,C()},[e,v,C]),e===0)return c.jsx(c.Fragment,{children:t});const $=(T,A)=>`absolute ${T==="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 ${A?"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:I,onMouseLeave:P,children:[i&&l&&c.jsx("button",{type:"button",className:$("left",p),"aria-label":"Scroll deck left","data-testid":"deck-scroll-left",onClick:()=>j("left"),children:c.jsx(GE,{className:"h-6 w-6",strokeWidth:2.5})}),i&&d&&c.jsx("button",{type:"button",className:$("right",y),"aria-label":"Scroll deck right","data-testid":"deck-scroll-right",onClick:()=>j("right"),children:c.jsx(JE,{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:XL,maxWidth:"100%"},children:c.jsx("div",{className:"flex items-center justify-start isolate group/fan",style:{minHeight:Bg,paddingLeft:Pf,paddingRight:Pf},children:b.Children.map(t,(T,A)=>c.jsx("div",{ref:U=>{r.current[A]=U},className:"relative flex items-center justify-center transition-[transform,box-shadow] duration-500 will-change-transform",style:{...tz(A),minHeight:Bg},onMouseEnter:()=>w(A),onMouseLeave:()=>w(null),children:T},T&&typeof T=="object"&&"key"in T?T.key:A))})})]})}const Xe=b.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:Ne("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}));Xe.displayName="Input";function oz({deck:e,services:t,credentials:n=[],playbooks:r=[],collectionWarnings:o,onDrop:s,onDragStart:i,onCredentialDragStart:a,onPlaybookDragStart:l,onDragEnd:u,onCardClick:d,onPlaybookClick:f,onCredentialClick:p}){const[h,y]=b.useState(!1),[m,x]=b.useState(e.name),g=b.useRef(null),v=Zt(),{toast:w}=Ht();b.useEffect(()=>{x(e.name),y(!1)},[e.id,e.name]),b.useEffect(()=>{var P,$;h&&((P=g.current)==null||P.focus(),($=g.current)==null||$.select())},[h]);const k=dt({mutationFn:async P=>(await _e("PUT",`/api/decks/${e.id}`,{name:P})).json(),onSuccess:P=>{if(!P.success)throw new Error(P.error||"Rename failed");v.invalidateQueries({queryKey:["/api/decks"]}),y(!1)},onError:P=>{x(e.name),y(!1),w({title:"Could not rename deck",description:P.message,variant:"destructive"})}}),C=()=>{const P=m.trim();if(!P||P===e.name){x(e.name),y(!1);return}k.mutate(P)},j=P=>{P.preventDefault(),s(P)},_=P=>{P.preventDefault()},I=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(Xe,{ref:g,value:m,disabled:k.isPending,onChange:P=>x(P.target.value),onBlur:C,onKeyDown:P=>{P.key==="Enter"?(P.preventDefault(),C()):P.key==="Escape"&&(P.preventDefault(),x(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:["(",I," 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:j,onDragOver:_,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:I===0?c.jsx("div",{className:"flex items-center justify-center",style:{minHeight:Bg},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:Fc,height:HN},"data-testid":"deck-empty-placeholder",children:c.jsx(ai,{className:"h-8 w-8 text-gray-500"})})}):c.jsxs(rz,{cardCount:I,children:[n.map((P,$)=>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:In,boxShadow:`0 0 20px ${In}20`},draggable:!0,onDragStart:T=>a(T,P,!0),onDragEnd:u,onClick:()=>p==null?void 0:p(P),"data-testid":`deck-card-${P.id}`,children:[c.jsx(Ea,{warnings:o==null?void 0:o.credentialWarnings.get(P.id)}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:In},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:In},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:In},children:c.jsx(VN,{credential:P,color:In})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:In},children:P.label}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:In,borderColor:In},children:P.hasSecret?"API Key":"Missing key"})]})]},P.id)),r.map((P,$)=>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:Sr,boxShadow:`0 0 20px ${Sr}20`},draggable:!0,onDragStart:T=>l(T,P,!0),onDragEnd:u,onClick:()=>f==null?void 0:f(P),"data-testid":`deck-card-${P.id}`,children:[c.jsx(Ea,{warnings:o==null?void 0:o.playbookWarnings.get(P.id)}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:Sr},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:Sr},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:Sr},children:c.jsx(Yv,{className:"h-7 w-7",strokeWidth:2.25})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Sr},children:P.title}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Sr,borderColor:Sr},children:"Playbook"})]})]},P.id)),t.map(P=>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:Hr(),boxShadow:`0 0 20px ${Hr()}20`},draggable:!0,onDragStart:$=>i($,P,!0),onDragEnd:u,onClick:()=>d==null?void 0:d(P),"data-testid":`deck-card-${P.id}`,children:[c.jsx(Ea,{warnings:o==null?void 0:o.serviceWarnings.get(P.id)}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:Hr()},children:P.type==="mcp"?"RM":P.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:Hr()},children:P.type==="mcp"?"RM":P.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:Hr()},children:c.jsx(qN,{service:P})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Hr()},children:P.name}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Hr(),borderColor:Hr()},children:P.type==="mcp"?"Remote MCP":P.type==="local-mcp"?"Local MCP":"A2A"})]})]},P.id))]})})})]})}var qp=0;function m0(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??dk()),document.body.insertAdjacentElement("beforeend",e[1]??dk()),qp++,()=>{qp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),qp--}},[])}function dk(){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 Vp="focusScope.autoFocusOnMount",Hp="focusScope.autoFocusOnUnmount",fk={bubbles:!1,cancelable:!0},sz="FocusScope",Rh=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,l]=b.useState(null),u=mr(o),d=mr(s),f=b.useRef(null),p=Ye(t,m=>l(m)),h=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let m=function(w){if(h.paused||!a)return;const k=w.target;a.contains(k)?f.current=k:Jo(f.current,{select:!0})},x=function(w){if(h.paused||!a)return;const k=w.relatedTarget;k!==null&&(a.contains(k)||Jo(f.current,{select:!0}))},g=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&Jo(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const v=new MutationObserver(g);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),v.disconnect()}}},[r,a,h.paused]),b.useEffect(()=>{if(a){pk.add(h);const m=document.activeElement;if(!a.contains(m)){const g=new CustomEvent(Vp,fk);a.addEventListener(Vp,u),a.dispatchEvent(g),g.defaultPrevented||(iz(dz(ZN(a)),{select:!0}),document.activeElement===m&&Jo(a))}return()=>{a.removeEventListener(Vp,u),setTimeout(()=>{const g=new CustomEvent(Hp,fk);a.addEventListener(Hp,d),a.dispatchEvent(g),g.defaultPrevented||Jo(m??document.body,{select:!0}),a.removeEventListener(Hp,d),pk.remove(h)},0)}}},[a,u,d,h]);const y=b.useCallback(m=>{if(!n&&!r||h.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(x&&g){const v=m.currentTarget,[w,k]=az(v);w&&k?!m.shiftKey&&g===k?(m.preventDefault(),n&&Jo(w,{select:!0})):m.shiftKey&&g===w&&(m.preventDefault(),n&&Jo(k,{select:!0})):g===v&&m.preventDefault()}},[n,r,h.paused]);return c.jsx(Te.div,{tabIndex:-1,...i,ref:p,onKeyDown:y})});Rh.displayName=sz;function iz(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Jo(r,{select:t}),document.activeElement!==n)return}function az(e){const t=ZN(e),n=hk(t,e),r=hk(t.reverse(),e);return[n,r]}function ZN(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function hk(e,t){for(const n of e)if(!lz(n,{upTo:t}))return n}function lz(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 cz(e){return e instanceof HTMLInputElement&&"select"in e}function Jo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&cz(e)&&t&&e.select()}}var pk=uz();function uz(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=mk(e,t),e.unshift(t)},remove(t){var n;e=mk(e,t),(n=e[0])==null||n.resume()}}}function mk(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function dz(e){return e.filter(t=>t.tagName!=="A")}var fz=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Vi=new WeakMap,Ju=new WeakMap,Yu={},Bp=0,QN=function(e){return e&&(e.host||QN(e.parentNode))},hz=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=QN(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})},pz=function(e,t,n,r){var o=hz(t,Array.isArray(e)?e:[e]);Yu[n]||(Yu[n]=new WeakMap);var s=Yu[n],i=[],a=new Set,l=new Set(o),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};o.forEach(u);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(p){if(a.has(p))d(p);else try{var h=p.getAttribute(r),y=h!==null&&h!=="false",m=(Vi.get(p)||0)+1,x=(s.get(p)||0)+1;Vi.set(p,m),s.set(p,x),i.push(p),m===1&&y&&Ju.set(p,!0),x===1&&p.setAttribute(n,"true"),y||p.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",p,g)}})};return d(t),a.clear(),Bp++,function(){i.forEach(function(f){var p=Vi.get(f)-1,h=s.get(f)-1;Vi.set(f,p),s.set(f,h),p||(Ju.has(f)||f.removeAttribute(r),Ju.delete(f)),h||f.removeAttribute(n)}),Bp--,Bp||(Vi=new WeakMap,Vi=new WeakMap,Ju=new WeakMap,Yu={})}},g0=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=fz(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),pz(r,o,n,"aria-hidden")):function(){return null}},Xr=function(){return Xr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Xr.apply(this,arguments)};function GN(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function mz(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Rd="right-scroll-bar-position",Id="width-before-scroll-bar",gz="with-scroll-bars-hidden",yz="--removed-body-scroll-bar-size";function Kp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function vz(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var xz=typeof window<"u"?b.useLayoutEffect:b.useEffect,gk=new WeakMap;function wz(e,t){var n=vz(null,function(r){return e.forEach(function(o){return Kp(o,r)})});return xz(function(){var r=gk.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||Kp(a,null)}),s.forEach(function(a){o.has(a)||Kp(a,i)})}gk.set(n,e)},[e]),n}function bz(e){return e}function kz(e,t){t===void 0&&(t=bz);var n=[],r=!1,o={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(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var l=function(){var d=i;i=[],d.forEach(s)},u=function(){return Promise.resolve().then(l)};u(),n={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),n}}}};return o}function _z(e){e===void 0&&(e={});var t=kz(null);return t.options=Xr({async:!0,ssr:!1},e),t}var JN=function(e){var t=e.sideCar,n=GN(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 b.createElement(r,Xr({},n))};JN.isSideCarExport=!0;function Sz(e,t){return e.useMedium(t),JN}var YN=_z(),Wp=function(){},Ih=b.forwardRef(function(e,t){var n=b.useRef(null),r=b.useState({onScrollCapture:Wp,onWheelCapture:Wp,onTouchMoveCapture:Wp}),o=r[0],s=r[1],i=e.forwardProps,a=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,x=e.allowPinchZoom,g=e.as,v=g===void 0?"div":g,w=e.gapMode,k=GN(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,j=wz([n,t]),_=Xr(Xr({},k),o);return b.createElement(b.Fragment,null,d&&b.createElement(C,{sideCar:YN,removeScrollBar:u,shards:f,noRelative:h,noIsolation:y,inert:m,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:w}),i?b.cloneElement(b.Children.only(a),Xr(Xr({},_),{ref:j})):b.createElement(v,Xr({},_,{className:l,ref:j}),a))});Ih.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ih.classNames={fullWidth:Id,zeroRight:Rd};var Cz=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ez(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Cz();return t&&e.setAttribute("nonce",t),e}function Nz(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function jz(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Pz=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ez())&&(Nz(t,n),jz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Tz=function(){var e=Pz();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},XN=function(){var e=Tz(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},$z={left:0,top:0,right:0,gap:0},Zp=function(e){return parseInt(e||"",10)||0},Rz=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Zp(n),Zp(r),Zp(o)]},Iz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return $z;var t=Rz(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])}},Az=XN(),Na="data-scroll-locked",Oz=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
280
- .`.concat(gz,` {
281
- overflow: hidden `).concat(r,`;
282
- padding-right: `).concat(a,"px ").concat(r,`;
283
- }
284
- body[`).concat(Na,`] {
285
- overflow: hidden `).concat(r,`;
286
- overscroll-behavior: contain;
287
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
288
- padding-left: `.concat(o,`px;
289
- padding-top: `).concat(s,`px;
290
- padding-right: `).concat(i,`px;
291
- margin-left:0;
292
- margin-top:0;
293
- margin-right: `).concat(a,"px ").concat(r,`;
294
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
295
- }
296
-
297
- .`).concat(Rd,` {
298
- right: `).concat(a,"px ").concat(r,`;
299
- }
300
-
301
- .`).concat(Id,` {
302
- margin-right: `).concat(a,"px ").concat(r,`;
303
- }
304
-
305
- .`).concat(Rd," .").concat(Rd,` {
306
- right: 0 `).concat(r,`;
307
- }
308
-
309
- .`).concat(Id," .").concat(Id,` {
310
- margin-right: 0 `).concat(r,`;
311
- }
312
-
313
- body[`).concat(Na,`] {
314
- `).concat(yz,": ").concat(a,`px;
315
- }
316
- `)},yk=function(){var e=parseInt(document.body.getAttribute(Na)||"0",10);return isFinite(e)?e:0},Mz=function(){b.useEffect(function(){return document.body.setAttribute(Na,(yk()+1).toString()),function(){var e=yk()-1;e<=0?document.body.removeAttribute(Na):document.body.setAttribute(Na,e.toString())}},[])},Dz=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Mz();var s=b.useMemo(function(){return Iz(o)},[o]);return b.createElement(Az,{styles:Oz(s,!t,o,n?"":"!important")})},Kg=!1;if(typeof window<"u")try{var Xu=Object.defineProperty({},"passive",{get:function(){return Kg=!0,!0}});window.addEventListener("test",Xu,Xu),window.removeEventListener("test",Xu,Xu)}catch{Kg=!1}var Hi=Kg?{passive:!1}:!1,Lz=function(e){return e.tagName==="TEXTAREA"},ej=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Lz(e)&&n[t]==="visible")},zz=function(e){return ej(e,"overflowY")},Fz=function(e){return ej(e,"overflowX")},vk=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=tj(e,r);if(o){var s=nj(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Uz=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},qz=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},tj=function(e,t){return e==="v"?zz(t):Fz(t)},nj=function(e,t){return e==="v"?Uz(t):qz(t)},Vz=function(e,t){return e==="h"&&t==="rtl"?-1:1},Hz=function(e,t,n,r,o){var s=Vz(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,l=t.contains(a),u=!1,d=i>0,f=0,p=0;do{if(!a)break;var h=nj(e,a),y=h[0],m=h[1],x=h[2],g=m-x-s*y;(y||g)&&tj(e,a)&&(f+=g,p+=y);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(d&&Math.abs(f)<1||!d&&Math.abs(p)<1)&&(u=!0),u},ed=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},xk=function(e){return[e.deltaX,e.deltaY]},wk=function(e){return e&&"current"in e?e.current:e},Bz=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Kz=function(e){return`
317
- .block-interactivity-`.concat(e,` {pointer-events: none;}
318
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
319
- `)},Wz=0,Bi=[];function Zz(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),o=b.useState(Wz++)[0],s=b.useState(XN)[0],i=b.useRef(e);b.useEffect(function(){i.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=mz([e.lockRef.current],(e.shards||[]).map(wk),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=b.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var g=ed(m),v=n.current,w="deltaX"in m?m.deltaX:v[0]-g[0],k="deltaY"in m?m.deltaY:v[1]-g[1],C,j=m.target,_=Math.abs(w)>Math.abs(k)?"h":"v";if("touches"in m&&_==="h"&&j.type==="range")return!1;var I=vk(_,j);if(!I)return!0;if(I?C=_:(C=_==="v"?"h":"v",I=vk(_,j)),!I)return!1;if(!r.current&&"changedTouches"in m&&(w||k)&&(r.current=C),!C)return!0;var P=r.current||C;return Hz(P,x,m,P==="h"?w:k)},[]),l=b.useCallback(function(m){var x=m;if(!(!Bi.length||Bi[Bi.length-1]!==s)){var g="deltaY"in x?xk(x):ed(x),v=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&Bz(C.delta,g)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var w=(i.current.shards||[]).map(wk).filter(Boolean).filter(function(C){return C.contains(x.target)}),k=w.length>0?a(x,w[0]):!i.current.noIsolation;k&&x.cancelable&&x.preventDefault()}}},[]),u=b.useCallback(function(m,x,g,v){var w={name:m,delta:x,target:g,should:v,shadowParent:Qz(g)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(k){return k!==w})},1)},[]),d=b.useCallback(function(m){n.current=ed(m),r.current=void 0},[]),f=b.useCallback(function(m){u(m.type,xk(m),m.target,a(m,e.lockRef.current))},[]),p=b.useCallback(function(m){u(m.type,ed(m),m.target,a(m,e.lockRef.current))},[]);b.useEffect(function(){return Bi.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Hi),document.addEventListener("touchmove",l,Hi),document.addEventListener("touchstart",d,Hi),function(){Bi=Bi.filter(function(m){return m!==s}),document.removeEventListener("wheel",l,Hi),document.removeEventListener("touchmove",l,Hi),document.removeEventListener("touchstart",d,Hi)}},[]);var h=e.removeScrollBar,y=e.inert;return b.createElement(b.Fragment,null,y?b.createElement(s,{styles:Kz(o)}):null,h?b.createElement(Dz,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Qz(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Gz=Sz(YN,Zz);var Ah=b.forwardRef(function(e,t){return b.createElement(Ih,Xr({},e,{ref:t,sideCar:Gz}))});Ah.classNames=Ih.classNames;var Oh="Popover",[rj,xte]=lo(Oh,[yl]),au=yl(),[Jz,zs]=rj(Oh),oj=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=e,a=au(t),l=b.useRef(null),[u,d]=b.useState(!1),[f,p]=$s({prop:r,defaultProp:o??!1,onChange:s,caller:Oh});return c.jsx(IN,{...a,children:c.jsx(Jz,{scope:t,contentId:jo(),triggerRef:l,open:f,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(h=>!h),[p]),hasCustomAnchor:u,onCustomAnchorAdd:b.useCallback(()=>d(!0),[]),onCustomAnchorRemove:b.useCallback(()=>d(!1),[]),modal:i,children:n})})};oj.displayName=Oh;var sj="PopoverAnchor",Yz=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=zs(sj,n),s=au(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:a}=o;return b.useEffect(()=>(i(),()=>a()),[i,a]),c.jsx(Ph,{...s,...r,ref:t})});Yz.displayName=sj;var ij="PopoverTrigger",aj=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=zs(ij,n),s=au(n),i=Ye(t,o.triggerRef),a=c.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":fj(o.open),...r,ref:i,onClick:ve(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:c.jsx(Ph,{asChild:!0,...s,children:a})});aj.displayName=ij;var y0="PopoverPortal",[Xz,eF]=rj(y0,{forceMount:void 0}),lj=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=zs(y0,t);return c.jsx(Xz,{scope:t,forceMount:n,children:c.jsx(co,{present:n||s.open,children:c.jsx(ru,{asChild:!0,container:o,children:r})})})};lj.displayName=y0;var nl="PopoverContent",cj=b.forwardRef((e,t)=>{const n=eF(nl,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=zs(nl,e.__scopePopover);return c.jsx(co,{present:r||s.open,children:s.modal?c.jsx(nF,{...o,ref:t}):c.jsx(rF,{...o,ref:t})})});cj.displayName=nl;var tF=Ni("PopoverContent.RemoveScroll"),nF=b.forwardRef((e,t)=>{const n=zs(nl,e.__scopePopover),r=b.useRef(null),o=Ye(t,r),s=b.useRef(!1);return b.useEffect(()=>{const i=r.current;if(i)return g0(i)},[]),c.jsx(Ah,{as:tF,allowPinchZoom:!0,children:c.jsx(uj,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,i=>{var a;i.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,u=a.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:ve(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),rF=b.forwardRef((e,t)=>{const n=zs(nl,e.__scopePopover),r=b.useRef(!1),o=b.useRef(!1);return c.jsx(uj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),uj=b.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...f}=e,p=zs(nl,n),h=au(n);return m0(),c.jsx(Rh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:c.jsx(hl,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>p.onOpenChange(!1),children:c.jsx(u0,{"data-state":fj(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)"}})})})}),dj="PopoverClose",oF=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=zs(dj,n);return c.jsx(Te.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});oF.displayName=dj;var sF="PopoverArrow",iF=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=au(n);return c.jsx(d0,{...o,...r,ref:t})});iF.displayName=sF;function fj(e){return e?"open":"closed"}var aF=oj,lF=aj,cF=lj,hj=cj;const uF=aF,dF=lF,pj=b.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>c.jsx(cF,{children:c.jsx(hj,{ref:o,align:t,sideOffset:n,className:Ne("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})}));pj.displayName=hj.displayName;function fF(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 o=Math.floor(r/60);if(o<60)return`${o}m`;const s=Math.floor(o/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function hF(e,t=24){return e.length>t?`${e.slice(0,t-1)}…`:e}function pF(e){const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n>=0?t.slice(n+1):t}function mF(e){const t=new Map;for(const n of e)t.set(n.deckId,(t.get(n.deckId)??0)+1);return t}function gF(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}`}const yF=3e3;function vF({highlightDeckId:e}){const{data:t}=ut({queryKey:["/api/scope/bindings"],refetchInterval:yF}),n=(t==null?void 0:t.data)??[],r=b.useMemo(()=>new Date,[t]),o=b.useMemo(()=>{const i=new Map;for(const a of n){const l=i.get(a.workspaceRoot)??[];l.push(a),i.set(a.workspaceRoot,l)}return[...i.entries()].sort(([a],[l])=>a.localeCompare(l)).map(([a,l])=>({workspaceRoot:a,rows:[...l].sort((u,d)=>u.lastActivityAt<d.lastActivityAt?1:-1)}))},[n]);if(n.length===0)return null;const s=e?n.filter(i=>i.deckId===e).length:0;return c.jsxs(uF,{children:[c.jsx(dF,{asChild:!0,children:c.jsxs(ne,{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(h4,{className:"mr-1 h-3 w-3",style:{color:wn},"aria-hidden":!0}),c.jsxs("span",{className:"font-mono",children:["⌘",n.length]}),s>0&&s<n.length?c.jsxs("span",{className:"ml-1 text-gray-400",children:["(",s," here)"]}):null]})}),c.jsxs(pj,{align:"end",className:"w-80 border-white/10 bg-gray-950/95 p-0 text-gray-100","data-testid":"live-session-badges-panel",children:[c.jsxs("div",{className:"border-b border-white/10 px-3 py-2",children:[c.jsx("p",{className:"text-sm font-semibold",style:{color:wn},children:"Live sessions"}),c.jsxs("p",{className:"text-xs text-gray-400",children:["Match ",c.jsx("span",{className:"font-mono",children:"⌘badge"})," to the chat opener"]})]}),c.jsx("div",{className:"max-h-64 overflow-y-auto p-2",children:o.map(({workspaceRoot:i,rows:a})=>c.jsxs("div",{className:"mb-2 last:mb-0",children:[c.jsxs("p",{className:"px-1 pb-1 text-[10px] uppercase tracking-wide text-gray-500",children:[pF(i),"/"]}),c.jsx("ul",{className:"space-y-1",children:a.map(l=>{const u=l.clientName??"agent",d=fF(l.lastActivityAt,r),f=d?`${u} · ${d}`:u,p=e===l.deckId;return c.jsxs("li",{className:Ne("rounded-md px-2 py-1.5 font-mono text-xs",p?"bg-[#92E4DD]/10 ring-1 ring-[#92E4DD]/40":"bg-white/5"),"data-testid":`live-session-row-${l.badge}`,children:[c.jsx("span",{className:"text-gray-100",children:hF(l.deckName)})," ",c.jsxs("span",{style:{color:wn},children:["⌘",l.badge]}),c.jsx("span",{className:"mt-0.5 block font-sans text-[10px] text-gray-400",children:f})]},l.badge)})})]},i))})]})]})}var Mh="Dialog",[mj,wte]=lo(Mh),[xF,zr]=mj(Mh),gj=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,a=b.useRef(null),l=b.useRef(null),[u,d]=$s({prop:r,defaultProp:o??!1,onChange:s,caller:Mh});return c.jsx(xF,{scope:t,triggerRef:a,contentRef:l,contentId:jo(),titleId:jo(),descriptionId:jo(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(f=>!f),[d]),modal:i,children:n})};gj.displayName=Mh;var yj="DialogTrigger",wF=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=zr(yj,n),s=Ye(t,o.triggerRef);return c.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":w0(o.open),...r,ref:s,onClick:ve(e.onClick,o.onOpenToggle)})});wF.displayName=yj;var v0="DialogPortal",[bF,vj]=mj(v0,{forceMount:void 0}),xj=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=zr(v0,t);return c.jsx(bF,{scope:t,forceMount:n,children:b.Children.map(r,i=>c.jsx(co,{present:n||s.open,children:c.jsx(ru,{asChild:!0,container:o,children:i})}))})};xj.displayName=v0;var Tf="DialogOverlay",wj=b.forwardRef((e,t)=>{const n=vj(Tf,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=zr(Tf,e.__scopeDialog);return s.modal?c.jsx(co,{present:r||s.open,children:c.jsx(_F,{...o,ref:t})}):null});wj.displayName=Tf;var kF=Ni("DialogOverlay.RemoveScroll"),_F=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=zr(Tf,n);return c.jsx(Ah,{as:kF,allowPinchZoom:!0,shards:[o.contentRef],children:c.jsx(Te.div,{"data-state":w0(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Pi="DialogContent",bj=b.forwardRef((e,t)=>{const n=vj(Pi,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=zr(Pi,e.__scopeDialog);return c.jsx(co,{present:r||s.open,children:s.modal?c.jsx(SF,{...o,ref:t}):c.jsx(CF,{...o,ref:t})})});bj.displayName=Pi;var SF=b.forwardRef((e,t)=>{const n=zr(Pi,e.__scopeDialog),r=b.useRef(null),o=Ye(t,n.contentRef,r);return b.useEffect(()=>{const s=r.current;if(s)return g0(s)},[]),c.jsx(kj,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&s.preventDefault()}),onFocusOutside:ve(e.onFocusOutside,s=>s.preventDefault())})}),CF=b.forwardRef((e,t)=>{const n=zr(Pi,e.__scopeDialog),r=b.useRef(!1),o=b.useRef(!1);return c.jsx(kj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),kj=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,a=zr(Pi,n),l=b.useRef(null),u=Ye(t,l);return m0(),c.jsxs(c.Fragment,{children:[c.jsx(Rh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:c.jsx(hl,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":w0(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(EF,{titleId:a.titleId}),c.jsx(jF,{contentRef:l,descriptionId:a.descriptionId})]})]})}),x0="DialogTitle",_j=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=zr(x0,n);return c.jsx(Te.h2,{id:o.titleId,...r,ref:t})});_j.displayName=x0;var Sj="DialogDescription",Cj=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=zr(Sj,n);return c.jsx(Te.p,{id:o.descriptionId,...r,ref:t})});Cj.displayName=Sj;var Ej="DialogClose",Nj=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=zr(Ej,n);return c.jsx(Te.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});Nj.displayName=Ej;function w0(e){return e?"open":"closed"}var jj="DialogTitleWarning",[bte,Pj]=dM(jj,{contentName:Pi,titleName:x0,docsSlug:"dialog"}),EF=({titleId:e})=>{const t=Pj(jj),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
320
-
321
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
322
-
323
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},NF="DialogDescriptionWarning",jF=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Pj(NF).contentName}}.`;return b.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},PF=gj,TF=xj,Tj=wj,$j=bj,Rj=_j,Ij=Cj,$F=Nj;const Fs=PF,RF=TF,Aj=b.forwardRef(({className:e,...t},n)=>c.jsx(Tj,{ref:n,className:Ne("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}));Aj.displayName=Tj.displayName;const Fo=b.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(RF,{children:[c.jsx(Aj,{}),c.jsxs($j,{ref:r,className:Ne("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($F,{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(Sf,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Fo.displayName=$j.displayName;const Uo=({className:e,...t})=>c.jsx("div",{className:Ne("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Uo.displayName="DialogHeader";const qo=b.forwardRef(({className:e,...t},n)=>c.jsx(Rj,{ref:n,className:Ne("text-lg font-semibold leading-none tracking-tight",e),...t}));qo.displayName=Rj.displayName;const Li=b.forwardRef(({className:e,...t},n)=>c.jsx(Ij,{ref:n,className:Ne("text-sm text-muted-foreground",e),...t}));Li.displayName=Ij.displayName;const _o=b.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:Ne("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}));_o.displayName="Textarea";var IF="Label",Oj=b.forwardRef((e,t)=>c.jsx(Te.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Oj.displayName=IF;var Mj=Oj;const AF=_h("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Be=b.forwardRef(({className:e,...t},n)=>c.jsx(Mj,{ref:n,className:Ne(AF(),e),...t}));Be.displayName=Mj.displayName;var OF=b.createContext(void 0);function b0(e){const t=b.useContext(OF);return e||t||"ltr"}var Qp="rovingFocusGroup.onEntryFocus",MF={bubbles:!1,cancelable:!0},lu="RovingFocusGroup",[Wg,Dj,DF]=Zv(lu),[LF,Lj]=lo(lu,[DF]),[zF,FF]=LF(lu),zj=b.forwardRef((e,t)=>c.jsx(Wg.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(Wg.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(UF,{...e,ref:t})})}));zj.displayName=lu;var UF=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,p=b.useRef(null),h=Ye(t,p),y=b0(s),[m,x]=$s({prop:i,defaultProp:a??null,onChange:l,caller:lu}),[g,v]=b.useState(!1),w=mr(u),k=Dj(n),C=b.useRef(!1),[j,_]=b.useState(0);return b.useEffect(()=>{const I=p.current;if(I)return I.addEventListener(Qp,w),()=>I.removeEventListener(Qp,w)},[w]),c.jsx(zF,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:m,onItemFocus:b.useCallback(I=>x(I),[x]),onItemShiftTab:b.useCallback(()=>v(!0),[]),onFocusableItemAdd:b.useCallback(()=>_(I=>I+1),[]),onFocusableItemRemove:b.useCallback(()=>_(I=>I-1),[]),children:c.jsx(Te.div,{tabIndex:g||j===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{C.current=!0}),onFocus:ve(e.onFocus,I=>{const P=!C.current;if(I.target===I.currentTarget&&P&&!g){const $=new CustomEvent(Qp,MF);if(I.currentTarget.dispatchEvent($),!$.defaultPrevented){const T=k().filter(Z=>Z.focusable),A=T.find(Z=>Z.active),U=T.find(Z=>Z.id===m),D=[A,U,...T].filter(Boolean).map(Z=>Z.ref.current);qj(D,d)}}C.current=!1}),onBlur:ve(e.onBlur,()=>v(!1))})})}),Fj="RovingFocusGroupItem",Uj=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,l=jo(),u=s||l,d=FF(Fj,n),f=d.currentTabStopId===u,p=Dj(n),{onFocusableItemAdd:h,onFocusableItemRemove:y,currentTabStopId:m}=d;return b.useEffect(()=>{if(r)return h(),()=>y()},[r,h,y]),c.jsx(Wg.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:c.jsx(Te.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:ve(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:ve(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ve(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const g=HF(x,d.orientation,d.dir);if(g!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let w=p().filter(k=>k.focusable).map(k=>k.ref.current);if(g==="last")w.reverse();else if(g==="prev"||g==="next"){g==="prev"&&w.reverse();const k=w.indexOf(x.currentTarget);w=d.loop?BF(w,k+1):w.slice(k+1)}setTimeout(()=>qj(w))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:m!=null}):i})})});Uj.displayName=Fj;var qF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function VF(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function HF(e,t,n){const r=VF(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return qF[r]}function qj(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function BF(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var KF=zj,WF=Uj,Dh="Tabs",[ZF,kte]=lo(Dh,[Lj]),Vj=Lj(),[QF,k0]=ZF(Dh),Hj=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:l="automatic",...u}=e,d=b0(a),[f,p]=$s({prop:r,onChange:o,defaultProp:s??"",caller:Dh});return c.jsx(QF,{scope:n,baseId:jo(),value:f,onValueChange:p,orientation:i,dir:d,activationMode:l,children:c.jsx(Te.div,{dir:d,"data-orientation":i,...u,ref:t})})});Hj.displayName=Dh;var Bj="TabsList",Kj=b.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=k0(Bj,n),i=Vj(n);return c.jsx(KF,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:c.jsx(Te.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Kj.displayName=Bj;var Wj="TabsTrigger",Zj=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=k0(Wj,n),a=Vj(n),l=Jj(i.baseId,r),u=Yj(i.baseId,r),d=r===i.value;return c.jsx(WF,{asChild:!0,...a,focusable:!o,active:d,children:c.jsx(Te.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...s,ref:t,onMouseDown:ve(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:ve(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:ve(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!o&&f&&i.onValueChange(r)})})})});Zj.displayName=Wj;var Qj="TabsContent",Gj=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=k0(Qj,n),l=Jj(a.baseId,r),u=Yj(a.baseId,r),d=r===a.value,f=b.useRef(d);return b.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),c.jsx(co,{present:o||d,children:({present:p})=>c.jsx(Te.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:p&&s})})});Gj.displayName=Qj;function Jj(e,t){return`${e}-trigger-${t}`}function Yj(e,t){return`${e}-content-${t}`}var GF=Hj,Xj=Kj,eP=Zj,tP=Gj;const JF=GF,nP=b.forwardRef(({className:e,...t},n)=>c.jsx(Xj,{ref:n,className:Ne("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));nP.displayName=Xj.displayName;const Zg=b.forwardRef(({className:e,...t},n)=>c.jsx(eP,{ref:n,className:Ne("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}));Zg.displayName=eP.displayName;const Qg=b.forwardRef(({className:e,...t},n)=>c.jsx(tP,{ref:n,className:Ne("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Qg.displayName=tP.displayName;function lc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rP(e){return lc(e)&&typeof e.command=="string"}function Gp(e){return!lc(e)||Object.keys(e).length===0?!1:Object.values(e).every(rP)}function YF(e){let t=e.trim();return t.startsWith("```")?t.replace(/^```(?:json)?\s*\n?/i,"").replace(/\n?```\s*$/,"").trim():t}function XF(e){if(!lc(e))throw new Error("Configuration must be a JSON object");if(lc(e.config)&&Gp(e.config.mcpServers))return{mcpServers:e.config.mcpServers};if(Gp(e.mcpServers))return{mcpServers:e.mcpServers};if(lc(e)&&typeof e.command=="string"){const t=typeof e.name=="string"&&e.name.trim()?e.name.trim():"local-server",{name:n,...r}=e;if(!rP(r))throw new Error("Missing or invalid command");return{mcpServers:{[t]:r}}}if(Gp(e))return{mcpServers:e};throw new Error(`Invalid configuration: expected a top-level "mcpServers" object. Example:
324
- {
325
- "mcpServers": {
326
- "google-drive": {
327
- "command": "npx",
328
- "args": ["-y", "@piotr-agier/google-drive-mcp"]
329
- }
330
- }
331
- }`)}function e3(e){let t;try{t=JSON.parse(YF(e))}catch(n){throw new Error(`Failed to parse JSON: ${n instanceof Error?n.message:"Unknown error"}`)}return XF(t)}function t3({type:e,open:t,onOpenChange:n}){const[r,o]=b.useState("remote"),[s,i]=b.useState("json"),[a,l]=b.useState(`{
332
- "mcpServers": {
333
- "memory": {
334
- "command": "npx",
335
- "args": ["-y", "@modelcontextprotocol/server-memory"],
336
- "env": {
337
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
338
- }
339
- }
340
- }
341
- }`),[u,d]=b.useState(null),[f,p]=b.useState(null),[h,y]=b.useState(null),[m,x]=b.useState({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:wn}),[g,v]=b.useState(`{
342
-
343
- }`),[w,k]=b.useState(null),[C,j]=b.useState({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:wn}),[_,I]=b.useState({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:wn}),P=Zt(),{toast:$}=Ht(),T=()=>{try{p(null);const E=e3(a),R=Object.entries(E.mcpServers);if(R.length===0)throw new Error("No MCP servers found in configuration");if(R.length>1)throw new Error("Multiple servers not supported. Please configure one server at a time.");const[M,K]=R[0],{command:G,args:le,env:se,description:he}=K;if(!G||typeof G!="string")throw new Error("Missing or invalid command");if(!le||!Array.isArray(le))throw new Error("Missing or invalid args array");const ke={name:M,command:G,args:le.map(String),env:se&&typeof se=="object"?se:void 0,description:he&&typeof he=="string"?he:void 0};d(ke),i("review"),j({name:ke.name,type:"local-mcp",command:ke.command,args:ke.args,env:ke.env||{},description:ke.description||"",cardColor:wn}),A(M)}catch(E){p(E instanceof Error?E.message:"Failed to parse JSON"),d(null)}},A=async E=>{try{const K=((await _e("GET","/api/services")).data||[]).find(G=>G.name===E);y(K?E:null)}catch(R){console.error("Failed to check name conflict:",R)}},U=async E=>{await A(E)},z=dt({mutationFn:async E=>{if(e==="mcp"&&r==="local"){const R={mcpServers:{[E.name]:{command:E.command,args:E.args.filter(M=>M.trim()!==""),...Object.keys(E.env).length>0&&{env:E.env}}}};return console.log("Importing local MCP server:",R),_e("POST","/api/local-mcp/import",{config:JSON.stringify(R)})}else{const R={name:E.name,type:e,url:e==="mcp"?E.url:E.manifest_url,description:E.description,cardColor:E.cardColor,...E.headers_enabled&&{headers:E.headers}};return console.log("Sending service data:",R),_e("POST","/api/services",R)}},onSuccess:()=>{P.invalidateQueries({queryKey:["/api/services"]}),P.invalidateQueries({queryKey:["/api/collection/warnings"]}),$({title:"Service registered successfully!",description:`${(e==="mcp"?r==="remote"?m:C:_).name} has been added to your collection.`}),Z()},onError:E=>{var R;console.error("Registration failed:",E),console.error("Error details:",{message:E==null?void 0:E.message,name:E==null?void 0:E.name,stack:E==null?void 0:E.stack,toString:E==null?void 0:E.toString(),constructor:(R=E==null?void 0:E.constructor)==null?void 0:R.name}),$({title:"Registration failed",description:(E==null?void 0:E.message)||"Failed to register service. Please try again.",variant:"destructive"})}}),D=async()=>{if(e==="mcp"&&r==="local"){if(s==="json")T();else if(s==="review"){if(await U(C.name),h){$({title:"Name Conflict",description:`A service with the name "${C.name}" already exists. Please choose a different name.`,variant:"destructive"});return}z.mutate(C)}}else{const E=e==="mcp"?r==="remote"?m:C:_;if(await U(E.name),h){$({title:"Name Conflict",description:`A service with the name "${E.name}" already exists. Please choose a different name.`,variant:"destructive"});return}if(e==="mcp"&&r==="remote"&&m.headers_enabled){const R=H();if(R===null)return;z.mutate({...m,headers:R});return}z.mutate(E)}},Z=()=>{i("json"),l(`{
344
- "mcpServers": {
345
- "memory": {
346
- "command": "npx",
347
- "args": ["-y", "@modelcontextprotocol/server-memory"],
348
- "env": {
349
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
350
- }
351
- }
352
- }
353
- }`),d(null),p(null),y(null),x({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:wn}),v(`{
354
-
355
- }`),k(null),j({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:wn}),I({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:wn}),n(!1)},B=(E,R)=>{x(M=>({...M,[E]:R}))},q=E=>{B("headers_enabled",E),E&&g.trim()===`{
356
-
357
- }`&&v(`{
358
- "Authorization": "Bearer "
359
- }`),E||k(null)},H=()=>{const E=g.trim();if(!E||E==="{}")return{};try{const R=JSON.parse(E);if(typeof R!="object"||R===null||Array.isArray(R))return k('Headers must be a JSON object (e.g. {"Authorization": "Bearer token"})'),null;for(const[M,K]of Object.entries(R))if(typeof K!="string")return k(`Header "${M}" must be a string value`),null;return k(null),R}catch{return k("Invalid JSON — fix syntax before registering"),null}},N=(E,R)=>{j(M=>({...M,[E]:R}))},O=(E,R)=>{I(M=>({...M,[E]:R}))},V=()=>{if(e==="mcp"&&r==="local"){if(s==="json")return"Parse Configuration";if(s==="review")return h?"Register Anyway":"Register Service"}return"Register Service"},S=()=>{var E,R;if(e==="mcp"&&r==="local"){if(s==="json")return!a.trim();if(s==="review")return!C.name.trim()||!C.command.trim()}else{const M=e==="mcp"?r==="remote"?m:C:_;return!M.name.trim()||e==="mcp"&&r==="remote"&&!((E=M.url)!=null&&E.trim())||e==="a2a"&&!((R=M.manifest_url)!=null&&R.trim())}return!1};return c.jsx(Fs,{open:t,onOpenChange:n,children:c.jsxs(Fo,{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(Uo,{children:[c.jsxs(qo,{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(_f,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}):c.jsx(i4,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}),"Register ",e==="mcp"?"MCP Server":"A2A Agent"]}),c.jsx(Li,{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(JF,{value:r,onValueChange:E=>o(E),className:"w-full",children:[c.jsxs(nP,{className:"grid w-full grid-cols-2 bg-white/10 border border-white/20",children:[c.jsxs(Zg,{value:"remote",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[c.jsx(_f,{className:"w-4 h-4 mr-2"}),"Remote MCP"]}),c.jsxs(Zg,{value:"local",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[c.jsx(p4,{className:"w-4 h-4 mr-2"}),"Local MCP"]})]}),c.jsxs(Qg,{value:"remote",className:"space-y-4 mt-4",children:[c.jsxs("div",{children:[c.jsx(Be,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),c.jsx(Xe,{id:"name",placeholder:"e.g., Database Tools",value:m.name,onChange:E=>{B("name",E.target.value),E.target.value.trim()?U(E.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(Pr,{className:"w-4 h-4"}),c.jsx("span",{children:"A service with this name already exists"})]})]}),c.jsxs("div",{children:[c.jsx(Be,{htmlFor:"url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"MCP URL"}),c.jsx(Xe,{id:"url",type:"url",placeholder:"http://localhost:8080/mcp or https://mcp.notion.com/mcp",value:m.url,onChange:E=>B("url",E.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(Be,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),c.jsx(_o,{id:"description",placeholder:"Brief description of capabilities...",value:m.description,onChange:E=>B("description",E.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),c.jsxs(Qg,{value:"local",className:"space-y-4 mt-4",children:[s==="json"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(Be,{htmlFor:"local-json",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Local MCP Configuration (JSON)"}),c.jsx(_o,{id:"local-json",placeholder:`{
360
- "mcpServers": {
361
- "memory": {
362
- "command": "npx",
363
- "args": ["-y", "@modelcontextprotocol/server-memory"]
364
- }
365
- }
366
- }`,value:a,onChange:E=>l(E.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:`{
367
- "mcpServers": {
368
- "memory": {
369
- "command": "npx",
370
- "args": ["-y", "@modelcontextprotocol/server-memory"],
371
- "env": {
372
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
373
- }
374
- }
375
- }
376
- }`})]})]}),c.jsxs(ne,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:T,disabled:!a.trim()||a.trim().length<10,"data-testid":"button-parse-json",children:[c.jsx(Lg,{className:"w-4 h-4 mr-2",style:{color:"#0A0A07"}}),"Parse Configuration"]})]}),s==="review"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(Be,{htmlFor:"local-name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),c.jsx(Xe,{id:"local-name",placeholder:"e.g., Memory Server",value:C.name,onChange:E=>{N("name",E.target.value),E.target.value.trim()?U(E.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(Pr,{className:"w-4 h-4 mr-1"}),'A service with the name "',h,'" already exists.']})]}),c.jsxs("div",{children:[c.jsx(Be,{htmlFor:"command",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Command"}),c.jsx(Xe,{id:"command",placeholder:"e.g., npx, python, node",value:C.command,onChange:E=>N("command",E.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(Be,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Arguments"}),C.args.map((E,R)=>c.jsxs("div",{className:"flex gap-2 mb-2",children:[c.jsx(Xe,{placeholder:`Argument ${R+1}`,value:E,onChange:M=>{const K=[...C.args];K[R]=M.target.value,N("args",K)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-arg-${R}`}),R===C.args.length-1&&c.jsx(ne,{type:"button",size:"sm",onClick:()=>N("args",[...C.args,""]),className:"bg-white/20 hover:bg-white/30 text-white",children:c.jsx(ai,{className:"w-4 h-4"})}),C.args.length>1&&c.jsx(ne,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const M=C.args.filter((K,G)=>G!==R);N("args",M)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:c.jsx(Sf,{className:"w-4 h-4"})})]},R)),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(Be,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Environment Variables"}),Object.entries(C.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(C.env).map(([E,R],M)=>c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Xe,{placeholder:"Variable name",value:E,onChange:K=>{const G={...C.env};delete G[E],G[K.target.value]=R,N("env",G)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-key-${M}`}),c.jsx(Xe,{placeholder:"Value",value:R,onChange:K=>{const G={...C.env};G[E]=K.target.value,N("env",G)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-value-${M}`}),c.jsx(ne,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const K={...C.env};delete K[E],N("env",K)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:c.jsx(Sf,{className:"w-4 h-4"})})]},M))}),c.jsxs(ne,{type:"button",size:"sm",onClick:()=>{const E={...C.env};E[""]="",N("env",E)},className:"mt-2 bg-white/20 hover:bg-white/30 text-white",children:[c.jsx(ai,{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(Be,{htmlFor:"local-description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),c.jsx(_o,{id:"local-description",placeholder:"Brief description of capabilities...",value:C.description,onChange:E=>N("description",E.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(ne,{type:"button",variant:"outline",className:"flex-1 border-white/20 text-white hover:bg-white/10",onClick:()=>i("json"),"data-testid":"button-back-to-json",children:"← Back to JSON"}),c.jsxs(ne,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${Jr}`,style:Yr(wn),onClick:D,disabled:S(),"data-testid":"button-register",children:[c.jsx(ai,{className:"w-4 h-4 mr-2"}),z.isPending?"Registering...":V()]})]})]}),s==="complete"&&c.jsxs("div",{className:"text-center py-8",children:[c.jsx(Lg,{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(ne,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:Z,"data-testid":"button-close",children:"Close"})]})]})]}):c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(Be,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Agent Name"}),c.jsx(Xe,{id:"name",placeholder:"e.g., Code Assistant",value:_.name,onChange:E=>{O("name",E.target.value),E.target.value.trim()?U(E.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(Pr,{className:"w-4 h-4"}),c.jsx("span",{children:"A service with this name already exists"})]})]}),c.jsxs("div",{children:[c.jsx(Be,{htmlFor:"manifest_url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Manifest URL"}),c.jsx(Xe,{id:"manifest_url",type:"url",placeholder:"http://localhost:8001/.well-known/a2a/manifest.json",value:_.manifest_url,onChange:E=>O("manifest_url",E.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(Be,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),c.jsx(_o,{id:"description",placeholder:"Brief description of capabilities...",value:_.description,onChange:E=>O("description",E.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:E=>q(E.target.checked),className:"rounded border-white/20 bg-white/10"}),c.jsx(Be,{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(Be,{htmlFor:"headers",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"HTTP Headers (JSON)"}),c.jsx(_o,{id:"headers",placeholder:`{
377
- "Authorization": "Bearer YOUR_TOKEN_HERE",
378
- "X-API-Key": "YOUR_API_KEY_HERE"
379
- }`,value:g,onChange:E=>{v(E.target.value),w&&k(null)},onBlur:()=>{g.trim()&&H()},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(Pr,{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(Pr,{className:"w-4 h-4 mr-1"}),f]}),h&&c.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[c.jsx(Pr,{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(ne,{type:"button",variant:"secondary",className:"flex-1 border text-white",style:{background:"#ad095e",borderColor:"#ad095e"},onClick:Z,"data-testid":"button-cancel",children:"Cancel"}),!(e==="mcp"&&r==="local")&&c.jsxs(ne,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${Jr}`,style:Yr(wn),disabled:z.isPending||S(),"data-testid":"button-register",onClick:D,children:[c.jsx(ai,{className:"w-4 h-4 mr-2"}),z.isPending?"Registering...":"Register Service"]})]})]})})}async function oP(e){return(await(await _e("POST","/api/export",{scope:e.scope??"collection",...e.deckId?{deckId:e.deckId}:{}})).json()).data}async function n3(e){return(await(await _e("POST","/api/import",e)).json()).data}function sP(e,t){const n=new Blob([`${JSON.stringify(e,null,2)}
380
- `],{type:"application/json"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=t,o.click(),URL.revokeObjectURL(r)}function r3(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"deck"}function bk(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 o3({decks:e,editingDeckId:t,onSelectDeck:n,isLoading:r}){const[o,s]=b.useState(!1),[i,a]=b.useState(""),l=Zt(),{toast:u}=Ht(),{data:d}=ut({queryKey:["/api/scope/bindings"],refetchInterval:3e3}),f=b.useMemo(()=>mF((d==null?void 0:d.data)??[]),[d]),p=dt({mutationFn:async k=>_e("POST","/api/decks",{name:k,isActive:!1}),onSuccess:async(k,C)=>{var _;const j=await k.json();l.invalidateQueries({queryKey:["/api/decks"]}),(_=j.data)!=null&&_.id&&n(j.data.id),u({title:"Deck created",description:`${C} has been created successfully.`}),s(!1),a("")},onError:k=>{u({title:"Failed to create deck",description:k.message,variant:"destructive"})}}),h=dt({mutationFn:async k=>{const C=await oP({scope:"deck",deckId:k.id});return sP(C,`${r3(k.name)}.agent-deck.json`),C},onSuccess:(k,C)=>{u({title:"Deck exported",description:`${C.name}: ${k.services.length} services, ${k.playbooks.length} playbooks`})},onError:k=>{u({title:"Export failed",description:k.message,variant:"destructive"})}}),y=(k,C)=>{k.stopPropagation(),h.mutate(C)},m=dt({mutationFn:async k=>_e("DELETE",`/api/decks/${k}`,{}),onSuccess:()=>{l.invalidateQueries({queryKey:["/api/decks"]}),u({title:"Deck deleted",description:"Your deck has been deleted successfully."})},onError:k=>{k.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:k.message,variant:"destructive"})}}),x=async(k,C)=>{k.stopPropagation();try{await navigator.clipboard.writeText(C.id),u({title:"Copied deck id",description:"Use with bind_workspace({ workspaceRoot, deckId }) in your agent."})}catch(j){u({title:"Failed to copy deck id",description:j instanceof Error?j.message:"Unknown error",variant:"destructive"})}},g=(k,C)=>{k.stopPropagation(),window.confirm("Are you sure you want to delete this deck? This action cannot be undone.")&&m.mutate(C)},v=k=>{k.preventDefault();const C=i.trim();C&&p.mutate(C)},w=k=>{var C,j,_;return(((C=k.services)==null?void 0:C.length)??0)+(((j=k.credentials)==null?void 0:j.length)??0)+(((_=k.playbooks)==null?void 0:_.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((k,C)=>c.jsx("div",{className:"h-16 bg-white/5 rounded-lg"},C))})]})}):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(kf,{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(ne,{onClick:()=>s(!0),className:"w-full border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"create-deck-button",children:[c.jsx(ai,{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(k=>{const C=k.id===t,j=w(k),_=f.get(k.id)??0,I=gF(j,_);return c.jsxs("div",{className:`p-2 rounded-lg border cursor-pointer transition-all relative group ${C?"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(k.id),"data-testid":`deck-item-${k.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(ne,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:P=>y(P,k),title:"Export this deck","data-testid":`export-deck-${k.id}`,children:c.jsx(XE,{className:"w-2 h-2"})}),c.jsx(ne,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:P=>x(P,k),title:"Copy deck id for bind_workspace",children:c.jsx(Xv,{className:"w-2 h-2"})}),c.jsx(ne,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:P=>g(P,k.id),title:"Delete deck",children:c.jsx(su,{className:"w-2 h-2"})})]}),c.jsxs("div",{children:[c.jsx("h3",{className:`font-semibold text-sm pr-16 ${C?"text-yellow-300":"text-white"}`,children:k.name}),c.jsx("p",{className:"text-xs text-gray-400 select-none pointer-events-none",children:I})]})]},k.id)})})})]}),c.jsx(Fs,{open:o,onOpenChange:s,children:c.jsxs(Fo,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsx(Uo,{children:c.jsxs(qo,{className:"flex items-center text-xl font-bold",children:[c.jsx(kf,{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(Be,{htmlFor:"deckName",children:"Deck Name"}),c.jsx(Xe,{id:"deckName",placeholder:"e.g., Hiring stack",value:i,onChange:k=>a(k.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(ne,{type:"button",variant:"outline",className:"flex-1 rounded-full border-white/20 text-[#E8F6F4] hover:bg-white/10",onClick:()=>s(!1),"data-testid":"button-cancel-create",children:"Cancel"}),c.jsx(ne,{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 s3({open:e,onOpenChange:t}){const[n,r]=b.useState(""),[o,s]=b.useState(""),i=Zt(),{toast:a}=Ht(),l=dt({mutationFn:async()=>_e("POST","/api/credentials",{label:n.trim(),value:o}),onSuccess:()=>{i.invalidateQueries({queryKey:["/api/credentials/vault"]}),i.invalidateQueries({queryKey:["/api/decks"]}),a({title:"API key saved",description:`${n.trim()} is stored securely. Your agent can use it from the active deck.`}),t(!1),r(""),s("")},onError:d=>{a({title:"Could not save API key",description:d.message,variant:"destructive"})}}),u=n.trim().length>0&&o.trim().length>0;return c.jsx(Fs,{open:e,onOpenChange:t,children:c.jsxs(Fo,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(Uo,{children:[c.jsx(qo,{className:"text-[#E8F6F4]",children:"Register API key"}),c.jsx(Li,{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(Be,{htmlFor:"credential-name",className:"text-[#CFEAE6]",children:"Service name"}),c.jsx(Xe,{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(Be,{htmlFor:"credential-value",className:"text-[#CFEAE6]",children:"API key"}),c.jsx(Xe,{id:"credential-value",type:"password",placeholder:"Paste key from the service dashboard",value:o,onChange:d=>s(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),c.jsx(ne,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Jr}`,style:Yr(In),onClick:()=>l.mutate(),disabled:!u||l.isPending,children:"Save to vault"})]})]})})}function i3({open:e,onOpenChange:t}){const[n,r]=b.useState(""),[o,s]=b.useState(""),[i,a]=b.useState(""),[l,u]=b.useState(""),[d,f]=b.useState(""),[p,h]=b.useState([]),[y,m]=b.useState([]),x=Zt(),{toast:g}=Ht(),{data:v}=ut({queryKey:["/api/credentials/vault"],enabled:e}),{data:w}=ut({queryKey:["/api/services"],enabled:e}),k=(v==null?void 0:v.data)??[],C=(w==null?void 0:w.data)??[],j=dt({mutationFn:async()=>_e("POST","/api/playbooks",{title:n.trim(),body:o,triggers:i.split(",").map(P=>P.trim()).filter(Boolean),dependsOnCredentialIds:p,dependsOnServiceIds:y,exec:l.trim()||void 0,skill:d.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{x.invalidateQueries({queryKey:["/api/playbooks/vault"]}),g({title:"Playbook saved",description:`${n.trim()} is in your collection.`}),t(!1),r(""),s(""),a(""),u(""),f(""),h([]),m([])},onError:P=>{g({title:"Could not save playbook",description:P.message,variant:"destructive"})}}),_=(P,$,T)=>{T(P.includes($)?P.filter(A=>A!==$):[...P,$])},I=n.trim().length>0&&o.trim().length>0;return c.jsx(Fs,{open:e,onOpenChange:t,children:c.jsxs(Fo,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(Uo,{children:[c.jsx(qo,{children:"Register Playbook"}),c.jsxs(Li,{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(Be,{htmlFor:"playbook-title",children:"Title"}),c.jsx(Xe,{id:"playbook-title",placeholder:"Hiring inbox, Ashby API guide…",value:n,onChange:P=>r(P.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Be,{htmlFor:"playbook-triggers",children:"Triggers (comma-separated, max 16)"}),c.jsx(Xe,{id:"playbook-triggers",placeholder:"check inbox, review applicants",value:i,onChange:P=>a(P.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Be,{htmlFor:"playbook-body",children:"Instructions (markdown)"}),c.jsx(_o,{id:"playbook-body",rows:8,placeholder:`# Steps
381
- 1. …
382
- 2. …`,value:o,onChange:P=>s(P.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(Be,{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:k.length===0?c.jsx("p",{className:"text-xs text-gray-500",children:"No API keys registered yet."}):k.map(P=>c.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:p.includes(P.id),onChange:()=>_(p,P.id,h)}),P.label]},P.id))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Be,{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:C.length===0?c.jsx("p",{className:"text-xs text-gray-500",children:"No MCP services registered yet."}):C.map(P=>c.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:y.includes(P.id),onChange:()=>_(y,P.id,m)}),P.name]},P.id))})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Be,{htmlFor:"playbook-exec",children:"Suggested exec (optional)"}),c.jsx(Xe,{id:"playbook-exec",placeholder:"agent-deck exec --connections … -- uv run …",value:l,onChange:P=>u(P.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Be,{htmlFor:"playbook-skill",children:"Skill path hint (optional)"}),c.jsx(Xe,{id:"playbook-skill",placeholder:".cursor/skills/…/SKILL.md",value:d,onChange:P=>f(P.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),c.jsx(ne,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Jr}`,style:Yr(Sr),onClick:()=>j.mutate(),disabled:!I||j.isPending,children:"Save to collection"})]})]})})}async function cu(e){const t=await e.json();if(!t.success)throw new Error(t.error??"Request failed");return t.data}function kk(e){return e.length===0?null:e.length<=3?e.join(", "):`${e.slice(0,3).join(", ")} and ${e.length-3} more`}async function Gg(e){const t=e?`?status=${encodeURIComponent(e)}`:"",n=await _e("GET",`/api/playbook-patches${t}`);return cu(n)}async function a3(e){const t=await _e("GET",`/api/playbook-patches/${e}/preview`);return cu(t)}async function l3(e){const t=await _e("POST",`/api/playbook-patches/${e}/accept`);return cu(t)}async function c3(e,t){const n=await _e("POST",`/api/playbook-patches/${e}/reject`,{reason:t});return cu(n)}async function u3(e){const t=await _e("GET",`/api/playbooks/${e}/events/count`);return cu(t)}async function _0(e){const t=await e.json();if(!t.success)throw new Error(t.error??"Request failed");return t.data}async function iP(e){const t=new URLSearchParams({available:"1"});e&&t.set("playbookId",e);const n=await _e("GET",`/api/feedback-signals/count?${t.toString()}`);return(await _0(n)).open}async function d3(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 _e("GET",`/api/feedback-signals${n}`);return _0(r)}async function f3(e){const t=await _e("POST","/api/feedback-signals/discard",{signalIds:e});return _0(t)}function h3(e){return!!e.linkedPatchId&&e.status==="open"}function Ad(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n")}"`}function p3(e){return e==null||e===""?"null":Ad(e)}function m3(e){return`Propose playbook updates from these Agent Deck feedback signals (copied from the Feedback table).
383
-
384
- For each coherent pattern:
385
- 1. Call \`propose_playbook_patch\` with consolidated item ops (prefer \`add_item\`) — or kind \`create\` when there is no playbook.
386
- 2. Pass **every** consumed row \`id\` in \`signal_ids\` so we can track which feedback is parked / solved.
387
- 3. Do not invent a list-feedback MCP tool. Discard noise in the dashboard.
388
-
389
- Signals (\`id\` required for tracking):
390
-
391
- \`\`\`yaml
392
- ${e.map(n=>{const r=[`- id: ${n.id}`,` playbook: ${p3(n.candidatePlaybookId)}`,` feedback: ${Ad(n.userFeedbackExcerpt)}`,` failure: ${Ad(n.failureSummary)}`];return n.correctedOutputHint&&r.push(` hint: ${Ad(n.correctedOutputHint)}`),n.candidateDeckId&&r.push(` deck: ${n.candidateDeckId}`),r.join(`
393
- `)}).join(`
394
- `)}
395
- \`\`\``}function g3({playbookId:e,open:t,onOpenChange:n}){const{data:r,isLoading:o}=ut({queryKey:e?[`/api/playbooks/${e}`]:["playbook-detail-disabled"],enabled:t&&!!e}),{data:s}=ut({queryKey:[`/api/playbooks/${e}/events/count`],queryFn:()=>u3(e),enabled:t&&!!e}),{data:i}=ut({queryKey:["/api/feedback-signals/count","available",e],queryFn:()=>iP(e),enabled:t&&!!e}),a=r==null?void 0:r.data,l=((a==null?void 0:a.dependencies.missingCredentialIds.length)??0)+((a==null?void 0:a.dependencies.missingServiceIds.length)??0);return c.jsx(Fs,{open:t,onOpenChange:n,children:c.jsxs(Fo,{className:"sm:max-w-6xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(Uo,{children:[c.jsx(qo,{children:(a==null?void 0:a.title)??"Playbook"}),c.jsx(Li,{className:"text-[#A8C4C0]",children:(a==null?void 0:a.id)??e})]}),o||!a?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 s=="number"&&c.jsxs("p",{className:"text-xs text-gray-500",children:["Fetched ",s," time",s===1?"":"s"," (undertriggering signal)",typeof i=="number"&&i>0?` · ${i} open feedback signal${i===1?"":"s"}`:null]}),typeof s!="number"&&typeof i=="number"&&i>0&&c.jsxs("p",{className:"text-xs text-gray-500",children:[i," open feedback signal",i===1?"":"s"]}),a.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:a.triggers.join(", ")})]}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Dependencies"}),a.dependencies.credentials.length===0&&a.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:[a.dependencies.credentials.map(u=>c.jsxs("li",{children:["API key: ",u.label]},u.id)),a.dependencies.services.map(u=>c.jsxs("li",{children:["MCP: ",u.label]},u.id)),a.dependencies.missingCredentialIds.map(u=>c.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[c.jsx(Pr,{className:"w-3 h-3"})," Missing API key: ",u]},u)),a.dependencies.missingServiceIds.map(u=>c.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[c.jsx(Pr,{className:"w-3 h-3"})," Missing MCP: ",u]},u))]})]}),a.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:a.exec})]}),a.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:a.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:a.body})]})]})]})})}function y3({credentialId:e,open:t,onOpenChange:n}){const r=Zt(),{toast:o}=Ht(),[s,i]=b.useState(""),[a,l]=b.useState(""),[u,d]=b.useState(""),{data:f,isLoading:p}=ut({queryKey:e?[`/api/credentials/${e}`]:["credential-detail-disabled"],enabled:t&&!!e}),h=f==null?void 0:f.data;b.useEffect(()=>{h&&(i(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=dt({mutationFn:async()=>{if(!e)throw new Error("No credential selected");const x=s.trim();if(!x)throw new Error("Name is required");const g=a.trim();if(g)try{new URL(g)}catch{throw new Error("Documentation link must be a valid URL")}await _e("PUT",`/api/credentials/${e}`,{label:x,docsUrl:g}),u.trim()&&await _e("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"]}),o({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:x=>{o({title:"Could not save API key",description:x.message,variant:"destructive"})}}),m=s.trim().length>0&&(s.trim()!==(h==null?void 0:h.label)||a.trim()!==((h==null?void 0:h.docsUrl)??"")||u.trim().length>0);return c.jsx(Fs,{open:t,onOpenChange:n,children:c.jsxs(Fo,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(Uo,{children:[c.jsx(qo,{className:"text-[#E8F6F4]",children:(h==null?void 0:h.label)??"API key"}),c.jsx(Li,{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(Pr,{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(Be,{htmlFor:"credential-detail-name",className:"text-[#CFEAE6]",children:"Name"}),c.jsx(Xe,{id:"credential-detail-name",value:s,onChange:x=>i(x.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Be,{htmlFor:"credential-detail-key",className:"text-[#CFEAE6]",children:h.hasSecret?"Rotate API key":"API key"}),c.jsx(Xe,{id:"credential-detail-key",type:"password",placeholder:h.hasSecret?"Leave blank to keep current key":"Paste key from the service dashboard",value:u,onChange:x=>d(x.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(Be,{htmlFor:"credential-detail-docs",className:"text-[#CFEAE6]",children:"Documentation link"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Xe,{id:"credential-detail-docs",type:"url",placeholder:"https://…",value:a,onChange:x=>l(x.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),a.trim()&&c.jsx(ne,{type:"button",variant:"outline",size:"icon",className:"shrink-0 border-white/15 bg-[#0F0F0C] text-[#A8C4C0] hover:bg-white/5",onClick:()=>window.open(a.trim(),"_blank","noopener,noreferrer"),title:"Open documentation",children:c.jsx(Eo,{className:"h-4 w-4"})})]})]}),c.jsx(ne,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Jr}`,style:Yr(In),onClick:()=>y.mutate(),disabled:!m||y.isPending,children:y.isPending?"Saving…":"Save changes"})]})]})})}const v3=_h("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 Xt({className:e,variant:t,...n}){return c.jsx("div",{className:Ne(v3({variant:t}),e),...n})}function aP(e){const t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Lh="Checkbox",[x3,_te]=lo(Lh),[w3,S0]=x3(Lh);function b3(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:s,form:i,name:a,onCheckedChange:l,required:u,value:d="on",internal_do_not_use_render:f}=e,[p,h]=$s({prop:n,defaultProp:o??!1,onChange:l,caller:Lh}),[y,m]=b.useState(null),[x,g]=b.useState(null),v=b.useRef(!1),w=y?!!i||!!y.closest("form"):!0,k={checked:p,disabled:s,setChecked:h,control:y,setControl:m,name:a,form:i,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:Ns(o)?!1:o,isFormControl:w,bubbleInput:x,setBubbleInput:g};return c.jsx(w3,{scope:t,...k,children:k3(f)?f(k):r})}var lP="CheckboxTrigger",cP=b.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:s,value:i,disabled:a,checked:l,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:h,bubbleInput:y}=S0(lP,e),m=Ye(o,d),x=b.useRef(l);return b.useEffect(()=>{const g=s==null?void 0:s.form;if(g){const v=()=>f(x.current);return g.addEventListener("reset",v),()=>g.removeEventListener("reset",v)}},[s,f]),c.jsx(Te.button,{type:"button",role:"checkbox","aria-checked":Ns(l)?"mixed":l,"aria-required":u,"data-state":pP(l),"data-disabled":a?"":void 0,disabled:a,value:i,...r,ref:m,onKeyDown:ve(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:ve(n,g=>{f(v=>Ns(v)?!0:!v),y&&h&&(p.current=g.isPropagationStopped(),p.current||g.stopPropagation())})})});cP.displayName=lP;var C0=b.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:l,onCheckedChange:u,form:d,...f}=e;return c.jsx(b3,{__scopeCheckbox:n,checked:o,defaultChecked:s,disabled:a,required:i,onCheckedChange:u,name:r,form:d,value:l,internal_do_not_use_render:({isFormControl:p})=>c.jsxs(c.Fragment,{children:[c.jsx(cP,{...f,ref:t,__scopeCheckbox:n}),p&&c.jsx(hP,{__scopeCheckbox:n})]})})});C0.displayName=Lh;var uP="CheckboxIndicator",dP=b.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,s=S0(uP,n);return c.jsx(co,{present:r||Ns(s.checked)||s.checked===!0,children:c.jsx(Te.span,{"data-state":pP(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});dP.displayName=uP;var fP="CheckboxBubbleInput",hP=b.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:s,defaultChecked:i,required:a,disabled:l,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:h}=S0(fP,e),y=Ye(n,h),m=aP(s),x=_N(r);b.useEffect(()=>{const v=p;if(!v)return;const w=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(w,"checked").set,j=!o.current;if(m!==s&&C){const _=new Event("click",{bubbles:j});v.indeterminate=Ns(s),C.call(v,Ns(s)?!1:s),v.dispatchEvent(_)}},[p,m,s,o]);const g=b.useRef(Ns(s)?!1:s);return c.jsx(Te.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??g.current,required:a,disabled:l,name:u,value:d,form:f,...t,tabIndex:-1,ref:y,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});hP.displayName=fP;function k3(e){return typeof e=="function"}function Ns(e){return e==="indeterminate"}function pP(e){return Ns(e)?"indeterminate":e?"checked":"unchecked"}const $f=b.forwardRef(({className:e,...t},n)=>c.jsx(C0,{ref:n,className:Ne("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(dP,{className:Ne("flex items-center justify-center text-current"),children:c.jsx(QE,{className:"h-4 w-4"})})}));$f.displayName=C0.displayName;const mP=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{className:"relative w-full overflow-auto",children:c.jsx("table",{ref:n,className:Ne("w-full caption-bottom text-sm",e),...t})}));mP.displayName="Table";const gP=b.forwardRef(({className:e,...t},n)=>c.jsx("thead",{ref:n,className:Ne("[&_tr]:border-b",e),...t}));gP.displayName="TableHeader";const yP=b.forwardRef(({className:e,...t},n)=>c.jsx("tbody",{ref:n,className:Ne("[&_tr:last-child]:border-0",e),...t}));yP.displayName="TableBody";const _3=b.forwardRef(({className:e,...t},n)=>c.jsx("tfoot",{ref:n,className:Ne("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));_3.displayName="TableFooter";const Gi=b.forwardRef(({className:e,...t},n)=>c.jsx("tr",{ref:n,className:Ne("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Gi.displayName="TableRow";const Od=b.forwardRef(({className:e,...t},n)=>c.jsx("th",{ref:n,className:Ne("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Od.displayName="TableHead";const Qs=b.forwardRef(({className:e,...t},n)=>c.jsx("td",{ref:n,className:Ne("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Qs.displayName="TableCell";const S3=b.forwardRef(({className:e,...t},n)=>c.jsx("caption",{ref:n,className:Ne("mt-4 text-sm text-muted-foreground",e),...t}));S3.displayName="TableCaption";function C3(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const E3=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,N3=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,j3={};function _k(e,t){return(j3.jsx?N3:E3).test(e)}const P3=/[ \t\n\f\r]/g;function T3(e){return typeof e=="object"?e.type==="text"?Sk(e.value):!1:Sk(e)}function Sk(e){return e.replace(P3,"")===""}class uu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}uu.prototype.normal={};uu.prototype.property={};uu.prototype.space=void 0;function vP(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new uu(n,r,t)}function Jg(e){return e.toLowerCase()}class Un{constructor(t,n){this.attribute=n,this.property=t}}Un.prototype.attribute="";Un.prototype.booleanish=!1;Un.prototype.boolean=!1;Un.prototype.commaOrSpaceSeparated=!1;Un.prototype.commaSeparated=!1;Un.prototype.defined=!1;Un.prototype.mustUseProperty=!1;Un.prototype.number=!1;Un.prototype.overloadedBoolean=!1;Un.prototype.property="";Un.prototype.spaceSeparated=!1;Un.prototype.space=void 0;let $3=0;const Pe=zi(),Ot=zi(),Yg=zi(),X=zi(),nt=zi(),xi=zi(),Vn=zi();function zi(){return 2**++$3}const Xg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pe,booleanish:Ot,commaOrSpaceSeparated:Vn,commaSeparated:xi,number:X,overloadedBoolean:Yg,spaceSeparated:nt},Symbol.toStringTag,{value:"Module"})),Jp=Object.keys(Xg);class E0 extends Un{constructor(t,n,r,o){let s=-1;if(super(t,n),Ck(this,"space",o),typeof r=="number")for(;++s<Jp.length;){const i=Jp[s];Ck(this,Jp[s],(r&Xg[i])===Xg[i])}}}E0.prototype.defined=!0;function Ck(e,t,n){n&&(e[t]=n)}function vl(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new E0(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Jg(r)]=r,n[Jg(s.attribute)]=r}return new uu(t,n,e.space)}const xP=vl({properties:{ariaActiveDescendant:null,ariaAtomic:Ot,ariaAutoComplete:null,ariaBusy:Ot,ariaChecked:Ot,ariaColCount:X,ariaColIndex:X,ariaColSpan:X,ariaControls:nt,ariaCurrent:null,ariaDescribedBy:nt,ariaDetails:null,ariaDisabled:Ot,ariaDropEffect:nt,ariaErrorMessage:null,ariaExpanded:Ot,ariaFlowTo:nt,ariaGrabbed:Ot,ariaHasPopup:null,ariaHidden:Ot,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:nt,ariaLevel:X,ariaLive:null,ariaModal:Ot,ariaMultiLine:Ot,ariaMultiSelectable:Ot,ariaOrientation:null,ariaOwns:nt,ariaPlaceholder:null,ariaPosInSet:X,ariaPressed:Ot,ariaReadOnly:Ot,ariaRelevant:null,ariaRequired:Ot,ariaRoleDescription:nt,ariaRowCount:X,ariaRowIndex:X,ariaRowSpan:X,ariaSelected:Ot,ariaSetSize:X,ariaSort:null,ariaValueMax:X,ariaValueMin:X,ariaValueNow:X,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function wP(e,t){return t in e?e[t]:t}function bP(e,t){return wP(e,t.toLowerCase())}const R3=vl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xi,acceptCharset:nt,accessKey:nt,action:null,allow:null,allowFullScreen:Pe,allowPaymentRequest:Pe,allowUserMedia:Pe,alpha:Pe,alt:null,as:null,async:Pe,autoCapitalize:null,autoComplete:nt,autoFocus:Pe,autoPlay:Pe,blocking:nt,capture:null,charSet:null,checked:Pe,cite:null,className:nt,closedBy:null,colorSpace:null,cols:X,colSpan:X,command:null,commandFor:null,content:null,contentEditable:Ot,controls:Pe,controlsList:nt,coords:X|xi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pe,defer:Pe,dir:null,dirName:null,disabled:Pe,download:Yg,draggable:Ot,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pe,formTarget:null,headers:nt,height:X,hidden:Yg,high:X,href:null,hrefLang:null,htmlFor:nt,httpEquiv:nt,id:null,imageSizes:null,imageSrcSet:null,inert:Pe,inputMode:null,integrity:null,is:null,isMap:Pe,itemId:null,itemProp:nt,itemRef:nt,itemScope:Pe,itemType:nt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pe,low:X,manifest:null,max:null,maxLength:X,media:null,method:null,min:null,minLength:X,multiple:Pe,muted:Pe,name:null,nonce:null,noModule:Pe,noValidate:Pe,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:Pe,optimum:X,pattern:null,ping:nt,placeholder:null,playsInline:Pe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pe,referrerPolicy:null,rel:nt,required:Pe,reversed:Pe,rows:X,rowSpan:X,sandbox:nt,scope:null,scoped:Pe,seamless:Pe,selected:Pe,shadowRootClonable:Pe,shadowRootCustomElementRegistry:Pe,shadowRootDelegatesFocus:Pe,shadowRootMode:null,shadowRootSerializable:Pe,shape:null,size:X,sizes:null,slot:null,span:X,spellCheck:Ot,src:null,srcDoc:null,srcLang:null,srcSet:null,start:X,step:null,style:null,tabIndex:X,target:null,title:null,translate:null,type:null,typeMustMatch:Pe,useMap:null,value:Ot,width:X,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:nt,axis:null,background:null,bgColor:null,border:X,borderColor:null,bottomMargin:X,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Pe,declare:Pe,event:null,face:null,frame:null,frameBorder:null,hSpace:X,leftMargin:X,link:null,longDesc:null,lowSrc:null,marginHeight:X,marginWidth:X,noResize:Pe,noHref:Pe,noShade:Pe,noWrap:Pe,object:null,profile:null,prompt:null,rev:null,rightMargin:X,rules:null,scheme:null,scrolling:Ot,standby:null,summary:null,text:null,topMargin:X,valueType:null,version:null,vAlign:null,vLink:null,vSpace:X,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Pe,disablePictureInPicture:Pe,disableRemotePlayback:Pe,exportParts:xi,part:nt,prefix:null,property:null,results:X,security:null,unselectable:null},space:"html",transform:bP}),I3=vl({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:Vn,accentHeight:X,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:X,amplitude:X,arabicForm:null,ascent:X,attributeName:null,attributeType:null,azimuth:X,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:X,by:null,calcMode:null,capHeight:X,className:nt,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:X,diffuseConstant:X,direction:null,display:null,dur:null,divisor:X,dominantBaseline:null,download:Pe,dx:null,dy:null,edgeMode:null,editable:null,elevation:X,enableBackground:null,end:null,event:null,exponent:X,externalResourcesRequired:null,fill:null,fillOpacity:X,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:xi,g2:xi,glyphName:xi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:X,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:X,horizOriginX:X,horizOriginY:X,id:null,ideographic:X,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:X,k:X,k1:X,k2:X,k3:X,k4:X,kernelMatrix:Vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:X,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:X,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:X,overlineThickness:X,paintOrder:null,panose1:null,path:null,pathLength:X,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:nt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:X,pointsAtY:X,pointsAtZ:X,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vn,rev:Vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vn,requiredFeatures:Vn,requiredFonts:Vn,requiredFormats:Vn,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:X,specularExponent:X,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:X,strikethroughThickness:X,string:null,stroke:null,strokeDashArray:Vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:X,strokeOpacity:X,strokeWidth:null,style:null,surfaceScale:X,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vn,tabIndex:X,tableValues:null,target:null,targetX:X,targetY:X,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:X,underlineThickness:X,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:X,values:null,vAlphabetic:X,vMathematical:X,vectorEffect:null,vHanging:X,vIdeographic:X,version:null,vertAdvY:X,vertOriginX:X,vertOriginY:X,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:X,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:wP}),kP=vl({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()}}),_P=vl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:bP}),SP=vl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),A3={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"},O3=/[A-Z]/g,Ek=/-[a-z]/g,M3=/^data[-\w.:]+$/i;function D3(e,t){const n=Jg(t);let r=t,o=Un;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&M3.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Ek,z3);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Ek.test(s)){let i=s.replace(O3,L3);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=E0}return new o(r,t)}function L3(e){return"-"+e.toLowerCase()}function z3(e){return e.charAt(1).toUpperCase()}const F3=vP([xP,R3,kP,_P,SP],"html"),N0=vP([xP,I3,kP,_P,SP],"svg");function U3(e){return e.join(" ").trim()}var j0={},Nk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,q3=/\n/g,V3=/^\s*/,H3=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,B3=/^:\s*/,K3=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,W3=/^[;\s]*/,Z3=/^\s+|\s+$/g,Q3=`
396
- `,jk="/",Pk="*",Xs="",G3="comment",J3="declaration";function Y3(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 o(y){var m=y.match(q3);m&&(n+=m.length);var x=y.lastIndexOf(Q3);r=~x?y.length-x:r+y.length}function s(){var y={line:n,column:r};return function(m){return m.position=new i(y),u(),m}}function i(y){this.start=y,this.end={line:n,column:r},this.source=t.source}i.prototype.content=e;function a(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 x=m[0];return o(x),e=e.slice(x.length),m}}function u(){l(V3)}function d(y){var m;for(y=y||[];m=f();)m!==!1&&y.push(m);return y}function f(){var y=s();if(!(jk!=e.charAt(0)||Pk!=e.charAt(1))){for(var m=2;Xs!=e.charAt(m)&&(Pk!=e.charAt(m)||jk!=e.charAt(m+1));)++m;if(m+=2,Xs===e.charAt(m-1))return a("End of comment missing");var x=e.slice(2,m-2);return r+=2,o(x),e=e.slice(m),r+=2,y({type:G3,comment:x})}}function p(){var y=s(),m=l(H3);if(m){if(f(),!l(B3))return a("property missing ':'");var x=l(K3),g=y({type:J3,property:Tk(m[0].replace(Nk,Xs)),value:x?Tk(x[0].replace(Nk,Xs)):Xs});return l(W3),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 Tk(e){return e?e.replace(Z3,Xs):Xs}var X3=Y3,e5=Zd&&Zd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j0,"__esModule",{value:!0});j0.default=n5;const t5=e5(X3);function n5(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,t5.default)(e),o=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:i,value:a}=s;o?t(i,a,s):a&&(n=n||{},n[i]=a)}),n}var zh={};Object.defineProperty(zh,"__esModule",{value:!0});zh.camelCase=void 0;var r5=/^--[a-zA-Z0-9_-]+$/,o5=/-([a-z])/g,s5=/^[^-]+$/,i5=/^-(webkit|moz|ms|o|khtml)-/,a5=/^-(ms)-/,l5=function(e){return!e||s5.test(e)||r5.test(e)},c5=function(e,t){return t.toUpperCase()},$k=function(e,t){return"".concat(t,"-")},u5=function(e,t){return t===void 0&&(t={}),l5(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(a5,$k):e=e.replace(i5,$k),e.replace(o5,c5))};zh.camelCase=u5;var d5=Zd&&Zd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},f5=d5(j0),h5=zh;function ey(e,t){var n={};return!e||typeof e!="string"||(0,f5.default)(e,function(r,o){r&&o&&(n[(0,h5.camelCase)(r,t)]=o)}),n}ey.default=ey;var p5=ey;const m5=ll(p5),CP=EP("end"),P0=EP("start");function EP(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 g5(e){const t=P0(e),n=CP(e);if(t&&n)return{start:t,end:n}}function cc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Rk(e.position):"start"in e||"end"in e?Rk(e):"line"in e||"column"in e?ty(e):""}function ty(e){return Ik(e&&e.line)+":"+Ik(e&&e.column)}function Rk(e){return ty(e&&e.start)+"-"+ty(e&&e.end)}function Ik(e){return e&&typeof e=="number"?e:1}class mn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",s={},i=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?o=t:!s.cause&&t&&(i=!0,o=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=cc(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}mn.prototype.file="";mn.prototype.name="";mn.prototype.reason="";mn.prototype.message="";mn.prototype.stack="";mn.prototype.column=void 0;mn.prototype.line=void 0;mn.prototype.ancestors=void 0;mn.prototype.cause=void 0;mn.prototype.fatal=void 0;mn.prototype.place=void 0;mn.prototype.ruleId=void 0;mn.prototype.source=void 0;const T0={}.hasOwnProperty,y5=new Map,v5=/[A-Z]/g,x5=new Set(["table","tbody","thead","tfoot","tr"]),w5=new Set(["td","th"]),NP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function b5(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=P5(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=j5(n,t.jsx,t.jsxs)}const o={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"?N0:F3,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=jP(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function jP(e,t,n){if(t.type==="element")return k5(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return _5(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return C5(e,t,n);if(t.type==="mdxjsEsm")return S5(e,t);if(t.type==="root")return E5(e,t,n);if(t.type==="text")return N5(e,t)}function k5(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=N0,e.schema=o),e.ancestors.push(t);const s=TP(e,t.tagName,!1),i=T5(e,t);let a=R0(e,t);return x5.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!T3(l):!0})),PP(e,i,s,t),$0(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function _5(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)}Uc(e,t.position)}function S5(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Uc(e,t.position)}function C5(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=N0,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:TP(e,t.name,!0),i=$5(e,t),a=R0(e,t);return PP(e,i,s,t),$0(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function E5(e,t,n){const r={};return $0(r,R0(e,t)),e.create(t,e.Fragment,r,n)}function N5(e,t){return t.value}function PP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function j5(e,t,n){return r;function r(o,s,i,a){const u=Array.isArray(i.children)?n:t;return a?u(s,i,a):u(s,i)}}function P5(e,t){return n;function n(r,o,s,i){const a=Array.isArray(s.children),l=P0(r);return t(o,s,i,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function T5(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&T0.call(t.properties,o)){const s=R5(e,o,t.properties[o]);if(s){const[i,a]=s;e.tableCellAlignToStyle&&i==="align"&&typeof a=="string"&&w5.has(t.tagName)?r=a:n[i]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function $5(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const i=s.expression;i.type;const a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Uc(e,t.position);else{const o=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else Uc(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function R0(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:y5;for(;++r<t.children.length;){const s=t.children[r];let i;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const u=o.get(l)||0;i=l+"-"+u,o.set(l,u+1)}}const a=jP(e,s,i);a!==void 0&&n.push(a)}return n}function R5(e,t,n){const r=D3(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?C3(n):U3(n)),r.property==="style"){let o=typeof n=="object"?n:I5(e,String(n));return e.stylePropertyNameCase==="css"&&(o=A5(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?A3[r.property]||r.property:r.attribute,n]}}function I5(e,t){try{return m5(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new mn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=NP+"#cannot-parse-style-attribute",o}}function TP(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let s=-1,i;for(;++s<o.length;){const a=_k(o[s])?{type:"Identifier",name:o[s]}:{type:"Literal",value:o[s]};i=i?{type:"MemberExpression",object:i,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=i}else r=_k(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return T0.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Uc(e)}function Uc(e,t){const n=new mn("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=NP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function A5(e){const t={};let n;for(n in e)T0.call(e,n)&&(t[O5(n)]=e[n]);return t}function O5(e){let t=e.replace(v5,M5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function M5(e){return"-"+e.toLowerCase()}const Yp={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"]},D5={};function I0(e,t){const n=D5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return $P(e,r,o)}function $P(e,t,n){if(L5(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 Ak(e.children,t,n)}return Array.isArray(e)?Ak(e,t,n):""}function Ak(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=$P(e[o],t,n);return r.join("")}function L5(e){return!!(e&&typeof e=="object")}const Ok=document.createElement("i");function A0(e){const t="&"+e+";";Ok.innerHTML=t;const n=Ok.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Gn(e,t,n,r){const o=e.length;let s=0,i;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function ur(e,t){return e.length>0?(Gn(e,e.length,0,t),e):t}const Mk={}.hasOwnProperty;function RP(e){const t={};let n=-1;for(;++n<e.length;)z5(t,e[n]);return t}function z5(e,t){let n;for(n in t){const o=(Mk.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){Mk.call(o,i)||(o[i]=[]);const a=s[i];F5(o[i],Array.isArray(a)?a:a?[a]:[])}}}function F5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Gn(e,0,0,r)}function IP(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 Ar(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const _n=Us(/[A-Za-z]/),hn=Us(/[\dA-Za-z]/),U5=Us(/[#-'*+\--9=?A-Z^-~]/);function Rf(e){return e!==null&&(e<32||e===127)}const ny=Us(/\d/),q5=Us(/[\dA-Fa-f]/),V5=Us(/[!-/:-@[-`{-~]/);function be(e){return e!==null&&e<-2}function ot(e){return e!==null&&(e<0||e===32)}function qe(e){return e===-2||e===-1||e===32}const Fh=Us(new RegExp("\\p{P}|\\p{S}","u")),Ti=Us(/\s/);function Us(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function xl(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&&hn(e.charCodeAt(n+1))&&hn(e.charCodeAt(n+2)))o=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),o=1):i="�"}else i=String.fromCharCode(s);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+o+1,i=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function We(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(l){return qe(l)?(e.enter(n),a(l)):t(l)}function a(l){return qe(l)&&s++<o?(e.consume(l),a):(e.exit(n),t(l))}}const H5={tokenize:B5};function B5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),We(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),s(a)}function s(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,i(a)}function i(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return be(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),i)}}const K5={tokenize:W5},Dk={tokenize:Z5};function W5(e){const t=this,n=[];let r=0,o,s,i;return a;function a(w){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&v();const k=t.events.length;let C=k,j;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){j=t.events[C][1].end;break}g(r);let _=k;for(;_<t.events.length;)t.events[_][1].end={...j},_++;return Gn(t.events,C+1,0,t.events.slice(k)),t.events.length=_,u(w)}return a(w)}function u(w){if(r===n.length){if(!o)return p(w);if(o.currentConstruct&&o.currentConstruct.concrete)return y(w);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Dk,d,f)(w)}function d(w){return o&&v(),g(r),p(w)}function f(w){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,y(w)}function p(w){return t.containerState={},e.attempt(Dk,h,y)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function y(w){if(w===null){o&&v(),g(0),e.consume(w);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:s}),m(w)}function m(w){if(w===null){x(e.exit("chunkFlow"),!0),g(0),e.consume(w);return}return be(w)?(e.consume(w),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),m)}function x(w,k){const C=t.sliceStream(w);if(k&&C.push(null),w.previous=s,s&&(s.next=w),s=w,o.defineSkip(w.start),o.write(C),t.parser.lazy[w.start.line]){let j=o.events.length;for(;j--;)if(o.events[j][1].start.offset<i&&(!o.events[j][1].end||o.events[j][1].end.offset>i))return;const _=t.events.length;let I=_,P,$;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(P){$=t.events[I][1].end;break}P=!0}for(g(r),j=_;j<t.events.length;)t.events[j][1].end={...$},j++;Gn(t.events,I+1,0,t.events.slice(_)),t.events.length=j}}function g(w){let k=n.length;for(;k-- >w;){const C=n[k];t.containerState=C[1],C[0].exit.call(t,e)}n.length=w}function v(){o.write([null]),s=void 0,o=void 0,t.containerState._closeFlow=void 0}}function Z5(e,t,n){return We(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function rl(e){if(e===null||ot(e)||Ti(e))return 1;if(Fh(e))return 2}function Uh(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const s=e[o].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const ry={name:"attention",resolveAll:Q5,tokenize:G5};function Q5(e,t){let n=-1,r,o,s,i,a,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};Lk(f,-l),Lk(p,l),i={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:l>1?"strong":"emphasis",start:{...i.start},end:{...a.end}},e[r][1].end={...i.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ur(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ur(u,[["enter",o,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=ur(u,Uh(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ur(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=ur(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Gn(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 G5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=rl(r);let s;return i;function i(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const u=e.exit("attentionSequence"),d=rl(l),f=!d||d===2&&o||n.includes(l),p=!o||o===2&&d||n.includes(r);return u._open=!!(s===42?f:f&&(o||!p)),u._close=!!(s===42?p:p&&(d||!f)),t(l)}}function Lk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const J5={name:"autolink",tokenize:Y5};function Y5(e,t,n){let r=0;return o;function o(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(h){return _n(h)?(e.consume(h),i):h===64?n(h):u(h)}function i(h){return h===43||h===45||h===46||hn(h)?(r=1,a(h)):u(h)}function a(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||hn(h))&&r++<32?(e.consume(h),a):(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||Rf(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),d):U5(h)?(e.consume(h),u):n(h)}function d(h){return hn(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||hn(h))&&r++<63){const y=h===45?p:f;return e.consume(h),y}return n(h)}}const du={partial:!0,tokenize:X5};function X5(e,t,n){return r;function r(s){return qe(s)?We(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||be(s)?t(s):n(s)}}const AP={continuation:{tokenize:tU},exit:nU,name:"blockQuote",tokenize:eU};function eU(e,t,n){const r=this;return o;function o(i){if(i===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)}function s(i){return qe(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function tU(e,t,n){const r=this;return o;function o(i){return qe(i)?We(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(AP,t,n)(i)}}function nU(e){e.exit("blockQuote")}const OP={name:"characterEscape",tokenize:rU};function rU(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),o}function o(s){return V5(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const MP={name:"characterReference",tokenize:oU};function oU(e,t,n){const r=this;let o=0,s,i;return a;function a(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"),s=31,i=hn,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,i=q5,d):(e.enter("characterReferenceValue"),s=7,i=ny,d(f))}function d(f){if(f===59&&o){const p=e.exit("characterReferenceValue");return i===hn&&!A0(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(f)&&o++<s?(e.consume(f),d):n(f)}}const zk={partial:!0,tokenize:iU},Fk={concrete:!0,name:"codeFenced",tokenize:sU};function sU(e,t,n){const r=this,o={partial:!0,tokenize:C};let s=0,i=0,a;return l;function l(j){return u(j)}function u(j){const _=r.events[r.events.length-1];return s=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,a=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(j)}function d(j){return j===a?(i++,e.consume(j),d):i<3?n(j):(e.exit("codeFencedFenceSequence"),qe(j)?We(e,f,"whitespace")(j):f(j))}function f(j){return j===null||be(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(zk,m,k)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(j))}function p(j){return j===null||be(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):qe(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),We(e,h,"whitespace")(j)):j===96&&j===a?n(j):(e.consume(j),p)}function h(j){return j===null||be(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===null||be(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===a?n(j):(e.consume(j),y)}function m(j){return e.attempt(o,k,x)(j)}function x(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),g}function g(j){return s>0&&qe(j)?We(e,v,"linePrefix",s+1)(j):v(j)}function v(j){return j===null||be(j)?e.check(zk,m,k)(j):(e.enter("codeFlowValue"),w(j))}function w(j){return j===null||be(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),w)}function k(j){return e.exit("codeFenced"),t(j)}function C(j,_,I){let P=0;return $;function $(D){return j.enter("lineEnding"),j.consume(D),j.exit("lineEnding"),T}function T(D){return j.enter("codeFencedFence"),qe(D)?We(j,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):A(D)}function A(D){return D===a?(j.enter("codeFencedFenceSequence"),U(D)):I(D)}function U(D){return D===a?(P++,j.consume(D),U):P>=i?(j.exit("codeFencedFenceSequence"),qe(D)?We(j,z,"whitespace")(D):z(D)):I(D)}function z(D){return D===null||be(D)?(j.exit("codeFencedFence"),_(D)):I(D)}}}function iU(e,t,n){const r=this;return o;function o(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const Xp={name:"codeIndented",tokenize:lU},aU={partial:!0,tokenize:cU};function lU(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),We(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?l(u):be(u)?e.attempt(aU,i,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||be(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function cU(e,t,n){const r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):be(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):We(e,s,"linePrefix",5)(i)}function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):be(i)?o(i):n(i)}}const uU={name:"codeText",previous:fU,resolve:dU,tokenize:hU};function dU(e){let t=e.length-4,n=3,r,o;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;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function fU(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function hU(e,t,n){let r=0,o,s;return i;function i(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),r++,a):(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?(s=e.enter("codeTextSequence"),o=0,d(f)):be(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||be(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",u(f))}}class pU{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 o=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&Ol(this.left,r),s.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),Ol(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ol(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);Ol(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ol(this.left,n.reverse())}}}function Ol(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 DP(e){const t={};let n=-1,r,o,s,i,a,l,u;const d=new pU(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,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,mU(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,o=void 0;s--;)if(i=d.get(s),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),i[1].type="lineEnding",o=s);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;o&&(r[1].end={...d.get(o)[1].start},a=d.slice(o,n),a.unshift(r),d.splice(o,n-o+1,a))}}return Gn(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function mU(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const s=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const a=i.events,l=[],u={};let d,f,p=-1,h=n,y=0,m=0;const x=[m];for(;h;){for(;e.get(++o)[1]!==h;);s.push(o),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),f&&i.defineSkip(h.start),h._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),h._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(m=p+1,x.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(i.events=[],h?(h._tokenizer=void 0,h.previous=void 0):x.pop(),p=x.length;p--;){const g=a.slice(x[p],x[p+1]),v=s.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 gU={resolve:vU,tokenize:xU},yU={partial:!0,tokenize:wU};function vU(e){return DP(e),e}function xU(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?s(a):be(a)?e.check(yU,i,s)(a):(e.consume(a),o)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function i(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function wU(e,t,n){const r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),We(e,s,"linePrefix")}function s(i){if(i===null||be(i))return n(i);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function LP(e,t,n,r,o,s,i,a,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(g),e.exit(s),p):g===null||g===32||g===41||Rf(g)?n(g):(e.enter(r),e.enter(i),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(g))}function p(g){return g===62?(e.enter(s),e.consume(g),e.exit(s),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(a),p(g)):g===null||g===60||be(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||ot(g))?(e.exit("chunkString"),e.exit(a),e.exit(i),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||Rf(g)?n(g):(e.consume(g),g===92?x:m)}function x(g){return g===40||g===41||g===92?(e.consume(g),m):m(g)}}function zP(e,t,n,r,o,s){const i=this;let a=0,l;return u;function u(h){return e.enter(r),e.enter(o),e.consume(h),e.exit(o),e.enter(s),d}function d(h){return a>999||h===null||h===91||h===93&&!l||h===94&&!a&&"_hiddenFootnoteSupport"in i.parser.constructs?n(h):h===93?(e.exit(s),e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):be(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||be(h)||a++>999?(e.exit("chunkString"),d(h)):(e.consume(h),l||(l=!qe(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),a++,f):f(h)}}function FP(e,t,n,r,o,s){let i;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(o),e.consume(p),e.exit(o),i=p===40?41:p,l):n(p)}function l(p){return p===i?(e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):(e.enter(s),u(p))}function u(p){return p===i?(e.exit(s),l(i)):p===null?n(p):be(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),We(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===i||p===null||be(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:d)}function f(p){return p===i||p===92?(e.consume(p),d):d(p)}}function uc(e,t){let n;return r;function r(o){return be(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):qe(o)?We(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const bU={name:"definition",tokenize:_U},kU={partial:!0,tokenize:SU};function _U(e,t,n){const r=this;let o;return s;function s(h){return e.enter("definition"),i(h)}function i(h){return zP.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return o=Ar(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 ot(h)?uc(e,u)(h):u(h)}function u(h){return LP(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(kU,f,f)(h)}function f(h){return qe(h)?We(e,p,"whitespace")(h):p(h)}function p(h){return h===null||be(h)?(e.exit("definition"),r.parser.defined.push(o),t(h)):n(h)}}function SU(e,t,n){return r;function r(a){return ot(a)?uc(e,o)(a):n(a)}function o(a){return FP(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return qe(a)?We(e,i,"whitespace")(a):i(a)}function i(a){return a===null||be(a)?t(a):n(a)}}const CU={name:"hardBreakEscape",tokenize:EU};function EU(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return be(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const NU={name:"headingAtx",resolve:jU,tokenize:PU};function jU(e,t){let n=e.length-2,r=3,o,s;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&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Gn(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function PU(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),i(d)}function i(d){return d===35&&r++<6?(e.consume(d),i):d===null||ot(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||be(d)?(e.exit("atxHeading"),t(d)):qe(d)?We(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||ot(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const TU=["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"],Uk=["pre","script","style","textarea"],$U={concrete:!0,name:"htmlFlow",resolveTo:AU,tokenize:OU},RU={partial:!0,tokenize:DU},IU={partial:!0,tokenize:MU};function AU(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 OU(e,t,n){const r=this;let o,s,i,a,l;return u;function u(S){return d(S)}function d(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),f}function f(S){return S===33?(e.consume(S),p):S===47?(e.consume(S),s=!0,m):S===63?(e.consume(S),o=3,r.interrupt?t:N):_n(S)?(e.consume(S),i=String.fromCharCode(S),x):n(S)}function p(S){return S===45?(e.consume(S),o=2,h):S===91?(e.consume(S),o=5,a=0,y):_n(S)?(e.consume(S),o=4,r.interrupt?t:N):n(S)}function h(S){return S===45?(e.consume(S),r.interrupt?t:N):n(S)}function y(S){const E="CDATA[";return S===E.charCodeAt(a++)?(e.consume(S),a===E.length?r.interrupt?t:A:y):n(S)}function m(S){return _n(S)?(e.consume(S),i=String.fromCharCode(S),x):n(S)}function x(S){if(S===null||S===47||S===62||ot(S)){const E=S===47,R=i.toLowerCase();return!E&&!s&&Uk.includes(R)?(o=1,r.interrupt?t(S):A(S)):TU.includes(i.toLowerCase())?(o=6,E?(e.consume(S),g):r.interrupt?t(S):A(S)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):s?v(S):w(S))}return S===45||hn(S)?(e.consume(S),i+=String.fromCharCode(S),x):n(S)}function g(S){return S===62?(e.consume(S),r.interrupt?t:A):n(S)}function v(S){return qe(S)?(e.consume(S),v):$(S)}function w(S){return S===47?(e.consume(S),$):S===58||S===95||_n(S)?(e.consume(S),k):qe(S)?(e.consume(S),w):$(S)}function k(S){return S===45||S===46||S===58||S===95||hn(S)?(e.consume(S),k):C(S)}function C(S){return S===61?(e.consume(S),j):qe(S)?(e.consume(S),C):w(S)}function j(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),l=S,_):qe(S)?(e.consume(S),j):I(S)}function _(S){return S===l?(e.consume(S),l=null,P):S===null||be(S)?n(S):(e.consume(S),_)}function I(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||ot(S)?C(S):(e.consume(S),I)}function P(S){return S===47||S===62||qe(S)?w(S):n(S)}function $(S){return S===62?(e.consume(S),T):n(S)}function T(S){return S===null||be(S)?A(S):qe(S)?(e.consume(S),T):n(S)}function A(S){return S===45&&o===2?(e.consume(S),Z):S===60&&o===1?(e.consume(S),B):S===62&&o===4?(e.consume(S),O):S===63&&o===3?(e.consume(S),N):S===93&&o===5?(e.consume(S),H):be(S)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(RU,V,U)(S)):S===null||be(S)?(e.exit("htmlFlowData"),U(S)):(e.consume(S),A)}function U(S){return e.check(IU,z,V)(S)}function z(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),D}function D(S){return S===null||be(S)?U(S):(e.enter("htmlFlowData"),A(S))}function Z(S){return S===45?(e.consume(S),N):A(S)}function B(S){return S===47?(e.consume(S),i="",q):A(S)}function q(S){if(S===62){const E=i.toLowerCase();return Uk.includes(E)?(e.consume(S),O):A(S)}return _n(S)&&i.length<8?(e.consume(S),i+=String.fromCharCode(S),q):A(S)}function H(S){return S===93?(e.consume(S),N):A(S)}function N(S){return S===62?(e.consume(S),O):S===45&&o===2?(e.consume(S),N):A(S)}function O(S){return S===null||be(S)?(e.exit("htmlFlowData"),V(S)):(e.consume(S),O)}function V(S){return e.exit("htmlFlow"),t(S)}}function MU(e,t,n){const r=this;return o;function o(i){return be(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function DU(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(du,t,n)}}const LU={name:"htmlText",tokenize:zU};function zU(e,t,n){const r=this;let o,s,i;return a;function a(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),C):N===63?(e.consume(N),w):_n(N)?(e.consume(N),I):n(N)}function u(N){return N===45?(e.consume(N),d):N===91?(e.consume(N),s=0,y):_n(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):be(N)?(i=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?Z(N):N===45?p(N):f(N)}function y(N){const O="CDATA[";return N===O.charCodeAt(s++)?(e.consume(N),s===O.length?m:y):n(N)}function m(N){return N===null?n(N):N===93?(e.consume(N),x):be(N)?(i=m,B(N)):(e.consume(N),m)}function x(N){return N===93?(e.consume(N),g):m(N)}function g(N){return N===62?Z(N):N===93?(e.consume(N),g):m(N)}function v(N){return N===null||N===62?Z(N):be(N)?(i=v,B(N)):(e.consume(N),v)}function w(N){return N===null?n(N):N===63?(e.consume(N),k):be(N)?(i=w,B(N)):(e.consume(N),w)}function k(N){return N===62?Z(N):w(N)}function C(N){return _n(N)?(e.consume(N),j):n(N)}function j(N){return N===45||hn(N)?(e.consume(N),j):_(N)}function _(N){return be(N)?(i=_,B(N)):qe(N)?(e.consume(N),_):Z(N)}function I(N){return N===45||hn(N)?(e.consume(N),I):N===47||N===62||ot(N)?P(N):n(N)}function P(N){return N===47?(e.consume(N),Z):N===58||N===95||_n(N)?(e.consume(N),$):be(N)?(i=P,B(N)):qe(N)?(e.consume(N),P):Z(N)}function $(N){return N===45||N===46||N===58||N===95||hn(N)?(e.consume(N),$):T(N)}function T(N){return N===61?(e.consume(N),A):be(N)?(i=T,B(N)):qe(N)?(e.consume(N),T):P(N)}function A(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),o=N,U):be(N)?(i=A,B(N)):qe(N)?(e.consume(N),A):(e.consume(N),z)}function U(N){return N===o?(e.consume(N),o=void 0,D):N===null?n(N):be(N)?(i=U,B(N)):(e.consume(N),U)}function z(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||ot(N)?P(N):(e.consume(N),z)}function D(N){return N===47||N===62||ot(N)?P(N):n(N)}function Z(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"),q}function q(N){return qe(N)?We(e,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):H(N)}function H(N){return e.enter("htmlTextData"),i(N)}}const O0={name:"labelEnd",resolveAll:VU,resolveTo:HU,tokenize:BU},FU={tokenize:KU},UU={tokenize:WU},qU={tokenize:ZU};function VU(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 o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Gn(e,0,e.length,n),e}function HU(e,t){let n=e.length,r=0,o,s,i,a;for(;n--;)if(o=e[n][1],s){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(s=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(i=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[i-2][1].start}};return a=[["enter",l,t],["enter",u,t]],a=ur(a,e.slice(s+1,s+r+3)),a=ur(a,[["enter",d,t]]),a=ur(a,Uh(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),a=ur(a,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),a=ur(a,e.slice(i+1)),a=ur(a,[["exit",l,t]]),Gn(e,s,e.length,a),e}function BU(e,t,n){const r=this;let o=r.events.length,s,i;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){s=r.events[o][1];break}return a;function a(p){return s?s._inactive?f(p):(i=r.parser.defined.includes(Ar(r.sliceSerialize({start:s.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(FU,d,i?d:f)(p):p===91?e.attempt(UU,d,i?u:f)(p):i?d(p):f(p)}function u(p){return e.attempt(qU,d,f)(p)}function d(p){return t(p)}function f(p){return s._balanced=!0,n(p)}}function KU(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),o}function o(f){return ot(f)?uc(e,s)(f):s(f)}function s(f){return f===41?d(f):LP(e,i,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function i(f){return ot(f)?uc(e,l)(f):d(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?FP(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return ot(f)?uc(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 WU(e,t,n){const r=this;return o;function o(a){return zP.call(r,e,s,i,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function i(a){return n(a)}}function ZU(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),o}function o(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const QU={name:"labelStartImage",resolveAll:O0.resolveAll,tokenize:GU};function GU(e,t,n){const r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),i):n(a)}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const JU={name:"labelStartLink",resolveAll:O0.resolveAll,tokenize:YU};function YU(e,t,n){const r=this;return o;function o(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s}function s(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}const em={name:"lineEnding",tokenize:XU};function XU(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),We(e,t,"linePrefix")}}const Md={name:"thematicBreak",tokenize:e9};function e9(e,t,n){let r=0,o;return s;function s(u){return e.enter("thematicBreak"),i(u)}function i(u){return o=u,a(u)}function a(u){return u===o?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||be(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===o?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),qe(u)?We(e,a,"whitespace")(u):a(u))}}const Pn={continuation:{tokenize:o9},exit:i9,name:"list",tokenize:r9},t9={partial:!0,tokenize:a9},n9={partial:!0,tokenize:s9};function r9(e,t,n){const r=this,o=r.events[r.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,i=0;return a;function a(h){const y=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:ny(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(Md,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 ny(h)&&++i<10?(e.consume(h),l):(!r.interrupt||i<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(du,r.interrupt?n:d,e.attempt(t9,p,f))}function d(h){return r.containerState.initialBlankLine=!0,s++,p(h)}function f(h){return qe(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function o9(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(du,o,s);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,We(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!qe(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(n9,t,i)(a))}function i(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,We(e,e.attempt(Pn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function s9(e,t,n){const r=this;return We(e,o,"listItemIndent",r.containerState.size+1);function o(s){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(s):n(s)}}function i9(e){e.exit(this.containerState.type)}function a9(e,t,n){const r=this;return We(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const i=r.events[r.events.length-1];return!qe(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const qk={name:"setextUnderline",resolveTo:l9,tokenize:c9};function l9(e,t){let n=e.length,r,o,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",i,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function c9(e,t,n){const r=this;let o;return s;function s(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"),o=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===o?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),qe(u)?We(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||be(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const u9={tokenize:d9};function d9(e){const t=this,n=e.attempt(du,r,e.attempt(this.parser.constructs.flowInitial,o,We(e,e.attempt(this.parser.constructs.flow,o,e.attempt(gU,o)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const f9={resolveAll:qP()},h9=UP("string"),p9=UP("text");function UP(e){return{resolveAll:qP(e==="text"?m9:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],s=n.attempt(o,i,a);return i;function i(d){return u(d)?s(d):a(d)}function a(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"),s(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const f=o[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 qP(e){return t;function t(n,r){let o=-1,s;for(;++o<=n.length;)s===void 0?n[o]&&n[o][1].type==="data"&&(s=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==s+2&&(n[s][1].end=n[o-1][1].end,n.splice(s+2,o-s-2),o=s+2),s=void 0);return e?e(n,r):n}}function m9(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],o=t.sliceStream(r);let s=o.length,i=-1,a=0,l;for(;s--;){const u=o[s];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)a++,i--;if(i)break;i=-1}else if(u===-2)l=!0,a++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},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 g9={42:Pn,43:Pn,45:Pn,48:Pn,49:Pn,50:Pn,51:Pn,52:Pn,53:Pn,54:Pn,55:Pn,56:Pn,57:Pn,62:AP},y9={91:bU},v9={[-2]:Xp,[-1]:Xp,32:Xp},x9={35:NU,42:Md,45:[qk,Md],60:$U,61:qk,95:Md,96:Fk,126:Fk},w9={38:MP,92:OP},b9={[-5]:em,[-4]:em,[-3]:em,33:QU,38:MP,42:ry,60:[J5,LU],91:JU,92:[CU,OP],93:O0,95:ry,96:uU},k9={null:[ry,f9]},_9={null:[42,95]},S9={null:[]},C9=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:_9,contentInitial:y9,disable:S9,document:g9,flow:x9,flowInitial:v9,insideSpan:k9,string:w9,text:b9},Symbol.toStringTag,{value:"Module"}));function E9(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 o={},s=[];let i=[],a=[];const l={attempt:_(C),check:_(j),consume:v,enter:w,exit:k,interrupt:_(j,{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&&s.push(t),u;function f(T){return i=ur(i,T),x(),i[i.length-1]!==null?[]:(I(t,0),u.events=Uh(s,u.events,u),u.events)}function p(T,A){return j9(h(T),A)}function h(T){return N9(i,T)}function y(){const{_bufferIndex:T,_index:A,line:U,column:z,offset:D}=r;return{_bufferIndex:T,_index:A,line:U,column:z,offset:D}}function m(T){o[T.line]=T.column,$()}function x(){let T;for(;r._index<i.length;){const A=i[r._index];if(typeof A=="string")for(T=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===T&&r._bufferIndex<A.length;)g(A.charCodeAt(r._bufferIndex));else g(A)}}function g(T){d=d(T)}function v(T){be(T)?(r.line++,r.column=1,r.offset+=T===-3?2:1,$()):T!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=T}function w(T,A){const U=A||{};return U.type=T,U.start=y(),u.events.push(["enter",U,u]),a.push(U),U}function k(T){const A=a.pop();return A.end=y(),u.events.push(["exit",A,u]),A}function C(T,A){I(T,A.from)}function j(T,A){A.restore()}function _(T,A){return U;function U(z,D,Z){let B,q,H,N;return Array.isArray(z)?V(z):"tokenize"in z?V([z]):O(z);function O(M){return K;function K(G){const le=G!==null&&M[G],se=G!==null&&M.null,he=[...Array.isArray(le)?le:le?[le]:[],...Array.isArray(se)?se:se?[se]:[]];return V(he)(G)}}function V(M){return B=M,q=0,M.length===0?Z:S(M[q])}function S(M){return K;function K(G){return N=P(),H=M,M.partial||(u.currentConstruct=M),M.name&&u.parser.constructs.disable.null.includes(M.name)?R():M.tokenize.call(A?Object.assign(Object.create(u),A):u,l,E,R)(G)}}function E(M){return T(H,N),D}function R(M){return N.restore(),++q<B.length?S(B[q]):Z}}}function I(T,A){T.resolveAll&&!s.includes(T)&&s.push(T),T.resolve&&Gn(u.events,A,u.events.length-A,T.resolve(u.events.slice(A),u)),T.resolveTo&&(u.events=T.resolveTo(u.events,u))}function P(){const T=y(),A=u.previous,U=u.currentConstruct,z=u.events.length,D=Array.from(a);return{from:z,restore:Z};function Z(){r=T,u.previous=A,u.currentConstruct=U,u.events.length=z,a=D,$()}}function $(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function N9(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;let i;if(n===o)i=[e[n].slice(r,s)];else{if(i=e.slice(n,o),r>-1){const a=i[0];typeof a=="string"?i[0]=a.slice(r):i.shift()}s>0&&i.push(e[o].slice(0,s))}return i}function j9(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const s=e[n];let i;if(typeof s=="string")i=s;else switch(s){case-5:{i="\r";break}case-4:{i=`
397
- `;break}case-3:{i=`\r
398
- `;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&o)continue;i=" ";break}default:i=String.fromCharCode(s)}o=s===-2,r.push(i)}return r.join("")}function P9(e){const r={constructs:RP([C9,...(e||{}).extensions||[]]),content:o(H5),defined:[],document:o(K5),flow:o(u9),lazy:{},string:o(h9),text:o(p9)};return r;function o(s){return i;function i(a){return E9(r,s,a)}}}function T9(e){for(;!DP(e););return e}const Vk=/[\0\t\n\r]/g;function $9(){let e=1,t="",n=!0,r;return o;function o(s,i,a){const l=[];let u,d,f,p,h;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),f=0,t="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(Vk.lastIndex=f,u=Vk.exec(s),p=u&&u.index!==void 0?u.index:s.length,h=s.charCodeAt(p),!u){t=s.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(s.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 a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const R9=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function I9(e){return e.replace(R9,A9)}function A9(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return IP(n.slice(s?2:1),s?16:10)}return A0(n)||e}const VP={}.hasOwnProperty;function O9(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),M9(n)(T9(P9(n).document().write($9()(e,t,!0))))}function M9(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ae),autolinkProtocol:P,autolinkEmail:P,atxHeading:s(ee),blockQuote:s(se),characterEscape:P,characterReference:P,codeFenced:s(he),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(he,i),codeText:s(ke,i),codeTextData:P,data:P,codeFlowValue:P,definition:s(tt),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(yt),hardBreakEscape:s(pe),hardBreakTrailing:s(pe),htmlFlow:s(re,i),htmlFlowData:P,htmlText:s(re,i),htmlTextData:P,image:s(Fe),label:i,link:s(ae),listItem:s(De),listItemValue:p,listOrdered:s(Re,f),listUnordered:s(Re),paragraph:s(vt),reference:S,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(ee),strong:s(nr),thematicBreak:s(Nn)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:le,autolinkProtocol:G,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:R,characterReferenceMarkerNumeric:R,characterReferenceValue:M,characterReference:K,codeFenced:l(x),codeFencedFence:m,codeFencedFenceInfo:h,codeFencedFenceMeta:y,codeFlowValue:$,codeIndented:l(g),codeText:l(D),codeTextData:$,data:$,definition:l(),definitionDestinationString:k,definitionLabelString:v,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(A),hardBreakTrailing:l(A),htmlFlow:l(U),htmlFlowData:$,htmlText:l(z),htmlTextData:$,image:l(B),label:H,labelText:q,lineEnding:T,link:l(Z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:E,resourceDestinationString:N,resourceTitleString:O,resource:V,setextHeading:l(I),setextHeadingLineSequence:_,setextHeadingText:j,strong:l(),thematicBreak:l()}};HP(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let te={type:"root",children:[]};const xe={stack:[te],tokenStack:[],config:t,enter:a,exit:u,buffer:i,resume:d,data:n},Ce=[];let Ke=-1;for(;++Ke<W.length;)if(W[Ke][1].type==="listOrdered"||W[Ke][1].type==="listUnordered")if(W[Ke][0]==="enter")Ce.push(Ke);else{const Gt=Ce.pop();Ke=o(W,Gt,Ke)}for(Ke=-1;++Ke<W.length;){const Gt=t[W[Ke][0]];VP.call(Gt,W[Ke][1].type)&&Gt[W[Ke][1].type].call(Object.assign({sliceSerialize:W[Ke][2].sliceSerialize},xe),W[Ke][1])}if(xe.tokenStack.length>0){const Gt=xe.tokenStack[xe.tokenStack.length-1];(Gt[1]||Hk).call(xe,void 0,Gt[0])}for(te.position={start:Wo(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:Wo(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Ke=-1;++Ke<t.transforms.length;)te=t.transforms[Ke](te)||te;return te}function o(W,te,xe){let Ce=te-1,Ke=-1,Gt=!1,rr,jn,Fr,Ur;for(;++Ce<=xe;){const Dt=W[Ce];switch(Dt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Dt[0]==="enter"?Ke++:Ke--,Ur=void 0;break}case"lineEndingBlank":{Dt[0]==="enter"&&(rr&&!Ur&&!Ke&&!Fr&&(Fr=Ce),Ur=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ur=void 0}if(!Ke&&Dt[0]==="enter"&&Dt[1].type==="listItemPrefix"||Ke===-1&&Dt[0]==="exit"&&(Dt[1].type==="listUnordered"||Dt[1].type==="listOrdered")){if(rr){let or=Ce;for(jn=void 0;or--;){const gn=W[or];if(gn[1].type==="lineEnding"||gn[1].type==="lineEndingBlank"){if(gn[0]==="exit")continue;jn&&(W[jn][1].type="lineEndingBlank",Gt=!0),gn[1].type="lineEnding",jn=or}else if(!(gn[1].type==="linePrefix"||gn[1].type==="blockQuotePrefix"||gn[1].type==="blockQuotePrefixWhitespace"||gn[1].type==="blockQuoteMarker"||gn[1].type==="listItemIndent"))break}Fr&&(!jn||Fr<jn)&&(rr._spread=!0),rr.end=Object.assign({},jn?W[jn][1].start:Dt[1].end),W.splice(jn||Ce,0,["exit",rr,Dt[2]]),Ce++,xe++}if(Dt[1].type==="listItemPrefix"){const or={type:"listItem",_spread:!1,start:Object.assign({},Dt[1].start),end:void 0};rr=or,W.splice(Ce,0,["enter",or,Dt[2]]),Ce++,xe++,Fr=void 0,Ur=!0}}}return W[te][1]._spread=Gt,xe}function s(W,te){return xe;function xe(Ce){a.call(this,W(Ce),Ce),te&&te.call(this,Ce)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(W,te,xe){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([te,xe||void 0]),W.position={start:Wo(te.start),end:void 0}}function l(W){return te;function te(xe){W&&W.call(this,xe),u.call(this,xe)}}function u(W,te){const xe=this.stack.pop(),Ce=this.tokenStack.pop();if(Ce)Ce[0].type!==W.type&&(te?te.call(this,W,Ce[0]):(Ce[1]||Hk).call(this,W,Ce[0]));else throw new Error("Cannot close `"+W.type+"` ("+cc({start:W.start,end:W.end})+"): it’s not open");xe.position.end=Wo(W.end)}function d(){return I0(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(W){if(this.data.expectingFirstListItemValue){const te=this.stack[this.stack.length-2];te.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function h(){const W=this.resume(),te=this.stack[this.stack.length-1];te.lang=W}function y(){const W=this.resume(),te=this.stack[this.stack.length-1];te.meta=W}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const W=this.resume(),te=this.stack[this.stack.length-1];te.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const W=this.resume(),te=this.stack[this.stack.length-1];te.value=W.replace(/(\r?\n|\r)$/g,"")}function v(W){const te=this.resume(),xe=this.stack[this.stack.length-1];xe.label=te,xe.identifier=Ar(this.sliceSerialize(W)).toLowerCase()}function w(){const W=this.resume(),te=this.stack[this.stack.length-1];te.title=W}function k(){const W=this.resume(),te=this.stack[this.stack.length-1];te.url=W}function C(W){const te=this.stack[this.stack.length-1];if(!te.depth){const xe=this.sliceSerialize(W).length;te.depth=xe}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function _(W){const te=this.stack[this.stack.length-1];te.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function P(W){const xe=this.stack[this.stack.length-1].children;let Ce=xe[xe.length-1];(!Ce||Ce.type!=="text")&&(Ce=st(),Ce.position={start:Wo(W.start),end:void 0},xe.push(Ce)),this.stack.push(Ce)}function $(W){const te=this.stack.pop();te.value+=this.sliceSerialize(W),te.position.end=Wo(W.end)}function T(W){const te=this.stack[this.stack.length-1];if(this.data.atHardBreak){const xe=te.children[te.children.length-1];xe.position.end=Wo(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(te.type)&&(P.call(this,W),$.call(this,W))}function A(){this.data.atHardBreak=!0}function U(){const W=this.resume(),te=this.stack[this.stack.length-1];te.value=W}function z(){const W=this.resume(),te=this.stack[this.stack.length-1];te.value=W}function D(){const W=this.resume(),te=this.stack[this.stack.length-1];te.value=W}function Z(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const te=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=te,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function B(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const te=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=te,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function q(W){const te=this.sliceSerialize(W),xe=this.stack[this.stack.length-2];xe.label=I9(te),xe.identifier=Ar(te).toLowerCase()}function H(){const W=this.stack[this.stack.length-1],te=this.resume(),xe=this.stack[this.stack.length-1];if(this.data.inReference=!0,xe.type==="link"){const Ce=W.children;xe.children=Ce}else xe.alt=te}function N(){const W=this.resume(),te=this.stack[this.stack.length-1];te.url=W}function O(){const W=this.resume(),te=this.stack[this.stack.length-1];te.title=W}function V(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function E(W){const te=this.resume(),xe=this.stack[this.stack.length-1];xe.label=te,xe.identifier=Ar(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function R(W){this.data.characterReferenceType=W.type}function M(W){const te=this.sliceSerialize(W),xe=this.data.characterReferenceType;let Ce;xe?(Ce=IP(te,xe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ce=A0(te);const Ke=this.stack[this.stack.length-1];Ke.value+=Ce}function K(W){const te=this.stack.pop();te.position.end=Wo(W.end)}function G(W){$.call(this,W);const te=this.stack[this.stack.length-1];te.url=this.sliceSerialize(W)}function le(W){$.call(this,W);const te=this.stack[this.stack.length-1];te.url="mailto:"+this.sliceSerialize(W)}function se(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function ke(){return{type:"inlineCode",value:""}}function tt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function yt(){return{type:"emphasis",children:[]}}function ee(){return{type:"heading",depth:0,children:[]}}function pe(){return{type:"break"}}function re(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function ae(){return{type:"link",title:null,url:"",children:[]}}function Re(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function De(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function vt(){return{type:"paragraph",children:[]}}function nr(){return{type:"strong",children:[]}}function st(){return{type:"text",value:""}}function Nn(){return{type:"thematicBreak"}}}function Wo(e){return{line:e.line,column:e.column,offset:e.offset}}function HP(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?HP(e,r):D9(e,r)}}function D9(e,t){let n;for(n in t)if(VP.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 Hk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+cc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+cc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+cc({start:t.start,end:t.end})+") is still open")}function L9(e){const t=this;t.parser=n;function n(r){return O9(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function z9(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 F9(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
399
- `}]}function U9(e,t){const n=t.value?t.value+`
400
- `:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function q9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function V9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function H9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=xl(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let i,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=s+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function B9(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 K9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function BP(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 o=e.all(t),s=o[0];s&&s.type==="text"?s.value="["+s.value:o.unshift({type:"text",value:"["});const i=o[o.length-1];return i&&i.type==="text"?i.value+=r:o.push({type:"text",value:r}),o}function W9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return BP(e,t);const o={src:xl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,s),e.applyData(t,s)}function Z9(e,t){const n={src:xl(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 Q9(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 G9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return BP(e,t);const o={href:xl(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function J9(e,t){const n={href:xl(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 Y9(e,t,n){const r=e.all(t),o=n?X9(n):KP(t),s={},i=[];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:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(o||a!==0||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
401
- `}),d.type==="element"&&d.tagName==="p"&&!o?i.push(...d.children):i.push(d)}const l=r[r.length-1];l&&(o||l.type!=="element"||l.tagName!=="p")&&i.push({type:"text",value:`
402
- `});const u={type:"element",tagName:"li",properties:s,children:i};return e.patch(t,u),e.applyData(t,u)}function X9(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=KP(n[r])}return t}function KP(e){const t=e.spread;return t??e.children.length>1}function e6(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const i=r[o];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function t6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function n6(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function r6(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function o6(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const i={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],i),o.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=P0(t.children[1]),l=CP(t.children[t.children.length-1]);a&&l&&(i.position={start:a,end:l}),o.push(i)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,s),e.applyData(t,s)}function s6(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,a=i?i.length:t.children.length;let l=-1;const u=[];for(;++l<a;){const f=t.children[l],p={},h=i?i[l]:void 0;h&&(p.align=h);let y={type:"element",tagName:s,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 i6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Bk=9,Kk=32;function a6(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const s=[];for(;r;)s.push(Wk(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return s.push(Wk(t.slice(o),o>0,!1)),s.join("")}function Wk(e,t,n){let r=0,o=e.length;if(t){let s=e.codePointAt(r);for(;s===Bk||s===Kk;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(o-1);for(;s===Bk||s===Kk;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function l6(e,t){const n={type:"text",value:a6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function c6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const u6={blockquote:z9,break:F9,code:U9,delete:q9,emphasis:V9,footnoteReference:H9,heading:B9,html:K9,imageReference:W9,image:Z9,inlineCode:Q9,linkReference:G9,link:J9,listItem:Y9,list:e6,paragraph:t6,root:n6,strong:r6,table:o6,tableCell:i6,tableRow:s6,text:l6,thematicBreak:c6,toml:td,yaml:td,definition:td,footnoteDefinition:td};function td(){}const WP=-1,qh=0,dc=1,If=2,M0=3,D0=4,L0=5,z0=6,ZP=7,QP=8,Zk=typeof self=="object"?self:globalThis,d6=(e,t)=>{const n=(o,s)=>(e.set(s,o),o),r=o=>{if(e.has(o))return e.get(o);const[s,i]=t[o];switch(s){case qh:case WP:return n(i,o);case dc:{const a=n([],o);for(const l of i)a.push(r(l));return a}case If:{const a=n({},o);for(const[l,u]of i)a[r(l)]=r(u);return a}case M0:return n(new Date(i),o);case D0:{const{source:a,flags:l}=i;return n(new RegExp(a,l),o)}case L0:{const a=n(new Map,o);for(const[l,u]of i)a.set(r(l),r(u));return a}case z0:{const a=n(new Set,o);for(const l of i)a.add(r(l));return a}case ZP:{const{name:a,message:l}=i;return n(new Zk[a](l),o)}case QP:return n(BigInt(i),o);case"BigInt":return n(Object(BigInt(i)),o);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:a}=new Uint8Array(i);return n(new DataView(a),i)}}return n(new Zk[s](i),o)};return r},Qk=e=>d6(new Map,e)(0),Ki="",{toString:f6}={},{keys:h6}=Object,Ml=e=>{const t=typeof e;if(t!=="object"||!e)return[qh,t];const n=f6.call(e).slice(8,-1);switch(n){case"Array":return[dc,Ki];case"Object":return[If,Ki];case"Date":return[M0,Ki];case"RegExp":return[D0,Ki];case"Map":return[L0,Ki];case"Set":return[z0,Ki];case"DataView":return[dc,n]}return n.includes("Array")?[dc,n]:n.includes("Error")?[ZP,n]:[If,n]},nd=([e,t])=>e===qh&&(t==="function"||t==="symbol"),p6=(e,t,n,r)=>{const o=(i,a)=>{const l=r.push(i)-1;return n.set(a,l),l},s=i=>{if(n.has(i))return n.get(i);let[a,l]=Ml(i);switch(a){case qh:{let d=i;switch(l){case"bigint":a=QP,d=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return o([WP],i)}return o([a,d],i)}case dc:{if(l){let p=i;return l==="DataView"?p=new Uint8Array(i.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(i)),o([l,[...p]],i)}const d=[],f=o([a,d],i);for(const p of i)d.push(s(p));return f}case If:{if(l)switch(l){case"BigInt":return o([l,i.toString()],i);case"Boolean":case"Number":case"String":return o([l,i.valueOf()],i)}if(t&&"toJSON"in i)return s(i.toJSON());const d=[],f=o([a,d],i);for(const p of h6(i))(e||!nd(Ml(i[p])))&&d.push([s(p),s(i[p])]);return f}case M0:return o([a,i.toISOString()],i);case D0:{const{source:d,flags:f}=i;return o([a,{source:d,flags:f}],i)}case L0:{const d=[],f=o([a,d],i);for(const[p,h]of i)(e||!(nd(Ml(p))||nd(Ml(h))))&&d.push([s(p),s(h)]);return f}case z0:{const d=[],f=o([a,d],i);for(const p of i)(e||!nd(Ml(p)))&&d.push(s(p));return f}}const{message:u}=i;return o([a,{name:l,message:u}],i)};return s},Gk=(e,{json:t,lossy:n}={})=>{const r=[];return p6(!(t||n),!!t,new Map,r)(e),r},Af=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Qk(Gk(e,t)):structuredClone(e):(e,t)=>Qk(Gk(e,t));function m6(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 g6(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function y6(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||m6,r=e.options.footnoteBackLabel||g6,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];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=xl(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 x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.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),a.push(g)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Af(i),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
403
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
404
- `}]}}const Vh=function(e){if(e==null)return b6;if(typeof e=="function")return Hh(e);if(typeof e=="object")return Array.isArray(e)?v6(e):x6(e);if(typeof e=="string")return w6(e);throw new Error("Expected function, string, or object as test")};function v6(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Vh(e[n]);return Hh(r);function r(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function x6(e){const t=e;return Hh(n);function n(r){const o=r;let s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function w6(e){return Hh(t);function t(n){return n&&n.type===e}}function Hh(e){return t;function t(n,r,o){return!!(k6(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function b6(){return!0}function k6(e){return e!==null&&typeof e=="object"&&"type"in e}const GP=[],_6=!0,oy=!1,S6="skip";function JP(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const s=Vh(o),i=r?-1:1;a(e,void 0,[])();function a(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=GP,y,m,x;if((!t||s(l,u,d[d.length-1]||void 0))&&(h=C6(n(l,d)),h[0]===oy))return h;if("children"in l&&l.children){const g=l;if(g.children&&h[0]!==S6)for(m=(r?g.children.length:-1)+i,x=d.concat(g);m>-1&&m<g.children.length;){const v=g.children[m];if(y=a(v,m,x)(),y[0]===oy)return y;m=typeof y[1]=="number"?y[1]:m+i}}return h}}}function C6(e){return Array.isArray(e)?e:typeof e=="number"?[_6,e]:e==null?GP:[e]}function F0(e,t,n,r){let o,s,i;typeof t=="function"&&typeof n!="function"?(s=void 0,i=t,o=n):(s=t,i=n,o=r),JP(e,s,a,o);function a(l,u){const d=u[u.length-1],f=d?d.children.indexOf(l):void 0;return i(l,f,d)}}const sy={}.hasOwnProperty,E6={};function N6(e,t){const n=t||E6,r=new Map,o=new Map,s=new Map,i={...u6,...n.handlers},a={all:u,applyData:P6,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:i,one:l,options:n,patch:j6,wrap:$6};return F0(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:o,p=String(d.identifier).toUpperCase();f.has(p)||f.set(p,d)}}),a;function l(d,f){const p=d.type,h=a.handlers[p];if(sy.call(a.handlers,p)&&h)return h(a,d,f);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in d){const{children:m,...x}=d,g=Af(x);return g.children=a.all(d),g}return Af(d)}return(a.options.unknownHandler||T6)(a,d,f)}function u(d){const f=[];if("children"in d){const p=d.children;let h=-1;for(;++h<p.length;){const y=a.one(p[h],d);if(y){if(h&&p[h-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=Jk(y.value)),!Array.isArray(y)&&y.type==="element")){const m=y.children[0];m&&m.type==="text"&&(m.value=Jk(m.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function j6(e,t){e.position&&(t.position=g5(e))}function P6(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const i="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:i}}n.type==="element"&&s&&Object.assign(n.properties,Af(s)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function T6(e,t){const n=t.data||{},r="value"in t&&!(sy.call(n,"hProperties")||sy.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 $6(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
405
- `});++r<e.length;)r&&n.push({type:"text",value:`
406
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
407
- `}),n}function Jk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Yk(e,t){const n=N6(e,t),r=n.one(e,void 0),o=y6(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&s.children.push({type:"text",value:`
408
- `},o),s}function R6(e,t){return e&&"run"in e?async function(n,r){const o=Yk(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Yk(n,{file:r,...e||t})}}function Xk(e){if(e)throw e}var Dd=Object.prototype.hasOwnProperty,YP=Object.prototype.toString,e1=Object.defineProperty,t1=Object.getOwnPropertyDescriptor,n1=function(t){return typeof Array.isArray=="function"?Array.isArray(t):YP.call(t)==="[object Array]"},r1=function(t){if(!t||YP.call(t)!=="[object Object]")return!1;var n=Dd.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Dd.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||Dd.call(t,o)},o1=function(t,n){e1&&n.name==="__proto__"?e1(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},s1=function(t,n){if(n==="__proto__")if(Dd.call(t,n)){if(t1)return t1(t,n).value}else return;return t[n]},I6=function e(){var t,n,r,o,s,i,a=arguments[0],l=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=s1(a,n),o=s1(t,n),a!==o&&(d&&o&&(r1(o)||(s=n1(o)))?(s?(s=!1,i=r&&n1(r)?r:[]):i=r&&r1(r)?r:{},o1(a,{name:n,newValue:e(d,i,o)})):typeof o<"u"&&o1(a,{name:n,newValue:o}));return a};const tm=ll(I6);function iy(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 A6(){const e=[],t={run:n,use:r};return t;function n(...o){let s=-1;const i=o.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);a(null,...o);function a(l,...u){const d=e[++s];let f=-1;if(l){i(l);return}for(;++f<o.length;)(u[f]===null||u[f]===void 0)&&(u[f]=o[f]);o=u,d?O6(d,a)(...u):i(null,...u)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function O6(e,t){let n;return r;function r(...i){const a=e.length>i.length;let l;a&&i.push(o);try{l=e.apply(this,i)}catch(u){const d=u;if(a&&n)throw d;return o(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,o):l instanceof Error?o(l):s(l))}function o(i,...a){n||(n=!0,t(i,...a))}function s(i){o(null,i)}}const Br={basename:M6,dirname:D6,extname:L6,join:z6,sep:"/"};function M6(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');fu(e);let n=0,r=-1,o=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else r<0&&(s=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else i<0&&(s=!0,i=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function D6(e){if(fu(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 L6(e){fu(e);let t=e.length,n=-1,r=0,o=-1,s=0,i;for(;t--;){const a=e.codePointAt(t);if(a===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),a===46?o<0?o=t:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||n<0||s===0||s===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function z6(...e){let t=-1,n;for(;++t<e.length;)fu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":F6(n)}function F6(e){fu(e);const t=e.codePointAt(0)===47;let n=U6(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function U6(e,t){let n="",r=0,o=-1,s=0,i=-1,a,l;for(;++i<=e.length;){if(i<e.length)a=e.codePointAt(i);else{if(a===47)break;a=47}if(a===47){if(!(o===i-1||s===1))if(o!==i-1&&s===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("/")),o=i,s=0;continue}}else if(n.length>0){n="",r=0,o=i,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,i):n=e.slice(o+1,i),r=i-o-1;o=i,s=0}else a===46&&s>-1?s++:s=-1}return n}function fu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const q6={cwd:V6};function V6(){return"/"}function ay(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function H6(e){if(typeof e=="string")e=new URL(e);else if(!ay(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 B6(e)}function B6(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 o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const nm=["history","path","basename","stem","extname","dirname"];class XP{constructor(t){let n;t?ay(t)?n={path:t}:typeof t=="string"||K6(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":q6.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<nm.length;){const s=nm[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let o;for(o in n)nm.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Br.basename(this.path):void 0}set basename(t){om(t,"basename"),rm(t,"basename"),this.path=Br.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Br.dirname(this.path):void 0}set dirname(t){i1(this.basename,"dirname"),this.path=Br.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Br.extname(this.path):void 0}set extname(t){if(rm(t,"extname"),i1(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Br.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ay(t)&&(t=H6(t)),om(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Br.basename(this.path,this.extname):void 0}set stem(t){om(t,"stem"),rm(t,"stem"),this.path=Br.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new mn(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function rm(e,t){if(e&&e.includes(Br.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Br.sep+"`")}function om(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function i1(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function K6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const W6=function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},Z6={}.hasOwnProperty;class U0 extends W6{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=A6()}copy(){const t=new U0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(tm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(am("data",this.frozen),this.namespace[t]=n,this):Z6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(am("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 o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=rd(t),r=this.parser||this.Parser;return sm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),sm("process",this.parser||this.Parser),im("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,i){const a=rd(t),l=r.parse(a);r.run(l,a,function(d,f,p){if(d||!f||!p)return u(d);const h=f,y=r.stringify(h,p);J6(y)?p.value=y:p.result=y,u(d,p)});function u(d,f){d||!f?i(d):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),sm("processSync",this.parser||this.Parser),im("processSync",this.compiler||this.Compiler),this.process(t,o),l1("processSync","process",n),r;function o(s,i){n=!0,Xk(s),r=i}}run(t,n,r){a1(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(i,a){const l=rd(n);o.run(t,l,u);function u(d,f,p){const h=f||t;d?a(d):i?i(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),l1("runSync","run",r),o;function s(i,a){Xk(i),o=a,r=!0}}stringify(t,n){this.freeze();const r=rd(n),o=this.compiler||this.Compiler;return im("stringify",o),a1(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(am("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;l(d,f)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(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");a(u.plugins),u.settings&&(o.settings=tm(!0,o.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];s(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];iy(m)&&iy(h)&&(h=tm(!0,m,h)),r[p]=[u,h,...y]}}}}const Q6=new U0().freeze();function sm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function im(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function am(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 a1(e){if(!iy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function l1(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function rd(e){return G6(e)?e:new XP(e)}function G6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function J6(e){return typeof e=="string"||Y6(e)}function Y6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const X6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",c1=[],u1={allowDangerousHtml:!0},e8=/^(https?|ircs?|mailto|xmpp)$/i,t8=[{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 n8(e){const t=r8(e),n=o8(e);return s8(t.runSync(t.parse(n),n),e)}function r8(e){const t=e.rehypePlugins||c1,n=e.remarkPlugins||c1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...u1}:u1;return Q6().use(L9).use(n).use(R6,r).use(t)}function o8(e){const t=e.children||"",n=new XP;return typeof t=="string"&&(n.value=t),n}function s8(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,i=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||i8;for(const d of t8)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+X6+d.id,void 0);return F0(e,u),b5(e,{Fragment:c.Fragment,components:o,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 i?p.children.splice(f,1):p.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let h;for(h in Yp)if(Object.hasOwn(Yp,h)&&Object.hasOwn(d.properties,h)){const y=d.properties[h],m=Yp[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):s?s.includes(d.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(d,f,p)),h&&p&&typeof f=="number")return a&&d.children?p.children.splice(f,1,...d.children):p.children.splice(f,1),f}}}function i8(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||e8.test(e.slice(0,t))?e:""}function d1(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;o!==-1;)r++,o=n.indexOf(t,o+t.length);return r}function a8(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function l8(e,t,n){const o=Vh((n||{}).ignore||[]),s=c8(t);let i=-1;for(;++i<s.length;)JP(e,"text",a);function a(u,d){let f=-1,p;for(;++f<d.length;){const h=d[f],y=p?p.children:void 0;if(o(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=s[i][0],h=s[i][1];let y=0;const x=f.children.indexOf(u);let g=!1,v=[];p.lastIndex=0;let w=p.exec(u.value);for(;w;){const k=w.index,C={index:w.index,input:w.input,stack:[...d,u]};let j=h(...w,C);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?p.lastIndex=k+1:(y!==k&&v.push({type:"text",value:u.value.slice(y,k)}),Array.isArray(j)?v.push(...j):j&&v.push(j),y=k+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(x,1,...v)):v=[u],x+v.length}}function c8(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 o=n[r];t.push([u8(o[0]),d8(o[1])])}return t}function u8(e){return typeof e=="string"?new RegExp(a8(e),"g"):e}function d8(e){return typeof e=="function"?e:function(){return e}}const lm="phrasing",cm=["autolink","link","image","label"];function f8(){return{transforms:[x8],enter:{literalAutolink:p8,literalAutolinkEmail:um,literalAutolinkHttp:um,literalAutolinkWww:um},exit:{literalAutolink:v8,literalAutolinkEmail:y8,literalAutolinkHttp:m8,literalAutolinkWww:g8}}}function h8(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:lm,notInConstruct:cm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:lm,notInConstruct:cm},{character:":",before:"[ps]",after:"\\/",inConstruct:lm,notInConstruct:cm}]}}function p8(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function um(e){this.config.enter.autolinkProtocol.call(this,e)}function m8(e){this.config.exit.autolinkProtocol.call(this,e)}function g8(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 y8(e){this.config.exit.autolinkEmail.call(this,e)}function v8(e){this.exit(e)}function x8(e){l8(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,w8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),b8]],{ignore:["link","linkReference"]})}function w8(e,t,n,r,o){let s="";if(!eT(o)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!k8(n)))return!1;const i=_8(n+r);if(!i[0])return!1;const a={type:"link",title:null,url:s+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[a,{type:"text",value:i[1]}]:a}function b8(e,t,n,r){return!eT(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function k8(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 _8(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 o=d1(e,"(");let s=d1(e,")");for(;r!==-1&&o>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function eT(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ti(n)||Fh(n))&&(!t||n!==47)}tT.peek=R8;function S8(){this.buffer()}function C8(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function E8(){this.buffer()}function N8(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function j8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ar(this.sliceSerialize(e)).toLowerCase(),n.label=t}function P8(e){this.exit(e)}function T8(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ar(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $8(e){this.exit(e)}function R8(){return"["}function tT(e,t,n,r){const o=n.createTracker(r);let s=o.move("[^");const i=n.enter("footnoteReference"),a=n.enter("reference");return s+=o.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),i(),s+=o.move("]"),s}function I8(){return{enter:{gfmFootnoteCallString:S8,gfmFootnoteCall:C8,gfmFootnoteDefinitionLabelString:E8,gfmFootnoteDefinition:N8},exit:{gfmFootnoteCallString:j8,gfmFootnoteCall:P8,gfmFootnoteDefinitionLabelString:T8,gfmFootnoteDefinition:$8}}}function A8(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:tT},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,o,s,i){const a=s.createTracker(i);let l=a.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return l+=a.move(s.safe(s.associationId(r),{before:l,after:"]"})),d(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
409
- `:" ")+s.indentLines(s.containerFlow(r,a.current()),t?nT:O8))),u(),l}}function O8(e,t,n){return t===0?e:nT(e,t,n)}function nT(e,t,n){return(n?"":" ")+e}const M8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];rT.peek=U8;function D8(){return{canContainEols:["delete"],enter:{strikethrough:z8},exit:{strikethrough:F8}}}function L8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:M8}],handlers:{delete:rT}}}function z8(e){this.enter({type:"delete",children:[]},e)}function F8(e){this.exit(e)}function rT(e,t,n,r){const o=n.createTracker(r),s=n.enter("strikethrough");let i=o.move("~~");return i+=n.containerPhrasing(e,{...o.current(),before:i,after:"~"}),i+=o.move("~~"),s(),i}function U8(){return"~"}function q8(e){return e.length}function V8(e,t){const n=t||{},r=(n.align||[]).concat(),o=n.stringLength||q8,s=[],i=[],a=[],l=[];let u=0,d=-1;for(;++d<e.length;){const m=[],x=[];let g=-1;for(e[d].length>u&&(u=e[d].length);++g<e[d].length;){const v=H8(e[d][g]);if(n.alignDelimiters!==!1){const w=o(v);x[g]=w,(l[g]===void 0||w>l[g])&&(l[g]=w)}m.push(v)}i[d]=m,a[d]=x}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)s[f]=f1(r[f]);else{const m=f1(r);for(;++f<u;)s[f]=m}f=-1;const p=[],h=[];for(;++f<u;){const m=s[f];let x="",g="";m===99?(x=":",g=":"):m===108?x=":":m===114&&(g=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[f]-x.length-g.length);const w=x+"-".repeat(v)+g;n.alignDelimiters!==!1&&(v=x.length+v+g.length,v>l[f]&&(l[f]=v),h[f]=v),p[f]=w}i.splice(1,0,p),a.splice(1,0,h),d=-1;const y=[];for(;++d<i.length;){const m=i[d],x=a[d];f=-1;const g=[];for(;++f<u;){const v=m[f]||"";let w="",k="";if(n.alignDelimiters!==!1){const C=l[f]-(x[f]||0),j=s[f];j===114?w=" ".repeat(C):j===99?C%2?(w=" ".repeat(C/2+.5),k=" ".repeat(C/2-.5)):(w=" ".repeat(C/2),k=w):k=" ".repeat(C)}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(k),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(`
410
- `)}function H8(e){return e==null?"":String(e)}function f1(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 B8(e,t,n,r){const o=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const i=n.indentLines(n.containerFlow(e,s.current()),K8);return o(),i}function K8(e,t,n){return">"+(n?"":" ")+e}function W8(e,t){return h1(e,t.inConstruct,!0)&&!h1(e,t.notInConstruct,!1)}function h1(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 p1(e,t,n,r){let o=-1;for(;++o<n.unsafe.length;)if(n.unsafe[o].character===`
411
- `&&W8(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return`\\
412
- `}function Z8(e,t){const n=String(e);let r=n.indexOf(t),o=r,s=0,i=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===o?++s>i&&(i=s):s=1,o=r+t.length,r=n.indexOf(t,o);return i}function Q8(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 G8(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 J8(e,t,n,r){const o=G8(n),s=e.value||"",i=o==="`"?"GraveAccent":"Tilde";if(Q8(e,n)){const f=n.enter("codeIndented"),p=n.indentLines(s,Y8);return f(),p}const a=n.createTracker(r),l=o.repeat(Math.max(Z8(s,o)+1,3)),u=n.enter("codeFenced");let d=a.move(l);if(e.lang){const f=n.enter(`codeFencedLang${i}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${i}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
413
- `,encode:["`"],...a.current()})),f()}return d+=a.move(`
414
- `),s&&(d+=a.move(s+`
415
- `)),d+=a.move(l),u(),d}function Y8(e,t,n){return(n?"":" ")+e}function q0(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 X8(e,t,n,r){const o=q0(n),s=o==='"'?"Quote":"Apostrophe",i=n.enter("definition");let a=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("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
416
- `,...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=l.move(" "+o),u+=l.move(n.safe(e.title,{before:u,after:o,...l.current()})),u+=l.move(o),a()),i(),u}function eq(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 qc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Of(e,t,n){const r=rl(e),o=rl(t);return r===void 0?o===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}oT.peek=tq;function oT(e,t,n,r){const o=eq(n),s=n.enter("emphasis"),i=n.createTracker(r),a=i.move(o);let l=i.move(n.containerPhrasing(e,{after:o,before:a,...i.current()}));const u=l.charCodeAt(0),d=Of(r.before.charCodeAt(r.before.length-1),u,o);d.inside&&(l=qc(u)+l.slice(1));const f=l.charCodeAt(l.length-1),p=Of(r.after.charCodeAt(0),f,o);p.inside&&(l=l.slice(0,-1)+qc(f));const h=i.move(o);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},a+l+h}function tq(e,t,n){return n.options.emphasis||"*"}function nq(e,t){let n=!1;return F0(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,oy}),!!((!e.depth||e.depth<3)&&I0(e)&&(t.options.setext||n))}function rq(e,t,n,r){const o=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(nq(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),p=n.containerPhrasing(e,{...s.current(),before:`
417
- `,after:`
418
- `});return f(),d(),p+`
419
- `+(o===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
420
- `))+1))}const i="#".repeat(o),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(i+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
421
- `,...s.current()});return/^[\t ]/.test(u)&&(u=qc(u.charCodeAt(0))+u.slice(1)),u=u?i+" "+u:i,n.options.closeAtx&&(u+=" "+i),l(),a(),u}sT.peek=oq;function sT(e){return e.value||""}function oq(){return"<"}iT.peek=sq;function iT(e,t,n,r){const o=q0(n),s=o==='"'?"Quote":"Apostrophe",i=n.enter("image");let a=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("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=l.move(" "+o),u+=l.move(n.safe(e.title,{before:u,after:o,...l.current()})),u+=l.move(o),a()),u+=l.move(")"),i(),u}function sq(){return"!"}aT.peek=iq;function aT(e,t,n,r){const o=e.referenceType,s=n.enter("imageReference");let i=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const u=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),i();const d=n.stack;n.stack=[],i=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return i(),n.stack=d,s(),o==="full"||!u||u!==f?l+=a.move(f+"]"):o==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function iq(){return"!"}lT.peek=aq;function lT(e,t,n){let r=e.value||"",o="`",s=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const i=n.unsafe[s],a=n.compilePattern(i);let l;if(i.atBreak)for(;l=a.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 o+r+o}function aq(){return"`"}function cT(e,t){const n=I0(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))}uT.peek=lq;function uT(e,t,n,r){const o=q0(n),s=o==='"'?"Quote":"Apostrophe",i=n.createTracker(r);let a,l;if(cT(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let f=i.move("<");return f+=i.move(n.containerPhrasing(e,{before:f,after:">",...i.current()})),f+=i.move(">"),a(),n.stack=d,f}a=n.enter("link"),l=n.enter("label");let u=i.move("[");return u+=i.move(n.containerPhrasing(e,{before:u,after:"](",...i.current()})),u+=i.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=i.move("<"),u+=i.move(n.safe(e.url,{before:u,after:">",...i.current()})),u+=i.move(">")):(l=n.enter("destinationRaw"),u+=i.move(n.safe(e.url,{before:u,after:e.title?" ":")",...i.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=i.move(" "+o),u+=i.move(n.safe(e.title,{before:u,after:o,...i.current()})),u+=i.move(o),l()),u+=i.move(")"),a(),u}function lq(e,t,n){return cT(e,n)?"<":"["}dT.peek=cq;function dT(e,t,n,r){const o=e.referenceType,s=n.enter("linkReference");let i=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),i();const d=n.stack;n.stack=[],i=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return i(),n.stack=d,s(),o==="full"||!u||u!==f?l+=a.move(f+"]"):o==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function cq(){return"["}function V0(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 uq(e){const t=V0(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 dq(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 fT(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 fq(e,t,n,r){const o=n.enter("list"),s=n.bulletCurrent;let i=e.ordered?dq(n):V0(n);const a=e.ordered?i==="."?")":".":uq(n);let l=t&&n.bulletLastUsed?i===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((i==="*"||i==="-")&&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),fT(n)===i&&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&&(i=a),n.bulletCurrent=i;const u=n.containerFlow(e,r);return n.bulletLastUsed=i,n.bulletCurrent=s,o(),u}function hq(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 pq(e,t,n,r){const o=hq(n);let s=n.bulletCurrent||V0(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let i=s.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(i=Math.ceil(i/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(i-s.length)),a.shift(i);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),d);return l(),u;function d(f,p,h){return p?(h?"":" ".repeat(i))+f:(h?s:s+" ".repeat(i-s.length))+f}}function mq(e,t,n,r){const o=n.enter("paragraph"),s=n.enter("phrasing"),i=n.containerPhrasing(e,r);return s(),o(),i}const gq=Vh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function yq(e,t,n,r){return(e.children.some(function(i){return gq(i)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function vq(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}hT.peek=xq;function hT(e,t,n,r){const o=vq(n),s=n.enter("strong"),i=n.createTracker(r),a=i.move(o+o);let l=i.move(n.containerPhrasing(e,{after:o,before:a,...i.current()}));const u=l.charCodeAt(0),d=Of(r.before.charCodeAt(r.before.length-1),u,o);d.inside&&(l=qc(u)+l.slice(1));const f=l.charCodeAt(l.length-1),p=Of(r.after.charCodeAt(0),f,o);p.inside&&(l=l.slice(0,-1)+qc(f));const h=i.move(o+o);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},a+l+h}function xq(e,t,n){return n.options.strong||"*"}function wq(e,t,n,r){return n.safe(e.value,r)}function bq(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 kq(e,t,n){const r=(fT(n)+(n.options.ruleSpaces?" ":"")).repeat(bq(n));return n.options.ruleSpaces?r.slice(0,-1):r}const pT={blockquote:B8,break:p1,code:J8,definition:X8,emphasis:oT,hardBreak:p1,heading:rq,html:sT,image:iT,imageReference:aT,inlineCode:lT,link:uT,linkReference:dT,list:fq,listItem:pq,paragraph:mq,root:yq,strong:hT,text:wq,thematicBreak:kq};function _q(){return{enter:{table:Sq,tableData:m1,tableHeader:m1,tableRow:Eq},exit:{codeText:Nq,table:Cq,tableData:dm,tableHeader:dm,tableRow:dm}}}function Sq(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 Cq(e){this.exit(e),this.data.inTable=void 0}function Eq(e){this.enter({type:"tableRow",children:[]},e)}function dm(e){this.exit(e)}function m1(e){this.enter({type:"tableCell",children:[]},e)}function Nq(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,jq));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function jq(e,t){return t==="|"?t:e}function Pq(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
422
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:i,tableCell:l,tableRow:a}};function i(h,y,m,x){return u(d(h,m,x),h.align)}function a(h,y,m,x){const g=f(h,m,x),v=u([g]);return v.slice(0,v.indexOf(`
423
- `))}function l(h,y,m,x){const g=m.enter("tableCell"),v=m.enter("phrasing"),w=m.containerPhrasing(h,{...x,before:s,after:s});return v(),g(),w}function u(h,y){return V8(h,{align:y,alignDelimiters:r,padding:n,stringLength:o})}function d(h,y,m){const x=h.children;let g=-1;const v=[],w=y.enter("table");for(;++g<x.length;)v[g]=f(x[g],y,m);return w(),v}function f(h,y,m){const x=h.children;let g=-1;const v=[],w=y.enter("tableRow");for(;++g<x.length;)v[g]=l(x[g],h,y,m);return w(),v}function p(h,y,m){let x=pT.inlineCode(h,y,m);return m.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function Tq(){return{exit:{taskListCheckValueChecked:g1,taskListCheckValueUnchecked:g1,paragraph:Rq}}}function $q(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Iq}}}function g1(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Rq(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 o=t.children;let s=-1,i;for(;++s<o.length;){const a=o[s];if(a.type==="paragraph"){i=a;break}}i===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 Iq(e,t,n,r){const o=e.children[0],s=typeof e.checked=="boolean"&&o&&o.type==="paragraph",i="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(i);let l=pT.listItem(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(d){return d+i}}function Aq(){return[f8(),I8(),D8(),_q(),Tq()]}function Oq(e){return{extensions:[h8(),A8(e),L8(),Pq(e),$q()]}}const Mq={tokenize:qq,partial:!0},mT={tokenize:Vq,partial:!0},gT={tokenize:Hq,partial:!0},yT={tokenize:Bq,partial:!0},Dq={tokenize:Kq,partial:!0},vT={name:"wwwAutolink",tokenize:Fq,previous:wT},xT={name:"protocolAutolink",tokenize:Uq,previous:bT},Vo={name:"emailAutolink",tokenize:zq,previous:kT},fo={};function Lq(){return{text:fo}}let Hs=48;for(;Hs<123;)fo[Hs]=Vo,Hs++,Hs===58?Hs=65:Hs===91&&(Hs=97);fo[43]=Vo;fo[45]=Vo;fo[46]=Vo;fo[95]=Vo;fo[72]=[Vo,xT];fo[104]=[Vo,xT];fo[87]=[Vo,vT];fo[119]=[Vo,vT];function zq(e,t,n){const r=this;let o,s;return i;function i(f){return!ly(f)||!kT.call(r,r.previous)||H0(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(f))}function a(f){return ly(f)?(e.consume(f),a):f===64?(e.consume(f),l):n(f)}function l(f){return f===46?e.check(Dq,d,u)(f):f===45||f===95||hn(f)?(s=!0,e.consume(f),l):d(f)}function u(f){return e.consume(f),o=!0,l}function d(f){return s&&o&&_n(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function Fq(e,t,n){const r=this;return o;function o(i){return i!==87&&i!==119||!wT.call(r,r.previous)||H0(r.events)?n(i):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Mq,e.attempt(mT,e.attempt(gT,s),n),n)(i))}function s(i){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(i)}}function Uq(e,t,n){const r=this;let o="",s=!1;return i;function i(f){return(f===72||f===104)&&bT.call(r,r.previous)&&!H0(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(f),e.consume(f),a):n(f)}function a(f){if(_n(f)&&o.length<5)return o+=String.fromCodePoint(f),e.consume(f),a;if(f===58){const p=o.toLowerCase();if(p==="http"||p==="https")return e.consume(f),l}return n(f)}function l(f){return f===47?(e.consume(f),s?u:(s=!0,l)):n(f)}function u(f){return f===null||Rf(f)||ot(f)||Ti(f)||Fh(f)?n(f):e.attempt(mT,e.attempt(gT,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function qq(e,t,n){let r=0;return o;function o(i){return(i===87||i===119)&&r<3?(r++,e.consume(i),o):i===46&&r===3?(e.consume(i),s):n(i)}function s(i){return i===null?n(i):t(i)}}function Vq(e,t,n){let r,o,s;return i;function i(u){return u===46||u===95?e.check(yT,l,a)(u):u===null||ot(u)||Ti(u)||u!==45&&Fh(u)?l(u):(s=!0,e.consume(u),i)}function a(u){return u===95?r=!0:(o=r,r=void 0),e.consume(u),i}function l(u){return o||r||!s?n(u):t(u)}}function Hq(e,t){let n=0,r=0;return o;function o(i){return i===40?(n++,e.consume(i),o):i===41&&r<n?s(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?e.check(yT,t,s)(i):i===null||ot(i)||Ti(i)?t(i):(e.consume(i),o)}function s(i){return i===41&&r++,e.consume(i),o}}function Bq(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),s):a===93?(e.consume(a),o):a===60||a===null||ot(a)||Ti(a)?t(a):n(a)}function o(a){return a===null||a===40||a===91||ot(a)||Ti(a)?t(a):r(a)}function s(a){return _n(a)?i(a):n(a)}function i(a){return a===59?(e.consume(a),r):_n(a)?(e.consume(a),i):n(a)}}function Kq(e,t,n){return r;function r(s){return e.consume(s),o}function o(s){return hn(s)?n(s):t(s)}}function wT(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ot(e)}function bT(e){return!_n(e)}function kT(e){return!(e===47||ly(e))}function ly(e){return e===43||e===45||e===46||e===95||hn(e)}function H0(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 Wq={tokenize:tV,partial:!0};function Zq(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Yq,continuation:{tokenize:Xq},exit:eV}},text:{91:{name:"gfmFootnoteCall",tokenize:Jq},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Qq,resolveTo:Gq}}}}function Qq(e,t,n){const r=this;let o=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i;for(;o--;){const l=r.events[o][1];if(l.type==="labelImage"){i=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!i||!i._balanced)return n(l);const u=Ar(r.sliceSerialize({start:i.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Gq(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)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function Jq(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,i;return a;function a(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(s>999||f===93&&!i||f===null||f===91||ot(f))return n(f);if(f===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return o.includes(Ar(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ot(f)||(i=!0),s++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),s++,u):u(f)}}function Yq(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,i=0,a;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(i>999||y===93&&!a||y===null||y===91||ot(y))return n(y);if(y===93){e.exit("chunkString");const m=e.exit("gfmFootnoteDefinitionLabelString");return s=Ar(r.sliceSerialize(m)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return ot(y)||(a=!0),i++,e.consume(y),y===92?f:d}function f(y){return y===91||y===92||y===93?(e.consume(y),i++,d):d(y)}function p(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),o.includes(s)||o.push(s),We(e,h,"gfmFootnoteDefinitionWhitespace")):n(y)}function h(y){return t(y)}}function Xq(e,t,n){return e.check(du,t,e.attempt(Wq,t,n))}function eV(e){e.exit("gfmFootnoteDefinition")}function tV(e,t,n){const r=this;return We(e,o,"gfmFootnoteDefinitionIndent",5);function o(s){const i=r.events[r.events.length-1];return i&&i[1].type==="gfmFootnoteDefinitionIndent"&&i[2].sliceSerialize(i[1],!0).length===4?t(s):n(s)}}function nV(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(i,a){let l=-1;for(;++l<i.length;)if(i[l][0]==="enter"&&i[l][1].type==="strikethroughSequenceTemporary"&&i[l][1]._close){let u=l;for(;u--;)if(i[u][0]==="exit"&&i[u][1].type==="strikethroughSequenceTemporary"&&i[u][1]._open&&i[l][1].end.offset-i[l][1].start.offset===i[u][1].end.offset-i[u][1].start.offset){i[l][1].type="strikethroughSequence",i[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},i[u][1].start),end:Object.assign({},i[l][1].end)},f={type:"strikethroughText",start:Object.assign({},i[u][1].end),end:Object.assign({},i[l][1].start)},p=[["enter",d,a],["enter",i[u][1],a],["exit",i[u][1],a],["enter",f,a]],h=a.parser.constructs.insideSpan.null;h&&Gn(p,p.length,0,Uh(h,i.slice(u+1,l),a)),Gn(p,p.length,0,[["exit",f,a],["enter",i[l][1],a],["exit",i[l][1],a],["exit",d,a]]),Gn(i,u-1,l-u+3,p),l=u+p.length-2;break}}for(l=-1;++l<i.length;)i[l][1].type==="strikethroughSequenceTemporary"&&(i[l][1].type="data");return i}function s(i,a,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):(i.enter("strikethroughSequenceTemporary"),h(y))}function h(y){const m=rl(u);if(y===126)return f>1?l(y):(i.consume(y),f++,h);if(f<2&&!n)return l(y);const x=i.exit("strikethroughSequenceTemporary"),g=rl(y);return x._open=!g||g===2&&!!m,x._close=!m||m===2&&!!g,a(y)}}}class rV{constructor(){this.map=[]}add(t,n,r){oV(this,t,n,r)}consume(t){if(this.map.sort(function(s,i){return s[0]-i[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 o=r.pop();for(;o;){for(const s of o)t.push(s);o=r.pop()}this.map.length=0}}function oV(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function sV(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function iV(){return{flow:{null:{name:"table",tokenize:aV,resolveAll:lV}}}}function aV(e,t,n){const r=this;let o=0,s=0,i;return a;function a($){let T=r.events.length-1;for(;T>-1;){const z=r.events[T][1].type;if(z==="lineEnding"||z==="linePrefix")T--;else break}const A=T>-1?r.events[T][1].type:null,U=A==="tableHead"||A==="tableRow"?j:l;return U===j&&r.parser.lazy[r.now().line]?n($):U($)}function l($){return e.enter("tableHead"),e.enter("tableRow"),u($)}function u($){return $===124||(i=!0,s+=1),d($)}function d($){return $===null?n($):be($)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),h):n($):qe($)?We(e,d,"whitespace")($):(s+=1,i&&(i=!1,o+=1),$===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),i=!0,d):(e.enter("data"),f($)))}function f($){return $===null||$===124||ot($)?(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"),i=!1,qe($)?We(e,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):y($))}function y($){return $===45||$===58?x($):$===124?(i=!0,e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),m):C($)}function m($){return qe($)?We(e,x,"whitespace")($):x($)}function x($){return $===58?(s+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),g):$===45?(s+=1,g($)):$===null||be($)?k($):C($)}function g($){return $===45?(e.enter("tableDelimiterFiller"),v($)):C($)}function v($){return $===45?(e.consume($),v):$===58?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w($))}function w($){return qe($)?We(e,k,"whitespace")($):k($)}function k($){return $===124?y($):$===null||be($)?!i||o!==s?C($):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t($)):C($)}function C($){return n($)}function j($){return e.enter("tableRow"),_($)}function _($){return $===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),_):$===null||be($)?(e.exit("tableRow"),t($)):qe($)?We(e,_,"whitespace")($):(e.enter("data"),I($))}function I($){return $===null||$===124||ot($)?(e.exit("data"),_($)):(e.consume($),$===92?P:I)}function P($){return $===92||$===124?(e.consume($),I):I($)}}function lV(e,t){let n=-1,r=!0,o=0,s=[0,0,0,0],i=[0,0,0,0],a=!1,l=0,u,d,f;const p=new rV;for(;++n<e.length;){const h=e[n],y=h[1];h[0]==="enter"?y.type==="tableHead"?(a=!1,l!==0&&(y1(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,s=[0,0,0,0],i=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},p.add(n,0,[["enter",d,t]])),o=y.type==="tableDelimiterRow"?2:d?3:1):o&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(r=!1,i[2]===0&&(s[1]!==0&&(i[0]=i[1],f=od(p,t,s,o,void 0,f),s=[0,0,0,0]),i[2]=n)):y.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(i[0]=i[1],f=od(p,t,s,o,void 0,f)),s=i,i=[s[1],n,0,0])):y.type==="tableHead"?(a=!0,l=n):y.type==="tableRow"||y.type==="tableDelimiterRow"?(l=n,s[1]!==0?(i[0]=i[1],f=od(p,t,s,o,n,f)):i[1]!==0&&(f=od(p,t,i,o,n,f)),o=0):o&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(i[3]=n)}for(l!==0&&y1(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=sV(t.events,n))}return e}function od(e,t,n,r,o,s){const i=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},Ji(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=Ji(t.events,n[1]);if(s={type:i,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=Ji(t.events,n[2]),d=Ji(t.events,n[3]),f={type:a,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 o!==void 0&&(s.end=Object.assign({},Ji(t.events,o)),e.add(o,0,[["exit",s,t]]),s=void 0),s}function y1(e,t,n,r,o){const s=[],i=Ji(t.events,n);o&&(o.end=Object.assign({},i),s.push(["exit",o,t])),r.end=Object.assign({},i),s.push(["exit",r,t]),e.add(n+1,0,s)}function Ji(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const cV={name:"tasklistCheck",tokenize:dV};function uV(){return{text:{91:cV}}}function dV(e,t,n){const r=this;return o;function o(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return ot(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),i):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),i):n(l)}function i(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return be(l)?t(l):qe(l)?e.check({tokenize:fV},t,n)(l):n(l)}}function fV(e,t,n){return We(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function hV(e){return RP([Lq(),Zq(),nV(e),iV(),uV()])}const pV={};function mV(e){const t=this,n=e||pV,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),i=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(hV(n)),s.push(Aq()),i.push(Oq(n))}const Mf=180;function gV(e){return e.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^#+\s+/gm,"").replace(/\s+/g," ").trim()}function yV(e,t){var o;if(t!=null&&t.trim())return t.trim();const n=((o=e.split(/\n\n+/)[0])==null?void 0:o.replace(/\n/g," "))??e,r=gV(n);return r.length<=Mf?r:`${r.slice(0,Mf-1).trimEnd()}…`}function vV(e,t){return t!=null&&t.trim()&&e.length>Mf?!0:e.length>Mf||/\n/.test(e)}function xV({description:e,title:t,expanded:n,onToggle:r}){const o=yV(e,t),s=vV(e,t);return e?s?c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"line-clamp-3 text-sm leading-relaxed",children:o}),c.jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 text-xs text-[#92E4DD] hover:text-white",children:[c.jsx(Sh,{className:`h-3.5 w-3.5 transition-transform ${n?"rotate-180":""}`}),n?"Hide full description":"Show full description"]})]}):c.jsx("span",{children:o}):c.jsx("span",{className:"text-gray-500",children:"—"})}function wV({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(n8,{remarkPlugins:[mV],children:e})})})}function bV(){const[e,t]=b.useState(null);return{expandedDescription:e,toggleDescription:r=>{t(o=>o===r?null:r)}}}function fm(e){return new Set(e.filter(t=>t.enabled===!1).map(t=>t.name))}function kV({serviceId:e,tools:t,isLoading:n}){const[r,o]=b.useState(""),[s,i]=b.useState(null),{expandedDescription:a,toggleDescription:l}=bV(),[u,d]=b.useState(()=>fm(t)),f=Zt(),{toast:p}=Ht(),h=b.useMemo(()=>t.map(k=>`${k.name}:${k.enabled===!1?"0":"1"}`).sort().join("\0"),[t]);b.useEffect(()=>{d(fm(t))},[e,h]);const y=dt({mutationFn:async k=>{await _e("PUT",`/api/services/${e}/tool-settings`,{disabledTools:k})},onSuccess:()=>{f.invalidateQueries({queryKey:["/api/services",e,"tools"]}),f.invalidateQueries({queryKey:["/api/services"]})},onError:k=>{p({title:"Could not save tool settings",description:k.message,variant:"destructive"}),d(fm(t))}}),m=k=>{d(k),y.mutate([...k])},x=(k,C)=>{const j=new Set(u);C?j.delete(k):j.add(k),m(j)},g=k=>{if(k){m(new Set);return}m(new Set(t.map(C=>C.name)))},v=b.useMemo(()=>{const k=r.trim().toLowerCase();return k?t.filter(C=>{var j;return C.name.toLowerCase().includes(k)||(((j=C.title)==null?void 0:j.toLowerCase().includes(k))??!1)||C.description.toLowerCase().includes(k)}):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(e0,{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(ne,{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(ne,{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(eN,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),c.jsx(Xe,{value:r,onChange:k=>o(k.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(mP,{children:[c.jsx(gP,{children:c.jsxs(Gi,{className:"border-white/10 hover:bg-transparent",children:[c.jsx(Od,{className:"w-[72px] text-center text-[#A8C4C0]",children:"Enabled"}),c.jsx(Od,{className:"w-[220px] text-[#A8C4C0]",children:"Tool"}),c.jsx(Od,{className:"text-[#A8C4C0]",children:"Description"})]})}),c.jsx(yP,{children:v.length===0?c.jsx(Gi,{className:"border-white/10 hover:bg-transparent",children:c.jsx(Qs,{colSpan:3,className:"py-8 text-center text-sm text-gray-400",children:"No tools match your search."})}):v.map(k=>{const C=!u.has(k.name),j=s===k.name,_=a===k.name,I=k.inputSchema&&Object.keys(k.inputSchema).length>0;return c.jsxs(b.Fragment,{children:[c.jsxs(Gi,{className:`border-white/10 ${C?"hover:bg-white/5":"opacity-60 hover:bg-white/5"}`,children:[c.jsx(Qs,{className:"text-center",children:c.jsx("div",{className:"flex justify-center",children:c.jsx($f,{checked:C,onCheckedChange:P=>x(k.name,P===!0),disabled:y.isPending,"aria-label":`${C?"Disable":"Enable"} ${k.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(Qs,{children:I?c.jsxs("button",{type:"button",onClick:()=>i(j?null:k.name),className:"flex w-full items-center gap-1 text-left font-mono text-sm text-[#92E4DD] hover:text-white",children:[c.jsx(Sh,{className:`h-4 w-4 shrink-0 transition-transform ${j?"rotate-180":""}`}),k.name]}):c.jsx("span",{className:"font-mono text-sm text-[#92E4DD]",children:k.name})}),c.jsx(Qs,{className:"max-w-0 text-sm text-gray-300",children:c.jsx(xV,{description:k.description,title:k.title,expanded:_,onToggle:()=>l(k.name)})})]}),_&&c.jsx(Gi,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:c.jsx(Qs,{colSpan:3,className:"py-3",children:c.jsx(wV,{description:k.description})})}),I&&j&&c.jsx(Gi,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:c.jsx(Qs,{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(k.inputSchema,null,2)})})})]},k.name)})})]})})]})}function hm({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 v1({serviceId:e,onConnected:t}){const{toast:n}=Ht(),[r,o]=b.useState(""),[s,i]=b.useState(""),[a,l]=b.useState(!1),[u,d]=b.useState(!1),[f,p]=b.useState(!1),{data:h,isLoading:y}=ut({queryKey:["/api/oauth",e,"setup"],queryFn:async()=>{const C=await _e("GET",`/api/oauth/${e}/setup`),j=await C.json();if(!C.ok||!j.success)throw new Error(j.error||"Failed to load OAuth setup");return j.data},enabled:!!e}),m=h==null?void 0:h.guide,x=!!(h!=null&&h.hasSavedCredentials),g=()=>{if(!u||(m==null?void 0:m.setupMode)!=="manual")return;const C={};return r.trim()&&(C.clientId=r.trim()),s.trim()&&(C.clientSecret=s.trim()),C},v=async(C,j)=>{try{await navigator.clipboard.writeText(j),n({title:"Copied",description:`${C} copied to clipboard.`})}catch{n({title:"Copy failed",description:"Select and copy manually.",variant:"destructive"})}};b.useEffect(()=>{(m==null?void 0:m.setupMode)==="manual"?d(!0):d(!1),p(!x)},[m==null?void 0:m.setupMode,x]),b.useEffect(()=>{h!=null&&h.savedOAuthClientId&&!r&&o(h.savedOAuthClientId)},[h==null?void 0:h.savedOAuthClientId,r]);const w=async C=>{var j,_,I;l(!0);try{const P=await _e("POST",`/api/oauth/${e}/connect`,C??{}),$=await P.json();if(!P.ok||!$.success){((j=$.data)!=null&&j.needsCredentials||((_=$.data)==null?void 0:_.setupMode)==="manual")&&d(!0),n({title:"OAuth setup",description:$.error||"Could not start OAuth flow.",variant:"destructive"});return}(I=$.data)!=null&&I.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(P){n({title:"OAuth setup failed",description:P instanceof Error?P.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(ne,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[c.jsx(Eo,{className:"w-4 h-4 mr-1"}),"Provider docs"]})]});const k=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}),k&&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})]}),x&&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&&!x&&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(C=>c.jsx("li",{children:C},C))})]}),(m.manifestJson||m.createAppUrl||k)&&c.jsxs("div",{className:"flex flex-wrap gap-2",children:[m.manifestJson&&c.jsxs(ne,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void v("App manifest",m.manifestJson),children:[c.jsx(l4,{className:"w-4 h-4 mr-1"}),"Copy manifest"]}),k&&c.jsxs(ne,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void v("Redirect URI",m.redirectUri),children:[c.jsx(Xv,{className:"w-4 h-4 mr-1"}),"Copy redirect URI"]}),m.createAppUrl&&c.jsxs(ne,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.createAppUrl,"_blank"),children:[c.jsx(Eo,{className:"w-4 h-4 mr-1"}),m.createAppLabel??"Open app creator"]})]}),m.steps.length>0&&c.jsx("div",{children:x&&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(hm,{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(hm,{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(Be,{htmlFor:`oauth-client-id-${e}`,className:"text-orange-200",children:"Client ID"}),c.jsx(Xe,{id:`oauth-client-id-${e}`,value:r,onChange:C=>o(C.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(Be,{htmlFor:`oauth-client-secret-${e}`,className:"text-orange-200",children:"Client Secret"}),c.jsx(Xe,{id:`oauth-client-secret-${e}`,type:"password",value:s,onChange:C=>i(C.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."}),x&&c.jsx(ne,{type:"button",size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>p(C=>!C),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(hm,{items:m.afterConnect,className:"text-orange-100/80"})]}),k&&c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx(ne,{size:"sm",className:"bg-orange-600 hover:bg-orange-700",disabled:a||u&&m.setupMode==="manual"&&!x&&(!r.trim()||!s.trim()),onClick:()=>w(g()),children:a?"Connecting…":x&&m.setupMode==="manual"?"Reconnect":m.setupMode==="dynamic"||m.setupMode==="managed"?"Connect":"Connect with credentials"}),m.docsUrl&&c.jsxs(ne,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[c.jsx(Eo,{className:"w-4 h-4 mr-1"}),"Docs"]})]}),m.setupMode==="informational"&&m.docsUrl&&c.jsxs(ne,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[c.jsx(Eo,{className:"w-4 h-4 mr-1"}),"Docs"]})]})}function Df(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 _T="agent-deck:oauth-complete";function _V(e){return typeof e=="object"&&e!==null&&e.type===_T}function SV(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 CV({service:e,isOpen:t,onClose:n}){var re,Fe,ae,Re,De,vt,nr,st,Nn,W,te,xe,Ce,Ke,Gt,rr,jn,Fr,Ur,Dt,or,gn;const[r,o]=b.useState(null),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[u,d]=b.useState(""),[f,p]=b.useState(""),[h,y]=b.useState(!1),[m,x]=b.useState(!1),[g,v]=b.useState(null),w=b.useRef(null),k=Zt(),{toast:C}=Ht(),j=e&&(g==null?void 0:g.id)===e.id?g:e,_=j,I=!!(_&&_.id&&_.url),{data:P,isLoading:$,error:T,refetch:A}=ut({queryKey:["/api/mcp/discover",_==null?void 0:_.url],queryFn:async()=>{if(!_||_.type!=="mcp")return null;console.log(`🔍 Attempting MCP discovery for: ${_.url}`);try{const je=await(await _e("POST","/api/mcp/discover",{url:_.url})).json();return console.log(`✅ MCP discovery successful for ${_.url}:`,je),je}catch(fe){throw console.log(`❌ MCP discovery failed for ${_.url}:`,fe),fe}},enabled:I&&_.type==="mcp"&&t,staleTime:0,gcTime:2*60*1e3}),U=((Fe=(re=P==null?void 0:P.data)==null?void 0:re.oauth)==null?void 0:Fe.required)===!0,{data:z,refetch:D}=ut({queryKey:["/api/oauth",_==null?void 0:_.id,"status"],queryFn:async()=>{const fe=await _e("GET",`/api/oauth/${_.id}/status`),je=await fe.json();if(!fe.ok||!je.success)throw new Error(je.error||"Failed to load OAuth status");return je.data},enabled:I&&_.type==="mcp"&&t&&U,refetchInterval:fe=>{const je=fe.state.data;return je!=null&&je.authenticated?!1:2e3}}),B=U?z!=null&&z.authenticated?{status:"authenticated",message:null}:z!=null&&z.hasToken&&(z!=null&&z.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:_==null?void 0:_.id,apiServiceType:_==null?void 0:_.type,apiServiceUrl:_==null?void 0:_.url,isOpen:t,hasValidService:I,enabled:I&&_.type==="mcp"&&t,mcpDiscoveryLoading:$,mcpDiscoveryData:P?JSON.stringify(P,null,2):null,mcpDiscoveryDataKeys:P?Object.keys(P):null,oauthRequired:(Re=(ae=P==null?void 0:P.data)==null?void 0:ae.oauth)==null?void 0:Re.required,oauthData:(De=P==null?void 0:P.data)!=null&&De.oauth?JSON.stringify(P.data.oauth,null,2):null,toolsQueryEnabled:I&&_.type==="mcp"&&t&&!((nr=(vt=P==null?void 0:P.data)==null?void 0:vt.oauth)!=null&&nr.required)});const{data:q,isLoading:H,error:N,refetch:O}=ut({queryKey:["/api/services",_==null?void 0:_.id,"tools"],queryFn:async()=>{if(!_||_.type!=="mcp"&&_.type!=="local-mcp")return{data:[]};console.log(`🔍 Attempting to discover tools for MCP service: ${_.id} at ${_.url}`);try{const je=await(await _e("GET",`/api/services/${_.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${_.id}:`,je),je}catch(fe){throw console.log(`❌ MCP tools discovery failed for ${_.id}:`,fe),fe}},enabled:I&&(_.type==="mcp"||_.type==="local-mcp")&&t&&(_.type==="local-mcp"||B.status==="authenticated"||B.status==="not_required"),staleTime:0,gcTime:2*60*1e3});b.useEffect(()=>{if(!t||!(_!=null&&_.id)||_.type!=="mcp"&&_.type!=="local-mcp"||!(_.type==="local-mcp"||B.status==="authenticated"||B.status==="not_required")||H||N)return;let je=!1;return(async()=>{try{const At=await(await _e("GET",`/api/services/${_.id}`)).json();!je&&(At!=null&&At.success)&&At.data&&v(At.data),k.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{je=!0}},[t,_==null?void 0:_.id,_==null?void 0:_.type,H,N,B.status,k]),b.useEffect(()=>{if(!t||!(_!=null&&_.id)||_.type!=="a2a")return;let fe=!1;return(async()=>{try{await _e("GET",`/api/services/${_.id}/health`);const Qe=await(await _e("GET",`/api/services/${_.id}`)).json();!fe&&(Qe!=null&&Qe.success)&&Qe.data&&v(Qe.data),k.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{fe=!0}},[t,_==null?void 0:_.id,_==null?void 0:_.type,k]),console.log("MCP Tools Query Debug:",{hasValidService:I,apiServiceType:_==null?void 0:_.type,isOpen:t,oauthRequired:(Nn=(st=P==null?void 0:P.data)==null?void 0:st.oauth)==null?void 0:Nn.required,oauthStatus:B.status,toolsQueryEnabled:I&&(_.type==="mcp"||_.type==="local-mcp")&&t&&(_.type==="local-mcp"||B.status==="authenticated"||B.status==="not_required"),mcpToolsLoading:H});const{data:V,isLoading:S,error:E}=ut({queryKey:["/api/proxy/a2a",_==null?void 0:_.id,"manifest"],queryFn:async()=>{if(!_||_.type!=="a2a")return null;const je=await(await _e("GET",`/api/proxy/a2a/${_.id}/manifest`)).text();return JSON.parse(je)},enabled:I&&_.type==="a2a"&&t,staleTime:0,gcTime:2*60*1e3}),R=(q==null?void 0:q.data)||[],M=V,K=H||S;console.log("ServiceDetailsModal Debug:",{service:e==null?void 0:e.id,serviceType:e==null?void 0:e.type,isOpen:t,mcpDiscoveryLoading:$,mcpDiscoveryData:P,mcpDiscoveryError:T?String(T):null,mcpToolsLoading:H,a2aManifestLoading:S,mcpToolsError:N?String(N):null,a2aManifestError:E?String(E):null,mcpToolsCount:R.length,mcpToolsData:q,hasA2aManifest:!!M,isLoading:K,oauthRequired:(te=(W=P==null?void 0:P.data)==null?void 0:W.oauth)==null?void 0:te.required,oauthStatus:B.status,oauthMessage:B.message,oauthAuthenticated:z==null?void 0:z.authenticated,expiresAt:z==null?void 0:z.expiresAt}),b.useEffect(()=>{if(!t){v(null),le.current=!1,G.current=!1;return}e&&(v(e),d(e.name||""),p(e.description||""))},[e,t]);const G=b.useRef(!1),le=b.useRef(!1);b.useEffect(()=>{if(!t||!(_!=null&&_.id)){G.current=!1;return}if(!(z!=null&&z.authenticated)){G.current=!1;return}if(G.current)return;G.current=!0,le.current=!0,(async()=>{C({title:"OAuth completed",description:"Authentication successful! Refreshing service status..."}),Df(k,_.id),k.invalidateQueries({queryKey:["/api/mcp/discover",_.url]});try{const je=await _e("GET",`/api/services/${_.id}`);if(je.ok){const J=await je.json();v(J.data??J)}}catch{}await A(),k.invalidateQueries({queryKey:["/api/services",_.id,"tools"]}),await O(),le.current=!1})()},[z==null?void 0:z.authenticated,t,_==null?void 0:_.id]);const se=()=>(e==null?void 0:e.type)==="mcp"?c.jsx(Wb,{className:"w-6 h-6"}):c.jsx(Lp,{className:"w-6 h-6"}),he=()=>(e==null?void 0:e.type)==="mcp"?"text-blue-400":"text-purple-400",ke=()=>(e==null?void 0:e.type)==="mcp"?"bg-blue-500/20":"bg-purple-500/20",tt=fe=>new Date(fe).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});b.useEffect(()=>{var fe,je;s&&((fe=w.current)==null||fe.focus(),(je=w.current)==null||je.select())},[s]);const yt=async()=>{const fe=(j==null?void 0:j.name)||"",je=u.trim();if(!j||!je||je===fe){d(fe),i(!1);return}y(!0);try{await _e("PUT",`/api/services/${j.id}`,{name:je}),v({...j,name:je}),k.invalidateQueries({queryKey:["/api/services"]}),k.invalidateQueries({queryKey:["/api/collection/warnings"]}),k.invalidateQueries({queryKey:["/api/decks"]}),i(!1)}catch(J){d(fe),i(!1),C({title:"Could not rename service",description:J instanceof Error?J.message:"Failed to update name",variant:"destructive"})}finally{y(!1)}},ee=async()=>{if(e){x(!0);try{if((await _e("PUT",`/api/services/${e.id}`,{description:f.trim()})).ok){if(g){const je={...g,description:f.trim()};v(je)}k.invalidateQueries({queryKey:["/api/services"]}),k.invalidateQueries({queryKey:["/api/collection/warnings"]}),k.invalidateQueries({queryKey:["/api/decks"]}),k.invalidateQueries({queryKey:["/api/decks"]}),C({title:"Description updated",description:"Service description has been updated successfully."}),l(!1)}else throw new Error("Failed to update description")}catch{C({title:"Update failed",description:"Failed to update service description. Please try again.",variant:"destructive"})}finally{x(!1)}}},pe=fe=>{fe||(le.current&&(Df(k,(_==null?void 0:_.id)??(e==null?void 0:e.id)),le.current=!1),G.current=!1,n())};return c.jsx(Fs,{open:t,onOpenChange:pe,children:c.jsxs(Fo,{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(Uo,{children:c.jsxs(qo,{className:"text-2xl font-bold flex items-center",children:[se(),c.jsx("div",{className:"ml-3 flex min-w-0 items-center",children:s?c.jsx("input",{ref:w,type:"text",value:u,disabled:h,onChange:fe=>d(fe.target.value),onBlur:()=>{yt()},onKeyDown:fe=>{fe.key==="Enter"?(fe.preventDefault(),yt()):fe.key==="Escape"&&(fe.preventDefault(),d((j==null?void 0:j.name)||""),i(!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((j==null?void 0:j.name)||""),i(!0)},"data-testid":"button-rename-service",children:j==null?void 0:j.name})}),c.jsx(Xt,{className:`ml-3 ${ke()} ${he()}`,children:(xe=e==null?void 0:e.type)==null?void 0:xe.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(s4,{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"}),!a&&c.jsx(ne,{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(e0,{className:"w-3 h-3"})})]}),a?c.jsxs("div",{className:"space-y-2",children:[c.jsx("textarea",{value:f,onChange:fe=>p(fe.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(ne,{size:"sm",onClick:ee,disabled:m,className:"h-6 px-2 text-xs",children:m?"Saving...":"Save"}),c.jsx(ne,{size:"sm",variant:"outline",onClick:()=>{l(!1),p((j==null?void 0:j.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:(j==null?void 0:j.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(Xt,{variant:"outline",className:"border-blue-500/30 text-blue-300",children:_.type.toUpperCase()}),e.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0&&c.jsx(Xt,{variant:"outline",className:"border-green-500/30 text-green-300",children:"Custom Headers"})]}),c.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>window.open(_.url,"_blank"),className:"p-1 h-auto",children:c.jsx(Eo,{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:_.url||"No URL available"}),e.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0&&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("pre",{className:"text-xs overflow-x-auto",children:JSON.stringify(e.headers,null,2)})]})]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Health Status"}),c.jsx(Xt,{className:_.health==="healthy"?"bg-green-500/20 text-green-300":_.health==="unhealthy"?"bg-red-500/20 text-red-300":"bg-amber-500/20 text-amber-200",children:_.health==="healthy"?"Healthy":_.health==="unhealthy"?"Unreachable":B.status==="required"||B.status==="expired"?"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:tt(_.registeredAt)})]})]})]}),K&&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:SV(_)?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"
424
- export GOOGLE_DRIVE_MCP_AUTH_PORT=3100
425
- 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(kV,{serviceId:_.id,tools:R,isLoading:H})]}),e.type==="a2a"&&M&&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(g4,{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:M.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:M.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:M.description})]}),M.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:M.provider.organization})]}),M.documentationUrl&&c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Documentation"}),c.jsxs(ne,{size:"sm",variant:"ghost",onClick:()=>window.open(M.documentationUrl,"_blank"),className:"p-1 h-auto text-purple-300",children:[c.jsx(Eo,{className:"w-4 h-4 mr-1"}),"View Docs"]})]})]})]}),M.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(ZE,{className:"w-5 h-5 mr-2"}),"Capabilities"]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[M.capabilities.streaming&&c.jsx(Xt,{className:"bg-green-500/20 text-green-300",children:"Streaming"}),M.capabilities.pushNotifications&&c.jsx(Xt,{className:"bg-blue-500/20 text-blue-300",children:"Push Notifications"}),M.capabilities.stateTransitionHistory&&c.jsx(Xt,{className:"bg-purple-500/20 text-purple-300",children:"State History"})]})]}),M.skills&&M.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(Lp,{className:"w-5 h-5 mr-2"}),"Skills (",M.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:M.skills.map((fe,je)=>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(Lp,{className:"w-6 h-6"})}),c.jsx("h4",{className:"font-bold text-sm mb-2 line-clamp-2 text-white",children:fe.name}),c.jsx("p",{className:"text-gray-300 text-xs line-clamp-4 mb-2",children:fe.description}),fe.tags&&fe.tags.length>0&&c.jsx("div",{className:"flex flex-wrap gap-1 justify-center",children:fe.tags.slice(0,2).map((J,Qe)=>c.jsx("span",{className:"text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded",children:J},Qe))})]}),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"})]},je))})]}),(M.defaultInputModes||M.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(Wb,{className:"w-5 h-5 mr-2"}),"Data Modes"]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[M.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:M.defaultInputModes.map((fe,je)=>c.jsx(Xt,{className:"bg-blue-500/20 text-blue-300 text-xs",children:fe},je))})]}),M.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:M.defaultOutputModes.map((fe,je)=>c.jsx(Xt,{className:"bg-green-500/20 text-green-300 text-xs",children:fe},je))})]})]})]})]}),(e==null?void 0:e.type)==="mcp"&&B.status==="not_required"&&(_==null?void 0:_.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(v1,{serviceId:_.id})]}),(e==null?void 0:e.type)==="mcp"&&B.status!=="authenticated"&&B.status!=="not_required"&&c.jsxs("div",{className:`${B.status==="expired"?"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:`${B.status==="expired"?"text-red-300":"text-orange-300"} font-semibold mb-2`,children:B.status==="expired"?"⏰ Token Expired":"🔐 Authentication Required"}),c.jsxs("div",{className:`${B.status==="expired"?"text-red-200":"text-orange-200"} text-sm space-y-2`,children:[c.jsx("p",{children:c.jsx("strong",{children:B.message})}),c.jsx("p",{children:B.status==="expired"?"Your OAuth token has expired. Please re-authenticate to continue using this service.":"This MCP server requires OAuth authentication to access its tools. Please authenticate to continue."}),(_==null?void 0:_.id)&&c.jsx(v1,{serviceId:_.id,onConnected:()=>void D()}),((Ke=(Ce=P==null?void 0:P.data)==null?void 0:Ce.oauth)==null?void 0:Ke.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:"})," ",P.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: ",_==null?void 0:_.url]}),c.jsxs("p",{children:["Status: ",H?"🔄 Loading...":N?"❌ Failed":"✅ Complete"]})]}),H&&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:_==null?void 0:_.url})]})]}),N&&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:N instanceof Error?N.message:String(N)}),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: ",_==null?void 0:_.url]}),c.jsxs("p",{children:["• Request: GET /api/services/",e==null?void 0:e.id,"/tools"]}),(_==null?void 0:_.headers)&&c.jsxs("div",{children:[c.jsx("p",{children:c.jsx("strong",{children:"📋 Headers sent:"})}),c.jsx("pre",{className:"text-xs overflow-x-auto",children:JSON.stringify(_.headers,null,2)})]}),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 ",_==null?void 0:_.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"})]})]})]}),!H&&!N&&R.length>0&&c.jsx("div",{className:"bg-green-500/20 p-2 rounded text-xs",children:c.jsxs("p",{children:["✅ Successfully discovered ",R.length," tools from MCP server"]})}),!H&&!N&&R.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"})]})]})]}),N&&(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:N instanceof Error?N.message:String(N)}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service URL:"})," ",_==null?void 0:_.url]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service ID:"})," ",_==null?void 0:_.id]}),(_==null?void 0:_.headers)&&c.jsxs("div",{children:[c.jsx("p",{children:c.jsx("strong",{children:"Custom Headers:"})}),c.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto",children:JSON.stringify(_.headers,null,2)})]})]})]}),E&&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:E instanceof Error?E.message:String(E)}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service URL:"})," ",_==null?void 0:_.url]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service ID:"})," ",_==null?void 0:_.id]})]})]}),!K&&!N&&!E&&(e.type==="mcp"||e.type==="local-mcp")&&R.length===0&&(e.type==="local-mcp"||!((rr=(Gt=P==null?void 0:P.data)==null?void 0:Gt.oauth)!=null&&rr.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 ",_==null?void 0:_.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:"})," ",_==null?void 0:_.url]}),$&&c.jsx("div",{className:"mt-3 p-3 bg-black/30 rounded",children:c.jsx("p",{children:"🔍 Analyzing MCP server configuration..."})}),P&&c.jsxs("div",{className:"mt-3 p-3 bg-black/30 rounded",children:[c.jsx("p",{children:c.jsx("strong",{children:"🔍 What we discovered:"})}),P.error&&P.analysis&&c.jsxs("div",{className:"text-yellow-200",children:[P.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"})]}),P.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"})]}),P.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"})]}),P.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"})]}),P.analysis.message&&c.jsxs("p",{children:["• ",c.jsx("strong",{children:"Analysis:"})," ",P.analysis.message]})]}),((Fr=(jn=P==null?void 0:P.data)==null?void 0:jn.oauth)==null?void 0:Fr.required)&&c.jsxs("div",{className:"text-yellow-200",children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),P.data.oauth.authorizationUrl&&c.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[c.jsx(ne,{size:"sm",variant:"default",className:"h-7",onClick:async()=>{var fe,je;if(_!=null&&_.id)try{C({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const J=await _e("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!J.ok){const At=await J.json();(fe=At.data)!=null&&fe.registrationUrl?(window.open(At.data.registrationUrl,"_blank"),C({title:"OAuth Registration Required",description:`${At.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):C({title:"OAuth Setup Failed",description:At.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Qe=await J.json();Qe.success&&((je=Qe.data)!=null&&je.authorizationUrl)?(window.open(Qe.data.authorizationUrl,"_blank"),C({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),D()):C({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(J){C({title:"OAuth Setup Failed",description:J instanceof Error?J.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),c.jsxs(ne,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(P.data.oauth.authorizationUrl,"_blank"),children:[c.jsx(Eo,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),!P.data.oauth.authorizationUrl&&P.data.oauth.protectedResourceConfigUrl&&c.jsx("div",{className:"mt-2",children:c.jsxs(ne,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(P.data.oauth.protectedResourceConfigUrl,"_blank"),children:[c.jsx(Eo,{className:"w-4 h-4 mr-1"}),"View OAuth Configuration"]})}),P.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(P.data.oauth.authorizationServerMetadataUrl,"_blank"),children:P.data.oauth.authorizationServerMetadataUrl})]})]}),(P==null?void 0:P.success)&&!((Dt=(Ur=P==null?void 0:P.data)==null?void 0:Ur.oauth)!=null&&Dt.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"})]}),((gn=(or=P==null?void 0:P.data)==null?void 0:or.oauth)==null?void 0:gn.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"}),P.data.oauth.resourceName&&c.jsxs("p",{children:["• Service: ",P.data.oauth.resourceName]}),P.data.oauth.authorizationUrl&&c.jsxs("p",{children:["• Authorization URL: ",P.data.oauth.authorizationUrl]}),P.data.oauth.tokenUrl&&c.jsxs("p",{children:["• Token URL: ",P.data.oauth.tokenUrl]}),c.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[c.jsx(ne,{size:"sm",variant:"default",className:"bg-orange-600 hover:bg-orange-700",onClick:async()=>{var fe,je;if(_!=null&&_.id)try{C({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const J=await _e("POST",`/api/oauth/${_.id}/auto-setup`,{});if(!J.ok){const At=await J.json();(fe=At.data)!=null&&fe.registrationUrl?(window.open(At.data.registrationUrl,"_blank"),C({title:"OAuth Registration Required",description:`${At.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):C({title:"OAuth Setup Failed",description:At.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Qe=await J.json();Qe.success&&((je=Qe.data)!=null&&je.authorizationUrl)?(window.open(Qe.data.authorizationUrl,"_blank"),C({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),D()):C({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(J){C({title:"OAuth Setup Failed",description:J instanceof Error?J.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),c.jsx(ne,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-300 hover:bg-orange-500/10",onClick:()=>{const fe=`OAuth Setup Instructions:
426
-
427
- 1. Go to the service provider's OAuth/Developer settings
428
- 2. Create a new OAuth application
429
- 3. Set Redirect URL: http://localhost:8000/api/oauth/${_==null?void 0:_.id}/callback
430
- 4. Copy the Client ID and Client Secret
431
- 5. Edit this service and add the credentials
432
-
433
- ${P.data.oauth.authorizationUrl?`Authorization URL: ${P.data.oauth.authorizationUrl}`:""}
434
- ${P.data.oauth.tokenUrl?`Token URL: ${P.data.oauth.tokenUrl}`:""}
435
- ${P.data.oauth.issuer?`Issuer: ${P.data.oauth.issuer}`:""}`;C({title:"OAuth Setup Instructions",description:fe,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"})]})]})]}),T&&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:T instanceof Error?T.message:String(T)})]})]})]}),!K&&!N&&!E&&e.type==="a2a"&&!M&&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 ",_==null?void 0:_.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 EV({open:e,onOpenChange:t}){const[n,r]=b.useState(null),[o,s]=b.useState(null),[i,a]=b.useState(null),[l,u]=b.useState(!1),d=Zt(),{toast:f}=Ht(),p=()=>{r(null),s(null),a(null),u(!1)},h=dt({mutationFn:async()=>{if(!n)throw new Error("Choose a bundle file first");const m=await n.text();let x;try{x=JSON.parse(m)}catch{throw new Error("File is not valid JSON")}return n3(x)},onSuccess:m=>{a(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:bk(m)})},onError:m=>{f({title:"Import failed",description:m.message,variant:"destructive"})}}),y=async m=>{var x,g,v;if(r(m),a(null),!m){s(null);return}try{const w=await m.text(),k=JSON.parse(w);s(`${((x=k.services)==null?void 0:x.length)??0} services · ${((g=k.playbooks)==null?void 0:g.length)??0} playbooks · ${((v=k.decks)==null?void 0:v.length)??0} decks`)}catch{s("Invalid JSON")}};return c.jsx(Fs,{open:e,onOpenChange:m=>{m||p(),t(m)},children:c.jsxs(Fo,{className:"sm:max-w-lg border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(Uo,{children:[c.jsx(qo,{children:"Import bundle"}),c.jsx(Li,{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(Be,{htmlFor:"bundle-file",children:"Bundle file"}),c.jsx(Xe,{id:"bundle-file",type:"file",accept:".json,.agent-deck.json,application/json",className:"cursor-pointer bg-white/5 border-white/20",onChange:m=>{var x;return y(((x=m.target.files)==null?void 0:x[0])??null)},"data-testid":"input-import-bundle"}),o&&c.jsx("p",{className:"text-xs text-[#A8C4C0]","data-testid":"import-preview",children:o})]}),!i&&c.jsx(ne,{onClick:()=>h.mutate(),disabled:!n||h.isPending||o==="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"}),i&&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:bk(i)}),i.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:i.servicesNeedingOauth.map(m=>c.jsx("li",{children:m},m))})]}),i.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:i.warnings.map(m=>c.jsx("li",{children:m},m))})]}),c.jsx(ne,{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(i.idMap,null,2)}),c.jsx(ne,{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 NV(){const[e,t]=b.useState("connecting"),[n,r]=b.useState(null),o=b.useRef(null),s=b.useRef(null),i=Zt();return b.useEffect(()=>{const l=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws/events`,u=()=>{try{const f=new WebSocket(l);o.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),i.invalidateQueries({queryKey:["/api/decks"]})):y.type==="service_update"?(console.log("Received service update:",y),Df(i,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"),s.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&&_V(f.data)&&Df(i,f.data.serviceId)};return window.addEventListener("message",d),()=>{window.removeEventListener("message",d),s.current&&clearTimeout(s.current),o.current&&o.current.readyState===WebSocket.OPEN&&o.current.close()}},[i]),{connectionStatus:e,lastMessage:n}}async function x1(e,t){const n=e==="credential"?`credentialId=${encodeURIComponent(t)}`:`serviceId=${encodeURIComponent(t)}`;return(await(await _e("GET",`/api/playbooks/dependents/check?${n}`)).json()).data??[]}function jV(e){const[t,n]=b.useState(null),[r,o]=b.useState(null),[s,i]=b.useState(null),[a,l]=b.useState(!1),u=Zt(),{toast:d}=Ht(),f=()=>{if(!e)throw new Error("Select a deck to edit first");return e},p=dt({mutationFn:async T=>{var B,q,H;const A=f(),D=(B=(await(await _e("GET","/api/decks")).json()).data)==null?void 0:B.find(N=>N.id===A);if(!D)throw new Error("Selected deck not found");if((q=D.services)!=null&&q.some(N=>N.id===T))throw new Error("Service is already in the deck");const Z=((H=D.services)==null?void 0:H.length)??0;return _e("POST",`/api/decks/${A}/services`,{serviceId:T,position:Z})},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:T=>{d({title:"Failed to add service",description:T.message,variant:"destructive"})}}),h=dt({mutationFn:async T=>{var Z,B;const A=f(),D=(Z=(await(await _e("GET","/api/decks")).json()).data)==null?void 0:Z.find(q=>q.id===A);if((B=D==null?void 0:D.credentials)!=null&&B.some(q=>q.id===T))throw new Error("API key is already in the deck");return _e("POST",`/api/decks/${A}/credentials`,{credentialId:T})},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:T=>{d({title:"Failed to add API key",description:T.message,variant:"destructive"})}}),y=dt({mutationFn:async T=>{var Z,B;const A=f(),D=(Z=(await(await _e("GET","/api/decks")).json()).data)==null?void 0:Z.find(q=>q.id===A);if((B=D==null?void 0:D.playbooks)!=null&&B.some(q=>q.id===T))throw new Error("Playbook is already in the deck");return _e("POST",`/api/decks/${A}/playbooks`,{playbookId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook added to deck",description:`${(s==null?void 0:s.title)||"Playbook"} is on this deck.`})},onError:T=>{d({title:"Failed to add playbook",description:T.message,variant:"destructive"})}}),m=dt({mutationFn:async T=>{const A=await x1("service",T);if(A.length>0){const z=A.map(Z=>Z.title).join(", ");if(!window.confirm(`Warning: ${A.length} playbook(s) depend on this MCP (${z}). Remove from deck anyway?`))throw new Error("Cancelled")}const U=f();return _e("DELETE",`/api/decks/${U}/services`,{serviceId:T})},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:T=>{T.message!=="Cancelled"&&d({title:"Failed to remove service",description:T.message,variant:"destructive"})}}),x=dt({mutationFn:async T=>{const A=await x1("credential",T);if(A.length>0){const z=A.map(Z=>Z.title).join(", ");if(!window.confirm(`Warning: ${A.length} playbook(s) depend on this API key (${z}). Remove from deck anyway?`))throw new Error("Cancelled")}const U=f();return _e("DELETE",`/api/decks/${U}/credentials`,{credentialId:T})},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:T=>{T.message!=="Cancelled"&&d({title:"Failed to remove API key",description:T.message,variant:"destructive"})}}),g=dt({mutationFn:async T=>{const A=f();return _e("DELETE",`/api/decks/${A}/playbooks`,{playbookId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook removed from deck",description:`${(s==null?void 0:s.title)||"Playbook"} is no longer on this deck.`})},onError:T=>{d({title:"Failed to remove playbook",description:T.message,variant:"destructive"})}}),v=(T,A)=>{T.currentTarget instanceof HTMLElement&&(T.currentTarget.style.opacity=A)},w=(T,A)=>{T.dataTransfer.setData("text/plain",A.id),T.dataTransfer.setData("application/json",JSON.stringify(A)),T.dataTransfer.effectAllowed=A.fromDeck?"move":"copy"},k=(T,A,U=!1)=>{n(A),o(null),i(null),l(U),w(T,{kind:"service",id:A.id,fromDeck:U}),v(T,"0.5")},C=(T,A,U=!1)=>{o(A),n(null),i(null),l(U),w(T,{kind:"credential",id:A.id,fromDeck:U}),v(T,"0.5")},j=(T,A,U=!1)=>{i(A),n(null),o(null),l(U),w(T,{kind:"playbook",id:A.id,fromDeck:U}),v(T,"0.5")},_=T=>{n(null),o(null),i(null),v(T,"1")},I=T=>{if(T.kind==="service"){T.fromDeck?m.mutate(T.id):p.mutate(T.id);return}if(T.kind==="credential"){T.fromDeck?x.mutate(T.id):h.mutate(T.id);return}T.fromDeck?g.mutate(T.id):y.mutate(T.id)};return{draggedService:t,draggedCredential:r,draggedPlaybook:s,isDraggingFromDeck:a,handleDragStart:k,handleCredentialDragStart:C,handlePlaybookDragStart:j,handleDragEnd:_,handleDrop:T=>{T.preventDefault();const A=T.dataTransfer.getData("application/json");if(A){try{I(JSON.parse(A))}catch{const U=T.dataTransfer.getData("text/plain");U&&t&&p.mutate(U)}n(null),o(null),i(null),l(!1)}},handleGlobalDrop:T=>{T.preventDefault();const A=T.dataTransfer.getData("application/json");if(A){try{const U=JSON.parse(A);U.fromDeck&&I(U)}catch{}n(null),o(null),i(null),l(!1)}},isDropping:p.isPending||h.isPending||y.isPending||m.isPending||x.isPending||g.isPending}}const pm="agent-deck-editing-deck-id";function PV(e){const[t,n]=b.useState(()=>typeof window>"u"?null:localStorage.getItem(pm));b.useEffect(()=>{if(e.length===0)return;if(!(t&&e.some(i=>i.id===t))){const i=e[0].id;n(i),localStorage.setItem(pm,i)}},[e,t]);const r=s=>{n(s),localStorage.setItem(pm,s)};return{editingDeck:e.find(s=>s.id===t)??null,editingDeckId:t,setEditingDeckId:r}}function w1(e,[t,n]){return Math.min(n,Math.max(t,e))}var TV=[" ","Enter","ArrowUp","ArrowDown"],$V=[" ","Enter"],$i="Select",[Bh,Kh,RV]=Zv($i),[wl,Ste]=lo($i,[RV,yl]),Wh=yl(),[IV,qs]=wl($i),[AV,OV]=wl($i),ST=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:h,form:y}=e,m=Wh(t),[x,g]=b.useState(null),[v,w]=b.useState(null),[k,C]=b.useState(!1),j=b0(u),[_,I]=$s({prop:r,defaultProp:o??!1,onChange:s,caller:$i}),[P,$]=$s({prop:i,defaultProp:a,onChange:l,caller:$i}),T=b.useRef(null),A=x?y||!!x.closest("form"):!0,[U,z]=b.useState(new Set),D=Array.from(U).map(Z=>Z.props.value).join(";");return c.jsx(IN,{...m,children:c.jsxs(IV,{required:h,scope:t,trigger:x,onTriggerChange:g,valueNode:v,onValueNodeChange:w,valueNodeHasChildren:k,onValueNodeHasChildrenChange:C,contentId:jo(),value:P,onValueChange:$,open:_,onOpenChange:I,dir:j,triggerPointerDownPosRef:T,disabled:p,children:[c.jsx(Bh.Provider,{scope:t,children:c.jsx(AV,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(Z=>{z(B=>new Set(B).add(Z))},[]),onNativeOptionRemove:b.useCallback(Z=>{z(B=>{const q=new Set(B);return q.delete(Z),q})},[]),children:n})}),A?c.jsxs(ZT,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:Z=>$(Z.target.value),disabled:p,form:y,children:[P===void 0?c.jsx("option",{value:""}):null,Array.from(U)]},D):null]})})};ST.displayName=$i;var CT="SelectTrigger",ET=b.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=Wh(n),i=qs(CT,n),a=i.disabled||r,l=Ye(t,i.onTriggerChange),u=Kh(n),d=b.useRef("touch"),[f,p,h]=GT(m=>{const x=u().filter(w=>!w.disabled),g=x.find(w=>w.value===i.value),v=JT(x,m,g);v!==void 0&&i.onValueChange(v.value)}),y=m=>{a||(i.onOpenChange(!0),h()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return c.jsx(Ph,{asChild:!0,...s,children:c.jsx(Te.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":QT(i.value)?"":void 0,...o,ref:l,onClick:ve(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&y(m)}),onPointerDown:ve(o.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(y(m),m.preventDefault())}),onKeyDown:ve(o.onKeyDown,m=>{const x=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(x&&m.key===" ")&&TV.includes(m.key)&&(y(),m.preventDefault())})})})});ET.displayName=CT;var NT="SelectValue",jT=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,l=qs(NT,n),{onValueNodeHasChildrenChange:u}=l,d=s!==void 0,f=Ye(t,l.onValueNodeChange);return sn(()=>{u(d)},[u,d]),c.jsx(Te.span,{...a,ref:f,style:{pointerEvents:"none"},children:QT(l.value)?c.jsx(c.Fragment,{children:i}):s})});jT.displayName=NT;var MV="SelectIcon",PT=b.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return c.jsx(Te.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});PT.displayName=MV;var DV="SelectPortal",TT=e=>c.jsx(ru,{asChild:!0,...e});TT.displayName=DV;var Ri="SelectContent",$T=b.forwardRef((e,t)=>{const n=qs(Ri,e.__scopeSelect),[r,o]=b.useState();if(sn(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Di.createPortal(c.jsx(RT,{scope:e.__scopeSelect,children:c.jsx(Bh.Slot,{scope:e.__scopeSelect,children:c.jsx("div",{children:e.children})})}),s):null}return c.jsx(IT,{...e,ref:t})});$T.displayName=Ri;var br=10,[RT,Vs]=wl(Ri),LV="SelectContentImpl",zV=Ni("SelectContent.RemoveScroll"),IT=b.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:y,hideWhenDetached:m,avoidCollisions:x,...g}=e,v=qs(Ri,n),[w,k]=b.useState(null),[C,j]=b.useState(null),_=Ye(t,K=>k(K)),[I,P]=b.useState(null),[$,T]=b.useState(null),A=Kh(n),[U,z]=b.useState(!1),D=b.useRef(!1);b.useEffect(()=>{if(w)return g0(w)},[w]),m0();const Z=b.useCallback(K=>{const[G,...le]=A().map(ke=>ke.ref.current),[se]=le.slice(-1),he=document.activeElement;for(const ke of K)if(ke===he||(ke==null||ke.scrollIntoView({block:"nearest"}),ke===G&&C&&(C.scrollTop=0),ke===se&&C&&(C.scrollTop=C.scrollHeight),ke==null||ke.focus(),document.activeElement!==he))return},[A,C]),B=b.useCallback(()=>Z([I,w]),[Z,I,w]);b.useEffect(()=>{U&&B()},[U,B]);const{onOpenChange:q,triggerPointerDownPosRef:H}=v;b.useEffect(()=>{if(w){let K={x:0,y:0};const G=se=>{var he,ke;K={x:Math.abs(Math.round(se.pageX)-(((he=H.current)==null?void 0:he.x)??0)),y:Math.abs(Math.round(se.pageY)-(((ke=H.current)==null?void 0:ke.y)??0))}},le=se=>{K.x<=10&&K.y<=10?se.preventDefault():w.contains(se.target)||q(!1),document.removeEventListener("pointermove",G),H.current=null};return H.current!==null&&(document.addEventListener("pointermove",G),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",G),document.removeEventListener("pointerup",le,{capture:!0})}}},[w,q,H]),b.useEffect(()=>{const K=()=>q(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[q]);const[N,O]=GT(K=>{const G=A().filter(he=>!he.disabled),le=G.find(he=>he.ref.current===document.activeElement),se=JT(G,K,le);se&&setTimeout(()=>se.ref.current.focus())}),V=b.useCallback((K,G,le)=>{const se=!D.current&&!le;(v.value!==void 0&&v.value===G||se)&&(P(K),se&&(D.current=!0))},[v.value]),S=b.useCallback(()=>w==null?void 0:w.focus(),[w]),E=b.useCallback((K,G,le)=>{const se=!D.current&&!le;(v.value!==void 0&&v.value===G||se)&&T(K)},[v.value]),R=r==="popper"?cy:AT,M=R===cy?{side:a,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:y,hideWhenDetached:m,avoidCollisions:x}:{};return c.jsx(RT,{scope:n,content:w,viewport:C,onViewportChange:j,itemRefCallback:V,selectedItem:I,onItemLeave:S,itemTextRefCallback:E,focusSelectedItem:B,selectedItemText:$,position:r,isPositioned:U,searchRef:N,children:c.jsx(Ah,{as:zV,allowPinchZoom:!0,children:c.jsx(Rh,{asChild:!0,trapped:v.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:ve(o,K=>{var G;(G=v.trigger)==null||G.focus({preventScroll:!0}),K.preventDefault()}),children:c.jsx(hl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:c.jsx(R,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:K=>K.preventDefault(),...g,...M,onPlaced:()=>z(!0),ref:_,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&&O(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let se=A().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(K.key)&&(se=se.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const he=K.target,ke=se.indexOf(he);se=se.slice(ke+1)}setTimeout(()=>Z(se)),K.preventDefault()}})})})})})})});IT.displayName=LV;var FV="SelectItemAlignedPosition",AT=b.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=qs(Ri,n),i=Vs(Ri,n),[a,l]=b.useState(null),[u,d]=b.useState(null),f=Ye(t,_=>d(_)),p=Kh(n),h=b.useRef(!1),y=b.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:g,focusSelectedItem:v}=i,w=b.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&m&&x&&g){const _=s.trigger.getBoundingClientRect(),I=u.getBoundingClientRect(),P=s.valueNode.getBoundingClientRect(),$=g.getBoundingClientRect();if(s.dir!=="rtl"){const he=$.left-I.left,ke=P.left-he,tt=_.left-ke,yt=_.width+tt,ee=Math.max(yt,I.width),pe=window.innerWidth-br,re=w1(ke,[br,Math.max(br,pe-ee)]);a.style.minWidth=yt+"px",a.style.left=re+"px"}else{const he=I.right-$.right,ke=window.innerWidth-P.right-he,tt=window.innerWidth-_.right-ke,yt=_.width+tt,ee=Math.max(yt,I.width),pe=window.innerWidth-br,re=w1(ke,[br,Math.max(br,pe-ee)]);a.style.minWidth=yt+"px",a.style.right=re+"px"}const T=p(),A=window.innerHeight-br*2,U=m.scrollHeight,z=window.getComputedStyle(u),D=parseInt(z.borderTopWidth,10),Z=parseInt(z.paddingTop,10),B=parseInt(z.borderBottomWidth,10),q=parseInt(z.paddingBottom,10),H=D+Z+U+q+B,N=Math.min(x.offsetHeight*5,H),O=window.getComputedStyle(m),V=parseInt(O.paddingTop,10),S=parseInt(O.paddingBottom,10),E=_.top+_.height/2-br,R=A-E,M=x.offsetHeight/2,K=x.offsetTop+M,G=D+Z+K,le=H-G;if(G<=E){const he=T.length>0&&x===T[T.length-1].ref.current;a.style.bottom="0px";const ke=u.clientHeight-m.offsetTop-m.offsetHeight,tt=Math.max(R,M+(he?S:0)+ke+B),yt=G+tt;a.style.height=yt+"px"}else{const he=T.length>0&&x===T[0].ref.current;a.style.top="0px";const tt=Math.max(E,D+m.offsetTop+(he?V:0)+M)+le;a.style.height=tt+"px",m.scrollTop=G-E+m.offsetTop}a.style.margin=`${br}px 0`,a.style.minHeight=N+"px",a.style.maxHeight=A+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[p,s.trigger,s.valueNode,a,u,m,x,g,s.dir,r]);sn(()=>w(),[w]);const[k,C]=b.useState();sn(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const j=b.useCallback(_=>{_&&y.current===!0&&(w(),v==null||v(),y.current=!1)},[w,v]);return c.jsx(qV,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:c.jsx(Te.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});AT.displayName=FV;var UV="SelectPopperPosition",cy=b.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=br,...s}=e,i=Wh(n);return c.jsx(u0,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});cy.displayName=UV;var[qV,B0]=wl(Ri,{}),uy="SelectViewport",OT=b.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Vs(uy,n),i=B0(uy,n),a=Ye(t,s.onViewportChange),l=b.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(Bh.Slot,{scope:n,children:c.jsx(Te.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ve(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:p}=i;if(p!=null&&p.current&&f){const h=Math.abs(l.current-d.scrollTop);if(h>0){const y=window.innerHeight-br*2,m=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),g=Math.max(m,x);if(g<y){const v=g+h,w=Math.min(y,v),k=v-w;f.style.height=w+"px",f.style.bottom==="0px"&&(d.scrollTop=k>0?k:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});OT.displayName=uy;var MT="SelectGroup",[VV,HV]=wl(MT),BV=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=jo();return c.jsx(VV,{scope:n,id:o,children:c.jsx(Te.div,{role:"group","aria-labelledby":o,...r,ref:t})})});BV.displayName=MT;var DT="SelectLabel",LT=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=HV(DT,n);return c.jsx(Te.div,{id:o.id,...r,ref:t})});LT.displayName=DT;var Lf="SelectItem",[KV,zT]=wl(Lf),FT=b.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=qs(Lf,n),l=Vs(Lf,n),u=a.value===r,[d,f]=b.useState(s??""),[p,h]=b.useState(!1),y=Ye(t,v=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,v,r,o)}),m=jo(),x=b.useRef("touch"),g=()=>{o||(a.onValueChange(r),a.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(KV,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:b.useCallback(v=>{f(w=>w||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(Bh.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:c.jsx(Te.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:y,onFocus:ve(i.onFocus,()=>h(!0)),onBlur:ve(i.onBlur,()=>h(!1)),onClick:ve(i.onClick,()=>{x.current!=="mouse"&&g()}),onPointerUp:ve(i.onPointerUp,()=>{x.current==="mouse"&&g()}),onPointerDown:ve(i.onPointerDown,v=>{x.current=v.pointerType}),onPointerMove:ve(i.onPointerMove,v=>{var w;x.current=v.pointerType,o?(w=l.onItemLeave)==null||w.call(l):x.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(i.onPointerLeave,v=>{var w;v.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:ve(i.onKeyDown,v=>{var k;((k=l.searchRef)==null?void 0:k.current)!==""&&v.key===" "||($V.includes(v.key)&&g(),v.key===" "&&v.preventDefault())})})})})});FT.displayName=Lf;var Kl="SelectItemText",UT=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=qs(Kl,n),a=Vs(Kl,n),l=zT(Kl,n),u=OV(Kl,n),[d,f]=b.useState(null),p=Ye(t,g=>f(g),l.onItemTextChange,g=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,g,l.value,l.disabled)}),h=d==null?void 0:d.textContent,y=b.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return sn(()=>(m(y),()=>x(y)),[m,x,y]),c.jsxs(c.Fragment,{children:[c.jsx(Te.span,{id:l.textId,...s,ref:p}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Di.createPortal(s.children,i.valueNode):null]})});UT.displayName=Kl;var qT="SelectItemIndicator",VT=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return zT(qT,n).isSelected?c.jsx(Te.span,{"aria-hidden":!0,...r,ref:t}):null});VT.displayName=qT;var dy="SelectScrollUpButton",HT=b.forwardRef((e,t)=>{const n=Vs(dy,e.__scopeSelect),r=B0(dy,e.__scopeSelect),[o,s]=b.useState(!1),i=Ye(t,r.onScrollButtonChange);return sn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollTop>0;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?c.jsx(KT,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});HT.displayName=dy;var fy="SelectScrollDownButton",BT=b.forwardRef((e,t)=>{const n=Vs(fy,e.__scopeSelect),r=B0(fy,e.__scopeSelect),[o,s]=b.useState(!1),i=Ye(t,r.onScrollButtonChange);return sn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<u;s(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?c.jsx(KT,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});BT.displayName=fy;var KT=b.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=Vs("SelectScrollButton",n),i=b.useRef(null),a=Kh(n),l=b.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return b.useEffect(()=>()=>l(),[l]),sn(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),c.jsx(Te.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ve(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ve(o.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ve(o.onPointerLeave,()=>{l()})})}),WV="SelectSeparator",WT=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(Te.div,{"aria-hidden":!0,...r,ref:t})});WT.displayName=WV;var hy="SelectArrow",ZV=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Wh(n),s=qs(hy,n),i=Vs(hy,n);return s.open&&i.position==="popper"?c.jsx(d0,{...o,...r,ref:t}):null});ZV.displayName=hy;var QV="SelectBubbleInput",ZT=b.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=b.useRef(null),s=Ye(r,o),i=aP(t);return b.useEffect(()=>{const a=o.current;if(!a)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==t&&d){const f=new Event("change",{bubbles:!0});d.call(a,t),a.dispatchEvent(f)}},[i,t]),c.jsx(Te.select,{...n,style:{...SE,...n.style},ref:s,defaultValue:t})});ZT.displayName=QV;function QT(e){return e===""||e===void 0}function GT(e){const t=mr(e),n=b.useRef(""),r=b.useRef(0),o=b.useCallback(i=>{const a=n.current+i;t(a),function l(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),s=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function JT(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=GV(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const l=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function GV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var JV=ST,YT=ET,YV=jT,XV=PT,eH=TT,XT=$T,tH=OT,e2=LT,t2=FT,nH=UT,rH=VT,n2=HT,r2=BT,o2=WT;const oH=JV,sH=YV,s2=b.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(YT,{ref:r,className:Ne("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(XV,{asChild:!0,children:c.jsx(Sh,{className:"h-4 w-4 opacity-50"})})]}));s2.displayName=YT.displayName;const i2=b.forwardRef(({className:e,...t},n)=>c.jsx(n2,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(a4,{className:"h-4 w-4"})}));i2.displayName=n2.displayName;const a2=b.forwardRef(({className:e,...t},n)=>c.jsx(r2,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Sh,{className:"h-4 w-4"})}));a2.displayName=r2.displayName;const l2=b.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>c.jsx(eH,{children:c.jsxs(XT,{ref:o,className:Ne("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(i2,{}),c.jsx(tH,{className:Ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(a2,{})]})}));l2.displayName=XT.displayName;const iH=b.forwardRef(({className:e,...t},n)=>c.jsx(e2,{ref:n,className:Ne("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));iH.displayName=e2.displayName;const Yi=b.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(t2,{ref:r,className:Ne("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(rH,{children:c.jsx(QE,{className:"h-4 w-4"})})}),c.jsx(nH,{children:t})]}));Yi.displayName=t2.displayName;const aH=b.forwardRef(({className:e,...t},n)=>c.jsx(o2,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",e),...t}));aH.displayName=o2.displayName;const lH="/assets/AgentDeckLogo3-X5qCXS2A.png";function cH(){const[e,t]=b.useState(""),[n,r]=b.useState(""),[o,s]=b.useState(!1),[i,a]=b.useState(!1),[l,u]=b.useState(null),[d,f]=b.useState(!1),[p,h]=b.useState(!1),[y,m]=b.useState(null),[x,g]=b.useState(!1),[v,w]=b.useState(!1),[k,C]=b.useState(null),[j,_]=b.useState(!1),[I,P]=b.useState(!1),[$,T]=b.useState(!1),[A,U]=b.useState(null),{toast:z}=Ht(),{data:D=[]}=ut({queryKey:["/api/playbook-patches","proposed"],queryFn:()=>Gg("proposed")}),{data:Z=0}=ut({queryKey:["/api/feedback-signals/count","available"],queryFn:()=>iP()}),B=async()=>{T(!0);try{const J=await oP({scope:"collection"});sP(J,"backup.agent-deck.json"),z({title:"Exported collection",description:`${J.services.length} services, ${J.playbooks.length} playbooks, ${J.decks.length} decks`})}catch(J){z({title:"Export failed",description:J instanceof Error?J.message:"Unknown error",variant:"destructive"})}finally{T(!1)}},{connectionStatus:q}=NV(),{data:H,isLoading:N,error:O}=ut({queryKey:["/api/decks"]}),V=(H==null?void 0:H.data)||[],{editingDeck:S,editingDeckId:E,setEditingDeckId:R}=PV(V),{handleDragStart:M,handleCredentialDragStart:K,handlePlaybookDragStart:G,handleDragEnd:le,handleDrop:se,handleGlobalDrop:he,isDraggingFromDeck:ke}=jV(E),{data:tt,isLoading:yt,error:ee}=ut({queryKey:["/api/services"]}),{data:pe,isLoading:re}=ut({queryKey:["/api/credentials/vault"]}),{data:Fe,isLoading:ae}=ut({queryKey:["/api/playbooks/vault"]}),{data:Re}=ut({queryKey:["/api/collection/warnings"],staleTime:6e4}),De=(tt==null?void 0:tt.data)||[],vt=(pe==null?void 0:pe.data)||[],nr=(Fe==null?void 0:Fe.data)||[],st=b.useMemo(()=>zL(Re==null?void 0:Re.data),[Re==null?void 0:Re.data]),Nn=(J,Qe)=>o?J==="service"?st.serviceWarnings.has(Qe):J==="credential"?st.credentialWarnings.has(Qe):st.playbookWarnings.has(Qe):!0,W=De.filter(J=>{var Cu;if(!Nn("service",J.id)||n==="api-key"||n==="playbook")return!1;const Qe=J.name.toLowerCase().includes(e.toLowerCase())||((Cu=J.description)==null?void 0:Cu.toLowerCase().includes(e.toLowerCase())),At=!n||n==="all"||J.type===n;return Qe&&At}),te=vt.filter(J=>!Nn("credential",J.id)||n&&n!=="all"&&n!=="api-key"?!1:J.label.toLowerCase().includes(e.toLowerCase())),xe=nr.filter(J=>!Nn("playbook",J.id)||n&&n!=="all"&&n!=="playbook"?!1:J.title.toLowerCase().includes(e.toLowerCase())||J.body.toLowerCase().includes(e.toLowerCase())),Ce=W.length+te.length+xe.length;ee&&console.error("Services error:",ee),O&&console.error("Decks error:",O);const Ke=()=>{t(""),r(""),s(!1)},Gt=!!(e||n||o),rr=new Set(((S==null?void 0:S.credentials)??[]).map(J=>J.id)),jn=new Set(((S==null?void 0:S.playbooks)??[]).map(J=>J.id)),Fr=(S==null?void 0:S.services)||[],Ur=(S==null?void 0:S.playbooks)||[],Dt=J=>{u(J),f(!0)},or=J=>{C(J.id),_(!0)},gn=J=>{m(J.id),g(!0)},fe=J=>{U(J)};if(ee||O){const J=(O instanceof Error?O.message:null)??(ee instanceof Error?ee.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:J}),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 yt||N||re||ae?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:J=>J.preventDefault(),style:{position:"relative",...ke&&{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:lH,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 ${q==="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 ${q==="connected"?"bg-emerald-400":"bg-red-400"}`}),c.jsx("button",{className:`text-sm hover:underline cursor-pointer ${q==="connected"?"text-emerald-300":"text-red-300"}`,"data-testid":"button-copy-mcp-url",onClick:()=>{navigator.clipboard.writeText("http://localhost:3001/mcp").then(()=>{z({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(vF,{highlightDeckId:E??void 0}),c.jsx(Ya,{href:"/feedback-signals",children:c.jsxs(ne,{variant:"outline",size:"sm",className:"relative border-white/20 bg-white/5 text-[#E8F6F4]",children:["Feedback",Z>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:Z})]})}),c.jsx(Ya,{href:"/playbook-patches",children:c.jsxs(ne,{variant:"outline",size:"sm",className:"relative border-white/20 bg-white/5 text-[#E8F6F4]",children:[c.jsx(u4,{className:"mr-2 h-4 w-4"}),"Review",D.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:D.length})]})})]})]})})}),ke&&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(o3,{decks:V,editingDeckId:E,onSelectDeck:R,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(ZE,{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(ne,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Jr}`,style:Yr(wn),onClick:()=>a(!0),"data-testid":"button-register-mcp",children:[c.jsx(_f,{className:"w-3 h-3 mr-2"}),"Register MCP"]}),c.jsxs(ne,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Jr}`,style:Yr(In),onClick:()=>h(!0),"data-testid":"button-register-api-key",children:[c.jsx(zg,{className:"w-3 h-3 mr-2"}),"Register API key"]}),c.jsxs(ne,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Jr}`,style:Yr(Sr),onClick:()=>w(!0),"data-testid":"button-register-playbook",children:[c.jsx(Yv,{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:S?c.jsx("div",{className:"h-full",children:c.jsx(oz,{deck:S,services:Fr,credentials:S.credentials??[],playbooks:Ur,allServices:De,collectionWarnings:st,onDrop:se,onDragStart:M,onCredentialDragStart:K,onPlaybookDragStart:G,onDragEnd:le,onCardClick:Dt,onPlaybookClick:or,onCredentialClick:gn})}):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(kf,{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(ne,{onClick:()=>{const J=document.querySelector('[data-testid="create-deck-button"]');J&&J.click()},className:"border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},children:[c.jsx(ai,{className:"w-4 h-4 mr-2"}),"Create New Deck"]}),c.jsxs(ne,{variant:"outline",className:"border-white/20 text-white hover:bg-white/10 text-sm py-2",onClick:()=>{const J=document.querySelector('[data-testid="deck-management-panel"]');J&&J.scrollIntoView({behavior:"smooth"})},children:[c.jsx(kf,{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(d4,{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:["(",Ce," cards)"]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs(ne,{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(XE,{className:"w-3 h-3 mr-1"}),$?"Exporting…":"Export all"]}),c.jsxs(ne,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:()=>P(!0),title:"Import a bundle file","data-testid":"button-import-bundle",children:[c.jsx(m4,{className:"w-3 h-3 mr-1"}),"Import"]}),c.jsxs("div",{className:"relative",children:[c.jsx(eN,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),c.jsx(Xe,{placeholder:"Search...",value:e,onChange:J=>t(J.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(oH,{value:n||"all",onValueChange:J=>r(J==="all"?"":J),children:[c.jsxs(s2,{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(c4,{className:"w-3 h-3 mr-1 shrink-0"}),c.jsx(sH,{placeholder:"Type"})]}),c.jsxs(l2,{children:[c.jsx(Yi,{value:"all",children:"All"}),c.jsx(Yi,{value:"mcp",children:"MCP"}),c.jsx(Yi,{value:"local-mcp",children:"Local MCP"}),c.jsx(Yi,{value:"api-key",children:"API Key"}),c.jsx(Yi,{value:"playbook",children:"Playbook"})]})]}),(e||n||o)&&c.jsx(ne,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:Ke,title:"Clear all filters",children:"Clear"})]})]}),st.total>0&&c.jsx("button",{type:"button",onClick:()=>s(J=>!J),className:`mb-3 w-full shrink-0 rounded-lg border px-3 py-2 text-left text-sm transition-colors ${o?"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(Pr,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-300"}),c.jsx("span",{children:o?c.jsxs(c.Fragment,{children:["Showing ",c.jsx("strong",{children:Ce})," card",Ce===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:st.total})," card",st.total===1?"":"s"," need attention",st.byKind.oauth_expired+st.byKind.oauth_required>0&&c.jsxs(c.Fragment,{children:[" ","(",st.byKind.oauth_expired+st.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:yt||re||ae?c.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,5rem)] gap-y-2 pr-12",children:Array.from({length:10}).map((J,Qe)=>c.jsx("div",{className:"animate-pulse",children:c.jsx("div",{className:"bg-white/10 rounded-lg w-32 h-48 aspect-[2/3]"})},Qe))}):Ce===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:Gt?o?"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"}),!Gt&&c.jsxs("div",{className:"flex gap-3 justify-center",children:[c.jsxs(ne,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${Jr}`,style:Yr(wn),onClick:()=>a(!0),"data-testid":"button-register-mcp-empty",children:[c.jsx(_f,{className:"w-3 h-3 mr-1"}),"Register MCP"]}),c.jsxs(ne,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${Jr}`,style:Yr(In),onClick:()=>h(!0),"data-testid":"button-register-api-key-empty",children:[c.jsx(zg,{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:[xe.map((J,Qe)=>c.jsx("div",{className:"relative group",style:{zIndex:A===J.id?999999:Ce-Qe},children:c.jsx(ZL,{playbook:J,isInActiveDeck:jn.has(J.id),activeDeck:S??void 0,isInCollection:!0,onDragStart:G,onDragEnd:le,onCardClick:or,onMouseEnter:()=>fe(J.id),onMouseLeave:()=>fe(null),warnings:st.playbookWarnings.get(J.id)})},J.id)),te.map((J,Qe)=>c.jsx("div",{className:"relative group",style:{zIndex:A===J.id?999999:Ce-xe.length-Qe},children:c.jsx(KL,{credential:J,isInActiveDeck:rr.has(J.id),activeDeck:S??void 0,isInCollection:!0,onDragStart:K,onDragEnd:le,onMouseEnter:()=>fe(J.id),onMouseLeave:()=>fe(null),onCardClick:gn,warnings:st.credentialWarnings.get(J.id)})},J.id)),W.map((J,Qe)=>{var At;return c.jsx("div",{className:"relative group",style:{zIndex:A===J.id?999999:Ce-xe.length-te.length-Qe},children:c.jsx(VL,{service:J,onDragStart:M,onDragEnd:le,isInActiveDeck:((At=S==null?void 0:S.services)==null?void 0:At.some(Cu=>Cu.id===J.id))||!1,onCardClick:Dt,isInCollection:!0,onMouseEnter:()=>fe(J.id),onMouseLeave:()=>fe(null),activeDeck:S??void 0,warnings:st.serviceWarnings.get(J.id)})},J.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(t3,{type:"mcp",open:i,onOpenChange:a}),c.jsx(CV,{service:l,isOpen:d,onClose:()=>f(!1)}),c.jsx(s3,{open:p,onOpenChange:h}),c.jsx(y3,{credentialId:y,open:x,onOpenChange:g}),c.jsx(i3,{open:v,onOpenChange:w}),c.jsx(g3,{playbookId:k,open:j,onOpenChange:_}),c.jsx(EV,{open:I,onOpenChange:P})]})}const es=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ne("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));es.displayName="Card";const Gs=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ne("flex flex-col space-y-1.5 p-6",e),...t}));Gs.displayName="CardHeader";const Js=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ne("text-2xl font-semibold leading-none tracking-tight",e),...t}));Js.displayName="CardTitle";const Ld=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ne("text-sm text-muted-foreground",e),...t}));Ld.displayName="CardDescription";const ts=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ne("p-6 pt-0",e),...t}));ts.displayName="CardContent";const uH=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ne("flex items-center p-6 pt-0",e),...t}));uH.displayName="CardFooter";function dH(){return c.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gray-50",children:c.jsx(es,{className:"w-full max-w-md mx-4",children:c.jsxs(ts,{className:"pt-6",children:[c.jsxs("div",{className:"flex mb-4 gap-2",children:[c.jsx(YE,{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 fH(){const[e]=wO(),[t,n]=b.useState("loading"),[r,o]=b.useState("Authenticating...");return b.useEffect(()=>{(async()=>{try{const i=new URL(window.location.href),a=i.searchParams.get("success"),l=i.searchParams.get("error"),u=i.searchParams.get("serviceId");a==="true"?(n("success"),o("Authentication successful! This window will close automatically."),window.opener&&!window.opener.closed&&window.opener.postMessage({type:_T,serviceId:u??void 0},window.location.origin),setTimeout(()=>{window.close()},2e3)):a==="false"?(n("error"),o(`OAuth Error: ${l||"Authentication failed"}`)):(n("error"),o("Invalid OAuth callback - please try again"))}catch(i){n("error"),o(i instanceof Error?i.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 ma(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(hH).join("&"),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}function hH([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:""}`}var b1=class{constructor(e,t={}){po(this,"serverUrl");po(this,"storageKeyPrefix");po(this,"serverUrlHash");po(this,"clientName");po(this,"clientUri");po(this,"callbackUrl");po(this,"preventAutoAuth");po(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=ma(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 ma(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 o=e.toString(),s=ma(o);return localStorage.setItem(this.getKey("last_auth_url"),s),s}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?ma(e):null}clearStorage(){const e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[];let r=0;for(let s=0;s<localStorage.length;s++){const i=localStorage.key(s);if(i){if(i.startsWith(e))n.push(i);else if(i.startsWith(t))try{const a=localStorage.getItem(i);a&&JSON.parse(a).serverUrlHash===this.serverUrlHash&&n.push(i)}catch(a){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,a)}}}return[...new Set(n)].forEach(s=>{localStorage.removeItem(s),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 pH=Object.freeze({status:"aborted"});function Q(e,t,n){function r(a,l){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,l);for(const d in i.prototype)d in a||Object.defineProperty(a,d,{value:i.prototype[d].bind(a)});a._zod.constr=i,a._zod.def=l}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var l;const u=n!=null&&n.Parent?new s:this;r(u,a),(l=u._zod).deferred??(l.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var l,u;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(u=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:u.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class Vc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const c2={};function As(e){return c2}function mH(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function gH(e,t){return typeof t=="bigint"?t.toString():t}function K0(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function W0(e){return e==null}function Z0(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function yH(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}function mt(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 Zh(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Dl(e){return JSON.stringify(e)}const u2=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function zf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const vH=K0(()=>{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 Ff(e){if(zf(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(zf(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const xH=new Set(["string","number","symbol"]);function hu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fi(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 me(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 wH(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const bH={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 kH(e,t){const n={},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(n[o]=r.shape[o])}return Fi(e,{...e._zod.def,shape:n,checks:[]})}function _H(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete n[o]}return Fi(e,{...e._zod.def,shape:n,checks:[]})}function SH(e,t){if(!Ff(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 Zh(this,"shape",r),r},checks:[]};return Fi(e,n)}function CH(e,t){return Fi(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Zh(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function EH(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const s in n){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=e?new e({type:"optional",innerType:r[s]}):r[s])}else for(const s in r)o[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return Fi(t,{...t._zod.def,shape:o,checks:[]})}function NH(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(const s in r)o[s]=new e({type:"nonoptional",innerType:r[s]});return Fi(t,{...t._zod.def,shape:o,checks:[]})}function fc(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 li(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function sd(e){return typeof e=="string"?e:e==null?void 0:e.message}function Os(e,t,n){var o,s,i,a,l,u;const r={...e,path:e.path??[]};if(!e.message){const d=sd((i=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:i.call(s,e))??sd((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??sd((l=n.customError)==null?void 0:l.call(n,e))??sd((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 Q0(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Hc(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const d2=(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,gH,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},f2=Q("$ZodError",d2),h2=Q("$ZodError",d2,{Parent:Error});function jH(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function PH(e,t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(i))):a[u]=a[u]||{_errors:[]},a=a[u],l++}}};return o(e),r}const TH=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Vc;if(i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(l=>Os(l,s,As())));throw u2(a,o==null?void 0:o.callee),a}return i.value},$H=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(l=>Os(l,s,As())));throw u2(a,o==null?void 0:o.callee),a}return i.value},p2=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Vc;return s.issues.length?{success:!1,error:new(e??f2)(s.issues.map(i=>Os(i,o,As())))}:{success:!0,data:s.value}},m2=p2(h2),g2=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Os(i,o,As())))}:{success:!0,data:s.value}},RH=g2(h2),IH=/^[cC][^\s-]{8,}$/,AH=/^[0-9a-z]+$/,OH=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,MH=/^[0-9a-vA-V]{20}$/,DH=/^[A-Za-z0-9]{27}$/,LH=/^[a-zA-Z0-9_-]{21}$/,zH=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,FH=/^([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})$/,k1=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)$/,UH=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qH="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function VH(){return new RegExp(qH,"u")}const HH=/^(?:(?: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])$/,BH=/^(([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})$/,KH=/^((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])$/,WH=/^(([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])$/,ZH=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,y2=/^[A-Za-z0-9_-]*$/,QH=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,GH=/^\+(?:[0-9]){6,14}[0-9]$/,v2="(?:(?:\\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])))",JH=new RegExp(`^${v2}$`);function x2(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 YH(e){return new RegExp(`^${x2(e)}$`)}function XH(e){const t=x2({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(`^${v2}T(?:${r})$`)}const eB=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}$`)},tB=/^\d+$/,nB=/^-?\d+(?:\.\d+)?/i,rB=/true|false/i,oB=/null/i,sB=/^[^A-Z]*$/,iB=/^[^a-z]*$/,qn=Q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),w2={number:"number",bigint:"bigint",object:"date"},b2=Q("$ZodCheckLessThan",(e,t)=>{qn.init(e,t);const n=w2[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.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})}}),k2=Q("$ZodCheckGreaterThan",(e,t)=>{qn.init(e,t);const n=w2[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.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})}}),aB=Q("$ZodCheckMultipleOf",(e,t)=>{qn.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):yH(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})}}),lB=Q("$ZodCheckNumberFormat",(e,t)=>{var i;qn.init(e,t),t.format=t.format||"float64";const n=(i=t.format)==null?void 0:i.includes("int"),r=n?"int":"number",[o,s]=bH[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=s,n&&(l.pattern=tB)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.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}):a.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<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inst:e})}}),cB=Q("$ZodCheckMaxLength",(e,t)=>{var n;qn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!W0(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=Q0(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),uB=Q("$ZodCheckMinLength",(e,t)=>{var n;qn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!W0(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=Q0(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dB=Q("$ZodCheckLengthEquals",(e,t)=>{var n;qn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!W0(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=Q0(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Qh=Q("$ZodCheckStringFormat",(e,t)=>{var n,r;qn.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),fB=Q("$ZodCheckRegex",(e,t)=>{Qh.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})}}),hB=Q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sB),Qh.init(e,t)}),pB=Q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=iB),Qh.init(e,t)}),mB=Q("$ZodCheckIncludes",(e,t)=>{qn.init(e,t);const n=hu(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),gB=Q("$ZodCheckStartsWith",(e,t)=>{qn.init(e,t);const n=new RegExp(`^${hu(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.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})}}),yB=Q("$ZodCheckEndsWith",(e,t)=>{qn.init(e,t);const n=new RegExp(`.*${hu(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.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})}}),vB=Q("$ZodCheckOverwrite",(e,t)=>{qn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class xB{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(`
436
- `).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
437
- `))}}const wB={major:4,minor:0,patch:0},at=Q("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wB;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const i of s._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(i,a,l)=>{let u=fc(i),d;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const p=i.issues.length,h=f._zod.check(i);if(h instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Vc;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,i.issues.length!==p&&(u||(u=fc(i,p)))});else{if(i.issues.length===p)continue;u||(u=fc(i,p))}}return d?d.then(()=>i):i};e._zod.run=(i,a)=>{const l=e._zod.parse(i,a);if(l instanceof Promise){if(a.async===!1)throw new Vc;return l.then(u=>s(u,r,a))}return s(l,r,a)}}e["~standard"]={validate:s=>{var i;try{const a=m2(e,s);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return RH(e,s).then(l=>{var u;return l.success?{value:l.data}:{issues:(u=l.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),G0=Q("$ZodString",(e,t)=>{var n;at.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??eB(e._zod.bag),e._zod.parse=(r,o)=>{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}}),bt=Q("$ZodStringFormat",(e,t)=>{Qh.init(e,t),G0.init(e,t)}),bB=Q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=FH),bt.init(e,t)}),kB=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=k1(r))}else t.pattern??(t.pattern=k1());bt.init(e,t)}),_B=Q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=UH),bt.init(e,t)}),SB=Q("$ZodURL",(e,t)=>{bt.init(e,t),e._zod.check=n=>{try{const r=n.value,o=new URL(r),s=o.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:QH.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.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("/")&&s.endsWith("/")?n.value=s.slice(0,-1):n.value=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),CB=Q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=VH()),bt.init(e,t)}),EB=Q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=LH),bt.init(e,t)}),NB=Q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=IH),bt.init(e,t)}),jB=Q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=AH),bt.init(e,t)}),PB=Q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=OH),bt.init(e,t)}),TB=Q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=MH),bt.init(e,t)}),$B=Q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=DH),bt.init(e,t)}),RB=Q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=XH(t)),bt.init(e,t)}),IB=Q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=JH),bt.init(e,t)}),AB=Q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=YH(t)),bt.init(e,t)}),OB=Q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=zH),bt.init(e,t)}),MB=Q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=HH),bt.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),DB=Q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=BH),bt.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})}}}),LB=Q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=KH),bt.init(e,t)}),zB=Q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=WH),bt.init(e,t),e._zod.check=n=>{const[r,o]=n.value.split("/");try{if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>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 _2(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const FB=Q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ZH),bt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{_2(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function UB(e){if(!y2.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return _2(n)}const qB=Q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=y2),bt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{UB(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),VB=Q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=GH),bt.init(e,t)});function HB(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const BB=Q("$ZodJWT",(e,t)=>{bt.init(e,t),e._zod.check=n=>{HB(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),S2=Q("$ZodNumber",(e,t)=>{at.init(e,t),e._zod.pattern=e._zod.bag.pattern??nB,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),KB=Q("$ZodNumber",(e,t)=>{lB.init(e,t),S2.init(e,t)}),WB=Q("$ZodBoolean",(e,t)=>{at.init(e,t),e._zod.pattern=rB,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),ZB=Q("$ZodNull",(e,t)=>{at.init(e,t),e._zod.pattern=oB,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),QB=Q("$ZodAny",(e,t)=>{at.init(e,t),e._zod.parse=n=>n}),GB=Q("$ZodUnknown",(e,t)=>{at.init(e,t),e._zod.parse=n=>n}),JB=Q("$ZodNever",(e,t)=>{at.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function _1(e,t,n){e.issues.length&&t.issues.push(...li(n,e.issues)),t.value[n]=e.value}const YB=Q("$ZodArray",(e,t)=>{at.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(u=>_1(u,n,i))):_1(l,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function id(e,t,n){e.issues.length&&t.issues.push(...li(n,e.issues)),t.value[n]=e.value}function S1(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(...li(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const XB=Q("$ZodObject",(e,t)=>{at.init(e,t);const n=K0(()=>{const f=Object.keys(t.shape);for(const h of f)if(!(t.shape[h]instanceof at))throw new Error(`Invalid element at key "${h}": expected a Zod schema`);const p=wH(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(p)}});mt(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 xB(["shape","payload","ctx"]),h=n.value,y=v=>{const w=Dl(v);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};p.write("const input = payload.value;");const m=Object.create(null);let x=0;for(const v of h.keys)m[v]=`key_${x++}`;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 k=Dl(v);p.write(`
438
- if (${w}.issues.length) {
439
- if (input[${k}] === undefined) {
440
- if (${k} in input) {
441
- newResult[${k}] = undefined;
442
- }
443
- } else {
444
- payload.issues = payload.issues.concat(
445
- ${w}.issues.map((iss) => ({
446
- ...iss,
447
- path: iss.path ? [${k}, ...iss.path] : [${k}],
448
- }))
449
- );
450
- }
451
- } else if (${w}.value === undefined) {
452
- if (${k} in input) newResult[${k}] = undefined;
453
- } else {
454
- newResult[${k}] = ${w}.value;
455
- }
456
- `)}else{const w=m[v];p.write(`const ${w} = ${y(v)};`),p.write(`
457
- if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
458
- ...iss,
459
- path: iss.path ? [${Dl(v)}, ...iss.path] : [${Dl(v)}]
460
- })));`),p.write(`newResult[${Dl(v)}] = ${w}.value`)}p.write("payload.value = newResult;"),p.write("return payload;");const g=p.compile();return(v,w)=>g(f,v,w)};let o;const s=zf,i=!c2.jitless,l=i&&vH.value,u=t.catchall;let d;e._zod.parse=(f,p)=>{d??(d=n.value);const h=f.value;if(!s(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;const y=[];if(i&&l&&(p==null?void 0:p.async)===!1&&p.jitless!==!0)o||(o=r(t.shape)),f=o(f,p);else{f.value={};const w=d.shape;for(const k of d.keys){const C=w[k],j=C._zod.run({value:h[k],issues:[]},p),_=C._zod.optin==="optional"&&C._zod.optout==="optional";j instanceof Promise?y.push(j.then(I=>_?S1(I,f,k,h):id(I,f,k))):_?S1(j,f,k,h):id(j,f,k)}}if(!u)return y.length?Promise.all(y).then(()=>f):f;const m=[],x=d.keySet,g=u._zod,v=g.def.type;for(const w of Object.keys(h)){if(x.has(w))continue;if(v==="never"){m.push(w);continue}const k=g.run({value:h[w],issues:[]},p);k instanceof Promise?y.push(k.then(C=>id(C,f,w))):id(k,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 C1(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(s=>Os(s,r,As())))}),t}const C2=Q("$ZodUnion",(e,t)=>{at.init(e,t),mt(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),mt(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),mt(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),mt(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=>Z0(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let o=!1;const s=[];for(const i of t.options){const a=i._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>C1(i,n,e,r)):C1(s,n,e,r)}}),eK=Q("$ZodDiscriminatedUnion",(e,t)=>{C2.init(e,t);const n=e._zod.parse;mt(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,l]of Object.entries(i)){o[a]||(o[a]=new Set);for(const u of l)o[a].add(u)}}return o});const r=K0(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const l of a){if(s.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);s.set(l,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!zf(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i==null?void 0:i[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),o)}}),tK=Q("$ZodIntersection",(e,t)=>{at.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([l,u])=>E1(n,l,u)):E1(n,s,i)}});function py(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(Ff(e)&&Ff(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=py(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}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 o=e[r],s=t[r],i=py(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function E1(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),fc(e))return e;const r=py(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 nK=Q("$ZodRecord",(e,t)=>{at.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Ff(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;n.value={};for(const l of i)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const u=t.valueType._zod.run({value:o[l],issues:[]},r);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&n.issues.push(...li(l,d.issues)),n.value[l]=d.value})):(u.issues.length&&n.issues.push(...li(l,u.issues)),n.value[l]=u.value)}let a;for(const l in o)i.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const i of Reflect.ownKeys(o)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>Os(u,r,As())),input:i,path:[i],inst:e}),n.value[a.value]=a.value;continue}const l=t.valueType._zod.run({value:o[i],issues:[]},r);l instanceof Promise?s.push(l.then(u=>{u.issues.length&&n.issues.push(...li(i,u.issues)),n.value[a.value]=u.value})):(l.issues.length&&n.issues.push(...li(i,l.issues)),n.value[a.value]=l.value)}}return s.length?Promise.all(s).then(()=>n):n}}),rK=Q("$ZodEnum",(e,t)=>{at.init(e,t);const n=mH(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>xH.has(typeof r)).map(r=>typeof r=="string"?hu(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),oK=Q("$ZodLiteral",(e,t)=>{at.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?hu(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),sK=Q("$ZodTransform",(e,t)=>{at.init(e,t),e._zod.parse=(n,r)=>{const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new Vc;return n.value=o,n}}),iK=Q("$ZodOptional",(e,t)=>{at.init(e,t),e._zod.optin="optional",e._zod.optout="optional",mt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),mt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Z0(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)}),aK=Q("$ZodNullable",(e,t)=>{at.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Z0(n.source)}|null)$`):void 0}),mt(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)}),lK=Q("$ZodDefault",(e,t)=>{at.init(e,t),e._zod.optin="optional",mt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>N1(s,t)):N1(o,t)}});function N1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const cK=Q("$ZodPrefault",(e,t)=>{at.init(e,t),e._zod.optin="optional",mt(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))}),uK=Q("$ZodNonOptional",(e,t)=>{at.init(e,t),mt(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 o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>j1(s,e)):j1(o,e)}});function j1(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 dK=Q("$ZodCatch",(e,t)=>{at.init(e,t),e._zod.optin="optional",mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>Os(i,r,As()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Os(s,r,As()))},input:n.value}),n.issues=[]),n)}}),fK=Q("$ZodPipe",(e,t)=>{at.init(e,t),mt(e._zod,"values",()=>t.in._zod.values),mt(e._zod,"optin",()=>t.in._zod.optin),mt(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>P1(s,t,r)):P1(o,t,r)}});function P1(e,t,n){return fc(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const hK=Q("$ZodReadonly",(e,t)=>{at.init(e,t),mt(e._zod,"propValues",()=>t.innerType._zod.propValues),mt(e._zod,"values",()=>t.innerType._zod.values),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(T1):T1(o)}});function T1(e){return e.value=Object.freeze(e.value),e}const pK=Q("$ZodCustom",(e,t)=>{qn.init(e,t),at.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>$1(s,n,r,e));$1(o,n,r,e)}});function $1(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Hc(o))}}class mK{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 gK(){return new mK}const ad=gK();function yK(e,t){return new e({type:"string",...me(t)})}function vK(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...me(t)})}function R1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...me(t)})}function xK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...me(t)})}function wK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...me(t)})}function bK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...me(t)})}function kK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...me(t)})}function E2(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...me(t)})}function _K(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...me(t)})}function SK(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...me(t)})}function CK(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...me(t)})}function EK(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...me(t)})}function NK(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...me(t)})}function jK(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...me(t)})}function PK(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...me(t)})}function TK(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...me(t)})}function $K(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...me(t)})}function RK(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...me(t)})}function IK(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...me(t)})}function AK(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...me(t)})}function OK(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...me(t)})}function MK(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...me(t)})}function DK(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...me(t)})}function LK(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...me(t)})}function zK(e,t){return new e({type:"string",format:"date",check:"string_format",...me(t)})}function FK(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...me(t)})}function UK(e,t){return new e({type:"string",format:"duration",check:"string_format",...me(t)})}function qK(e,t){return new e({type:"number",checks:[],...me(t)})}function VK(e,t){return new e({type:"number",coerce:!0,checks:[],...me(t)})}function HK(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...me(t)})}function BK(e,t){return new e({type:"boolean",...me(t)})}function KK(e,t){return new e({type:"null",...me(t)})}function WK(e){return new e({type:"any"})}function ZK(e){return new e({type:"unknown"})}function QK(e,t){return new e({type:"never",...me(t)})}function I1(e,t){return new b2({check:"less_than",...me(t),value:e,inclusive:!1})}function mm(e,t){return new b2({check:"less_than",...me(t),value:e,inclusive:!0})}function A1(e,t){return new k2({check:"greater_than",...me(t),value:e,inclusive:!1})}function gm(e,t){return new k2({check:"greater_than",...me(t),value:e,inclusive:!0})}function O1(e,t){return new aB({check:"multiple_of",...me(t),value:e})}function N2(e,t){return new cB({check:"max_length",...me(t),maximum:e})}function Uf(e,t){return new uB({check:"min_length",...me(t),minimum:e})}function j2(e,t){return new dB({check:"length_equals",...me(t),length:e})}function GK(e,t){return new fB({check:"string_format",format:"regex",...me(t),pattern:e})}function JK(e){return new hB({check:"string_format",format:"lowercase",...me(e)})}function YK(e){return new pB({check:"string_format",format:"uppercase",...me(e)})}function XK(e,t){return new mB({check:"string_format",format:"includes",...me(t),includes:e})}function eW(e,t){return new gB({check:"string_format",format:"starts_with",...me(t),prefix:e})}function tW(e,t){return new yB({check:"string_format",format:"ends_with",...me(t),suffix:e})}function pu(e){return new vB({check:"overwrite",tx:e})}function nW(e){return pu(t=>t.normalize(e))}function rW(){return pu(e=>e.trim())}function oW(){return pu(e=>e.toLowerCase())}function sW(){return pu(e=>e.toUpperCase())}function iW(e,t,n){return new e({type:"array",element:t,...me(n)})}function aW(e,t,n){const r=me(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function lW(e,t,n){return new e({type:"custom",check:"custom",fn:t,...me(n)})}const cW=Q("ZodISODateTime",(e,t)=>{RB.init(e,t),Pt.init(e,t)});function P2(e){return LK(cW,e)}const uW=Q("ZodISODate",(e,t)=>{IB.init(e,t),Pt.init(e,t)});function dW(e){return zK(uW,e)}const fW=Q("ZodISOTime",(e,t)=>{AB.init(e,t),Pt.init(e,t)});function hW(e){return FK(fW,e)}const pW=Q("ZodISODuration",(e,t)=>{OB.init(e,t),Pt.init(e,t)});function mW(e){return UK(pW,e)}const gW=(e,t)=>{f2.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>PH(e,n)},flatten:{value:n=>jH(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Gh=Q("ZodError",gW,{Parent:Error}),yW=TH(Gh),vW=$H(Gh),xW=p2(Gh),wW=g2(Gh),kt=Q("ZodType",(e,t)=>(at.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)=>Fi(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>yW(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>xW(e,n,r),e.parseAsync=async(n,r)=>vW(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>wW(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(h7(n,r)),e.superRefine=n=>e.check(p7(n)),e.overwrite=n=>e.check(pu(n)),e.optional=()=>Ct(e),e.nullable=()=>L1(e),e.nullish=()=>Ct(L1(e)),e.nonoptional=n=>s7(e,n),e.array=()=>oe(e),e.or=n=>_t([e,n]),e.and=n=>Y0(e,n),e.transform=n=>gy(e,O2(n)),e.default=n=>n7(e,n),e.prefault=n=>o7(e,n),e.catch=n=>a7(e,n),e.pipe=n=>gy(e,n),e.readonly=()=>u7(e),e.describe=n=>{const r=e.clone();return ad.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=ad.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return ad.get(e);const r=e.clone();return ad.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),T2=Q("_ZodString",(e,t)=>{G0.init(e,t),kt.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(GK(...r)),e.includes=(...r)=>e.check(XK(...r)),e.startsWith=(...r)=>e.check(eW(...r)),e.endsWith=(...r)=>e.check(tW(...r)),e.min=(...r)=>e.check(Uf(...r)),e.max=(...r)=>e.check(N2(...r)),e.length=(...r)=>e.check(j2(...r)),e.nonempty=(...r)=>e.check(Uf(1,...r)),e.lowercase=r=>e.check(JK(r)),e.uppercase=r=>e.check(YK(r)),e.trim=()=>e.check(rW()),e.normalize=(...r)=>e.check(nW(...r)),e.toLowerCase=()=>e.check(oW()),e.toUpperCase=()=>e.check(sW())}),bW=Q("ZodString",(e,t)=>{G0.init(e,t),T2.init(e,t),e.email=n=>e.check(vK(kW,n)),e.url=n=>e.check(E2($2,n)),e.jwt=n=>e.check(DK(LW,n)),e.emoji=n=>e.check(_K(SW,n)),e.guid=n=>e.check(R1(M1,n)),e.uuid=n=>e.check(xK(ld,n)),e.uuidv4=n=>e.check(wK(ld,n)),e.uuidv6=n=>e.check(bK(ld,n)),e.uuidv7=n=>e.check(kK(ld,n)),e.nanoid=n=>e.check(SK(CW,n)),e.guid=n=>e.check(R1(M1,n)),e.cuid=n=>e.check(CK(EW,n)),e.cuid2=n=>e.check(EK(NW,n)),e.ulid=n=>e.check(NK(jW,n)),e.base64=n=>e.check(AK(OW,n)),e.base64url=n=>e.check(OK(MW,n)),e.xid=n=>e.check(jK(PW,n)),e.ksuid=n=>e.check(PK(TW,n)),e.ipv4=n=>e.check(TK($W,n)),e.ipv6=n=>e.check($K(RW,n)),e.cidrv4=n=>e.check(RK(IW,n)),e.cidrv6=n=>e.check(IK(AW,n)),e.e164=n=>e.check(MK(DW,n)),e.datetime=n=>e.check(P2(n)),e.date=n=>e.check(dW(n)),e.time=n=>e.check(hW(n)),e.duration=n=>e.check(mW(n))});function F(e){return yK(bW,e)}const Pt=Q("ZodStringFormat",(e,t)=>{bt.init(e,t),T2.init(e,t)}),kW=Q("ZodEmail",(e,t)=>{_B.init(e,t),Pt.init(e,t)}),M1=Q("ZodGUID",(e,t)=>{bB.init(e,t),Pt.init(e,t)}),ld=Q("ZodUUID",(e,t)=>{kB.init(e,t),Pt.init(e,t)}),$2=Q("ZodURL",(e,t)=>{SB.init(e,t),Pt.init(e,t)});function _W(e){return E2($2,e)}const SW=Q("ZodEmoji",(e,t)=>{CB.init(e,t),Pt.init(e,t)}),CW=Q("ZodNanoID",(e,t)=>{EB.init(e,t),Pt.init(e,t)}),EW=Q("ZodCUID",(e,t)=>{NB.init(e,t),Pt.init(e,t)}),NW=Q("ZodCUID2",(e,t)=>{jB.init(e,t),Pt.init(e,t)}),jW=Q("ZodULID",(e,t)=>{PB.init(e,t),Pt.init(e,t)}),PW=Q("ZodXID",(e,t)=>{TB.init(e,t),Pt.init(e,t)}),TW=Q("ZodKSUID",(e,t)=>{$B.init(e,t),Pt.init(e,t)}),$W=Q("ZodIPv4",(e,t)=>{MB.init(e,t),Pt.init(e,t)}),RW=Q("ZodIPv6",(e,t)=>{DB.init(e,t),Pt.init(e,t)}),IW=Q("ZodCIDRv4",(e,t)=>{LB.init(e,t),Pt.init(e,t)}),AW=Q("ZodCIDRv6",(e,t)=>{zB.init(e,t),Pt.init(e,t)}),OW=Q("ZodBase64",(e,t)=>{FB.init(e,t),Pt.init(e,t)}),MW=Q("ZodBase64URL",(e,t)=>{qB.init(e,t),Pt.init(e,t)}),DW=Q("ZodE164",(e,t)=>{VB.init(e,t),Pt.init(e,t)}),LW=Q("ZodJWT",(e,t)=>{BB.init(e,t),Pt.init(e,t)}),J0=Q("ZodNumber",(e,t)=>{S2.init(e,t),kt.init(e,t),e.gt=(r,o)=>e.check(A1(r,o)),e.gte=(r,o)=>e.check(gm(r,o)),e.min=(r,o)=>e.check(gm(r,o)),e.lt=(r,o)=>e.check(I1(r,o)),e.lte=(r,o)=>e.check(mm(r,o)),e.max=(r,o)=>e.check(mm(r,o)),e.int=r=>e.check(D1(r)),e.safe=r=>e.check(D1(r)),e.positive=r=>e.check(A1(0,r)),e.nonnegative=r=>e.check(gm(0,r)),e.negative=r=>e.check(I1(0,r)),e.nonpositive=r=>e.check(mm(0,r)),e.multipleOf=(r,o)=>e.check(O1(r,o)),e.step=(r,o)=>e.check(O1(r,o)),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 Ge(e){return qK(J0,e)}const zW=Q("ZodNumberFormat",(e,t)=>{KB.init(e,t),J0.init(e,t)});function D1(e){return HK(zW,e)}const FW=Q("ZodBoolean",(e,t)=>{WB.init(e,t),kt.init(e,t)});function ht(e){return BK(FW,e)}const UW=Q("ZodNull",(e,t)=>{ZB.init(e,t),kt.init(e,t)});function qW(e){return KK(UW,e)}const VW=Q("ZodAny",(e,t)=>{QB.init(e,t),kt.init(e,t)});function HW(){return WK(VW)}const BW=Q("ZodUnknown",(e,t)=>{GB.init(e,t),kt.init(e,t)});function Nt(){return ZK(BW)}const KW=Q("ZodNever",(e,t)=>{JB.init(e,t),kt.init(e,t)});function WW(e){return QK(KW,e)}const ZW=Q("ZodArray",(e,t)=>{YB.init(e,t),kt.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Uf(n,r)),e.nonempty=n=>e.check(Uf(1,n)),e.max=(n,r)=>e.check(N2(n,r)),e.length=(n,r)=>e.check(j2(n,r)),e.unwrap=()=>e.element});function oe(e,t){return iW(ZW,e,t)}const R2=Q("ZodObject",(e,t)=>{XB.init(e,t),kt.init(e,t),mt(e,"shape",()=>t.shape),e.keyof=()=>er(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Nt()}),e.loose=()=>e.clone({...e._zod.def,catchall:Nt()}),e.strict=()=>e.clone({...e._zod.def,catchall:WW()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>SH(e,n),e.merge=n=>CH(e,n),e.pick=n=>kH(e,n),e.omit=n=>_H(e,n),e.partial=(...n)=>EH(M2,e,n[0]),e.required=(...n)=>NH(D2,e,n[0])});function ie(e,t){const n={type:"object",get shape(){return Zh(this,"shape",{...e}),this.shape},...me(t)};return new R2(n)}function nn(e,t){return new R2({type:"object",get shape(){return Zh(this,"shape",{...e}),this.shape},catchall:Nt(),...me(t)})}const I2=Q("ZodUnion",(e,t)=>{C2.init(e,t),kt.init(e,t),e.options=t.options});function _t(e,t){return new I2({type:"union",options:e,...me(t)})}const QW=Q("ZodDiscriminatedUnion",(e,t)=>{I2.init(e,t),eK.init(e,t)});function A2(e,t,n){return new QW({type:"union",options:t,discriminator:e,...me(n)})}const GW=Q("ZodIntersection",(e,t)=>{tK.init(e,t),kt.init(e,t)});function Y0(e,t){return new GW({type:"intersection",left:e,right:t})}const JW=Q("ZodRecord",(e,t)=>{nK.init(e,t),kt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function gt(e,t,n){return new JW({type:"record",keyType:e,valueType:t,...me(n)})}const my=Q("ZodEnum",(e,t)=>{rK.init(e,t),kt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new my({...t,checks:[],...me(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new my({...t,checks:[],...me(o),entries:s})}});function er(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new my({type:"enum",entries:n,...me(t)})}const YW=Q("ZodLiteral",(e,t)=>{oK.init(e,t),kt.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 YW({type:"literal",values:Array.isArray(e)?e:[e],...me(t)})}const XW=Q("ZodTransform",(e,t)=>{sK.init(e,t),kt.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=s=>{if(typeof s=="string")n.issues.push(Hc(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),n.issues.push(Hc(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function O2(e){return new XW({type:"transform",transform:e})}const M2=Q("ZodOptional",(e,t)=>{iK.init(e,t),kt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ct(e){return new M2({type:"optional",innerType:e})}const e7=Q("ZodNullable",(e,t)=>{aK.init(e,t),kt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function L1(e){return new e7({type:"nullable",innerType:e})}const t7=Q("ZodDefault",(e,t)=>{lK.init(e,t),kt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function n7(e,t){return new t7({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const r7=Q("ZodPrefault",(e,t)=>{cK.init(e,t),kt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function o7(e,t){return new r7({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const D2=Q("ZodNonOptional",(e,t)=>{uK.init(e,t),kt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function s7(e,t){return new D2({type:"nonoptional",innerType:e,...me(t)})}const i7=Q("ZodCatch",(e,t)=>{dK.init(e,t),kt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function a7(e,t){return new i7({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const l7=Q("ZodPipe",(e,t)=>{fK.init(e,t),kt.init(e,t),e.in=t.in,e.out=t.out});function gy(e,t){return new l7({type:"pipe",in:e,out:t})}const c7=Q("ZodReadonly",(e,t)=>{hK.init(e,t),kt.init(e,t)});function u7(e){return new c7({type:"readonly",innerType:e})}const L2=Q("ZodCustom",(e,t)=>{pK.init(e,t),kt.init(e,t)});function d7(e){const t=new qn({check:"custom"});return t._zod.check=e,t}function f7(e,t){return aW(L2,e??(()=>!0),t)}function h7(e,t={}){return lW(L2,e,t)}function p7(e){const t=d7(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Hc(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Hc(o))}},e(n.value,n)));return t}function z2(e,t){return gy(O2(e),t)}const m7={custom:"custom"};function g7(e){return VK(J0,e)}const Jh="2025-11-25",y7=[Jh,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ys="io.modelcontextprotocol/related-task",Yh="2.0",Vt=f7(e=>e!==null&&(typeof e=="object"||typeof e=="function")),F2=_t([F(),Ge().int()]),U2=F();nn({ttl:Ge().optional(),pollInterval:Ge().optional()});const v7=ie({ttl:Ge().optional()}),x7=ie({taskId:F()}),X0=nn({progressToken:F2.optional(),[Ys]:x7.optional()}),tr=ie({_meta:X0.optional()}),mu=tr.extend({task:v7.optional()}),w7=e=>mu.safeParse(e).success,an=ie({method:F(),params:tr.loose().optional()}),gr=ie({_meta:X0.optional()}),yr=ie({method:F(),params:gr.loose().optional()}),ln=nn({_meta:X0.optional()}),Xh=_t([F(),Ge().int()]),q2=ie({jsonrpc:ye(Yh),id:Xh,...an.shape}).strict(),yy=e=>q2.safeParse(e).success,V2=ie({jsonrpc:ye(Yh),...yr.shape}).strict(),b7=e=>V2.safeParse(e).success,ex=ie({jsonrpc:ye(Yh),id:Xh,result:ln}).strict(),Wl=e=>ex.safeParse(e).success;var $e;(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"})($e||($e={}));const tx=ie({jsonrpc:ye(Yh),id:Xh.optional(),error:ie({code:Ge().int(),message:F(),data:Nt().optional()})}).strict(),k7=e=>tx.safeParse(e).success,zd=_t([q2,V2,ex,tx]);_t([ex,tx]);const ga=ln.strict(),_7=gr.extend({requestId:Xh.optional(),reason:F().optional()}),nx=yr.extend({method:ye("notifications/cancelled"),params:_7}),S7=ie({src:F(),mimeType:F().optional(),sizes:oe(F()).optional(),theme:er(["light","dark"]).optional()}),gu=ie({icons:oe(S7).optional()}),ol=ie({name:F(),title:F().optional()}),H2=ol.extend({...ol.shape,...gu.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),C7=Y0(ie({applyDefaults:ht().optional()}),gt(F(),Nt())),E7=z2(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Y0(ie({form:C7.optional(),url:Vt.optional()}),gt(F(),Nt()).optional())),N7=nn({list:Vt.optional(),cancel:Vt.optional(),requests:nn({sampling:nn({createMessage:Vt.optional()}).optional(),elicitation:nn({create:Vt.optional()}).optional()}).optional()}),j7=nn({list:Vt.optional(),cancel:Vt.optional(),requests:nn({tools:nn({call:Vt.optional()}).optional()}).optional()}),P7=ie({experimental:gt(F(),Vt).optional(),sampling:ie({context:Vt.optional(),tools:Vt.optional()}).optional(),elicitation:E7.optional(),roots:ie({listChanged:ht().optional()}).optional(),tasks:N7.optional(),extensions:gt(F(),Vt).optional()}),T7=tr.extend({protocolVersion:F(),capabilities:P7,clientInfo:H2}),$7=an.extend({method:ye("initialize"),params:T7}),R7=ie({experimental:gt(F(),Vt).optional(),logging:Vt.optional(),completions:Vt.optional(),prompts:ie({listChanged:ht().optional()}).optional(),resources:ie({subscribe:ht().optional(),listChanged:ht().optional()}).optional(),tools:ie({listChanged:ht().optional()}).optional(),tasks:j7.optional(),extensions:gt(F(),Vt).optional()}),B2=ln.extend({protocolVersion:F(),capabilities:R7,serverInfo:H2,instructions:F().optional()}),K2=yr.extend({method:ye("notifications/initialized"),params:gr.optional()}),I7=e=>K2.safeParse(e).success,rx=an.extend({method:ye("ping"),params:tr.optional()}),A7=ie({progress:Ge(),total:Ct(Ge()),message:Ct(F())}),O7=ie({...gr.shape,...A7.shape,progressToken:F2}),ox=yr.extend({method:ye("notifications/progress"),params:O7}),M7=tr.extend({cursor:U2.optional()}),yu=an.extend({params:M7.optional()}),vu=ln.extend({nextCursor:U2.optional()}),D7=er(["working","input_required","completed","failed","cancelled"]),xu=ie({taskId:F(),status:D7,ttl:_t([Ge(),qW()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:Ct(Ge()),statusMessage:Ct(F())}),Bc=ln.extend({task:xu}),L7=gr.merge(xu),qf=yr.extend({method:ye("notifications/tasks/status"),params:L7}),sx=an.extend({method:ye("tasks/get"),params:tr.extend({taskId:F()})}),ix=ln.merge(xu),ax=an.extend({method:ye("tasks/result"),params:tr.extend({taskId:F()})});ln.loose();const lx=yu.extend({method:ye("tasks/list")}),cx=vu.extend({tasks:oe(xu)}),ux=an.extend({method:ye("tasks/cancel"),params:tr.extend({taskId:F()})}),z7=ln.merge(xu),W2=ie({uri:F(),mimeType:Ct(F()),_meta:gt(F(),Nt()).optional()}),Z2=W2.extend({text:F()}),dx=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Q2=W2.extend({blob:dx}),wu=er(["user","assistant"]),bl=ie({audience:oe(wu).optional(),priority:Ge().min(0).max(1).optional(),lastModified:P2({offset:!0}).optional()}),G2=ie({...ol.shape,...gu.shape,uri:F(),description:Ct(F()),mimeType:Ct(F()),size:Ct(Ge()),annotations:bl.optional(),_meta:Ct(nn({}))}),F7=ie({...ol.shape,...gu.shape,uriTemplate:F(),description:Ct(F()),mimeType:Ct(F()),annotations:bl.optional(),_meta:Ct(nn({}))}),U7=yu.extend({method:ye("resources/list")}),Vf=vu.extend({resources:oe(G2)}),q7=yu.extend({method:ye("resources/templates/list")}),J2=vu.extend({resourceTemplates:oe(F7)}),fx=tr.extend({uri:F()}),V7=fx,H7=an.extend({method:ye("resources/read"),params:V7}),hx=ln.extend({contents:oe(_t([Z2,Q2]))}),Y2=yr.extend({method:ye("notifications/resources/list_changed"),params:gr.optional()}),B7=fx,K7=an.extend({method:ye("resources/subscribe"),params:B7}),W7=fx,Z7=an.extend({method:ye("resources/unsubscribe"),params:W7}),Q7=gr.extend({uri:F()}),G7=yr.extend({method:ye("notifications/resources/updated"),params:Q7}),J7=ie({name:F(),description:Ct(F()),required:Ct(ht())}),Y7=ie({...ol.shape,...gu.shape,description:Ct(F()),arguments:Ct(oe(J7)),_meta:Ct(nn({}))}),X7=yu.extend({method:ye("prompts/list")}),Hf=vu.extend({prompts:oe(Y7)}),eZ=tr.extend({name:F(),arguments:gt(F(),F()).optional()}),tZ=an.extend({method:ye("prompts/get"),params:eZ}),px=ie({type:ye("text"),text:F(),annotations:bl.optional(),_meta:gt(F(),Nt()).optional()}),mx=ie({type:ye("image"),data:dx,mimeType:F(),annotations:bl.optional(),_meta:gt(F(),Nt()).optional()}),gx=ie({type:ye("audio"),data:dx,mimeType:F(),annotations:bl.optional(),_meta:gt(F(),Nt()).optional()}),nZ=ie({type:ye("tool_use"),name:F(),id:F(),input:gt(F(),Nt()),_meta:gt(F(),Nt()).optional()}),rZ=ie({type:ye("resource"),resource:_t([Z2,Q2]),annotations:bl.optional(),_meta:gt(F(),Nt()).optional()}),oZ=G2.extend({type:ye("resource_link")}),yx=_t([px,mx,gx,oZ,rZ]),sZ=ie({role:wu,content:yx}),vx=ln.extend({description:F().optional(),messages:oe(sZ)}),X2=yr.extend({method:ye("notifications/prompts/list_changed"),params:gr.optional()}),iZ=ie({title:F().optional(),readOnlyHint:ht().optional(),destructiveHint:ht().optional(),idempotentHint:ht().optional(),openWorldHint:ht().optional()}),aZ=ie({taskSupport:er(["required","optional","forbidden"]).optional()}),e$=ie({...ol.shape,...gu.shape,description:F().optional(),inputSchema:ie({type:ye("object"),properties:gt(F(),Vt).optional(),required:oe(F()).optional()}).catchall(Nt()),outputSchema:ie({type:ye("object"),properties:gt(F(),Vt).optional(),required:oe(F()).optional()}).catchall(Nt()).optional(),annotations:iZ.optional(),execution:aZ.optional(),_meta:gt(F(),Nt()).optional()}),lZ=yu.extend({method:ye("tools/list")}),xx=vu.extend({tools:oe(e$)}),bu=ln.extend({content:oe(yx).default([]),structuredContent:gt(F(),Nt()).optional(),isError:ht().optional()});bu.or(ln.extend({toolResult:Nt()}));const cZ=mu.extend({name:F(),arguments:gt(F(),Nt()).optional()}),uZ=an.extend({method:ye("tools/call"),params:cZ}),t$=yr.extend({method:ye("notifications/tools/list_changed"),params:gr.optional()}),dZ=ie({autoRefresh:ht().default(!0),debounceMs:Ge().int().nonnegative().default(300)}),n$=er(["debug","info","notice","warning","error","critical","alert","emergency"]),fZ=tr.extend({level:n$}),hZ=an.extend({method:ye("logging/setLevel"),params:fZ}),pZ=gr.extend({level:n$,logger:F().optional(),data:Nt()}),mZ=yr.extend({method:ye("notifications/message"),params:pZ}),gZ=ie({name:F().optional()}),yZ=ie({hints:oe(gZ).optional(),costPriority:Ge().min(0).max(1).optional(),speedPriority:Ge().min(0).max(1).optional(),intelligencePriority:Ge().min(0).max(1).optional()}),vZ=ie({mode:er(["auto","required","none"]).optional()}),xZ=ie({type:ye("tool_result"),toolUseId:F().describe("The unique identifier for the corresponding tool call."),content:oe(yx).default([]),structuredContent:ie({}).loose().optional(),isError:ht().optional(),_meta:gt(F(),Nt()).optional()}),wZ=A2("type",[px,mx,gx]),Bf=A2("type",[px,mx,gx,nZ,xZ]),bZ=ie({role:wu,content:_t([Bf,oe(Bf)]),_meta:gt(F(),Nt()).optional()}),kZ=mu.extend({messages:oe(bZ),modelPreferences:yZ.optional(),systemPrompt:F().optional(),includeContext:er(["none","thisServer","allServers"]).optional(),temperature:Ge().optional(),maxTokens:Ge().int(),stopSequences:oe(F()).optional(),metadata:Vt.optional(),tools:oe(e$).optional(),toolChoice:vZ.optional()}),r$=an.extend({method:ye("sampling/createMessage"),params:kZ}),o$=ln.extend({model:F(),stopReason:Ct(er(["endTurn","stopSequence","maxTokens"]).or(F())),role:wu,content:wZ}),s$=ln.extend({model:F(),stopReason:Ct(er(["endTurn","stopSequence","maxTokens","toolUse"]).or(F())),role:wu,content:_t([Bf,oe(Bf)])}),_Z=ie({type:ye("boolean"),title:F().optional(),description:F().optional(),default:ht().optional()}),SZ=ie({type:ye("string"),title:F().optional(),description:F().optional(),minLength:Ge().optional(),maxLength:Ge().optional(),format:er(["email","uri","date","date-time"]).optional(),default:F().optional()}),CZ=ie({type:er(["number","integer"]),title:F().optional(),description:F().optional(),minimum:Ge().optional(),maximum:Ge().optional(),default:Ge().optional()}),EZ=ie({type:ye("string"),title:F().optional(),description:F().optional(),enum:oe(F()),default:F().optional()}),NZ=ie({type:ye("string"),title:F().optional(),description:F().optional(),oneOf:oe(ie({const:F(),title:F()})),default:F().optional()}),jZ=ie({type:ye("string"),title:F().optional(),description:F().optional(),enum:oe(F()),enumNames:oe(F()).optional(),default:F().optional()}),PZ=_t([EZ,NZ]),TZ=ie({type:ye("array"),title:F().optional(),description:F().optional(),minItems:Ge().optional(),maxItems:Ge().optional(),items:ie({type:ye("string"),enum:oe(F())}),default:oe(F()).optional()}),$Z=ie({type:ye("array"),title:F().optional(),description:F().optional(),minItems:Ge().optional(),maxItems:Ge().optional(),items:ie({anyOf:oe(ie({const:F(),title:F()}))}),default:oe(F()).optional()}),RZ=_t([TZ,$Z]),IZ=_t([jZ,PZ,RZ]),AZ=_t([IZ,_Z,SZ,CZ]),OZ=mu.extend({mode:ye("form").optional(),message:F(),requestedSchema:ie({type:ye("object"),properties:gt(F(),AZ),required:oe(F()).optional()})}),MZ=mu.extend({mode:ye("url"),message:F(),elicitationId:F(),url:F().url()}),DZ=_t([OZ,MZ]),i$=an.extend({method:ye("elicitation/create"),params:DZ}),LZ=gr.extend({elicitationId:F()}),zZ=yr.extend({method:ye("notifications/elicitation/complete"),params:LZ}),a$=ln.extend({action:er(["accept","decline","cancel"]),content:z2(e=>e===null?void 0:e,gt(F(),_t([F(),Ge(),ht(),oe(F())])).optional())}),FZ=ie({type:ye("ref/resource"),uri:F()}),UZ=ie({type:ye("ref/prompt"),name:F()}),qZ=tr.extend({ref:_t([UZ,FZ]),argument:ie({name:F(),value:F()}),context:ie({arguments:gt(F(),F()).optional()}).optional()}),VZ=an.extend({method:ye("completion/complete"),params:qZ}),l$=ln.extend({completion:nn({values:oe(F()).max(100),total:Ct(Ge().int()),hasMore:Ct(ht())})}),HZ=ie({uri:F().startsWith("file://"),name:F().optional(),_meta:gt(F(),Nt()).optional()}),BZ=an.extend({method:ye("roots/list"),params:tr.optional()}),KZ=ln.extend({roots:oe(HZ)}),WZ=yr.extend({method:ye("notifications/roots/list_changed"),params:gr.optional()});_t([rx,$7,VZ,hZ,tZ,X7,U7,q7,H7,K7,Z7,uZ,lZ,sx,ax,lx,ux]);_t([nx,ox,K2,WZ,qf]);_t([ga,o$,s$,a$,KZ,ix,cx,Bc]);_t([rx,r$,i$,BZ,sx,ax,lx,ux]);_t([nx,ox,mZ,G7,Y2,t$,X2,qf,zZ]);_t([ga,B2,l$,vx,Hf,Vf,J2,hx,bu,xx,ix,cx,Bc]);class Se 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===$e.UrlElicitationRequired&&r){const o=r;if(o.elicitations)return new ZZ(o.elicitations,n)}return new Se(t,n,r)}}class ZZ extends Se{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super($e.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}}class z1 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 ym(e){}function c$(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=ym,onError:n=ym,onRetry:r=ym,onComment:o}=e;let s="",i=!0,a,l="",u="";function d(m){const x=i?m.replace(/^\xEF\xBB\xBF/,""):m,[g,v]=QZ(`${s}${x}`);for(const w of g)f(w);s=v,i=!1}function f(m){if(m===""){h();return}if(m.startsWith(":")){o&&o(m.slice(m.startsWith(": ")?2:1));return}const x=m.indexOf(":");if(x!==-1){const g=m.slice(0,x),v=m[x+1]===" "?2:1,w=m.slice(x+v);p(g,w,m);return}p(m,"",m)}function p(m,x,g){switch(m){case"event":u=x;break;case"data":l=`${l}${x}
461
- `;break;case"id":a=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.test(x)?r(parseInt(x,10)):n(new z1(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:g}));break;default:n(new z1(`Unknown field "${m.length>20?`${m.slice(0,20)}…`:m}"`,{type:"unknown-field",field:m,value:x,line:g}));break}}function h(){l.length>0&&t({id:a,event:u||void 0,data:l.endsWith(`
462
- `)?l.slice(0,-1):l}),a=void 0,l="",u=""}function y(m={}){s&&m.consume&&f(s),i=!0,a=void 0,l="",u="",s=""}return{feed:d,reset:y}}function QZ(e){const t=[];let n="",r=0;for(;r<e.length;){const o=e.indexOf("\r",r),s=e.indexOf(`
463
- `,r);let i=-1;if(o!==-1&&s!==-1?i=Math.min(o,s):o!==-1?o===e.length-1?i=-1:i=o:s!==-1&&(i=s),i===-1){n=e.slice(r);break}else{const a=e.slice(r,i);t.push(a),r=i+1,e[r-1]==="\r"&&e[r]===`
464
- `&&r++}}return[t,n]}class F1 extends Event{constructor(t,n){var r,o;super(t),this.code=(r=n==null?void 0:n.code)!=null?r:void 0,this.message=(o=n==null?void 0:n.message)!=null?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(U1(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(U1(this),n)}}function GZ(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function vy(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(vy).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${vy(e.cause)}`:e.message:`${e}`}function U1(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var u$=e=>{throw TypeError(e)},wx=(e,t,n)=>t.has(e)||u$("Cannot "+n),Ue=(e,t,n)=>(wx(e,t,"read from private field"),n?n.call(e):t.get(e)),Lt=(e,t,n)=>t.has(e)?u$("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),xt=(e,t,n,r)=>(wx(e,t,"write to private field"),t.set(e,n),n),yo=(e,t,n)=>(wx(e,t,"access private method"),n),An,ei,Xi,Fd,Kf,hc,ya,pc,ss,ea,ja,ta,Zl,kr,xy,wy,by,q1,ky,_y,Ql,Sy,Cy;class Ud extends EventTarget{constructor(t,n){var r,o;super(),Lt(this,kr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Lt(this,An),Lt(this,ei),Lt(this,Xi),Lt(this,Fd),Lt(this,Kf),Lt(this,hc),Lt(this,ya),Lt(this,pc,null),Lt(this,ss),Lt(this,ea),Lt(this,ja,null),Lt(this,ta,null),Lt(this,Zl,null),Lt(this,wy,async s=>{var i;Ue(this,ea).reset();const{body:a,redirected:l,status:u,headers:d}=s;if(u===204){yo(this,kr,Ql).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?xt(this,Xi,new URL(s.url)):xt(this,Xi,void 0),u!==200){yo(this,kr,Ql).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){yo(this,kr,Ql).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ue(this,An)===this.CLOSED)return;xt(this,An,this.OPEN);const f=new Event("open");if((i=Ue(this,Zl))==null||i.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){yo(this,kr,Ql).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const p=new TextDecoder,h=a.getReader();let y=!0;do{const{done:m,value:x}=await h.read();x&&Ue(this,ea).feed(p.decode(x,{stream:!m})),m&&(y=!1,Ue(this,ea).reset(),yo(this,kr,Sy).call(this))}while(y)}),Lt(this,by,s=>{xt(this,ss,void 0),!(s.name==="AbortError"||s.type==="aborted")&&yo(this,kr,Sy).call(this,vy(s))}),Lt(this,ky,s=>{typeof s.id=="string"&&xt(this,pc,s.id);const i=new MessageEvent(s.event||"message",{data:s.data,origin:Ue(this,Xi)?Ue(this,Xi).origin:Ue(this,ei).origin,lastEventId:s.id||""});Ue(this,ta)&&(!s.event||s.event==="message")&&Ue(this,ta).call(this,i),this.dispatchEvent(i)}),Lt(this,_y,s=>{xt(this,hc,s)}),Lt(this,Cy,()=>{xt(this,ya,void 0),Ue(this,An)===this.CONNECTING&&yo(this,kr,xy).call(this)});try{if(t instanceof URL)xt(this,ei,t);else if(typeof t=="string")xt(this,ei,new URL(t,JZ()));else throw new Error("Invalid URL")}catch{throw GZ("An invalid or illegal string was specified")}xt(this,ea,c$({onEvent:Ue(this,ky),onRetry:Ue(this,_y)})),xt(this,An,this.CONNECTING),xt(this,hc,3e3),xt(this,Kf,(r=n==null?void 0:n.fetch)!=null?r:globalThis.fetch),xt(this,Fd,(o=n==null?void 0:n.withCredentials)!=null?o:!1),yo(this,kr,xy).call(this)}get readyState(){return Ue(this,An)}get url(){return Ue(this,ei).href}get withCredentials(){return Ue(this,Fd)}get onerror(){return Ue(this,ja)}set onerror(t){xt(this,ja,t)}get onmessage(){return Ue(this,ta)}set onmessage(t){xt(this,ta,t)}get onopen(){return Ue(this,Zl)}set onopen(t){xt(this,Zl,t)}addEventListener(t,n,r){const o=n;super.addEventListener(t,o,r)}removeEventListener(t,n,r){const o=n;super.removeEventListener(t,o,r)}close(){Ue(this,ya)&&clearTimeout(Ue(this,ya)),Ue(this,An)!==this.CLOSED&&(Ue(this,ss)&&Ue(this,ss).abort(),xt(this,An,this.CLOSED),xt(this,ss,void 0))}}An=new WeakMap,ei=new WeakMap,Xi=new WeakMap,Fd=new WeakMap,Kf=new WeakMap,hc=new WeakMap,ya=new WeakMap,pc=new WeakMap,ss=new WeakMap,ea=new WeakMap,ja=new WeakMap,ta=new WeakMap,Zl=new WeakMap,kr=new WeakSet,xy=function(){xt(this,An,this.CONNECTING),xt(this,ss,new AbortController),Ue(this,Kf)(Ue(this,ei),yo(this,kr,q1).call(this)).then(Ue(this,wy)).catch(Ue(this,by))},wy=new WeakMap,by=new WeakMap,q1=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ue(this,pc)?{"Last-Event-ID":Ue(this,pc)}:void 0},cache:"no-store",signal:(e=Ue(this,ss))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},ky=new WeakMap,_y=new WeakMap,Ql=function(e,t){var n;Ue(this,An)!==this.CLOSED&&xt(this,An,this.CLOSED);const r=new F1("error",{code:t,message:e});(n=Ue(this,ja))==null||n.call(this,r),this.dispatchEvent(r)},Sy=function(e,t){var n;if(Ue(this,An)===this.CLOSED)return;xt(this,An,this.CONNECTING);const r=new F1("error",{code:t,message:e});(n=Ue(this,ja))==null||n.call(this,r),this.dispatchEvent(r),xt(this,ya,setTimeout(Ue(this,Cy),Ue(this,hc)))},Cy=new WeakMap,Ud.CONNECTING=0,Ud.OPEN=1,Ud.CLOSED=2;function JZ(){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 Wf(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function d$(e=fetch,t){return t?async(n,r)=>{const o={...t,...r,headers:r!=null&&r.headers?{...Wf(t.headers),...Wf(r.headers)}:t.headers};return e(n,o)}:e}let bx;bx=globalThis.crypto;async function YZ(e){return(await bx).getRandomValues(new Uint8Array(e))}async function XZ(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let n="";const r=await YZ(e);for(let o=0;o<e;o++){const s=r[o]%t.length;n+=t[s]}return n}async function eQ(e){return await XZ(e)}async function tQ(e){const t=await(await bx).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function nQ(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await eQ(e),n=await tQ(t);return{code_verifier:t,code_challenge:n}}const en=_W().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:m7.custom,message:"URL must be parseable",fatal:!0}),pH}).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"}),rQ=nn({resource:F().url(),authorization_servers:oe(en).optional(),jwks_uri:F().url().optional(),scopes_supported:oe(F()).optional(),bearer_methods_supported:oe(F()).optional(),resource_signing_alg_values_supported:oe(F()).optional(),resource_name:F().optional(),resource_documentation:F().optional(),resource_policy_uri:F().url().optional(),resource_tos_uri:F().url().optional(),tls_client_certificate_bound_access_tokens:ht().optional(),authorization_details_types_supported:oe(F()).optional(),dpop_signing_alg_values_supported:oe(F()).optional(),dpop_bound_access_tokens_required:ht().optional()}),f$=nn({issuer:F(),authorization_endpoint:en,token_endpoint:en,registration_endpoint:en.optional(),scopes_supported:oe(F()).optional(),response_types_supported:oe(F()),response_modes_supported:oe(F()).optional(),grant_types_supported:oe(F()).optional(),token_endpoint_auth_methods_supported:oe(F()).optional(),token_endpoint_auth_signing_alg_values_supported:oe(F()).optional(),service_documentation:en.optional(),revocation_endpoint:en.optional(),revocation_endpoint_auth_methods_supported:oe(F()).optional(),revocation_endpoint_auth_signing_alg_values_supported:oe(F()).optional(),introspection_endpoint:F().optional(),introspection_endpoint_auth_methods_supported:oe(F()).optional(),introspection_endpoint_auth_signing_alg_values_supported:oe(F()).optional(),code_challenge_methods_supported:oe(F()).optional(),client_id_metadata_document_supported:ht().optional()}),oQ=nn({issuer:F(),authorization_endpoint:en,token_endpoint:en,userinfo_endpoint:en.optional(),jwks_uri:en,registration_endpoint:en.optional(),scopes_supported:oe(F()).optional(),response_types_supported:oe(F()),response_modes_supported:oe(F()).optional(),grant_types_supported:oe(F()).optional(),acr_values_supported:oe(F()).optional(),subject_types_supported:oe(F()),id_token_signing_alg_values_supported:oe(F()),id_token_encryption_alg_values_supported:oe(F()).optional(),id_token_encryption_enc_values_supported:oe(F()).optional(),userinfo_signing_alg_values_supported:oe(F()).optional(),userinfo_encryption_alg_values_supported:oe(F()).optional(),userinfo_encryption_enc_values_supported:oe(F()).optional(),request_object_signing_alg_values_supported:oe(F()).optional(),request_object_encryption_alg_values_supported:oe(F()).optional(),request_object_encryption_enc_values_supported:oe(F()).optional(),token_endpoint_auth_methods_supported:oe(F()).optional(),token_endpoint_auth_signing_alg_values_supported:oe(F()).optional(),display_values_supported:oe(F()).optional(),claim_types_supported:oe(F()).optional(),claims_supported:oe(F()).optional(),service_documentation:F().optional(),claims_locales_supported:oe(F()).optional(),ui_locales_supported:oe(F()).optional(),claims_parameter_supported:ht().optional(),request_parameter_supported:ht().optional(),request_uri_parameter_supported:ht().optional(),require_request_uri_registration:ht().optional(),op_policy_uri:en.optional(),op_tos_uri:en.optional(),client_id_metadata_document_supported:ht().optional()}),sQ=ie({...oQ.shape,...f$.pick({code_challenge_methods_supported:!0}).shape}),iQ=ie({access_token:F(),id_token:F().optional(),token_type:F(),expires_in:g7().optional(),scope:F().optional(),refresh_token:F().optional()}).strip(),aQ=ie({error:F(),error_description:F().optional(),error_uri:F().optional()}),V1=en.optional().or(ye("").transform(()=>{})),lQ=ie({redirect_uris:oe(en),token_endpoint_auth_method:F().optional(),grant_types:oe(F()).optional(),response_types:oe(F()).optional(),client_name:F().optional(),client_uri:en.optional(),logo_uri:V1,scope:F().optional(),contacts:oe(F()).optional(),tos_uri:V1,policy_uri:F().optional(),jwks_uri:en.optional(),jwks:HW().optional(),software_id:F().optional(),software_version:F().optional(),software_statement:F().optional()}).strip(),cQ=ie({client_id:F(),client_secret:F().optional(),client_id_issued_at:Ge().optional(),client_secret_expires_at:Ge().optional()}).strip(),uQ=lQ.merge(cQ);ie({error:F(),error_description:F().optional()}).strip();ie({token:F(),token_type_hint:F().optional()}).strip();function dQ(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function fQ({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 o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return o.startsWith(s)}class Qt 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 Ey extends Qt{}Ey.errorCode="invalid_request";class Zf extends Qt{}Zf.errorCode="invalid_client";class Qf extends Qt{}Qf.errorCode="invalid_grant";class Gf extends Qt{}Gf.errorCode="unauthorized_client";class Ny extends Qt{}Ny.errorCode="unsupported_grant_type";class jy extends Qt{}jy.errorCode="invalid_scope";class Py extends Qt{}Py.errorCode="access_denied";class sl extends Qt{}sl.errorCode="server_error";class Ty extends Qt{}Ty.errorCode="temporarily_unavailable";class $y extends Qt{}$y.errorCode="unsupported_response_type";class Ry extends Qt{}Ry.errorCode="unsupported_token_type";class Iy extends Qt{}Iy.errorCode="invalid_token";class Ay extends Qt{}Ay.errorCode="method_not_allowed";class Oy extends Qt{}Oy.errorCode="too_many_requests";class Jf extends Qt{}Jf.errorCode="invalid_client_metadata";class My extends Qt{}My.errorCode="insufficient_scope";class Dy extends Qt{}Dy.errorCode="invalid_target";const hQ={[Ey.errorCode]:Ey,[Zf.errorCode]:Zf,[Qf.errorCode]:Qf,[Gf.errorCode]:Gf,[Ny.errorCode]:Ny,[jy.errorCode]:jy,[Py.errorCode]:Py,[sl.errorCode]:sl,[Ty.errorCode]:Ty,[$y.errorCode]:$y,[Ry.errorCode]:Ry,[Iy.errorCode]:Iy,[Ay.errorCode]:Ay,[Oy.errorCode]:Oy,[Jf.errorCode]:Jf,[My.errorCode]:My,[Dy.errorCode]:Dy};class Kn extends Error{constructor(t){super(t??"Unauthorized")}}function pQ(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const vm="code",xm="S256";function mQ(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&pQ(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 gQ(e,t,n,r){const{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":yQ(o,s,n);return;case"client_secret_post":vQ(o,s,r);return;case"none":xQ(o,r);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function yQ(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 vQ(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function xQ(e,t){t.set("client_id",e)}async function h$(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const r=aQ.parse(JSON.parse(n)),{error:o,error_description:s,error_uri:i}=r,a=hQ[o]||sl;return new a(s||"",i)}catch(r){const o=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${r}. Raw body: ${n}`;return new sl(o)}}async function $r(e,t){var n,r;try{return await wm(e,t)}catch(o){if(o instanceof Zf||o instanceof Gf)return await((n=e.invalidateCredentials)==null?void 0:n.call(e,"all")),await wm(e,t);if(o instanceof Qf)return await((r=e.invalidateCredentials)==null?void 0:r.call(e,"tokens")),await wm(e,t);throw o}}async function wm(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:o,fetchFn:s}){var w,k,C,j,_;const i=await((w=e.discoveryState)==null?void 0:w.call(e));let a,l,u,d=o;if(!d&&(i!=null&&i.resourceMetadataUrl)&&(d=new URL(i.resourceMetadataUrl)),i!=null&&i.authorizationServerUrl){if(l=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await m$(l,{fetchFn:s}),!a)try{a=await p$(t,{resourceMetadataUrl:d},s)}catch{}(u!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await((k=e.saveDiscoveryState)==null?void 0:k.call(e,{authorizationServerUrl:String(l),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:a,authorizationServerMetadata:u}))}else{const I=await EQ(t,{resourceMetadataUrl:d,fetchFn:s});l=I.authorizationServerUrl,u=I.authorizationServerMetadata,a=I.resourceMetadata,await((C=e.saveDiscoveryState)==null?void 0:C.call(e,{authorizationServerUrl:String(l),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:a,authorizationServerMetadata:u}))}const f=await bQ(t,e,a),p=r||((j=a==null?void 0:a.scopes_supported)==null?void 0:j.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 I=(u==null?void 0:u.client_id_metadata_document_supported)===!0,P=e.clientMetadataUrl;if(P&&!wQ(P))throw new Jf(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${P}`);if(I&&P)h={client_id:P},await((_=e.saveClientInformation)==null?void 0:_.call(e,h));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const T=await $Q(l,{metadata:u,clientMetadata:e.clientMetadata,scope:p,fetchFn:s});await e.saveClientInformation(T),h=T}}const y=!e.redirectUrl;if(n!==void 0||y){const I=await TQ(e,l,{metadata:u,resource:f,authorizationCode:n,fetchFn:s});return await e.saveTokens(I),"AUTHORIZED"}const m=await e.tokens();if(m!=null&&m.refresh_token)try{const I=await PQ(l,{metadata:u,clientInformation:h,refreshToken:m.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens(I),"AUTHORIZED"}catch(I){if(!(!(I instanceof Qt)||I instanceof sl))throw I}const x=e.state?await e.state():void 0,{authorizationUrl:g,codeVerifier:v}=await NQ(l,{metadata:u,clientInformation:h,state:x,redirectUrl:e.redirectUrl,scope:p,resource:f});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(g),"REDIRECT"}function wQ(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function bQ(e,t,n){const r=dQ(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n==null?void 0:n.resource);if(n){if(!fQ({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 Yf(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,r]=t.split(" ");if(n.toLowerCase()!=="bearer"||!r)return{};const o=bm(e,"resource_metadata")||void 0;let s;if(o)try{s=new URL(o)}catch{}const i=bm(e,"scope")||void 0,a=bm(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function bm(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const r=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=n.match(r);return o?o[1]||o[2]:null}async function p$(e,t,n=fetch){var o,s;const r=await SQ(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((o=r==null?void 0:r.body)==null?void 0:o.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!r.ok)throw await((s=r.body)==null?void 0:s.cancel()),new Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return rQ.parse(await r.json())}async function kx(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?kx(e,void 0,n):void 0;throw r}}function kQ(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function H1(e,t,n=fetch){return await kx(e,{"MCP-Protocol-Version":t},n)}function _Q(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function SQ(e,t,n,r){const o=new URL(e),s=(r==null?void 0:r.protocolVersion)??Jh;let i;if(r!=null&&r.metadataUrl)i=new URL(r.metadataUrl);else{const l=kQ(t,o.pathname);i=new URL(l,(r==null?void 0:r.metadataServerUrl)??o),i.search=o.search}let a=await H1(i,s,n);if(!(r!=null&&r.metadataUrl)&&_Q(a,o.pathname)){const l=new URL(`/.well-known/${t}`,o);a=await H1(l,s,n)}return a}function CQ(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 o=t.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),r.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function m$(e,{fetchFn:t=fetch,protocolVersion:n=Jh}={}){var s;const r={"MCP-Protocol-Version":n,Accept:"application/json"},o=CQ(e);for(const{url:i,type:a}of o){const l=await kx(i,r,t);if(l){if(!l.ok){if(await((s=l.body)==null?void 0:s.cancel()),l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return a==="oauth"?f$.parse(await l.json()):sQ.parse(await l.json())}}}async function EQ(e,t){let n,r;try{n=await p$(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 o=await m$(r,{fetchFn:t==null?void 0:t.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:o,resourceMetadata:n}}async function NQ(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(vm))throw new Error(`Incompatible auth server: does not support response type ${vm}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(xm))throw new Error(`Incompatible auth server: does not support code challenge method ${xm}`)}else a=new URL("/authorize",e);const l=await nQ(),u=l.code_verifier,d=l.code_challenge;return a.searchParams.set("response_type",vm),a.searchParams.set("client_id",n.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",xm),a.searchParams.set("redirect_uri",String(r)),s&&a.searchParams.set("state",s),o&&a.searchParams.set("scope",o),o!=null&&o.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",i.href),{authorizationUrl:a,codeVerifier:u}}function jQ(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function g$(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:o,resource:s,fetchFn:i}){const a=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(s&&n.set("resource",s.href),o)await o(l,n,a,t);else if(r){const d=(t==null?void 0:t.token_endpoint_auth_methods_supported)??[],f=mQ(r,d);gQ(f,r,l,n)}const u=await(i??fetch)(a,{method:"POST",headers:l,body:n});if(!u.ok)throw await h$(u);return iQ.parse(await u.json())}async function PQ(e,{metadata:t,clientInformation:n,refreshToken:r,resource:o,addClientAuthentication:s,fetchFn:i}){const a=new URLSearchParams({grant_type:"refresh_token",refresh_token:r}),l=await g$(e,{metadata:t,tokenRequestParams:a,clientInformation:n,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:r,...l}}async function TQ(e,t,{metadata:n,resource:r,authorizationCode:o,fetchFn:s}={}){const i=e.clientMetadata.scope;let a;if(e.prepareTokenRequest&&(a=await e.prepareTokenRequest(i)),!a){if(!o)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();a=jQ(o,u,e.redirectUrl)}const l=await e.clientInformation();return g$(t,{metadata:n,tokenRequestParams:a,clientInformation:l??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:s})}async function $Q(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:o}){let s;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);const i=await(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...r!==void 0?{scope:r}:{}})});if(!i.ok)throw await h$(i);return uQ.parse(await i.json())}class RQ extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class IQ{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=d$(n==null?void 0:n.fetch,n==null?void 0:n.requestInit)}async _authThenStart(){var n;if(!this._authProvider)throw new Kn("No auth provider");let t;try{t=await $r(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 Kn;return await this._startOrAuth()}async _commonHeaders(){var r;const t={};if(this._authProvider){const o=await this._authProvider.tokens();o&&(t.Authorization=`Bearer ${o.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=Wf((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,o)=>{this._eventSource=new Ud(this._url.href,{...this._eventSourceInit,fetch:async(s,i)=>{const a=await this._commonHeaders();a.set("Accept","text/event-stream");const l=await t(s,{...i,headers:a});if(l.status===401&&l.headers.has("www-authenticate")){const{resourceMetadataUrl:u,scope:d}=Yf(l);this._resourceMetadataUrl=u,this._scope=d}return l}}),this._abortController=new AbortController,this._eventSource.onerror=s=>{var a;if(s.code===401&&this._authProvider){this._authThenStart().then(r,o);return}const i=new RQ(s.code,s.message,s);o(i),(a=this.onerror)==null||a.call(this,i)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",s=>{var a;const i=s;try{if(this._endpoint=new URL(i.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(l){o(l),(a=this.onerror)==null||a.call(this,l),this.close();return}r()}),this._eventSource.onmessage=s=>{var l,u;const i=s;let a;try{a=zd.parse(JSON.parse(i.data))}catch(d){(l=this.onerror)==null||l.call(this,d);return}(u=this.onmessage)==null||u.call(this,a)}})}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 Kn("No auth provider");if(await $r(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Kn("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,o;if(!this._endpoint)throw new Error("Not connected");try{const s=await this._commonHeaders();s.set("content-type","application/json");const i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:(n=this._abortController)==null?void 0:n.signal},a=await(this._fetch??fetch)(this._endpoint,i);if(!a.ok){const l=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){const{resourceMetadataUrl:u,scope:d}=Yf(a);if(this._resourceMetadataUrl=u,this._scope=d,await $r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Kn;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${l}`)}await((r=a.body)==null?void 0:r.cancel())}catch(s){throw(o=this.onerror)==null||o.call(this,s),s}}setProtocolVersion(t){this._protocolVersion=t}}class AQ extends TransformStream{constructor({onError:t,onRetry:n,onComment:r}={}){let o;super({start(s){o=c$({onEvent:i=>{s.enqueue(i)},onError(i){t==="terminate"?s.error(i):typeof t=="function"&&t(i)},onRetry:n,onComment:r})},transform(s){o.feed(s)}})}}const OQ={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Wi extends Error{constructor(t,n){super(`Streamable HTTP error: ${n}`),this.code=t}}class MQ{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=d$(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)??OQ}async _authThenStart(){var n;if(!this._authProvider)throw new Kn("No auth provider");let t;try{t=await $r(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 Kn;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var r;const t={};if(this._authProvider){const o=await this._authProvider.tokens();o&&(t.Authorization=`Bearer ${o.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=Wf((r=this._requestInit)==null?void 0:r.headers);return new Headers({...t,...n})}async _startOrAuthSse(t){var r,o,s;const{resumptionToken:n}=t;try{const i=await this._commonHeaders();i.set("Accept","text/event-stream"),n&&i.set("last-event-id",n);const a=await(this._fetch??fetch)(this._url,{method:"GET",headers:i,signal:(r=this._abortController)==null?void 0:r.signal});if(!a.ok){if(await((o=a.body)==null?void 0:o.cancel()),a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new Wi(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,t,!0)}catch(i){throw(s=this.onerror)==null||s.call(this,i),i}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const n=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(n*Math.pow(r,t),o)}_scheduleReconnection(t,n=0){var s;const r=this._reconnectionOptions.maxRetries;if(n>=r){(s=this.onerror)==null||s.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}const o=this._getNextReconnectionDelay(n);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(i=>{var a;(a=this.onerror)==null||a.call(this,new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(t,n+1)})},o)}_handleSseStream(t,n,r){if(!t)return;const{onresumptiontoken:o,replayMessageId:s}=n;let i,a=!1,l=!1;(async()=>{var d,f,p,h;try{const y=t.pipeThrough(new TextDecoderStream).pipeThrough(new AQ({onRetry:g=>{this._serverRetryMs=g}})).getReader();for(;;){const{value:g,done:v}=await y.read();if(v)break;if(g.id&&(i=g.id,a=!0,o==null||o(g.id)),!!g.data&&(!g.event||g.event==="message"))try{const w=zd.parse(JSON.parse(g.data));Wl(w)&&(l=!0,s!==void 0&&(w.id=s)),(d=this.onmessage)==null||d.call(this,w)}catch(w){(f=this.onerror)==null||f.call(this,w)}}(r||a)&&!l&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(y){if((p=this.onerror)==null||p.call(this,new Error(`SSE stream disconnected: ${y}`)),(r||a)&&!l&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},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 Kn("No auth provider");if(await $r(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Kn("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,o,s,i,a,l;try{const{resumptionToken:u,onresumptiontoken:d}=n||{};if(u){this._startOrAuthSse({resumptionToken:u,replayMessageId:yy(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 Wi(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:w,scope:k}=Yf(h);if(this._resourceMetadataUrl=w,this._scope=k,await $r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Kn;return this._hasCompletedAuthFlow=!0,this.send(t)}if(h.status===403&&this._authProvider){const{resourceMetadataUrl:w,scope:k,error:C}=Yf(h);if(C==="insufficient_scope"){const j=h.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===j)throw new Wi(403,"Server returned 403 after trying upscoping");if(k&&(this._scope=k),w&&(this._resourceMetadataUrl=w),this._lastUpscopingHeader=j??void 0,await $r(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Kn;return this.send(t)}}throw new Wi(h.status,`Error POSTing to endpoint: ${v}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,h.status===202){await((o=h.body)==null?void 0:o.cancel()),I7(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var w;return(w=this.onerror)==null?void 0:w.call(this,v)});return}const x=(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(x)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(k=>zd.parse(k)):[zd.parse(v)];for(const k of w)(s=this.onmessage)==null||s.call(this,k)}else throw await((i=h.body)==null?void 0:i.cancel()),new Wi(-1,`Unexpected content type: ${g}`);else await((a=h.body)==null?void 0:a.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 o=await this._commonHeaders(),s={...this._requestInit,method:"DELETE",headers:o,signal:(t=this._abortController)==null?void 0:t.signal},i=await(this._fetch??fetch)(this._url,s);if(await((n=i.body)==null?void 0:n.cancel()),!i.ok&&i.status!==405)throw new Wi(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(o){throw(r=this.onerror)==null||r.call(this,o),o}}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 ep(e){return!!e._zod}function ns(e,t){return ep(e)?m2(e,t):e.safeParse(t)}function y$(e){var n,r;if(!e)return;let t;if(ep(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 DQ(e){var o;if(ep(e)){const i=(o=e._zod)==null?void 0:o.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.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 Bs(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function B1(e){const t=y$(e),n=t==null?void 0:t.method;if(!n)throw new Error("Schema is missing a method literal");const r=DQ(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function K1(e,t){const n=ns(e,t);if(!n.success)throw n.error;return n.data}const LQ=6e4;class zQ{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(nx,n=>{this._oncancel(n)}),this.setNotificationHandler(ox,n=>{this._onprogress(n)}),this.setRequestHandler(rx,n=>({})),this._taskStore=t==null?void 0:t.taskStore,this._taskMessageQueue=t==null?void 0:t.taskMessageQueue,this._taskStore&&(this.setRequestHandler(sx,async(n,r)=>{const o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new Se($e.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(ax,async(n,r)=>{const o=async()=>{var a;const s=n.params.taskId;if(this._taskMessageQueue){let l;for(;l=await this._taskMessageQueue.dequeue(s,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 Se(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((a=this._transport)==null?void 0:a.send(l.message,{relatedRequestId:r.requestId}))}}const i=await this._taskStore.getTask(s,r.sessionId);if(!i)throw new Se($e.InvalidParams,`Task not found: ${s}`);if(!Bs(i.status))return await this._waitForTaskUpdate(s,r.signal),await o();if(Bs(i.status)){const l=await this._taskStore.getTaskResult(s,r.sessionId);return this._clearTaskQueue(s),{...l,_meta:{...l._meta,[Ys]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(lx,async(n,r)=>{var o;try{const{tasks:s,nextCursor:i}=await this._taskStore.listTasks((o=n.params)==null?void 0:o.cursor,r.sessionId);return{tasks:s,nextCursor:i,_meta:{}}}catch(s){throw new Se($e.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(ux,async(n,r)=>{try{const o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new Se($e.InvalidParams,`Task not found: ${n.params.taskId}`);if(Bs(o.status))throw new Se($e.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId);const s=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!s)throw new Se($e.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof Se?o:new Se($e.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}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,o,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:o})}_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),Se.fromError($e.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 s,i,a;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=(s=this.transport)==null?void 0:s.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};const r=(i=this.transport)==null?void 0:i.onerror;this._transport.onerror=l=>{r==null||r(l),this._onerror(l)};const o=(a=this._transport)==null?void 0:a.onmessage;this._transport.onmessage=(l,u)=>{o==null||o(l,u),Wl(l)||k7(l)?this._onresponse(l):yy(l)?this._onrequest(l,u):b7(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 o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(const o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();const n=Se.fromError($e.ConnectionClosed,"Connection closed");this._transport=void 0,(r=this.onclose)==null||r.call(this);for(const o of t.values())o(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,o=this._transport,s=(p=(f=(d=t.params)==null?void 0:d._meta)==null?void 0:f[Ys])==null?void 0:p.taskId;if(r===void 0){const y={jsonrpc:"2.0",id:t.id,error:{code:$e.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:y,timestamp:Date.now()},o==null?void 0:o.sessionId).catch(m=>this._onerror(new Error(`Failed to enqueue error response: ${m}`))):o==null||o.send(y).catch(m=>this._onerror(new Error(`Failed to send an error response: ${m}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);const a=w7(t.params)?t.params.task:void 0,l=this._taskStore?this.requestTaskStore(t,o==null?void 0:o.sessionId):void 0,u={signal:i.signal,sessionId:o==null?void 0:o.sessionId,_meta:(h=t.params)==null?void 0:h._meta,sendNotification:async y=>{if(i.signal.aborted)return;const m={relatedRequestId:t.id};s&&(m.relatedTask={taskId:s}),await this.notification(y,m)},sendRequest:async(y,m,x)=>{var w;if(i.signal.aborted)throw new Se($e.ConnectionClosed,"Request was cancelled");const g={...x,relatedRequestId:t.id};s&&!g.relatedTask&&(g.relatedTask={taskId:s});const v=((w=g.relatedTask)==null?void 0:w.taskId)??s;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:s,taskStore:l,taskRequestedTtl:a==null?void 0:a.ttl,closeSSEStream:n==null?void 0:n.closeSSEStream,closeStandaloneSSEStream:n==null?void 0:n.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>r(t,u)).then(async y=>{if(i.signal.aborted)return;const m={result:y,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:m,timestamp:Date.now()},o==null?void 0:o.sessionId):await(o==null?void 0:o.send(m))},async y=>{if(i.signal.aborted)return;const m={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(y.code)?y.code:$e.InternalError,message:y.message??"Internal error",...y.data!==void 0&&{data:y.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:m,timestamp:Date.now()},o==null?void 0:o.sessionId):await(o==null?void 0:o.send(m))}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...r}=t.params,o=Number(n),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(l){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(l);return}s(r)}_onresponse(t){const n=Number(t.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),Wl(t))r(t);else{const i=new Se(t.error.code,t.error.message,t.error.data);r(i)}return}const o=this._responseHandlers.get(n);if(o===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 s=!1;if(Wl(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,n))}}if(s||this._progressHandlers.delete(n),Wl(t))o(t);else{const i=Se.fromError(t.error.code,t.error.message,t.error.data);o(i)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)==null?void 0:t.close())}async*requestStream(t,n,r){var i,a;const{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(t,n,r)}}catch(l){yield{type:"error",error:l instanceof Se?l:new Se($e.InternalError,String(l))}}return}let s;try{const l=await this.request(t,Bc,r);if(l.task)s=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new Se($e.InternalError,"Task creation did not return a task");for(;;){const u=await this.getTask({taskId:s},r);if(yield{type:"taskStatus",task:u},Bs(u.status)){u.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},n,r)}:u.status==="failed"?yield{type:"error",error:new Se($e.InternalError,`Task ${s} failed`)}:u.status==="cancelled"&&(yield{type:"error",error:new Se($e.InternalError,`Task ${s} was cancelled`)});return}if(u.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},n,r)};return}const d=u.pollInterval??((i=this._options)==null?void 0:i.defaultTaskPollInterval)??1e3;await new Promise(f=>setTimeout(f,d)),(a=r==null?void 0:r.signal)==null||a.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof Se?l:new Se($e.InternalError,String(l))}}}request(t,n,r){const{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:l}=r??{};return new Promise((u,d)=>{var v,w,k,C,j;const f=_=>{d(_)};if(!this._transport){f(new Error("Not connected"));return}if(((v=this._options)==null?void 0:v.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(_){f(_);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:{...((k=t.params)==null?void 0:k._meta)||{},progressToken:p}}),a&&(h.params={...h.params,task:a}),l&&(h.params={...h.params,_meta:{...((C=h.params)==null?void 0:C._meta)||{},[Ys]:l}});const y=_=>{var P;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(P=this._transport)==null||P.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(_)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch($=>this._onerror(new Error(`Failed to send cancellation: ${$}`)));const I=_ instanceof Se?_:new Se($e.RequestTimeout,String(_));d(I)};this._responseHandlers.set(p,_=>{var I;if(!((I=r==null?void 0:r.signal)!=null&&I.aborted)){if(_ instanceof Error)return d(_);try{const P=ns(n,_.result);P.success?u(P.data):d(P.error)}catch(P){d(P)}}}),(j=r==null?void 0:r.signal)==null||j.addEventListener("abort",()=>{var _;y((_=r==null?void 0:r.signal)==null?void 0:_.reason)});const m=(r==null?void 0:r.timeout)??LQ,x=()=>y(Se.fromError($e.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(p,m,r==null?void 0:r.maxTotalTimeout,x,(r==null?void 0:r.resetTimeoutOnProgress)??!1);const g=l==null?void 0:l.taskId;if(g){const _=I=>{const P=this._responseHandlers.get(p);P?P(I):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,_),this._enqueueTaskMessage(g,{type:"request",message:h,timestamp:Date.now()}).catch(I=>{this._cleanupTimeout(p),d(I)})}else this._transport.send(h,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(_=>{this._cleanupTimeout(p),d(_)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},ix,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},cx,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},z7,n)}async notification(t,n){var a,l,u,d;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const r=(a=n==null?void 0:n.relatedTask)==null?void 0:a.taskId;if(r){const f={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((l=t.params)==null?void 0:l._meta)||{},[Ys]: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)||{},[Ys]:n.relatedTask}}}),(h=this._transport)==null||h.send(f,n).catch(y=>this._onerror(y))});return}let i={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(i={...i,params:{...i.params,_meta:{...((d=i.params)==null?void 0:d._meta)||{},[Ys]:n.relatedTask}}}),await this._transport.send(i,n)}setRequestHandler(t,n){const r=B1(t);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,s)=>{const i=K1(t,o);return Promise.resolve(n(i,s))})}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=B1(t);this._notificationHandlers.set(r,o=>{const s=K1(t,o);return Promise.resolve(n(s))})}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 s;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const o=(s=this._options)==null?void 0:s.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,r,o)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(t,n);for(const o of r)if(o.type==="request"&&yy(o.message)){const s=o.message.id,i=this._requestResolvers.get(s);i?(i(new Se($e.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){var o,s;let r=((o=this._options)==null?void 0:o.defaultTaskPollInterval)??1e3;try{const i=await((s=this._taskStore)==null?void 0:s.getTask(t));i!=null&&i.pollInterval&&(r=i.pollInterval)}catch{}return new Promise((i,a)=>{if(n.aborted){a(new Se($e.InvalidRequest,"Request cancelled"));return}const l=setTimeout(i,r);n.addEventListener("abort",()=>{clearTimeout(l),a(new Se($e.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await r.createTask(o,t.id,{method:t.method,params:t.params},n)},getTask:async o=>{const s=await r.getTask(o,n);if(!s)throw new Se($e.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await r.storeTaskResult(o,s,i,n);const a=await r.getTask(o,n);if(a){const l=qf.parse({method:"notifications/tasks/status",params:a});await this.notification(l),Bs(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>r.getTaskResult(o,n),updateTaskStatus:async(o,s,i)=>{const a=await r.getTask(o,n);if(!a)throw new Se($e.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Bs(a.status))throw new Se($e.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,s,i,n);const l=await r.getTask(o,n);if(l){const u=qf.parse({method:"notifications/tasks/status",params:l});await this.notification(u),Bs(l.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>r.listTasks(o,n)}}}function W1(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function FQ(e,t){const n={...e};for(const r in t){const o=r,s=t[o];if(s===void 0)continue;const i=n[o];W1(i)&&W1(s)?n[o]={...i,...s}:n[o]=s}return n}var Ly={exports:{}},v$={},Or={},il={},ku={},Me={},Kc={};(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,k)=>`${w}${k}`,"")}get names(){var v;return(v=this._names)!==null&&v!==void 0?v:this._names=this._items.reduce((w,k)=>(k instanceof n&&(w[k.str]=(w[k.str]||0)+1),w),{})}}e._Code=r,e.nil=new r("");function o(g,...v){const w=[g[0]];let k=0;for(;k<v.length;)a(w,v[k]),w.push(g[++k]);return new r(w)}e._=o;const s=new r("+");function i(g,...v){const w=[h(g[0])];let k=0;for(;k<v.length;)w.push(s),a(w,v[k]),w.push(s,h(g[++k]));return l(w),new r(w)}e.str=i;function a(g,v){v instanceof r?g.push(...v._items):v instanceof n?g.push(v):g.push(f(v))}e.addCodeArg=a;function l(g){let v=1;for(;v<g.length-1;){if(g[v]===s){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:i`${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}`):o`[${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 x(g){return new r(g.toString())}e.regexpCode=x})(Kc);var zy={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Kc;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 o{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=o;class s 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=s;const i=(0,t._)`\n`;class a extends o{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?i:t.nil}}get(){return this._scope}name(u){return new s(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 x=this._scope[h]||(this._scope[h]=[]),g=x.length;return x[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 x=f[y]=f[y]||new Map;m.forEach(g=>{if(x.has(g))return;x.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);x.set(g,r.Completed)})}return h}}e.ValueScope=a})(zy);(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=Kc,n=zy;var r=Kc;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 o=zy;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.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 s{optimizeNodes(){return this}optimizeNames(E,R){return this}}class i extends s{constructor(E,R,M){super(),this.varKind=E,this.name=R,this.rhs=M}render({es5:E,_n:R}){const M=E?n.varKinds.var:this.varKind,K=this.rhs===void 0?"":` = ${this.rhs}`;return`${M} ${this.name}${K};`+R}optimizeNames(E,R){if(E[this.name.str])return this.rhs&&(this.rhs=z(this.rhs,E,R)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends s{constructor(E,R,M){super(),this.lhs=E,this.rhs=R,this.sideEffects=M}render({_n:E}){return`${this.lhs} = ${this.rhs};`+E}optimizeNames(E,R){if(!(this.lhs instanceof t.Name&&!E[this.lhs.str]&&!this.sideEffects))return this.rhs=z(this.rhs,E,R),this}get names(){const E=this.lhs instanceof t.Name?{}:{...this.lhs.names};return U(E,this.rhs)}}class l extends a{constructor(E,R,M,K){super(E,M,K),this.op=R}render({_n:E}){return`${this.lhs} ${this.op}= ${this.rhs};`+E}}class u extends s{constructor(E){super(),this.label=E,this.names={}}render({_n:E}){return`${this.label}:`+E}}class d extends s{constructor(E){super(),this.label=E,this.names={}}render({_n:E}){return`break${this.label?` ${this.label}`:""};`+E}}class f extends s{constructor(E){super(),this.error=E}render({_n:E}){return`throw ${this.error};`+E}get names(){return this.error.names}}class p extends s{constructor(E){super(),this.code=E}render({_n:E}){return`${this.code};`+E}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(E,R){return this.code=z(this.code,E,R),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class h extends s{constructor(E=[]){super(),this.nodes=E}render(E){return this.nodes.reduce((R,M)=>R+M.render(E),"")}optimizeNodes(){const{nodes:E}=this;let R=E.length;for(;R--;){const M=E[R].optimizeNodes();Array.isArray(M)?E.splice(R,1,...M):M?E[R]=M:E.splice(R,1)}return E.length>0?this:void 0}optimizeNames(E,R){const{nodes:M}=this;let K=M.length;for(;K--;){const G=M[K];G.optimizeNames(E,R)||(D(E,G.names),M.splice(K,1))}return M.length>0?this:void 0}get names(){return this.nodes.reduce((E,R)=>A(E,R.names),{})}}class y extends h{render(E){return"{"+E._n+super.render(E)+"}"+E._n}}class m extends h{}class x extends y{}x.kind="else";class g extends y{constructor(E,R){super(R),this.condition=E}render(E){let R=`if(${this.condition})`+super.render(E);return this.else&&(R+="else "+this.else.render(E)),R}optimizeNodes(){super.optimizeNodes();const E=this.condition;if(E===!0)return this.nodes;let R=this.else;if(R){const M=R.optimizeNodes();R=this.else=Array.isArray(M)?new x(M):M}if(R)return E===!1?R instanceof g?R:R.nodes:this.nodes.length?this:new g(Z(E),R instanceof g?[R]:R.nodes);if(!(E===!1||!this.nodes.length))return this}optimizeNames(E,R){var M;if(this.else=(M=this.else)===null||M===void 0?void 0:M.optimizeNames(E,R),!!(super.optimizeNames(E,R)||this.else))return this.condition=z(this.condition,E,R),this}get names(){const E=super.names;return U(E,this.condition),this.else&&A(E,this.else.names),E}}g.kind="if";class v extends y{}v.kind="for";class w extends v{constructor(E){super(),this.iteration=E}render(E){return`for(${this.iteration})`+super.render(E)}optimizeNames(E,R){if(super.optimizeNames(E,R))return this.iteration=z(this.iteration,E,R),this}get names(){return A(super.names,this.iteration.names)}}class k extends v{constructor(E,R,M,K){super(),this.varKind=E,this.name=R,this.from=M,this.to=K}render(E){const R=E.es5?n.varKinds.var:this.varKind,{name:M,from:K,to:G}=this;return`for(${R} ${M}=${K}; ${M}<${G}; ${M}++)`+super.render(E)}get names(){const E=U(super.names,this.from);return U(E,this.to)}}class C extends v{constructor(E,R,M,K){super(),this.loop=E,this.varKind=R,this.name=M,this.iterable=K}render(E){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(E)}optimizeNames(E,R){if(super.optimizeNames(E,R))return this.iterable=z(this.iterable,E,R),this}get names(){return A(super.names,this.iterable.names)}}class j extends y{constructor(E,R,M){super(),this.name=E,this.args=R,this.async=M}render(E){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(E)}}j.kind="func";class _ extends h{render(E){return"return "+super.render(E)}}_.kind="return";class I extends y{render(E){let R="try"+super.render(E);return this.catch&&(R+=this.catch.render(E)),this.finally&&(R+=this.finally.render(E)),R}optimizeNodes(){var E,R;return super.optimizeNodes(),(E=this.catch)===null||E===void 0||E.optimizeNodes(),(R=this.finally)===null||R===void 0||R.optimizeNodes(),this}optimizeNames(E,R){var M,K;return super.optimizeNames(E,R),(M=this.catch)===null||M===void 0||M.optimizeNames(E,R),(K=this.finally)===null||K===void 0||K.optimizeNames(E,R),this}get names(){const E=super.names;return this.catch&&A(E,this.catch.names),this.finally&&A(E,this.finally.names),E}}class P extends y{constructor(E){super(),this.error=E}render(E){return`catch(${this.error})`+super.render(E)}}P.kind="catch";class $ extends y{render(E){return"finally"+super.render(E)}}$.kind="finally";class T{constructor(E,R={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...R,_n:R.lines?`
465
- `:""},this._extScope=E,this._scope=new n.Scope({parent:E}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(E){return this._scope.name(E)}scopeName(E){return this._extScope.name(E)}scopeValue(E,R){const M=this._extScope.value(E,R);return(this._values[M.prefix]||(this._values[M.prefix]=new Set)).add(M),M}getScopeValue(E,R){return this._extScope.getValue(E,R)}scopeRefs(E){return this._extScope.scopeRefs(E,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(E,R,M,K){const G=this._scope.toName(R);return M!==void 0&&K&&(this._constants[G.str]=M),this._leafNode(new i(E,G,M)),G}const(E,R,M){return this._def(n.varKinds.const,E,R,M)}let(E,R,M){return this._def(n.varKinds.let,E,R,M)}var(E,R,M){return this._def(n.varKinds.var,E,R,M)}assign(E,R,M){return this._leafNode(new a(E,R,M))}add(E,R){return this._leafNode(new l(E,e.operators.ADD,R))}code(E){return typeof E=="function"?E():E!==t.nil&&this._leafNode(new p(E)),this}object(...E){const R=["{"];for(const[M,K]of E)R.length>1&&R.push(","),R.push(M),(M!==K||this.opts.es5)&&(R.push(":"),(0,t.addCodeArg)(R,K));return R.push("}"),new t._Code(R)}if(E,R,M){if(this._blockNode(new g(E)),R&&M)this.code(R).else().code(M).endIf();else if(R)this.code(R).endIf();else if(M)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(E){return this._elseNode(new g(E))}else(){return this._elseNode(new x)}endIf(){return this._endBlockNode(g,x)}_for(E,R){return this._blockNode(E),R&&this.code(R).endFor(),this}for(E,R){return this._for(new w(E),R)}forRange(E,R,M,K,G=this.opts.es5?n.varKinds.var:n.varKinds.let){const le=this._scope.toName(E);return this._for(new k(G,le,R,M),()=>K(le))}forOf(E,R,M,K=n.varKinds.const){const G=this._scope.toName(E);if(this.opts.es5){const le=R instanceof t.Name?R:this.var("_arr",R);return this.forRange("_i",0,(0,t._)`${le}.length`,se=>{this.var(G,(0,t._)`${le}[${se}]`),M(G)})}return this._for(new C("of",K,G,R),()=>M(G))}forIn(E,R,M,K=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(E,(0,t._)`Object.keys(${R})`,M);const G=this._scope.toName(E);return this._for(new C("in",K,G,R),()=>M(G))}endFor(){return this._endBlockNode(v)}label(E){return this._leafNode(new u(E))}break(E){return this._leafNode(new d(E))}return(E){const R=new _;if(this._blockNode(R),this.code(E),R.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(_)}try(E,R,M){if(!R&&!M)throw new Error('CodeGen: "try" without "catch" and "finally"');const K=new I;if(this._blockNode(K),this.code(E),R){const G=this.name("e");this._currNode=K.catch=new P(G),R(G)}return M&&(this._currNode=K.finally=new $,this.code(M)),this._endBlockNode(P,$)}throw(E){return this._leafNode(new f(E))}block(E,R){return this._blockStarts.push(this._nodes.length),E&&this.code(E).endBlock(R),this}endBlock(E){const R=this._blockStarts.pop();if(R===void 0)throw new Error("CodeGen: not in self-balancing block");const M=this._nodes.length-R;if(M<0||E!==void 0&&M!==E)throw new Error(`CodeGen: wrong number of nodes: ${M} vs ${E} expected`);return this._nodes.length=R,this}func(E,R=t.nil,M,K){return this._blockNode(new j(E,R,M)),K&&this.code(K).endFunc(),this}endFunc(){return this._endBlockNode(j)}optimize(E=1){for(;E-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(E){return this._currNode.nodes.push(E),this}_blockNode(E){this._currNode.nodes.push(E),this._nodes.push(E)}_endBlockNode(E,R){const M=this._currNode;if(M instanceof E||R&&M instanceof R)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${R?`${E.kind}/${R.kind}`:E.kind}"`)}_elseNode(E){const R=this._currNode;if(!(R instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=R.else=E,this}get _root(){return this._nodes[0]}get _currNode(){const E=this._nodes;return E[E.length-1]}set _currNode(E){const R=this._nodes;R[R.length-1]=E}}e.CodeGen=T;function A(S,E){for(const R in E)S[R]=(S[R]||0)+(E[R]||0);return S}function U(S,E){return E instanceof t._CodeOrName?A(S,E.names):S}function z(S,E,R){if(S instanceof t.Name)return M(S);if(!K(S))return S;return new t._Code(S._items.reduce((G,le)=>(le instanceof t.Name&&(le=M(le)),le instanceof t._Code?G.push(...le._items):G.push(le),G),[]));function M(G){const le=R[G.str];return le===void 0||E[G.str]!==1?G:(delete E[G.str],le)}function K(G){return G instanceof t._Code&&G._items.some(le=>le instanceof t.Name&&E[le.str]===1&&R[le.str]!==void 0)}}function D(S,E){for(const R in E)S[R]=(S[R]||0)-(E[R]||0)}function Z(S){return typeof S=="boolean"||typeof S=="number"||S===null?!S:(0,t._)`!${V(S)}`}e.not=Z;const B=O(e.operators.AND);function q(...S){return S.reduce(B)}e.and=q;const H=O(e.operators.OR);function N(...S){return S.reduce(H)}e.or=N;function O(S){return(E,R)=>E===t.nil?R:R===t.nil?E:(0,t._)`${V(E)} ${S} ${V(R)}`}function V(S){return S instanceof t.Name?S:(0,t._)`(${S})`}})(Me);var ue={};Object.defineProperty(ue,"__esModule",{value:!0});ue.checkStrictMode=ue.getErrorPath=ue.Type=ue.useFunc=ue.setEvaluated=ue.evaluatedPropsToName=ue.mergeEvaluated=ue.eachItem=ue.unescapeJsonPointer=ue.escapeJsonPointer=ue.escapeFragment=ue.unescapeFragment=ue.schemaRefOrVal=ue.schemaHasRulesButRef=ue.schemaHasRules=ue.checkUnknownRules=ue.alwaysValidSchema=ue.toHash=void 0;const rt=Me,UQ=Kc;function qQ(e){const t={};for(const n of e)t[n]=!0;return t}ue.toHash=qQ;function VQ(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(x$(e,t),!w$(t,e.self.RULES.all))}ue.alwaysValidSchema=VQ;function x$(e,t=e.schema){const{opts:n,self:r}=e;if(!n.strictSchema||typeof t=="boolean")return;const o=r.RULES.keywords;for(const s in t)o[s]||_$(e,`unknown keyword: "${s}"`)}ue.checkUnknownRules=x$;function w$(e,t){if(typeof e=="boolean")return!e;for(const n in e)if(t[n])return!0;return!1}ue.schemaHasRules=w$;function HQ(e,t){if(typeof e=="boolean")return!e;for(const n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}ue.schemaHasRulesButRef=HQ;function BQ({topSchemaRef:e,schemaPath:t},n,r,o){if(!o){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return(0,rt._)`${n}`}return(0,rt._)`${e}${t}${(0,rt.getProperty)(r)}`}ue.schemaRefOrVal=BQ;function KQ(e){return b$(decodeURIComponent(e))}ue.unescapeFragment=KQ;function WQ(e){return encodeURIComponent(_x(e))}ue.escapeFragment=WQ;function _x(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}ue.escapeJsonPointer=_x;function b$(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}ue.unescapeJsonPointer=b$;function ZQ(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)}ue.eachItem=ZQ;function Z1({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(o,s,i,a)=>{const l=i===void 0?s:i instanceof rt.Name?(s instanceof rt.Name?e(o,s,i):t(o,s,i),i):s instanceof rt.Name?(t(o,i,s),s):n(s,i);return a===rt.Name&&!(l instanceof rt.Name)?r(o,l):l}}ue.mergeEvaluated={props:Z1({mergeNames:(e,t,n)=>e.if((0,rt._)`${n} !== true && ${t} !== undefined`,()=>{e.if((0,rt._)`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,(0,rt._)`${n} || {}`).code((0,rt._)`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if((0,rt._)`${n} !== true`,()=>{t===!0?e.assign(n,!0):(e.assign(n,(0,rt._)`${n} || {}`),Sx(e,n,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:k$}),items:Z1({mergeNames:(e,t,n)=>e.if((0,rt._)`${n} !== true && ${t} !== undefined`,()=>e.assign(n,(0,rt._)`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if((0,rt._)`${n} !== true`,()=>e.assign(n,t===!0?!0:(0,rt._)`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function k$(e,t){if(t===!0)return e.var("props",!0);const n=e.var("props",(0,rt._)`{}`);return t!==void 0&&Sx(e,n,t),n}ue.evaluatedPropsToName=k$;function Sx(e,t,n){Object.keys(n).forEach(r=>e.assign((0,rt._)`${t}${(0,rt.getProperty)(r)}`,!0))}ue.setEvaluated=Sx;const Q1={};function QQ(e,t){return e.scopeValue("func",{ref:t,code:Q1[t.code]||(Q1[t.code]=new UQ._Code(t.code))})}ue.useFunc=QQ;var Fy;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Fy||(ue.Type=Fy={}));function GQ(e,t,n){if(e instanceof rt.Name){const r=t===Fy.Num;return n?r?(0,rt._)`"[" + ${e} + "]"`:(0,rt._)`"['" + ${e} + "']"`:r?(0,rt._)`"/" + ${e}`:(0,rt._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,rt.getProperty)(e).toString():"/"+_x(e)}ue.getErrorPath=GQ;function _$(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw new Error(t);e.self.logger.warn(t)}}ue.checkStrictMode=_$;var ho={};Object.defineProperty(ho,"__esModule",{value:!0});const dn=Me,JQ={data:new dn.Name("data"),valCxt:new dn.Name("valCxt"),instancePath:new dn.Name("instancePath"),parentData:new dn.Name("parentData"),parentDataProperty:new dn.Name("parentDataProperty"),rootData:new dn.Name("rootData"),dynamicAnchors:new dn.Name("dynamicAnchors"),vErrors:new dn.Name("vErrors"),errors:new dn.Name("errors"),this:new dn.Name("this"),self:new dn.Name("self"),scope:new dn.Name("scope"),json:new dn.Name("json"),jsonPos:new dn.Name("jsonPos"),jsonLen:new dn.Name("jsonLen"),jsonPart:new dn.Name("jsonPart")};ho.default=JQ;(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=Me,n=ue,r=ho;e.keywordError={message:({keyword:x})=>(0,t.str)`must pass "${x}" keyword validation`},e.keyword$DataError={message:({keyword:x,schemaType:g})=>g?(0,t.str)`"${x}" keyword must be ${g} ($data)`:(0,t.str)`"${x}" keyword is invalid ($data)`};function o(x,g=e.keywordError,v,w){const{it:k}=x,{gen:C,compositeRule:j,allErrors:_}=k,I=f(x,g,v);w??(j||_)?l(C,I):u(k,(0,t._)`[${I}]`)}e.reportError=o;function s(x,g=e.keywordError,v){const{it:w}=x,{gen:k,compositeRule:C,allErrors:j}=w,_=f(x,g,v);l(k,_),C||j||u(w,r.default.vErrors)}e.reportExtraError=s;function i(x,g){x.assign(r.default.errors,g),x.if((0,t._)`${r.default.vErrors} !== null`,()=>x.if(g,()=>x.assign((0,t._)`${r.default.vErrors}.length`,g),()=>x.assign(r.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:x,keyword:g,schemaValue:v,data:w,errsCount:k,it:C}){if(k===void 0)throw new Error("ajv implementation error");const j=x.name("err");x.forRange("i",k,r.default.errors,_=>{x.const(j,(0,t._)`${r.default.vErrors}[${_}]`),x.if((0,t._)`${j}.instancePath === undefined`,()=>x.assign((0,t._)`${j}.instancePath`,(0,t.strConcat)(r.default.instancePath,C.errorPath))),x.assign((0,t._)`${j}.schemaPath`,(0,t.str)`${C.errSchemaPath}/${g}`),C.opts.verbose&&(x.assign((0,t._)`${j}.schema`,v),x.assign((0,t._)`${j}.data`,w))})}e.extendErrors=a;function l(x,g){const v=x.const("err",g);x.if((0,t._)`${r.default.vErrors} === null`,()=>x.assign(r.default.vErrors,(0,t._)`[${v}]`),(0,t._)`${r.default.vErrors}.push(${v})`),x.code((0,t._)`${r.default.errors}++`)}function u(x,g){const{gen:v,validateName:w,schemaEnv:k}=x;k.$async?v.throw((0,t._)`new ${x.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(x,g,v){const{createErrors:w}=x.it;return w===!1?(0,t._)`{}`:p(x,g,v)}function p(x,g,v={}){const{gen:w,it:k}=x,C=[h(k,v),y(x,v)];return m(x,g,C),w.object(...C)}function h({errorPath:x},{instancePath:g}){const v=g?(0,t.str)`${x}${(0,n.getErrorPath)(g,n.Type.Str)}`:x;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,v)]}function y({keyword:x,it:{errSchemaPath:g}},{schemaPath:v,parentSchema:w}){let k=w?g:(0,t.str)`${g}/${x}`;return v&&(k=(0,t.str)`${k}${(0,n.getErrorPath)(v,n.Type.Str)}`),[d.schemaPath,k]}function m(x,{params:g,message:v},w){const{keyword:k,data:C,schemaValue:j,it:_}=x,{opts:I,propertyName:P,topSchemaRef:$,schemaPath:T}=_;w.push([d.keyword,k],[d.params,typeof g=="function"?g(x):g||(0,t._)`{}`]),I.messages&&w.push([d.message,typeof v=="function"?v(x):v]),I.verbose&&w.push([d.schema,j],[d.parentSchema,(0,t._)`${$}${T}`],[r.default.data,C]),P&&w.push([d.propertyName,P])}})(ku);Object.defineProperty(il,"__esModule",{value:!0});il.boolOrEmptySchema=il.topBoolOrEmptySchema=void 0;const YQ=ku,XQ=Me,eG=ho,tG={message:"boolean schema is false"};function nG(e){const{gen:t,schema:n,validateName:r}=e;n===!1?S$(e,!1):typeof n=="object"&&n.$async===!0?t.return(eG.default.data):(t.assign((0,XQ._)`${r}.errors`,null),t.return(!0))}il.topBoolOrEmptySchema=nG;function rG(e,t){const{gen:n,schema:r}=e;r===!1?(n.var(t,!1),S$(e)):n.var(t,!0)}il.boolOrEmptySchema=rG;function S$(e,t){const{gen:n,data:r}=e,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,YQ.reportError)(o,tG,void 0,t)}var Ft={},Ii={};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.getRules=Ii.isJSONType=void 0;const oG=["string","number","integer","boolean","null","object","array"],sG=new Set(oG);function iG(e){return typeof e=="string"&&sG.has(e)}Ii.isJSONType=iG;function aG(){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:{}}}Ii.getRules=aG;var Po={};Object.defineProperty(Po,"__esModule",{value:!0});Po.shouldUseRule=Po.shouldUseGroup=Po.schemaHasRulesForType=void 0;function lG({schema:e,self:t},n){const r=t.RULES.types[n];return r&&r!==!0&&C$(e,r)}Po.schemaHasRulesForType=lG;function C$(e,t){return t.rules.some(n=>E$(e,n))}Po.shouldUseGroup=C$;function E$(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))}Po.shouldUseRule=E$;Object.defineProperty(Ft,"__esModule",{value:!0});Ft.reportTypeError=Ft.checkDataTypes=Ft.checkDataType=Ft.coerceAndCheckDataType=Ft.getJSONTypes=Ft.getSchemaTypes=Ft.DataType=void 0;const cG=Ii,uG=Po,dG=ku,Ae=Me,N$=ue;var Pa;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Pa||(Ft.DataType=Pa={}));function fG(e){const t=j$(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}Ft.getSchemaTypes=fG;function j$(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(cG.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ft.getJSONTypes=j$;function hG(e,t){const{gen:n,data:r,opts:o}=e,s=pG(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,uG.schemaHasRulesForType)(e,t[0]));if(i){const a=Cx(t,r,o.strictNumbers,Pa.Wrong);n.if(a,()=>{s.length?mG(e,t,s):Ex(e)})}return i}Ft.coerceAndCheckDataType=hG;const P$=new Set(["string","number","integer","boolean","null"]);function pG(e,t){return t?e.filter(n=>P$.has(n)||t==="array"&&n==="array"):[]}function mG(e,t,n){const{gen:r,data:o,opts:s}=e,i=r.let("dataType",(0,Ae._)`typeof ${o}`),a=r.let("coerced",(0,Ae._)`undefined`);s.coerceTypes==="array"&&r.if((0,Ae._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>r.assign(o,(0,Ae._)`${o}[0]`).assign(i,(0,Ae._)`typeof ${o}`).if(Cx(t,o,s.strictNumbers),()=>r.assign(a,o))),r.if((0,Ae._)`${a} !== undefined`);for(const u of n)(P$.has(u)||u==="array"&&s.coerceTypes==="array")&&l(u);r.else(),Ex(e),r.endIf(),r.if((0,Ae._)`${a} !== undefined`,()=>{r.assign(o,a),gG(e,a)});function l(u){switch(u){case"string":r.elseIf((0,Ae._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,Ae._)`"" + ${o}`).elseIf((0,Ae._)`${o} === null`).assign(a,(0,Ae._)`""`);return;case"number":r.elseIf((0,Ae._)`${i} == "boolean" || ${o} === null
466
- || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Ae._)`+${o}`);return;case"integer":r.elseIf((0,Ae._)`${i} === "boolean" || ${o} === null
467
- || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Ae._)`+${o}`);return;case"boolean":r.elseIf((0,Ae._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,Ae._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":r.elseIf((0,Ae._)`${o} === "" || ${o} === 0 || ${o} === false`),r.assign(a,null);return;case"array":r.elseIf((0,Ae._)`${i} === "string" || ${i} === "number"
468
- || ${i} === "boolean" || ${o} === null`).assign(a,(0,Ae._)`[${o}]`)}}}function gG({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,Ae._)`${t} !== undefined`,()=>e.assign((0,Ae._)`${t}[${n}]`,r))}function Uy(e,t,n,r=Pa.Correct){const o=r===Pa.Correct?Ae.operators.EQ:Ae.operators.NEQ;let s;switch(e){case"null":return(0,Ae._)`${t} ${o} null`;case"array":s=(0,Ae._)`Array.isArray(${t})`;break;case"object":s=(0,Ae._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,Ae._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,Ae._)`typeof ${t} ${o} ${e}`}return r===Pa.Correct?s:(0,Ae.not)(s);function i(a=Ae.nil){return(0,Ae.and)((0,Ae._)`typeof ${t} == "number"`,a,n?(0,Ae._)`isFinite(${t})`:Ae.nil)}}Ft.checkDataType=Uy;function Cx(e,t,n,r){if(e.length===1)return Uy(e[0],t,n,r);let o;const s=(0,N$.toHash)(e);if(s.array&&s.object){const i=(0,Ae._)`typeof ${t} != "object"`;o=s.null?i:(0,Ae._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=Ae.nil;s.number&&delete s.integer;for(const i in s)o=(0,Ae.and)(o,Uy(i,t,n,r));return o}Ft.checkDataTypes=Cx;const yG={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Ae._)`{type: ${e}}`:(0,Ae._)`{type: ${t}}`};function Ex(e){const t=vG(e);(0,dG.reportError)(t,yG)}Ft.reportTypeError=Ex;function vG(e){const{gen:t,data:n,schema:r}=e,o=(0,N$.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:o,schemaValue:o,parentSchema:r,params:{},it:e}}var tp={};Object.defineProperty(tp,"__esModule",{value:!0});tp.assignDefaults=void 0;const Zi=Me,xG=ue;function wG(e,t){const{properties:n,items:r}=e.schema;if(t==="object"&&n)for(const o in n)G1(e,o,n[o].default);else t==="array"&&Array.isArray(r)&&r.forEach((o,s)=>G1(e,s,o.default))}tp.assignDefaults=wG;function G1(e,t,n){const{gen:r,compositeRule:o,data:s,opts:i}=e;if(n===void 0)return;const a=(0,Zi._)`${s}${(0,Zi.getProperty)(t)}`;if(o){(0,xG.checkStrictMode)(e,`default is ignored for: ${a}`);return}let l=(0,Zi._)`${a} === undefined`;i.useDefaults==="empty"&&(l=(0,Zi._)`${l} || ${a} === null || ${a} === ""`),r.if(l,(0,Zi._)`${a} = ${(0,Zi.stringify)(n)}`)}var no={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.validateUnion=Le.validateArray=Le.usePattern=Le.callValidateCode=Le.schemaProperties=Le.allSchemaProperties=Le.noPropertyInData=Le.propertyInData=Le.isOwnProperty=Le.hasPropFunc=Le.reportMissingProp=Le.checkMissingProp=Le.checkReportMissingProp=void 0;const ft=Me,Nx=ue,Zo=ho,bG=ue;function kG(e,t){const{gen:n,data:r,it:o}=e;n.if(Px(n,r,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ft._)`${t}`},!0),e.error()})}Le.checkReportMissingProp=kG;function _G({gen:e,data:t,it:{opts:n}},r,o){return(0,ft.or)(...r.map(s=>(0,ft.and)(Px(e,t,s,n.ownProperties),(0,ft._)`${o} = ${s}`)))}Le.checkMissingProp=_G;function SG(e,t){e.setParams({missingProperty:t},!0),e.error()}Le.reportMissingProp=SG;function T$(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ft._)`Object.prototype.hasOwnProperty`})}Le.hasPropFunc=T$;function jx(e,t,n){return(0,ft._)`${T$(e)}.call(${t}, ${n})`}Le.isOwnProperty=jx;function CG(e,t,n,r){const o=(0,ft._)`${t}${(0,ft.getProperty)(n)} !== undefined`;return r?(0,ft._)`${o} && ${jx(e,t,n)}`:o}Le.propertyInData=CG;function Px(e,t,n,r){const o=(0,ft._)`${t}${(0,ft.getProperty)(n)} === undefined`;return r?(0,ft.or)(o,(0,ft.not)(jx(e,t,n))):o}Le.noPropertyInData=Px;function $$(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}Le.allSchemaProperties=$$;function EG(e,t){return $$(t).filter(n=>!(0,Nx.alwaysValidSchema)(e,t[n]))}Le.schemaProperties=EG;function NG({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:s},it:i},a,l,u){const d=u?(0,ft._)`${e}, ${t}, ${r}${o}`:t,f=[[Zo.default.instancePath,(0,ft.strConcat)(Zo.default.instancePath,s)],[Zo.default.parentData,i.parentData],[Zo.default.parentDataProperty,i.parentDataProperty],[Zo.default.rootData,Zo.default.rootData]];i.opts.dynamicRef&&f.push([Zo.default.dynamicAnchors,Zo.default.dynamicAnchors]);const p=(0,ft._)`${d}, ${n.object(...f)}`;return l!==ft.nil?(0,ft._)`${a}.call(${l}, ${p})`:(0,ft._)`${a}(${p})`}Le.callValidateCode=NG;const jG=(0,ft._)`new RegExp`;function PG({gen:e,it:{opts:t}},n){const r=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(n,r);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ft._)`${o.code==="new RegExp"?jG:(0,bG.useFunc)(e,o)}(${n}, ${r})`})}Le.usePattern=PG;function TG(e){const{gen:t,data:n,keyword:r,it:o}=e,s=t.name("valid");if(o.allErrors){const a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){const l=t.const("len",(0,ft._)`${n}.length`);t.forRange("i",0,l,u=>{e.subschema({keyword:r,dataProp:u,dataPropType:Nx.Type.Num},s),t.if((0,ft.not)(s),a)})}}Le.validateArray=TG;function $G(e){const{gen:t,schema:n,keyword:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(l=>(0,Nx.alwaysValidSchema)(o,l))&&!o.opts.unevaluated)return;const i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((l,u)=>{const d=e.subschema({keyword:r,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,ft._)`${i} || ${a}`),e.mergeValidEvaluated(d,a)||t.if((0,ft.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Le.validateUnion=$G;Object.defineProperty(no,"__esModule",{value:!0});no.validateKeywordUsage=no.validSchemaType=no.funcKeywordCode=no.macroKeywordCode=void 0;const bn=Me,ti=ho,RG=Le,IG=ku;function AG(e,t){const{gen:n,keyword:r,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),l=R$(n,r,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);const u=n.name("valid");e.subschema({schema:a,schemaPath:bn.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}no.macroKeywordCode=AG;function OG(e,t){var n;const{gen:r,keyword:o,schema:s,parentSchema:i,$data:a,it:l}=e;DG(l,t);const u=!a&&t.compile?t.compile.call(l.self,s,i,l):t.validate,d=R$(r,o,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&&J1(e),x(()=>e.error());else{const g=t.async?h():y();t.modifying&&J1(e),x(()=>MG(e,g))}}function h(){const g=r.let("ruleErrs",null);return r.try(()=>m((0,bn._)`await `),v=>r.assign(f,!1).if((0,bn._)`${v} instanceof ${l.ValidationError}`,()=>r.assign(g,(0,bn._)`${v}.errors`),()=>r.throw(v))),g}function y(){const g=(0,bn._)`${d}.errors`;return r.assign(g,null),m(bn.nil),g}function m(g=t.async?(0,bn._)`await `:bn.nil){const v=l.opts.passContext?ti.default.this:ti.default.self,w=!("compile"in t&&!a||t.schema===!1);r.assign(f,(0,bn._)`${g}${(0,RG.callValidateCode)(e,d,v,w)}`,t.modifying)}function x(g){var v;r.if((0,bn.not)((v=t.valid)!==null&&v!==void 0?v:f),g)}}no.funcKeywordCode=OG;function J1(e){const{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,(0,bn._)`${r.parentData}[${r.parentDataProperty}]`))}function MG(e,t){const{gen:n}=e;n.if((0,bn._)`Array.isArray(${t})`,()=>{n.assign(ti.default.vErrors,(0,bn._)`${ti.default.vErrors} === null ? ${t} : ${ti.default.vErrors}.concat(${t})`).assign(ti.default.errors,(0,bn._)`${ti.default.vErrors}.length`),(0,IG.extendErrors)(e)},()=>e.error())}function DG({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function R$(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,bn.stringify)(n)})}function LG(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")}no.validSchemaType=LG;function zG({schema:e,opts:t,self:n,errSchemaPath:r},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");const i=o.dependencies;if(i!=null&&i.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){const l=`keyword "${s}" value is invalid at path "${r}": `+n.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(l);else throw new Error(l)}}no.validateKeywordUsage=zG;var js={};Object.defineProperty(js,"__esModule",{value:!0});js.extendSubschemaMode=js.extendSubschemaData=js.getSubschema=void 0;const eo=Me,I$=ue;function FG(e,{keyword:t,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const a=e.schema[t];return n===void 0?{schema:a,schemaPath:(0,eo._)`${e.schemaPath}${(0,eo.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:(0,eo._)`${e.schemaPath}${(0,eo.getProperty)(t)}${(0,eo.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,I$.escapeFragment)(n)}`}}if(r!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}js.getSubschema=FG;function UG(e,t,{dataProp:n,dataPropType:r,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:a}=t;if(n!==void 0){const{errorPath:u,dataPathArr:d,opts:f}=t,p=a.let("data",(0,eo._)`${t.data}${(0,eo.getProperty)(n)}`,!0);l(p),e.errorPath=(0,eo.str)`${u}${(0,I$.getErrorPath)(n,r,f.jsPropertySyntax)}`,e.parentDataProperty=(0,eo._)`${n}`,e.dataPathArr=[...d,e.parentDataProperty]}if(o!==void 0){const u=o instanceof eo.Name?o:a.let("data",o,!0);l(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);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]}}js.extendSubschemaData=UG;function qG(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:o,allErrors:s}){r!==void 0&&(e.compositeRule=r),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=n}js.extendSubschemaMode=qG;var tn={},A$=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,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))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(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n},O$={exports:{}},ys=O$.exports=function(e,t,n){typeof t=="function"&&(n=t,t={}),n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};qd(t,r,o,e,"",e)};ys.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ys.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ys.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ys.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 qd(e,t,n,r,o,s,i,a,l,u){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,o,s,i,a,l,u);for(var d in r){var f=r[d];if(Array.isArray(f)){if(d in ys.arrayKeywords)for(var p=0;p<f.length;p++)qd(e,t,n,f[p],o+"/"+d+"/"+p,s,o,d,r,p)}else if(d in ys.propsKeywords){if(f&&typeof f=="object")for(var h in f)qd(e,t,n,f[h],o+"/"+d+"/"+VG(h),s,o,d,r,h)}else(d in ys.keywords||e.allKeys&&!(d in ys.skipKeywords))&&qd(e,t,n,f,o+"/"+d,s,o,d,r)}n(r,o,s,i,a,l,u)}}function VG(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var HG=O$.exports;Object.defineProperty(tn,"__esModule",{value:!0});tn.getSchemaRefs=tn.resolveUrl=tn.normalizeId=tn._getFullPath=tn.getFullPath=tn.inlineRef=void 0;const BG=ue,KG=A$,WG=HG,ZG=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function QG(e,t=!0){return typeof e=="boolean"?!0:t===!0?!qy(e):t?M$(e)<=t:!1}tn.inlineRef=QG;const GG=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function qy(e){for(const t in e){if(GG.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(qy)||typeof n=="object"&&qy(n))return!0}return!1}function M$(e){let t=0;for(const n in e){if(n==="$ref")return 1/0;if(t++,!ZG.has(n)&&(typeof e[n]=="object"&&(0,BG.eachItem)(e[n],r=>t+=M$(r)),t===1/0))return 1/0}return t}function D$(e,t="",n){n!==!1&&(t=Ta(t));const r=e.parse(t);return L$(e,r)}tn.getFullPath=D$;function L$(e,t){return e.serialize(t).split("#")[0]+"#"}tn._getFullPath=L$;const JG=/#\/?$/;function Ta(e){return e?e.replace(JG,""):""}tn.normalizeId=Ta;function YG(e,t,n){return n=Ta(n),e.resolve(t,n)}tn.resolveUrl=YG;const XG=/^[a-z_][-a-z0-9._]*$/i;function eJ(e,t){if(typeof e=="boolean")return{};const{schemaId:n,uriResolver:r}=this.opts,o=Ta(e[n]||t),s={"":o},i=D$(r,o,!1),a={},l=new Set;return WG(e,{allKeys:!0},(f,p,h,y)=>{if(y===void 0)return;const m=i+p;let x=s[y];typeof f[n]=="string"&&(x=g.call(this,f[n])),v.call(this,f.$anchor),v.call(this,f.$dynamicAnchor),s[p]=x;function g(w){const k=this.opts.uriResolver.resolve;if(w=Ta(x?k(x,w):w),l.has(w))throw d(w);l.add(w);let C=this.refs[w];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?u(f,C.schema,w):w!==Ta(m)&&(w[0]==="#"?(u(f,a[w],w),a[w]=f):this.refs[w]=m),w}function v(w){if(typeof w=="string"){if(!XG.test(w))throw new Error(`invalid anchor "${w}"`);g.call(this,`#${w}`)}}}),a;function u(f,p,h){if(p!==void 0&&!KG(f,p))throw d(h)}function d(f){return new Error(`reference "${f}" resolves to more than one schema`)}}tn.getSchemaRefs=eJ;Object.defineProperty(Or,"__esModule",{value:!0});Or.getData=Or.KeywordCxt=Or.validateFunctionCode=void 0;const z$=il,Y1=Ft,Tx=Po,Xf=Ft,tJ=tp,mc=no,km=js,ge=Me,Ee=ho,nJ=tn,To=ue,Ll=ku;function rJ(e){if(q$(e)&&(V$(e),U$(e))){iJ(e);return}F$(e,()=>(0,z$.topBoolOrEmptySchema)(e))}Or.validateFunctionCode=rJ;function F$({gen:e,validateName:t,schema:n,schemaEnv:r,opts:o},s){o.code.es5?e.func(t,(0,ge._)`${Ee.default.data}, ${Ee.default.valCxt}`,r.$async,()=>{e.code((0,ge._)`"use strict"; ${X1(n,o)}`),sJ(e,o),e.code(s)}):e.func(t,(0,ge._)`${Ee.default.data}, ${oJ(o)}`,r.$async,()=>e.code(X1(n,o)).code(s))}function oJ(e){return(0,ge._)`{${Ee.default.instancePath}="", ${Ee.default.parentData}, ${Ee.default.parentDataProperty}, ${Ee.default.rootData}=${Ee.default.data}${e.dynamicRef?(0,ge._)`, ${Ee.default.dynamicAnchors}={}`:ge.nil}}={}`}function sJ(e,t){e.if(Ee.default.valCxt,()=>{e.var(Ee.default.instancePath,(0,ge._)`${Ee.default.valCxt}.${Ee.default.instancePath}`),e.var(Ee.default.parentData,(0,ge._)`${Ee.default.valCxt}.${Ee.default.parentData}`),e.var(Ee.default.parentDataProperty,(0,ge._)`${Ee.default.valCxt}.${Ee.default.parentDataProperty}`),e.var(Ee.default.rootData,(0,ge._)`${Ee.default.valCxt}.${Ee.default.rootData}`),t.dynamicRef&&e.var(Ee.default.dynamicAnchors,(0,ge._)`${Ee.default.valCxt}.${Ee.default.dynamicAnchors}`)},()=>{e.var(Ee.default.instancePath,(0,ge._)`""`),e.var(Ee.default.parentData,(0,ge._)`undefined`),e.var(Ee.default.parentDataProperty,(0,ge._)`undefined`),e.var(Ee.default.rootData,Ee.default.data),t.dynamicRef&&e.var(Ee.default.dynamicAnchors,(0,ge._)`{}`)})}function iJ(e){const{schema:t,opts:n,gen:r}=e;F$(e,()=>{n.$comment&&t.$comment&&B$(e),dJ(e),r.let(Ee.default.vErrors,null),r.let(Ee.default.errors,0),n.unevaluated&&aJ(e),H$(e),pJ(e)})}function aJ(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 X1(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 lJ(e,t){if(q$(e)&&(V$(e),U$(e))){cJ(e,t);return}(0,z$.boolOrEmptySchema)(e,t)}function U$({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 q$(e){return typeof e.schema!="boolean"}function cJ(e,t){const{schema:n,gen:r,opts:o}=e;o.$comment&&n.$comment&&B$(e),fJ(e),hJ(e);const s=r.const("_errs",Ee.default.errors);H$(e,s),r.var(t,(0,ge._)`${s} === ${Ee.default.errors}`)}function V$(e){(0,To.checkUnknownRules)(e),uJ(e)}function H$(e,t){if(e.opts.jtd)return e_(e,[],!1,t);const n=(0,Y1.getSchemaTypes)(e.schema),r=(0,Y1.coerceAndCheckDataType)(e,n);e_(e,n,!r,t)}function uJ(e){const{schema:t,errSchemaPath:n,opts:r,self:o}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,To.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function dJ(e){const{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,To.checkStrictMode)(e,"default is ignored in the schema root")}function fJ(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,nJ.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function hJ(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function B$({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:o}){const s=n.$comment;if(o.$comment===!0)e.code((0,ge._)`${Ee.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){const i=(0,ge.str)`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,ge._)`${Ee.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function pJ(e){const{gen:t,schemaEnv:n,validateName:r,ValidationError:o,opts:s}=e;n.$async?t.if((0,ge._)`${Ee.default.errors} === 0`,()=>t.return(Ee.default.data),()=>t.throw((0,ge._)`new ${o}(${Ee.default.vErrors})`)):(t.assign((0,ge._)`${r}.errors`,Ee.default.vErrors),s.unevaluated&&mJ(e),t.return((0,ge._)`${Ee.default.errors} === 0`))}function mJ({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 e_(e,t,n,r){const{gen:o,schema:s,data:i,allErrors:a,opts:l,self:u}=e,{RULES:d}=u;if(s.$ref&&(l.ignoreKeywordsWithRef||!(0,To.schemaHasRulesButRef)(s,d))){o.block(()=>Z$(e,"$ref",d.all.$ref.definition));return}l.jtd||gJ(e,t),o.block(()=>{for(const p of d.rules)f(p);f(d.post)});function f(p){(0,Tx.shouldUseGroup)(s,p)&&(p.type?(o.if((0,Xf.checkDataType)(p.type,i,l.strictNumbers)),t_(e,p),t.length===1&&t[0]===p.type&&n&&(o.else(),(0,Xf.reportTypeError)(e)),o.endIf()):t_(e,p),a||o.if((0,ge._)`${Ee.default.errors} === ${r||0}`))}}function t_(e,t){const{gen:n,schema:r,opts:{useDefaults:o}}=e;o&&(0,tJ.assignDefaults)(e,t.type),n.block(()=>{for(const s of t.rules)(0,Tx.shouldUseRule)(r,s)&&Z$(e,s.keyword,s.definition,t.type)})}function gJ(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(yJ(e,t),e.opts.allowUnionTypes||vJ(e,t),xJ(e,e.dataTypes))}function yJ(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(n=>{K$(e.dataTypes,n)||$x(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),bJ(e,t)}}function vJ(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&$x(e,"use allowUnionTypes to allow union type keyword")}function xJ(e,t){const n=e.self.RULES.all;for(const r in n){const o=n[r];if(typeof o=="object"&&(0,Tx.shouldUseRule)(e.schema,o)){const{type:s}=o.definition;s.length&&!s.some(i=>wJ(t,i))&&$x(e,`missing type "${s.join(",")}" for keyword "${r}"`)}}}function wJ(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function K$(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function bJ(e,t){const n=[];for(const r of e.dataTypes)K$(t,r)?n.push(r):t.includes("integer")&&r==="number"&&n.push("integer");e.dataTypes=n}function $x(e,t){const n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,To.checkStrictMode)(e,t,e.opts.strictTypes)}class W${constructor(t,n,r){if((0,mc.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,To.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",Q$(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,mc.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",Ee.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?Ll.reportExtraError:Ll.reportError)(this,this.def.error,n)}$dataError(){(0,Ll.reportError)(this,this.def.$dataError||Ll.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ll.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:o,schemaType:s,def:i}=this;r.if((0,ge.or)((0,ge._)`${o} === undefined`,n)),t!==ge.nil&&r.assign(t,!0),(s.length||i.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:o,it:s}=this;return(0,ge.or)(i(),a());function i(){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,Xf.checkDataTypes)(l,n,s.opts.strictNumbers,Xf.DataType.Wrong)}`}return ge.nil}function a(){if(o.validateSchema){const l=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,ge._)`!${l}(${n})`}return ge.nil}}subschema(t,n){const r=(0,km.getSubschema)(this.it,t);(0,km.extendSubschemaData)(r,this.it,t),(0,km.extendSubschemaMode)(r,t);const o={...this.it,...r,items:void 0,props:void 0};return lJ(o,n),o}mergeEvaluated(t,n){const{it:r,gen:o}=this;r.opts.unevaluated&&(r.props!==!0&&t.props!==void 0&&(r.props=To.mergeEvaluated.props(o,t.props,r.props,n)),r.items!==!0&&t.items!==void 0&&(r.items=To.mergeEvaluated.items(o,t.items,r.items,n)))}mergeValidEvaluated(t,n){const{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(n,()=>this.mergeEvaluated(t,ge.Name)),!0}}Or.KeywordCxt=W$;function Z$(e,t,n,r){const o=new W$(e,n,t);"code"in n?n.code(o,r):o.$data&&n.validate?(0,mc.funcKeywordCode)(o,n):"macro"in n?(0,mc.macroKeywordCode)(o,n):(n.compile||n.validate)&&(0,mc.funcKeywordCode)(o,n)}const kJ=/^\/(?:[^~]|~0|~1)*$/,_J=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Q$(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let o,s;if(e==="")return Ee.default.rootData;if(e[0]==="/"){if(!kJ.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=Ee.default.rootData}else{const u=_J.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);const d=+u[1];if(o=u[2],o==="#"){if(d>=t)throw new Error(l("property/index",d));return r[t-d]}if(d>t)throw new Error(l("data",d));if(s=n[t-d],!o)return s}let i=s;const a=o.split("/");for(const u of a)u&&(s=(0,ge._)`${s}${(0,ge.getProperty)((0,To.unescapeJsonPointer)(u))}`,i=(0,ge._)`${i} && ${s}`);return i;function l(u,d){return`Cannot access ${u} ${d} levels up, current level is ${t}`}}Or.getData=Q$;var _u={};Object.defineProperty(_u,"__esModule",{value:!0});class SJ extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}_u.default=SJ;var kl={};Object.defineProperty(kl,"__esModule",{value:!0});const _m=tn;class CJ extends Error{constructor(t,n,r,o){super(o||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,_m.resolveUrl)(t,n,r),this.missingSchema=(0,_m.normalizeId)((0,_m.getFullPath)(t,this.missingRef))}}kl.default=CJ;var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.resolveSchema=Mn.getCompilingSchema=Mn.resolveRef=Mn.compileSchema=Mn.SchemaEnv=void 0;const xr=Me,EJ=_u,Ks=ho,Tr=tn,n_=ue,NJ=Or;class np{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,Tr.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={}}}Mn.SchemaEnv=np;function Rx(e){const t=G$.call(this,e);if(t)return t;const n=(0,Tr.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:r,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new xr.CodeGen(this.scope,{es5:r,lines:o,ownProperties:s});let a;e.$async&&(a=i.scopeValue("Error",{ref:EJ.default,code:(0,xr._)`require("ajv/dist/runtime/validation_error").default`}));const l=i.scopeName("validate");e.validateName=l;const u={gen:i,allErrors:this.opts.allErrors,data:Ks.default.data,parentData:Ks.default.parentData,parentDataProperty:Ks.default.parentDataProperty,dataNames:[Ks.default.data],dataPathArr:[xr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,xr.stringify)(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:xr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,xr._)`""`,opts:this.opts,self:this};let d;try{this._compilations.add(e),(0,NJ.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);const f=i.toString();d=`${i.scopeRefs(Ks.default.scope)}return ${f}`,this.opts.code.process&&(d=this.opts.code.process(d,e));const h=new Function(`${Ks.default.self}`,`${Ks.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:i._values}),this.opts.unevaluated){const{props:y,items:m}=u;h.evaluated={props:y instanceof xr.Name?void 0:y,items:m instanceof xr.Name?void 0:m,dynamicProps:y instanceof xr.Name,dynamicItems:m instanceof xr.Name},h.source&&(h.source.evaluated=(0,xr.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)}}Mn.compileSchema=Rx;function jJ(e,t,n){var r;n=(0,Tr.resolveUrl)(this.opts.uriResolver,t,n);const o=e.refs[n];if(o)return o;let s=$J.call(this,e,n);if(s===void 0){const i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;i&&(s=new np({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[n]=PJ.call(this,s)}Mn.resolveRef=jJ;function PJ(e){return(0,Tr.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Rx.call(this,e)}function G$(e){for(const t of this._compilations)if(TJ(t,e))return t}Mn.getCompilingSchema=G$;function TJ(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function $J(e,t){let n;for(;typeof(n=this.refs[t])=="string";)t=n;return n||this.schemas[t]||rp.call(this,e,t)}function rp(e,t){const n=this.opts.uriResolver.parse(t),r=(0,Tr._getFullPath)(this.opts.uriResolver,n);let o=(0,Tr.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===o)return Sm.call(this,n,e);const s=(0,Tr.normalizeId)(r),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){const a=rp.call(this,e,i);return typeof(a==null?void 0:a.schema)!="object"?void 0:Sm.call(this,n,a)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||Rx.call(this,i),s===(0,Tr.normalizeId)(t)){const{schema:a}=i,{schemaId:l}=this.opts,u=a[l];return u&&(o=(0,Tr.resolveUrl)(this.opts.uriResolver,o,u)),new np({schema:a,schemaId:l,root:e,baseId:o})}return Sm.call(this,n,i)}}Mn.resolveSchema=rp;const RJ=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Sm(e,{baseId:t,schema:n,root:r}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(const a of e.fragment.slice(1).split("/")){if(typeof n=="boolean")return;const l=n[(0,n_.unescapeFragment)(a)];if(l===void 0)return;n=l;const u=typeof n=="object"&&n[this.opts.schemaId];!RJ.has(a)&&u&&(t=(0,Tr.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof n!="boolean"&&n.$ref&&!(0,n_.schemaHasRulesButRef)(n,this.RULES)){const a=(0,Tr.resolveUrl)(this.opts.uriResolver,t,n.$ref);s=rp.call(this,r,a)}const{schemaId:i}=this.opts;if(s=s||new np({schema:n,schemaId:i,root:r,baseId:t}),s.schema!==s.root.schema)return s}const IJ="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",AJ="Meta-schema for $data reference (JSON AnySchema extension proposal)",OJ="object",MJ=["$data"],DJ={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},LJ=!1,zJ={$id:IJ,description:AJ,type:OJ,required:MJ,properties:DJ,additionalProperties:LJ};var Ix={},op={exports:{}};const FJ={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};var UJ={HEX:FJ};const{HEX:qJ}=UJ,VJ=/^(?:(?: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;function J$(e){if(X$(e,".")<3)return{host:e,isIPV4:!1};const t=e.match(VJ)||[],[n]=t;return n?{host:BJ(n,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function r_(e,t=!1){let n="",r=!0;for(const o of e){if(qJ[o]===void 0)return;o!=="0"&&r===!0&&(r=!1),r||(n+=o)}return t&&n.length===0&&(n="0"),n}function HJ(e){let t=0;const n={error:!1,address:"",zone:""},r=[],o=[];let s=!1,i=!1,a=!1;function l(){if(o.length){if(s===!1){const u=r_(o);if(u!==void 0)r.push(u);else return n.error=!0,!1}o.length=0}return!0}for(let u=0;u<e.length;u++){const d=e[u];if(!(d==="["||d==="]"))if(d===":"){if(i===!0&&(a=!0),!l())break;if(t++,r.push(":"),t>7){n.error=!0;break}u-1>=0&&e[u-1]===":"&&(i=!0);continue}else if(d==="%"){if(!l())break;s=!0}else{o.push(d);continue}}return o.length&&(s?n.zone=o.join(""):a?r.push(o.join("")):r.push(r_(o))),n.address=r.join(""),n}function Y$(e){if(X$(e,":")<2)return{host:e,isIPV6:!1};const t=HJ(e);if(t.error)return{host:e,isIPV6:!1};{let n=t.address,r=t.address;return t.zone&&(n+="%"+t.zone,r+="%25"+t.zone),{host:n,escapedHost:r,isIPV6:!0}}}function BJ(e,t){let n="",r=!0;const o=e.length;for(let s=0;s<o;s++){const i=e[s];i==="0"&&r?(s+1<=o&&e[s+1]===t||s+1===o)&&(n+=i,r=!1):(i===t?r=!0:r=!1,n+=i)}return n}function X$(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}const o_=/^\.\.?\//u,s_=/^\/\.(?:\/|$)/u,i_=/^\/\.\.(?:\/|$)/u,KJ=/^\/?(?:.|\n)*?(?=\/|$)/u;function WJ(e){const t=[];for(;e.length;)if(e.match(o_))e=e.replace(o_,"");else if(e.match(s_))e=e.replace(s_,"/");else if(e.match(i_))e=e.replace(i_,"/"),t.pop();else if(e==="."||e==="..")e="";else{const n=e.match(KJ);if(n){const r=n[0];e=e.slice(r.length),t.push(r)}else throw new Error("Unexpected dot segment condition")}return t.join("")}function ZJ(e,t){const n=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=n(e.scheme)),e.userinfo!==void 0&&(e.userinfo=n(e.userinfo)),e.host!==void 0&&(e.host=n(e.host)),e.path!==void 0&&(e.path=n(e.path)),e.query!==void 0&&(e.query=n(e.query)),e.fragment!==void 0&&(e.fragment=n(e.fragment)),e}function QJ(e){const t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let n=unescape(e.host);const r=J$(n);if(r.isIPV4)n=r.host;else{const o=Y$(r.host);o.isIPV6===!0?n=`[${o.escapedHost}]`:n=e.host}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 GJ={recomposeAuthority:QJ,normalizeComponentEncoding:ZJ,removeDotSegments:WJ,normalizeIPv4:J$,normalizeIPv6:Y$};const JJ=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,YJ=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function eR(e){return typeof e.secure=="boolean"?e.secure:String(e.scheme).toLowerCase()==="wss"}function tR(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function nR(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 XJ(e){return e.secure=eR(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function eY(e){if((e.port===(eR(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,n]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function tY(e,t){if(!e.path)return e.error="URN can not be parsed",e;const n=e.path.match(YJ);if(n){const r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];const o=`${r}:${t.nid||e.nid}`,s=Ax[o];e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function nY(e,t){const n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),o=`${n}:${t.nid||r}`,s=Ax[o];s&&(e=s.serialize(e,t));const i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function rY(e,t){const n=e;return n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!JJ.test(n.uuid))&&(n.error=n.error||"UUID is not valid."),n}function oY(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t}const rR={scheme:"http",domainHost:!0,parse:tR,serialize:nR},sY={scheme:"https",domainHost:rR.domainHost,parse:tR,serialize:nR},Vd={scheme:"ws",domainHost:!0,parse:XJ,serialize:eY},iY={scheme:"wss",domainHost:Vd.domainHost,parse:Vd.parse,serialize:Vd.serialize},aY={scheme:"urn",parse:tY,serialize:nY,skipNormalize:!0},lY={scheme:"urn:uuid",parse:rY,serialize:oY,skipNormalize:!0},Ax={http:rR,https:sY,ws:Vd,wss:iY,urn:aY,"urn:uuid":lY};var cY=Ax;const{normalizeIPv6:uY,normalizeIPv4:dY,removeDotSegments:Gl,recomposeAuthority:fY,normalizeComponentEncoding:cd}=GJ,Ox=cY;function hY(e,t){return typeof e=="string"?e=ro(Lo(e,t),t):typeof e=="object"&&(e=Lo(ro(e,t),t)),e}function pY(e,t,n){const r=Object.assign({scheme:"null"},n),o=oR(Lo(e,r),Lo(t,r),r,!0);return ro(o,{...r,skipEscape:!0})}function oR(e,t,n,r){const o={};return r||(e=Lo(ro(e,n),n),t=Lo(ro(t,n),n)),n=n||{},!n.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Gl(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Gl(t.path||""),o.query=t.query):(t.path?(t.path.charAt(0)==="/"?o.path=Gl(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=Gl(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function mY(e,t,n){return typeof e=="string"?(e=unescape(e),e=ro(cd(Lo(e,n),!0),{...n,skipEscape:!0})):typeof e=="object"&&(e=ro(cd(e,!0),{...n,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=ro(cd(Lo(t,n),!0),{...n,skipEscape:!0})):typeof t=="object"&&(t=ro(cd(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function ro(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),o=[],s=Ox[(r.scheme||n.scheme||"").toLowerCase()];s&&s.serialize&&s.serialize(n,r),n.path!==void 0&&(r.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),n.scheme!==void 0&&(n.path=n.path.split("%3A").join(":")))),r.reference!=="suffix"&&n.scheme&&o.push(n.scheme,":");const i=fY(n);if(i!==void 0&&(r.reference!=="suffix"&&o.push("//"),o.push(i),n.path&&n.path.charAt(0)!=="/"&&o.push("/")),n.path!==void 0){let a=n.path;!r.absolutePath&&(!s||!s.absolutePath)&&(a=Gl(a)),i===void 0&&(a=a.replace(/^\/\//u,"/%2F")),o.push(a)}return n.query!==void 0&&o.push("?",n.query),n.fragment!==void 0&&o.push("#",n.fragment),o.join("")}const gY=Array.from({length:127},(e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)));function yY(e){let t=0;for(let n=0,r=e.length;n<r;++n)if(t=e.charCodeAt(n),t>126||gY[t])return!0;return!1}const vY=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Lo(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},o=e.indexOf("%")!==-1;let s=!1;n.reference==="suffix"&&(e=(n.scheme?n.scheme+":":"")+"//"+e);const i=e.match(vY);if(i){if(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port)&&(r.port=i[5]),r.host){const l=dY(r.host);if(l.isIPV4===!1){const u=uY(l.host);r.host=u.host.toLowerCase(),s=u.isIPV6}else r.host=l.host,s=!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 a=Ox[(n.scheme||r.scheme||"").toLowerCase()];if(!n.unicodeSupport&&(!a||!a.unicodeSupport)&&r.host&&(n.domainHost||a&&a.domainHost)&&s===!1&&yY(r.host))try{r.host=URL.domainToASCII(r.host.toLowerCase())}catch(l){r.error=r.error||"Host's domain name can not be converted to ASCII: "+l}(!a||a&&!a.skipNormalize)&&(o&&r.scheme!==void 0&&(r.scheme=unescape(r.scheme)),o&&r.host!==void 0&&(r.host=unescape(r.host)),r.path&&(r.path=escape(unescape(r.path))),r.fragment&&(r.fragment=encodeURI(decodeURIComponent(r.fragment)))),a&&a.parse&&a.parse(r,n)}else r.error=r.error||"URI can not be parsed.";return r}const Mx={SCHEMES:Ox,normalize:hY,resolve:pY,resolveComponents:oR,equal:mY,serialize:ro,parse:Lo};op.exports=Mx;op.exports.default=Mx;op.exports.fastUri=Mx;var xY=op.exports;Object.defineProperty(Ix,"__esModule",{value:!0});const sR=xY;sR.code='require("ajv/dist/runtime/uri").default';Ix.default=sR;(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=Or;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Me;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=_u,o=kl,s=Ii,i=Mn,a=Me,l=tn,u=Ft,d=ue,f=zJ,p=Ix,h=(N,O)=>new RegExp(N,O);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"]),x={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 O,V,S,E,R,M,K,G,le,se,he,ke,tt,yt,ee,pe,re,Fe,ae,Re,De,vt,nr,st,Nn;const W=N.strict,te=(O=N.code)===null||O===void 0?void 0:O.optimize,xe=te===!0||te===void 0?1:te||0,Ce=(S=(V=N.code)===null||V===void 0?void 0:V.regExp)!==null&&S!==void 0?S:h,Ke=(E=N.uriResolver)!==null&&E!==void 0?E:p.default;return{strictSchema:(M=(R=N.strictSchema)!==null&&R!==void 0?R:W)!==null&&M!==void 0?M:!0,strictNumbers:(G=(K=N.strictNumbers)!==null&&K!==void 0?K:W)!==null&&G!==void 0?G:!0,strictTypes:(se=(le=N.strictTypes)!==null&&le!==void 0?le:W)!==null&&se!==void 0?se:"log",strictTuples:(ke=(he=N.strictTuples)!==null&&he!==void 0?he:W)!==null&&ke!==void 0?ke:"log",strictRequired:(yt=(tt=N.strictRequired)!==null&&tt!==void 0?tt:W)!==null&&yt!==void 0?yt:!1,code:N.code?{...N.code,optimize:xe,regExp:Ce}:{optimize:xe,regExp:Ce},loopRequired:(ee=N.loopRequired)!==null&&ee!==void 0?ee:v,loopEnum:(pe=N.loopEnum)!==null&&pe!==void 0?pe:v,meta:(re=N.meta)!==null&&re!==void 0?re:!0,messages:(Fe=N.messages)!==null&&Fe!==void 0?Fe:!0,inlineRefs:(ae=N.inlineRefs)!==null&&ae!==void 0?ae:!0,schemaId:(Re=N.schemaId)!==null&&Re!==void 0?Re:"$id",addUsedSchema:(De=N.addUsedSchema)!==null&&De!==void 0?De:!0,validateSchema:(vt=N.validateSchema)!==null&&vt!==void 0?vt:!0,validateFormats:(nr=N.validateFormats)!==null&&nr!==void 0?nr:!0,unicodeRegExp:(st=N.unicodeRegExp)!==null&&st!==void 0?st:!0,int32range:(Nn=N.int32range)!==null&&Nn!==void 0?Nn:!0,uriResolver:Ke}}class k{constructor(O={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,O=this.opts={...O,...w(O)};const{es5:V,lines:S}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:m,es5:V,lines:S}),this.logger=A(O.logger);const E=O.validateFormats;O.validateFormats=!1,this.RULES=(0,s.getRules)(),C.call(this,x,O,"NOT SUPPORTED"),C.call(this,g,O,"DEPRECATED","warn"),this._metaOpts=$.call(this),O.formats&&I.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),O.keywords&&P.call(this,O.keywords),typeof O.meta=="object"&&this.addMetaSchema(O.meta),_.call(this),O.validateFormats=E}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:O,meta:V,schemaId:S}=this.opts;let E=f;S==="id"&&(E={...f},E.id=E.$id,delete E.$id),V&&O&&this.addMetaSchema(E,E[S],!1)}defaultMeta(){const{meta:O,schemaId:V}=this.opts;return this.opts.defaultMeta=typeof O=="object"?O[V]||O:void 0}validate(O,V){let S;if(typeof O=="string"){if(S=this.getSchema(O),!S)throw new Error(`no schema with key or ref "${O}"`)}else S=this.compile(O);const E=S(V);return"$async"in S||(this.errors=S.errors),E}compile(O,V){const S=this._addSchema(O,V);return S.validate||this._compileSchemaEnv(S)}compileAsync(O,V){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:S}=this.opts;return E.call(this,O,V);async function E(se,he){await R.call(this,se.$schema);const ke=this._addSchema(se,he);return ke.validate||M.call(this,ke)}async function R(se){se&&!this.getSchema(se)&&await E.call(this,{$ref:se},!0)}async function M(se){try{return this._compileSchemaEnv(se)}catch(he){if(!(he instanceof o.default))throw he;return K.call(this,he),await G.call(this,he.missingSchema),M.call(this,se)}}function K({missingSchema:se,missingRef:he}){if(this.refs[se])throw new Error(`AnySchema ${se} is loaded but ${he} cannot be resolved`)}async function G(se){const he=await le.call(this,se);this.refs[se]||await R.call(this,he.$schema),this.refs[se]||this.addSchema(he,se,V)}async function le(se){const he=this._loading[se];if(he)return he;try{return await(this._loading[se]=S(se))}finally{delete this._loading[se]}}}addSchema(O,V,S,E=this.opts.validateSchema){if(Array.isArray(O)){for(const M of O)this.addSchema(M,void 0,S,E);return this}let R;if(typeof O=="object"){const{schemaId:M}=this.opts;if(R=O[M],R!==void 0&&typeof R!="string")throw new Error(`schema ${M} must be string`)}return V=(0,l.normalizeId)(V||R),this._checkUnique(V),this.schemas[V]=this._addSchema(O,S,V,E,!0),this}addMetaSchema(O,V,S=this.opts.validateSchema){return this.addSchema(O,V,!0,S),this}validateSchema(O,V){if(typeof O=="boolean")return!0;let S;if(S=O.$schema,S!==void 0&&typeof S!="string")throw new Error("$schema must be a string");if(S=S||this.opts.defaultMeta||this.defaultMeta(),!S)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const E=this.validate(S,O);if(!E&&V){const R="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(R);else throw new Error(R)}return E}getSchema(O){let V;for(;typeof(V=j.call(this,O))=="string";)O=V;if(V===void 0){const{schemaId:S}=this.opts,E=new i.SchemaEnv({schema:{},schemaId:S});if(V=i.resolveSchema.call(this,E,O),!V)return;this.refs[O]=V}return V.validate||this._compileSchemaEnv(V)}removeSchema(O){if(O instanceof RegExp)return this._removeAllSchemas(this.schemas,O),this._removeAllSchemas(this.refs,O),this;switch(typeof O){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const V=j.call(this,O);return typeof V=="object"&&this._cache.delete(V.schema),delete this.schemas[O],delete this.refs[O],this}case"object":{const V=O;this._cache.delete(V);let S=O[this.opts.schemaId];return S&&(S=(0,l.normalizeId)(S),delete this.schemas[S],delete this.refs[S]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(O){for(const V of O)this.addKeyword(V);return this}addKeyword(O,V){let S;if(typeof O=="string")S=O,typeof V=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),V.keyword=S);else if(typeof O=="object"&&V===void 0){if(V=O,S=V.keyword,Array.isArray(S)&&!S.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(z.call(this,S,V),!V)return(0,d.eachItem)(S,R=>D.call(this,R)),this;B.call(this,V);const E={...V,type:(0,u.getJSONTypes)(V.type),schemaType:(0,u.getJSONTypes)(V.schemaType)};return(0,d.eachItem)(S,E.type.length===0?R=>D.call(this,R,E):R=>E.type.forEach(M=>D.call(this,R,E,M))),this}getKeyword(O){const V=this.RULES.all[O];return typeof V=="object"?V.definition:!!V}removeKeyword(O){const{RULES:V}=this;delete V.keywords[O],delete V.all[O];for(const S of V.rules){const E=S.rules.findIndex(R=>R.keyword===O);E>=0&&S.rules.splice(E,1)}return this}addFormat(O,V){return typeof V=="string"&&(V=new RegExp(V)),this.formats[O]=V,this}errorsText(O=this.errors,{separator:V=", ",dataVar:S="data"}={}){return!O||O.length===0?"No errors":O.map(E=>`${S}${E.instancePath} ${E.message}`).reduce((E,R)=>E+V+R)}$dataMetaSchema(O,V){const S=this.RULES.all;O=JSON.parse(JSON.stringify(O));for(const E of V){const R=E.split("/").slice(1);let M=O;for(const K of R)M=M[K];for(const K in S){const G=S[K];if(typeof G!="object")continue;const{$data:le}=G.definition,se=M[K];le&&se&&(M[K]=H(se))}}return O}_removeAllSchemas(O,V){for(const S in O){const E=O[S];(!V||V.test(S))&&(typeof E=="string"?delete O[S]:E&&!E.meta&&(this._cache.delete(E.schema),delete O[S]))}}_addSchema(O,V,S,E=this.opts.validateSchema,R=this.opts.addUsedSchema){let M;const{schemaId:K}=this.opts;if(typeof O=="object")M=O[K];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof O!="boolean")throw new Error("schema must be object or boolean")}let G=this._cache.get(O);if(G!==void 0)return G;S=(0,l.normalizeId)(M||S);const le=l.getSchemaRefs.call(this,O,S);return G=new i.SchemaEnv({schema:O,schemaId:K,meta:V,baseId:S,localRefs:le}),this._cache.set(G.schema,G),R&&!S.startsWith("#")&&(S&&this._checkUnique(S),this.refs[S]=G),E&&this.validateSchema(O,!0),G}_checkUnique(O){if(this.schemas[O]||this.refs[O])throw new Error(`schema with key or id "${O}" already exists`)}_compileSchemaEnv(O){if(O.meta?this._compileMetaSchema(O):i.compileSchema.call(this,O),!O.validate)throw new Error("ajv implementation error");return O.validate}_compileMetaSchema(O){const V=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,O)}finally{this.opts=V}}}k.ValidationError=r.default,k.MissingRefError=o.default,e.default=k;function C(N,O,V,S="error"){for(const E in N){const R=E;R in O&&this.logger[S](`${V}: option ${E}. ${N[R]}`)}}function j(N){return N=(0,l.normalizeId)(N),this.schemas[N]||this.refs[N]}function _(){const N=this.opts.schemas;if(N)if(Array.isArray(N))this.addSchema(N);else for(const O in N)this.addSchema(N[O],O)}function I(){for(const N in this.opts.formats){const O=this.opts.formats[N];O&&this.addFormat(N,O)}}function P(N){if(Array.isArray(N)){this.addVocabulary(N);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const O in N){const V=N[O];V.keyword||(V.keyword=O),this.addKeyword(V)}}function $(){const N={...this.opts};for(const O of y)delete N[O];return N}const T={log(){},warn(){},error(){}};function A(N){if(N===!1)return T;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 U=/^[a-z_$][a-z0-9_$:-]*$/i;function z(N,O){const{RULES:V}=this;if((0,d.eachItem)(N,S=>{if(V.keywords[S])throw new Error(`Keyword ${S} is already defined`);if(!U.test(S))throw new Error(`Keyword ${S} has invalid name`)}),!!O&&O.$data&&!("code"in O||"validate"in O))throw new Error('$data keyword must have "code" or "validate" function')}function D(N,O,V){var S;const E=O==null?void 0:O.post;if(V&&E)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:R}=this;let M=E?R.post:R.rules.find(({type:G})=>G===V);if(M||(M={type:V,rules:[]},R.rules.push(M)),R.keywords[N]=!0,!O)return;const K={keyword:N,definition:{...O,type:(0,u.getJSONTypes)(O.type),schemaType:(0,u.getJSONTypes)(O.schemaType)}};O.before?Z.call(this,M,K,O.before):M.rules.push(K),R.all[N]=K,(S=O.implements)===null||S===void 0||S.forEach(G=>this.addKeyword(G))}function Z(N,O,V){const S=N.rules.findIndex(E=>E.keyword===V);S>=0?N.rules.splice(S,0,O):(N.rules.push(O),this.logger.warn(`rule ${V} is not defined`))}function B(N){let{metaSchema:O}=N;O!==void 0&&(N.$data&&this.opts.$data&&(O=H(O)),N.validateSchema=this.compile(O,!0))}const q={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function H(N){return{anyOf:[N,q]}}})(v$);var Dx={},Lx={},zx={};Object.defineProperty(zx,"__esModule",{value:!0});const wY={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};zx.default=wY;var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.callRef=Ai.getValidate=void 0;const bY=kl,a_=Le,Rn=Me,Qi=ho,l_=Mn,ud=ue,kY={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:l}=r,{root:u}=s;if((n==="#"||n==="#/")&&o===u.baseId)return f();const d=l_.resolveRef.call(l,u,o,n);if(d===void 0)throw new bY.default(r.opts.uriResolver,o,n);if(d instanceof l_.SchemaEnv)return p(d);return h(d);function f(){if(s===u)return Hd(e,i,s,s.$async);const y=t.scopeValue("root",{ref:u});return Hd(e,(0,Rn._)`${y}.validate`,u,u.$async)}function p(y){const m=iR(e,y);Hd(e,m,y,y.$async)}function h(y){const m=t.scopeValue("schema",a.code.source===!0?{ref:y,code:(0,Rn.stringify)(y)}:{ref:y}),x=t.name("valid"),g=e.subschema({schema:y,dataTypes:[],schemaPath:Rn.nil,topSchemaRef:m,errSchemaPath:n},x);e.mergeEvaluated(g),e.ok(x)}}};function iR(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):(0,Rn._)`${n.scopeValue("wrapper",{ref:t})}.validate`}Ai.getValidate=iR;function Hd(e,t,n,r){const{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:l}=s,u=l.passContext?Qi.default.this:Rn.nil;r?d():f();function d(){if(!a.$async)throw new Error("async schema referenced by sync schema");const y=o.let("valid");o.try(()=>{o.code((0,Rn._)`await ${(0,a_.callValidateCode)(e,t,u)}`),h(t),i||o.assign(y,!0)},m=>{o.if((0,Rn._)`!(${m} instanceof ${s.ValidationError})`,()=>o.throw(m)),p(m),i||o.assign(y,!1)}),e.ok(y)}function f(){e.result((0,a_.callValidateCode)(e,t,u),()=>h(t),()=>p(t))}function p(y){const m=(0,Rn._)`${y}.errors`;o.assign(Qi.default.vErrors,(0,Rn._)`${Qi.default.vErrors} === null ? ${m} : ${Qi.default.vErrors}.concat(${m})`),o.assign(Qi.default.errors,(0,Rn._)`${Qi.default.vErrors}.length`)}function h(y){var m;if(!s.opts.unevaluated)return;const x=(m=n==null?void 0:n.validate)===null||m===void 0?void 0:m.evaluated;if(s.props!==!0)if(x&&!x.dynamicProps)x.props!==void 0&&(s.props=ud.mergeEvaluated.props(o,x.props,s.props));else{const g=o.var("props",(0,Rn._)`${y}.evaluated.props`);s.props=ud.mergeEvaluated.props(o,g,s.props,Rn.Name)}if(s.items!==!0)if(x&&!x.dynamicItems)x.items!==void 0&&(s.items=ud.mergeEvaluated.items(o,x.items,s.items));else{const g=o.var("items",(0,Rn._)`${y}.evaluated.items`);s.items=ud.mergeEvaluated.items(o,g,s.items,Rn.Name)}}}Ai.callRef=Hd;Ai.default=kY;Object.defineProperty(Lx,"__esModule",{value:!0});const _Y=zx,SY=Ai,CY=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",_Y.default,SY.default];Lx.default=CY;var Fx={},Ux={};Object.defineProperty(Ux,"__esModule",{value:!0});const eh=Me,Qo=eh.operators,th={maximum:{okStr:"<=",ok:Qo.LTE,fail:Qo.GT},minimum:{okStr:">=",ok:Qo.GTE,fail:Qo.LT},exclusiveMaximum:{okStr:"<",ok:Qo.LT,fail:Qo.GTE},exclusiveMinimum:{okStr:">",ok:Qo.GT,fail:Qo.LTE}},EY={message:({keyword:e,schemaCode:t})=>(0,eh.str)`must be ${th[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,eh._)`{comparison: ${th[e].okStr}, limit: ${t}}`},NY={keyword:Object.keys(th),type:"number",schemaType:"number",$data:!0,error:EY,code(e){const{keyword:t,data:n,schemaCode:r}=e;e.fail$data((0,eh._)`${n} ${th[t].fail} ${r} || isNaN(${n})`)}};Ux.default=NY;var qx={};Object.defineProperty(qx,"__esModule",{value:!0});const gc=Me,jY={message:({schemaCode:e})=>(0,gc.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,gc._)`{multipleOf: ${e}}`},PY={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:jY,code(e){const{gen:t,data:n,schemaCode:r,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,gc._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,gc._)`${i} !== parseInt(${i})`;e.fail$data((0,gc._)`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};qx.default=PY;var Vx={},Hx={};Object.defineProperty(Hx,"__esModule",{value:!0});function aR(e){const t=e.length;let n=0,r=0,o;for(;r<t;)n++,o=e.charCodeAt(r++),o>=55296&&o<=56319&&r<t&&(o=e.charCodeAt(r),(o&64512)===56320&&r++);return n}Hx.default=aR;aR.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(Vx,"__esModule",{value:!0});const ni=Me,TY=ue,$Y=Hx,RY={message({keyword:e,schemaCode:t}){const n=e==="maxLength"?"more":"fewer";return(0,ni.str)`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>(0,ni._)`{limit: ${e}}`},IY={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:RY,code(e){const{keyword:t,data:n,schemaCode:r,it:o}=e,s=t==="maxLength"?ni.operators.GT:ni.operators.LT,i=o.opts.unicode===!1?(0,ni._)`${n}.length`:(0,ni._)`${(0,TY.useFunc)(e.gen,$Y.default)}(${n})`;e.fail$data((0,ni._)`${i} ${s} ${r}`)}};Vx.default=IY;var Bx={};Object.defineProperty(Bx,"__esModule",{value:!0});const AY=Le,nh=Me,OY={message:({schemaCode:e})=>(0,nh.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,nh._)`{pattern: ${e}}`},MY={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:OY,code(e){const{data:t,$data:n,schema:r,schemaCode:o,it:s}=e,i=s.opts.unicodeRegExp?"u":"",a=n?(0,nh._)`(new RegExp(${o}, ${i}))`:(0,AY.usePattern)(e,r);e.fail$data((0,nh._)`!${a}.test(${t})`)}};Bx.default=MY;var Kx={};Object.defineProperty(Kx,"__esModule",{value:!0});const yc=Me,DY={message({keyword:e,schemaCode:t}){const n=e==="maxProperties"?"more":"fewer";return(0,yc.str)`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>(0,yc._)`{limit: ${e}}`},LY={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:DY,code(e){const{keyword:t,data:n,schemaCode:r}=e,o=t==="maxProperties"?yc.operators.GT:yc.operators.LT;e.fail$data((0,yc._)`Object.keys(${n}).length ${o} ${r}`)}};Kx.default=LY;var Wx={};Object.defineProperty(Wx,"__esModule",{value:!0});const zl=Le,vc=Me,zY=ue,FY={message:({params:{missingProperty:e}})=>(0,vc.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,vc._)`{missingProperty: ${e}}`},UY={keyword:"required",type:"object",schemaType:"array",$data:!0,error:FY,code(e){const{gen:t,schema:n,schemaCode:r,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&n.length===0)return;const l=n.length>=a.loopRequired;if(i.allErrors?u():d(),a.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 x=i.schemaEnv.baseId+i.errSchemaPath,g=`required property "${m}" is not defined at "${x}" (strictRequired)`;(0,zY.checkStrictMode)(i,g,i.opts.strictRequired)}}function u(){if(l||s)e.block$data(vc.nil,f);else for(const h of n)(0,zl.checkReportMissingProp)(e,h)}function d(){const h=t.let("missing");if(l||s){const y=t.let("valid",!0);e.block$data(y,()=>p(h,y)),e.ok(y)}else t.if((0,zl.checkMissingProp)(e,n,h)),(0,zl.reportMissingProp)(e,h),t.else()}function f(){t.forOf("prop",r,h=>{e.setParams({missingProperty:h}),t.if((0,zl.noPropertyInData)(t,o,h,a.ownProperties),()=>e.error())})}function p(h,y){e.setParams({missingProperty:h}),t.forOf(h,r,()=>{t.assign(y,(0,zl.propertyInData)(t,o,h,a.ownProperties)),t.if((0,vc.not)(y),()=>{e.error(),t.break()})},vc.nil)}}};Wx.default=UY;var Zx={};Object.defineProperty(Zx,"__esModule",{value:!0});const xc=Me,qY={message({keyword:e,schemaCode:t}){const n=e==="maxItems"?"more":"fewer";return(0,xc.str)`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>(0,xc._)`{limit: ${e}}`},VY={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:qY,code(e){const{keyword:t,data:n,schemaCode:r}=e,o=t==="maxItems"?xc.operators.GT:xc.operators.LT;e.fail$data((0,xc._)`${n}.length ${o} ${r}`)}};Zx.default=VY;var Qx={},Su={};Object.defineProperty(Su,"__esModule",{value:!0});const lR=A$;lR.code='require("ajv/dist/runtime/equal").default';Su.default=lR;Object.defineProperty(Qx,"__esModule",{value:!0});const Cm=Ft,Jt=Me,HY=ue,BY=Su,KY={message:({params:{i:e,j:t}})=>(0,Jt.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Jt._)`{i: ${e}, j: ${t}}`},WY={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:KY,code(e){const{gen:t,data:n,$data:r,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!r&&!o)return;const l=t.let("valid"),u=s.items?(0,Cm.getSchemaTypes)(s.items):[];e.block$data(l,d,(0,Jt._)`${i} === false`),e.ok(l);function d(){const y=t.let("i",(0,Jt._)`${n}.length`),m=t.let("j");e.setParams({i:y,j:m}),t.assign(l,!0),t.if((0,Jt._)`${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 x=t.name("item"),g=(0,Cm.checkDataTypes)(u,x,a.opts.strictNumbers,Cm.DataType.Wrong),v=t.const("indices",(0,Jt._)`{}`);t.for((0,Jt._)`;${y}--;`,()=>{t.let(x,(0,Jt._)`${n}[${y}]`),t.if(g,(0,Jt._)`continue`),u.length>1&&t.if((0,Jt._)`typeof ${x} == "string"`,(0,Jt._)`${x} += "_"`),t.if((0,Jt._)`typeof ${v}[${x}] == "number"`,()=>{t.assign(m,(0,Jt._)`${v}[${x}]`),e.error(),t.assign(l,!1).break()}).code((0,Jt._)`${v}[${x}] = ${y}`)})}function h(y,m){const x=(0,HY.useFunc)(t,BY.default),g=t.name("outer");t.label(g).for((0,Jt._)`;${y}--;`,()=>t.for((0,Jt._)`${m} = ${y}; ${m}--;`,()=>t.if((0,Jt._)`${x}(${n}[${y}], ${n}[${m}])`,()=>{e.error(),t.assign(l,!1).break(g)})))}}};Qx.default=WY;var Gx={};Object.defineProperty(Gx,"__esModule",{value:!0});const Vy=Me,ZY=ue,QY=Su,GY={message:"must be equal to constant",params:({schemaCode:e})=>(0,Vy._)`{allowedValue: ${e}}`},JY={keyword:"const",$data:!0,error:GY,code(e){const{gen:t,data:n,$data:r,schemaCode:o,schema:s}=e;r||s&&typeof s=="object"?e.fail$data((0,Vy._)`!${(0,ZY.useFunc)(t,QY.default)}(${n}, ${o})`):e.fail((0,Vy._)`${s} !== ${n}`)}};Gx.default=JY;var Jx={};Object.defineProperty(Jx,"__esModule",{value:!0});const Jl=Me,YY=ue,XY=Su,eX={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Jl._)`{allowedValues: ${e}}`},tX={keyword:"enum",schemaType:"array",$data:!0,error:eX,code(e){const{gen:t,data:n,$data:r,schema:o,schemaCode:s,it:i}=e;if(!r&&o.length===0)throw new Error("enum must have non-empty array");const a=o.length>=i.opts.loopEnum;let l;const u=()=>l??(l=(0,YY.useFunc)(t,XY.default));let d;if(a||r)d=t.let("valid"),e.block$data(d,f);else{if(!Array.isArray(o))throw new Error("ajv implementation error");const h=t.const("vSchema",s);d=(0,Jl.or)(...o.map((y,m)=>p(h,m)))}e.pass(d);function f(){t.assign(d,!1),t.forOf("v",s,h=>t.if((0,Jl._)`${u()}(${n}, ${h})`,()=>t.assign(d,!0).break()))}function p(h,y){const m=o[y];return typeof m=="object"&&m!==null?(0,Jl._)`${u()}(${n}, ${h}[${y}])`:(0,Jl._)`${n} === ${m}`}}};Jx.default=tX;Object.defineProperty(Fx,"__esModule",{value:!0});const nX=Ux,rX=qx,oX=Vx,sX=Bx,iX=Kx,aX=Wx,lX=Zx,cX=Qx,uX=Gx,dX=Jx,fX=[nX.default,rX.default,oX.default,sX.default,iX.default,aX.default,lX.default,cX.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},uX.default,dX.default];Fx.default=fX;var Yx={},_l={};Object.defineProperty(_l,"__esModule",{value:!0});_l.validateAdditionalItems=void 0;const ri=Me,Hy=ue,hX={message:({params:{len:e}})=>(0,ri.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ri._)`{limit: ${e}}`},pX={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:hX,code(e){const{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){(0,Hy.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}cR(e,r)}};function cR(e,t){const{gen:n,schema:r,data:o,keyword:s,it:i}=e;i.items=!0;const a=n.const("len",(0,ri._)`${o}.length`);if(r===!1)e.setParams({len:t.length}),e.pass((0,ri._)`${a} <= ${t.length}`);else if(typeof r=="object"&&!(0,Hy.alwaysValidSchema)(i,r)){const u=n.var("valid",(0,ri._)`${a} <= ${t.length}`);n.if((0,ri.not)(u),()=>l(u)),e.ok(u)}function l(u){n.forRange("i",t.length,a,d=>{e.subschema({keyword:s,dataProp:d,dataPropType:Hy.Type.Num},u),i.allErrors||n.if((0,ri.not)(u),()=>n.break())})}}_l.validateAdditionalItems=cR;_l.default=pX;var Xx={},Sl={};Object.defineProperty(Sl,"__esModule",{value:!0});Sl.validateTuple=void 0;const c_=Me,Bd=ue,mX=Le,gX={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return uR(e,"additionalItems",t);n.items=!0,!(0,Bd.alwaysValidSchema)(n,t)&&e.ok((0,mX.validateArray)(e))}};function uR(e,t,n=e.schema){const{gen:r,parentSchema:o,data:s,keyword:i,it:a}=e;d(o),a.opts.unevaluated&&n.length&&a.items!==!0&&(a.items=Bd.mergeEvaluated.items(r,n.length,a.items));const l=r.name("valid"),u=r.const("len",(0,c_._)`${s}.length`);n.forEach((f,p)=>{(0,Bd.alwaysValidSchema)(a,f)||(r.if((0,c_._)`${u} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},l)),e.ok(l))});function d(f){const{opts:p,errSchemaPath:h}=a,y=n.length,m=y===f.minItems&&(y===f.maxItems||f[t]===!1);if(p.strictTuples&&!m){const x=`"${i}" is ${y}-tuple, but minItems or maxItems/${t} are not specified or different at path "${h}"`;(0,Bd.checkStrictMode)(a,x,p.strictTuples)}}}Sl.validateTuple=uR;Sl.default=gX;Object.defineProperty(Xx,"__esModule",{value:!0});const yX=Sl,vX={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,yX.validateTuple)(e,"items")};Xx.default=vX;var ew={};Object.defineProperty(ew,"__esModule",{value:!0});const u_=Me,xX=ue,wX=Le,bX=_l,kX={message:({params:{len:e}})=>(0,u_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,u_._)`{limit: ${e}}`},_X={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:kX,code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:o}=n;r.items=!0,!(0,xX.alwaysValidSchema)(r,t)&&(o?(0,bX.validateAdditionalItems)(e,o):e.ok((0,wX.validateArray)(e)))}};ew.default=_X;var tw={};Object.defineProperty(tw,"__esModule",{value:!0});const ir=Me,dd=ue,SX={message:({params:{min:e,max:t}})=>t===void 0?(0,ir.str)`must contain at least ${e} valid item(s)`:(0,ir.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ir._)`{minContains: ${e}}`:(0,ir._)`{minContains: ${e}, maxContains: ${t}}`},CX={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:SX,code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:s}=e;let i,a;const{minContains:l,maxContains:u}=r;s.opts.next?(i=l===void 0?1:l,a=u):i=1;const d=t.const("len",(0,ir._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,dd.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,dd.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,dd.alwaysValidSchema)(s,n)){let m=(0,ir._)`${d} >= ${i}`;a!==void 0&&(m=(0,ir._)`${m} && ${d} <= ${a}`),e.pass(m);return}s.items=!0;const f=t.name("valid");a===void 0&&i===1?h(f,()=>t.if(f,()=>t.break())):i===0?(t.let(f,!0),a!==void 0&&t.if((0,ir._)`${o}.length > 0`,p)):(t.let(f,!1),p()),e.result(f,()=>e.reset());function p(){const m=t.name("_valid"),x=t.let("count",0);h(m,()=>t.if(m,()=>y(x)))}function h(m,x){t.forRange("i",0,d,g=>{e.subschema({keyword:"contains",dataProp:g,dataPropType:dd.Type.Num,compositeRule:!0},m),x()})}function y(m){t.code((0,ir._)`${m}++`),a===void 0?t.if((0,ir._)`${m} >= ${i}`,()=>t.assign(f,!0).break()):(t.if((0,ir._)`${m} > ${a}`,()=>t.assign(f,!1).break()),i===1?t.assign(f,!0):t.if((0,ir._)`${m} >= ${i}`,()=>t.assign(f,!0)))}}};tw.default=CX;var dR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=Me,n=ue,r=Le;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},
469
- missingProperty: ${f},
470
- depsCount: ${u},
471
- deps: ${d}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(l){const[u,d]=s(l);i(l,u),a(l,d)}};function s({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 i(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 x=(0,r.propertyInData)(d,f,y,p.opts.ownProperties);l.setParams({property:y,depsCount:m.length,deps:m.join(", ")}),p.allErrors?d.if(x,()=>{for(const g of m)(0,r.checkReportMissingProp)(l,g)}):(d.if((0,t._)`${x} && (${(0,r.checkMissingProp)(l,m,h)})`),(0,r.reportMissingProp)(l,h),d.else())}}e.validatePropertyDeps=i;function a(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 x=l.subschema({keyword:p,schemaProp:m},y);l.mergeValidEvaluated(x,y)},()=>d.var(y,!0)),l.ok(y))}e.validateSchemaDeps=a,e.default=o})(dR);var nw={};Object.defineProperty(nw,"__esModule",{value:!0});const fR=Me,EX=ue,NX={message:"property name must be valid",params:({params:e})=>(0,fR._)`{propertyName: ${e.propertyName}}`},jX={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:NX,code(e){const{gen:t,schema:n,data:r,it:o}=e;if((0,EX.alwaysValidSchema)(o,n))return;const s=t.name("valid");t.forIn("key",r,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,fR.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};nw.default=jX;var sp={};Object.defineProperty(sp,"__esModule",{value:!0});const fd=Le,wr=Me,PX=ho,hd=ue,TX={message:"must NOT have additional properties",params:({params:e})=>(0,wr._)`{additionalProperty: ${e.additionalProperty}}`},$X={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:TX,code(e){const{gen:t,schema:n,parentSchema:r,data:o,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");const{allErrors:a,opts:l}=i;if(i.props=!0,l.removeAdditional!=="all"&&(0,hd.alwaysValidSchema)(i,n))return;const u=(0,fd.allSchemaProperties)(r.properties),d=(0,fd.allSchemaProperties)(r.patternProperties);f(),e.ok((0,wr._)`${s} === ${PX.default.errors}`);function f(){t.forIn("key",o,x=>{!u.length&&!d.length?y(x):t.if(p(x),()=>y(x))})}function p(x){let g;if(u.length>8){const v=(0,hd.schemaRefOrVal)(i,r.properties,"properties");g=(0,fd.isOwnProperty)(t,v,x)}else u.length?g=(0,wr.or)(...u.map(v=>(0,wr._)`${x} === ${v}`)):g=wr.nil;return d.length&&(g=(0,wr.or)(g,...d.map(v=>(0,wr._)`${(0,fd.usePattern)(e,v)}.test(${x})`))),(0,wr.not)(g)}function h(x){t.code((0,wr._)`delete ${o}[${x}]`)}function y(x){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){h(x);return}if(n===!1){e.setParams({additionalProperty:x}),e.error(),a||t.break();return}if(typeof n=="object"&&!(0,hd.alwaysValidSchema)(i,n)){const g=t.name("valid");l.removeAdditional==="failing"?(m(x,g,!1),t.if((0,wr.not)(g),()=>{e.reset(),h(x)})):(m(x,g),a||t.if((0,wr.not)(g),()=>t.break()))}}function m(x,g,v){const w={keyword:"additionalProperties",dataProp:x,dataPropType:hd.Type.Str};v===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(w,g)}}};sp.default=$X;var rw={};Object.defineProperty(rw,"__esModule",{value:!0});const RX=Or,d_=Le,Em=ue,f_=sp,IX={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:s}=e;s.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&f_.default.code(new RX.KeywordCxt(s,f_.default,"additionalProperties"));const i=(0,d_.allSchemaProperties)(n);for(const f of i)s.definedProperties.add(f);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Em.mergeEvaluated.props(t,(0,Em.toHash)(i),s.props));const a=i.filter(f=>!(0,Em.alwaysValidSchema)(s,n[f]));if(a.length===0)return;const l=t.name("valid");for(const f of a)u(f)?d(f):(t.if((0,d_.propertyInData)(t,o,f,s.opts.ownProperties)),d(f),s.allErrors||t.else().var(l,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(l);function u(f){return s.opts.useDefaults&&!s.compositeRule&&n[f].default!==void 0}function d(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},l)}}};rw.default=IX;var ow={};Object.defineProperty(ow,"__esModule",{value:!0});const h_=Le,pd=Me,p_=ue,m_=ue,AX={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:r,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,h_.allSchemaProperties)(n),l=a.filter(m=>(0,p_.alwaysValidSchema)(s,n[m]));if(a.length===0||l.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;const u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,d=t.name("valid");s.props!==!0&&!(s.props instanceof pd.Name)&&(s.props=(0,m_.evaluatedPropsToName)(t,s.props));const{props:f}=s;p();function p(){for(const m of a)u&&h(m),s.allErrors?y(m):(t.var(d,!0),y(m),t.if(d))}function h(m){for(const x in u)new RegExp(m).test(x)&&(0,p_.checkStrictMode)(s,`property ${x} matches pattern ${m} (use allowMatchingProperties)`)}function y(m){t.forIn("key",r,x=>{t.if((0,pd._)`${(0,h_.usePattern)(e,m)}.test(${x})`,()=>{const g=l.includes(m);g||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:x,dataPropType:m_.Type.Str},d),s.opts.unevaluated&&f!==!0?t.assign((0,pd._)`${f}[${x}]`,!0):!g&&!s.allErrors&&t.if((0,pd.not)(d),()=>t.break())})})}}};ow.default=AX;var sw={};Object.defineProperty(sw,"__esModule",{value:!0});const OX=ue,MX={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:r}=e;if((0,OX.alwaysValidSchema)(r,n)){e.fail();return}const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};sw.default=MX;var iw={};Object.defineProperty(iw,"__esModule",{value:!0});const DX=Le,LX={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:DX.validateUnion,error:{message:"must match a schema in anyOf"}};iw.default=LX;var aw={};Object.defineProperty(aw,"__esModule",{value:!0});const Kd=Me,zX=ue,FX={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Kd._)`{passingSchemas: ${e.passing}}`},UX={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:FX,code(e){const{gen:t,schema:n,parentSchema:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;const s=n,i=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((d,f)=>{let p;(0,zX.alwaysValidSchema)(o,d)?t.var(l,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},l),f>0&&t.if((0,Kd._)`${l} && ${i}`).assign(i,!1).assign(a,(0,Kd._)`[${a}, ${f}]`).else(),t.if(l,()=>{t.assign(i,!0),t.assign(a,f),p&&e.mergeEvaluated(p,Kd.Name)})})}}};aw.default=UX;var lw={};Object.defineProperty(lw,"__esModule",{value:!0});const qX=ue,VX={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 o=t.name("valid");n.forEach((s,i)=>{if((0,qX.alwaysValidSchema)(r,s))return;const a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};lw.default=VX;var cw={};Object.defineProperty(cw,"__esModule",{value:!0});const rh=Me,hR=ue,HX={message:({params:e})=>(0,rh.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,rh._)`{failingKeyword: ${e.ifClause}}`},BX={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:HX,code(e){const{gen:t,parentSchema:n,it:r}=e;n.then===void 0&&n.else===void 0&&(0,hR.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const o=g_(r,"then"),s=g_(r,"else");if(!o&&!s)return;const i=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),o&&s){const d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,u("then",d),u("else",d))}else o?t.if(a,u("then")):t.if((0,rh.not)(a),u("else"));e.pass(i,()=>e.error(!0));function l(){const d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function u(d,f){return()=>{const p=e.subschema({keyword:d},a);t.assign(i,a),e.mergeValidEvaluated(p,i),f?t.assign(f,(0,rh._)`${d}`):e.setParams({ifClause:d})}}}};function g_(e,t){const n=e.schema[t];return n!==void 0&&!(0,hR.alwaysValidSchema)(e,n)}cw.default=BX;var uw={};Object.defineProperty(uw,"__esModule",{value:!0});const KX=ue,WX={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){t.if===void 0&&(0,KX.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};uw.default=WX;Object.defineProperty(Yx,"__esModule",{value:!0});const ZX=_l,QX=Xx,GX=Sl,JX=ew,YX=tw,XX=dR,eee=nw,tee=sp,nee=rw,ree=ow,oee=sw,see=iw,iee=aw,aee=lw,lee=cw,cee=uw;function uee(e=!1){const t=[oee.default,see.default,iee.default,aee.default,lee.default,cee.default,eee.default,tee.default,XX.default,nee.default,ree.default];return e?t.push(QX.default,JX.default):t.push(ZX.default,GX.default),t.push(YX.default),t}Yx.default=uee;var dw={},fw={};Object.defineProperty(fw,"__esModule",{value:!0});const Rt=Me,dee={message:({schemaCode:e})=>(0,Rt.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Rt._)`{format: ${e}}`},fee={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:dee,code(e,t){const{gen:n,data:r,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=a;if(!l.validateFormats)return;o?p():h();function p(){const y=n.scopeValue("formats",{ref:f.formats,code:l.code.formats}),m=n.const("fDef",(0,Rt._)`${y}[${i}]`),x=n.let("fType"),g=n.let("format");n.if((0,Rt._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>n.assign(x,(0,Rt._)`${m}.type || "string"`).assign(g,(0,Rt._)`${m}.validate`),()=>n.assign(x,(0,Rt._)`"string"`).assign(g,m)),e.fail$data((0,Rt.or)(v(),w()));function v(){return l.strictSchema===!1?Rt.nil:(0,Rt._)`${i} && !${g}`}function w(){const k=d.$async?(0,Rt._)`(${m}.async ? await ${g}(${r}) : ${g}(${r}))`:(0,Rt._)`${g}(${r})`,C=(0,Rt._)`(typeof ${g} == "function" ? ${k} : ${g}.test(${r}))`;return(0,Rt._)`${g} && ${g} !== true && ${x} === ${t} && !${C}`}}function h(){const y=f.formats[s];if(!y){v();return}if(y===!0)return;const[m,x,g]=w(y);m===t&&e.pass(k());function v(){if(l.strictSchema===!1){f.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function w(C){const j=C instanceof RegExp?(0,Rt.regexpCode)(C):l.code.formats?(0,Rt._)`${l.code.formats}${(0,Rt.getProperty)(s)}`:void 0,_=n.scopeValue("formats",{key:s,ref:C,code:j});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,Rt._)`${_}.validate`]:["string",C,_]}function k(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!d.$async)throw new Error("async format in sync schema");return(0,Rt._)`await ${g}(${r})`}return typeof x=="function"?(0,Rt._)`${g}(${r})`:(0,Rt._)`${g}.test(${r})`}}}};fw.default=fee;Object.defineProperty(dw,"__esModule",{value:!0});const hee=fw,pee=[hee.default];dw.default=pee;var al={};Object.defineProperty(al,"__esModule",{value:!0});al.contentVocabulary=al.metadataVocabulary=void 0;al.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];al.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Dx,"__esModule",{value:!0});const mee=Lx,gee=Fx,yee=Yx,vee=dw,y_=al,xee=[mee.default,gee.default,(0,yee.default)(),vee.default,y_.metadataVocabulary,y_.contentVocabulary];Dx.default=xee;var hw={},ip={};Object.defineProperty(ip,"__esModule",{value:!0});ip.DiscrError=void 0;var v_;(function(e){e.Tag="tag",e.Mapping="mapping"})(v_||(ip.DiscrError=v_={}));Object.defineProperty(hw,"__esModule",{value:!0});const na=Me,By=ip,x_=Mn,wee=kl,bee=ue,kee={message:({params:{discrError:e,tagName:t}})=>e===By.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>(0,na._)`{error: ${e}, tag: ${n}, tagValue: ${t}}`},_ee={keyword:"discriminator",type:"object",schemaType:"object",error:kee,code(e){const{gen:t,data:n,schema:r,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=r.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const l=t.let("valid",!1),u=t.const("tag",(0,na._)`${n}${(0,na.getProperty)(a)}`);t.if((0,na._)`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:By.DiscrError.Tag,tag:u,tagName:a})),e.ok(l);function d(){const h=p();t.if(!1);for(const y in h)t.elseIf((0,na._)`${u} === ${y}`),t.assign(l,f(h[y]));t.else(),e.error(!1,{discrError:By.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function f(h){const y=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:h},y);return e.mergeEvaluated(m,na.Name),y}function p(){var h;const y={},m=g(o);let x=!0;for(let k=0;k<i.length;k++){let C=i[k];if(C!=null&&C.$ref&&!(0,bee.schemaHasRulesButRef)(C,s.self.RULES)){const _=C.$ref;if(C=x_.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,_),C instanceof x_.SchemaEnv&&(C=C.schema),C===void 0)throw new wee.default(s.opts.uriResolver,s.baseId,_)}const j=(h=C==null?void 0:C.properties)===null||h===void 0?void 0:h[a];if(typeof j!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);x=x&&(m||g(C)),v(j,k)}if(!x)throw new Error(`discriminator: "${a}" must be required`);return y;function g({required:k}){return Array.isArray(k)&&k.includes(a)}function v(k,C){if(k.const)w(k.const,C);else if(k.enum)for(const j of k.enum)w(j,C);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(k,C){if(typeof k!="string"||k in y)throw new Error(`discriminator: "${a}" values must be unique strings`);y[k]=C}}}};hw.default=_ee;const See="http://json-schema.org/draft-07/schema#",Cee="http://json-schema.org/draft-07/schema#",Eee="Core schema meta-schema",Nee={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:[]}},jee=["object","boolean"],Pee={$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:"#"}},Tee={$schema:See,$id:Cee,title:Eee,definitions:Nee,type:jee,properties:Pee,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=v$,r=Dx,o=hw,s=Tee,i=["/properties"],a="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(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const y=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(y,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}t.Ajv=l,e.exports=t=l,e.exports.Ajv=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var u=Or;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=Me;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=_u;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var p=kl;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})(Ly,Ly.exports);var pR=Ly.exports;const $ee=ll(pR);var Ky={exports:{}},mR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(T,A){return{validate:T,compare:A}}e.fullFormats={date:t(s,i),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:j},int64:{type:"number",validate:_},float:{type:"number",validate:I},double:{type:"number",validate:I},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),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(T){return T%4===0&&(T%100!==0||T%400===0)}const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(T){const A=r.exec(T);if(!A)return!1;const U=+A[1],z=+A[2],D=+A[3];return z>=1&&z<=12&&D>=1&&D<=(z===2&&n(U)?29:o[z])}function i(T,A){if(T&&A)return T>A?1:T<A?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(T){return function(U){const z=a.exec(U);if(!z)return!1;const D=+z[1],Z=+z[2],B=+z[3],q=z[4],H=z[5]==="-"?-1:1,N=+(z[6]||0),O=+(z[7]||0);if(N>23||O>59||T&&!q)return!1;if(D<=23&&Z<=59&&B<60)return!0;const V=Z-O*H,S=D-N*H-(V<0?1:0);return(S===23||S===-1)&&(V===59||V===-1)&&B<61}}function u(T,A){if(!(T&&A))return;const U=new Date("2020-01-01T"+T).valueOf(),z=new Date("2020-01-01T"+A).valueOf();if(U&&z)return U-z}function d(T,A){if(!(T&&A))return;const U=a.exec(T),z=a.exec(A);if(U&&z)return T=U[1]+U[2]+U[3],A=z[1]+z[2]+z[3],T>A?1:T<A?-1:0}const f=/t|\s/i;function p(T){const A=l(T);return function(z){const D=z.split(f);return D.length===2&&s(D[0])&&A(D[1])}}function h(T,A){if(!(T&&A))return;const U=new Date(T).valueOf(),z=new Date(A).valueOf();if(U&&z)return U-z}function y(T,A){if(!(T&&A))return;const[U,z]=T.split(f),[D,Z]=A.split(f),B=i(U,D);if(B!==void 0)return B||u(z,Z)}const m=/\/|:/,x=/^(?:[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(T){return m.test(T)&&x.test(T)}const v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function w(T){return v.lastIndex=0,v.test(T)}const k=-2147483648,C=2**31-1;function j(T){return Number.isInteger(T)&&T<=C&&T>=k}function _(T){return Number.isInteger(T)}function I(){return!0}const P=/[^\\]\\Z/;function $(T){if(P.test(T))return!1;try{return new RegExp(T),!0}catch{return!1}}})(mR);var gR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=pR,n=Me,r=n.operators,o={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}},s={message:({keyword:a,schemaCode:l})=>(0,n.str)`should be ${o[a].okStr} ${l}`,params:({keyword:a,schemaCode:l})=>(0,n._)`{comparison: ${o[a].okStr}, limit: ${l}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:s,code(a){const{gen:l,data:u,schemaCode:d,keyword:f,it:p}=a,{opts:h,self:y}=p;if(!h.validateFormats)return;const m=new t.KeywordCxt(p,y.RULES.all.format.definition,"format");m.$data?x():g();function x(){const w=l.scopeValue("formats",{ref:y.formats,code:h.code.formats}),k=l.const("fmt",(0,n._)`${w}[${m.schemaCode}]`);a.fail$data((0,n.or)((0,n._)`typeof ${k} != "object"`,(0,n._)`${k} instanceof RegExp`,(0,n._)`typeof ${k}.compare != "function"`,v(k)))}function g(){const w=m.schema,k=y.formats[w];if(!k||k===!0)return;if(typeof k!="object"||k instanceof RegExp||typeof k.compare!="function")throw new Error(`"${f}": format "${w}" does not define "compare" function`);const C=l.scopeValue("formats",{key:w,ref:k,code:h.code.formats?(0,n._)`${h.code.formats}${(0,n.getProperty)(w)}`:void 0});a.fail$data(v(C))}function v(w){return(0,n._)`${w}.compare(${u}, ${d}) ${o[f].fail} 0`}},dependencies:["format"]};const i=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=i})(gR);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n=mR,r=gR,o=Me,s=new o.Name("fullFormats"),i=new o.Name("fastFormats"),a=(u,d={keywords:!0})=>{if(Array.isArray(d))return l(u,d,n.fullFormats,s),u;const[f,p]=d.mode==="fast"?[n.fastFormats,i]:[n.fullFormats,s],h=d.formats||n.formatNames;return l(u,h,f,p),d.keywords&&(0,r.default)(u),u};a.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,o._)`require("ajv-formats/dist/formats").${p}`);for(const m of d)u.addFormat(m,f[m])}e.exports=t=a,Object.defineProperty(t,"__esModule",{value:!0}),t.default=a})(Ky,Ky.exports);var Ree=Ky.exports;const Iee=ll(Ree);function Aee(){const e=new $ee({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Iee(e),e}class Oee{constructor(t){this._ajv=t??Aee()}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 Mee{constructor(t){this._client=t}async*callToolStream(t,n=bu,r){const o=this._client,s={...r,task:(r==null?void 0:r.task)??(o.isToolTask(t.name)?{}:void 0)},i=o.requestStream({method:"tools/call",params:t},n,s),a=o.getToolOutputValidator(t.name);for await(const l of i){if(l.type==="result"&&a){const u=l.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new Se($e.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{const d=a(u.structuredContent);if(!d.valid){yield{type:"error",error:new Se($e.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof Se){yield{type:"error",error:d};return}yield{type:"error",error:new Se($e.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 Dee(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 Lee(e,t,n){var r,o;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(!((o=e.elicitation)!=null&&o.create))throw new Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break}}function Wd(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 o of Object.keys(r)){const s=r[o];n[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(n[o]=s.default),n[o]!==void 0&&Wd(s,n[o])}}if(Array.isArray(e.anyOf))for(const n of e.anyOf)typeof n!="boolean"&&Wd(n,t);if(Array.isArray(e.oneOf))for(const n of e.oneOf)typeof n!="boolean"&&Wd(n,t)}}function zee(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 Fee extends zQ{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 Oee,n!=null&&n.listChanged&&(this._pendingListChangedConfig=n.listChanged)}_setupListChangedHandlers(t){var n,r,o,s,i,a;t.tools&&((r=(n=this._serverCapabilities)==null?void 0:n.tools)!=null&&r.listChanged)&&this._setupListChangedHandler("tools",t$,t.tools,async()=>(await this.listTools()).tools),t.prompts&&((s=(o=this._serverCapabilities)==null?void 0:o.prompts)!=null&&s.listChanged)&&this._setupListChangedHandler("prompts",X2,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&((a=(i=this._serverCapabilities)==null?void 0:i.resources)!=null&&a.listChanged)&&this._setupListChangedHandler("resources",Y2,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Mee(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=FQ(this._capabilities,t)}setRequestHandler(t,n){var a;const r=y$(t),o=r==null?void 0:r.method;if(!o)throw new Error("Schema is missing a method literal");let s;if(ep(o)){const l=o,u=(a=l._zod)==null?void 0:a.def;s=(u==null?void 0:u.value)??l.value}else{const l=o,u=l._def;s=(u==null?void 0:u.value)??l.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");const i=s;if(i==="elicitation/create"){const l=async(u,d)=>{var w,k;const f=ns(i$,u);if(!f.success){const C=f.error instanceof Error?f.error.message:String(f.error);throw new Se($e.InvalidParams,`Invalid elicitation request: ${C}`)}const{params:p}=f.data;p.mode=p.mode??"form";const{supportsFormMode:h,supportsUrlMode:y}=zee(this._capabilities.elicitation);if(p.mode==="form"&&!h)throw new Se($e.InvalidParams,"Client does not support form-mode elicitation requests");if(p.mode==="url"&&!y)throw new Se($e.InvalidParams,"Client does not support URL-mode elicitation requests");const m=await Promise.resolve(n(u,d));if(p.task){const C=ns(Bc,m);if(!C.success){const j=C.error instanceof Error?C.error.message:String(C.error);throw new Se($e.InvalidParams,`Invalid task creation result: ${j}`)}return C.data}const x=ns(a$,m);if(!x.success){const C=x.error instanceof Error?x.error.message:String(x.error);throw new Se($e.InvalidParams,`Invalid elicitation result: ${C}`)}const g=x.data,v=p.mode==="form"?p.requestedSchema:void 0;if(p.mode==="form"&&g.action==="accept"&&g.content&&v&&(k=(w=this._capabilities.elicitation)==null?void 0:w.form)!=null&&k.applyDefaults)try{Wd(v,g.content)}catch{}return g};return super.setRequestHandler(t,l)}if(i==="sampling/createMessage"){const l=async(u,d)=>{const f=ns(r$,u);if(!f.success){const g=f.error instanceof Error?f.error.message:String(f.error);throw new Se($e.InvalidParams,`Invalid sampling request: ${g}`)}const{params:p}=f.data,h=await Promise.resolve(n(u,d));if(p.task){const g=ns(Bc,h);if(!g.success){const v=g.error instanceof Error?g.error.message:String(g.error);throw new Se($e.InvalidParams,`Invalid task creation result: ${v}`)}return g.data}const m=p.tools||p.toolChoice?s$:o$,x=ns(m,h);if(!x.success){const g=x.error instanceof Error?x.error.message:String(x.error);throw new Se($e.InvalidParams,`Invalid sampling result: ${g}`)}return x.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:Jh,capabilities:this._capabilities,clientInfo:this._clientInfo}},B2,n);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!y7.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,o,s,i;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(!((o=this._serverCapabilities)!=null&&o.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(!((s=this._serverCapabilities)!=null&&s.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!((i=this._serverCapabilities)!=null&&i.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;Dee((r=(n=this._serverCapabilities)==null?void 0:n.tasks)==null?void 0:r.requests,t,"Server")}assertTaskHandlerCapability(t){var n;this._capabilities&&Lee((n=this._capabilities.tasks)==null?void 0:n.requests,t,"Client")}async ping(t){return this.request({method:"ping"},ga,t)}async complete(t,n){return this.request({method:"completion/complete",params:t},l$,n)}async setLoggingLevel(t,n){return this.request({method:"logging/setLevel",params:{level:t}},ga,n)}async getPrompt(t,n){return this.request({method:"prompts/get",params:t},vx,n)}async listPrompts(t,n){return this.request({method:"prompts/list",params:t},Hf,n)}async listResources(t,n){return this.request({method:"resources/list",params:t},Vf,n)}async listResourceTemplates(t,n){return this.request({method:"resources/templates/list",params:t},J2,n)}async readResource(t,n){return this.request({method:"resources/read",params:t},hx,n)}async subscribeResource(t,n){return this.request({method:"resources/subscribe",params:t},ga,n)}async unsubscribeResource(t,n){return this.request({method:"resources/unsubscribe",params:t},ga,n)}async callTool(t,n=bu,r){if(this.isToolTaskRequired(t.name))throw new Se($e.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const o=await this.request({method:"tools/call",params:t},n,r),s=this.getToolOutputValidator(t.name);if(s){if(!o.structuredContent&&!o.isError)throw new Se($e.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(o.structuredContent)try{const i=s(o.structuredContent);if(!i.valid)throw new Se($e.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof Se?i:new Se($e.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return o}isToolTask(t){var n,r,o,s;return(s=(o=(r=(n=this._serverCapabilities)==null?void 0:n.tasks)==null?void 0:r.requests)==null?void 0:o.tools)!=null&&s.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 s=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,s)}const o=(n=r.execution)==null?void 0:n.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(r.name),o==="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},xx,n);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(t,n,r,o){const s=dZ.safeParse(r);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof r.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);const{autoRefresh:i,debounceMs:a}=s.data,{onChanged:l}=r,u=async()=>{if(!i){l(null,null);return}try{const f=await o();l(null,f)}catch(f){const p=f instanceof Error?f:new Error(String(f));l(p,null)}},d=()=>{if(a){const f=this._listChangedDebounceTimers.get(t);f&&clearTimeout(f);const p=setTimeout(u,a);this._listChangedDebounceTimers.set(t,p)}else u()};this.setNotificationHandler(n,d)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function Fl(e,t){if(!e)throw new Error(t)}var w_=3e3,Uee=5e3,Nm=5*60*1e3;function qee(e){const{url:t,clientName:n,clientUri:r,callbackUrl:o=typeof window<"u"?ma(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:s="mcp:auth",clientConfig:i={},customHeaders:a={},autoRetry:l=!1,autoReconnect:u=w_,transportType:d="auto",preventAutoAuth:f=!1,onPopupWindow:p}=e,[h,y]=b.useState("discovering"),[m,x]=b.useState([]),[g,v]=b.useState([]),[w,k]=b.useState([]),[C,j]=b.useState([]),[_,I]=b.useState(void 0),[P,$]=b.useState([]),[T,A]=b.useState(void 0),U=b.useRef(null),z=b.useRef(null),D=b.useRef(null),Z=b.useRef(!1),B=b.useRef(!0),q=b.useRef(0),H=b.useRef(null),N=b.useRef(h),O=b.useRef(u),V=b.useRef(null);b.useEffect(()=>{N.current=h,O.current=u},[h,u]);const S=b.useCallback((ee,pe,...re)=>{const Fe=re.length>0?`${pe} ${re.map(ae=>JSON.stringify(ae)).join(" ")}`:pe;console[ee](`[useMcp] ${Fe}`),B.current&&$(ae=>[...ae.slice(-100),{level:ee,message:Fe,timestamp:Date.now()}])},[]),E=b.useCallback(async(ee=!1)=>{ee||S("info","Disconnecting..."),Z.current=!1,H.current&&clearTimeout(H.current),H.current=null;const pe=z.current;if(U.current=null,z.current=null,B.current&&!ee&&(y("discovering"),x([]),v([]),k([]),j([]),I(void 0),A(void 0)),pe)try{await pe.close(),ee||S("debug","Transport closed")}catch(re){ee||S("warn","Error closing transport:",re)}},[S]),R=b.useCallback((ee,pe)=>{var re;if(S("error",ee,pe??""),B.current){y("failed"),I(ee);const Fe=(re=D.current)==null?void 0:re.getLastAttemptedAuthUrl();Fe&&(A(Fe),S("info","Manual authentication URL may be available.",Fe))}Z.current=!1},[S]),M=b.useCallback(async()=>{if(Z.current){S("debug","Connection attempt already in progress.");return}if(!B.current){S("debug","Connect called after unmount, aborting.");return}Z.current=!0,q.current+=1,I(void 0),A(void 0),V.current=null,y("discovering"),S("info",`Connecting attempt #${q.current} to ${t}...`),D.current||(D.current=new b1(t,{storageKeyPrefix:s,clientName:n,clientUri:r,callbackUrl:o,preventAutoAuth:f,onPopupWindow:p}),S("debug","BrowserOAuthClientProvider initialized in connect.")),U.current||(U.current=new Fee({name:i.name||"use-mcp-react-client",version:i.version||"0.1.0"},{capabilities:{}}),S("debug","MCP Client initialized in connect."));const ee=async re=>{S("info",`Attempting connection with ${re.toUpperCase()} transport...`),N.current!=="authenticating"&&y("connecting");let Fe;try{Fl(D.current,"Auth Provider must be initialized"),Fl(U.current,"Client must be initialized"),z.current&&(await z.current.close().catch(vt=>S("warn",`Error closing previous transport: ${vt.message}`)),z.current=null);const ae={authProvider:D.current,requestInit:{headers:{Accept:"application/json, text/event-stream",...a}}},Re=ma(t),De=new URL(Re);S("debug",`Creating ${re.toUpperCase()} transport for URL: ${De.toString()}`),S("debug","Transport options:",{authProvider:!!D.current,headers:a,url:De.toString()}),re==="http"?(S("debug","Creating StreamableHTTPClientTransport..."),Fe=new MQ(De,ae),S("debug","StreamableHTTPClientTransport created successfully")):(S("debug","Creating SSEClientTransport..."),Fe=new IQ(De,ae),S("debug","SSEClientTransport created successfully")),z.current=Fe,S("debug",`${re.toUpperCase()} transport created and assigned to ref.`)}catch(ae){return R(`Failed to create ${re.toUpperCase()} transport: ${ae instanceof Error?ae.message:String(ae)}`,ae instanceof Error?ae:void 0),"failed"}Fe.onmessage=ae=>{var Re,De;S("debug",`[Transport] Received: ${JSON.stringify(ae)}`),(De=(Re=U.current)==null?void 0:Re.handleMessage)==null||De.call(Re,ae)},Fe.onerror=ae=>{S("warn",`Transport error event (${re.toUpperCase()}):`,ae),S("debug","Error details:",{message:ae.message,stack:ae.stack,name:ae.name,cause:ae.cause}),R(`Transport error (${re.toUpperCase()}): ${ae.message}`,ae)},Fe.onclose=()=>{if(!B.current||Z.current)return;S("info",`Transport connection closed (${V.current||"unknown"} type).`);const ae=N.current,Re=O.current;if(ae==="ready"&&Re){const De=typeof Re=="number"?Re:w_;S("info",`Attempting to reconnect in ${De}ms...`),y("connecting"),setTimeout(()=>{B.current&&M()},De)}else ae!=="failed"&&ae!=="authenticating"&&R("Connection closed unexpectedly.")};try{S("info",`Connecting client via ${re.toUpperCase()}...`),S("debug","About to call client.connect() with transport instance"),S("debug",`Transport instance type: ${Fe.constructor.name}`),await U.current.connect(Fe),S("info",`Client connected via ${re.toUpperCase()}. Loading tools, resources, and prompts...`),V.current=re,y("loading");const ae=await U.current.request({method:"tools/list"},xx);let Re={resources:[],resourceTemplates:[]};try{Re=await U.current.request({method:"resources/list"},Vf)}catch(vt){S("debug","Server does not support resources/list method",vt)}let De={prompts:[]};try{De=await U.current.request({method:"prompts/list"},Hf)}catch(vt){S("debug","Server does not support prompts/list method",vt)}if(B.current){x(ae.tools),v(Re.resources),k(Array.isArray(Re.resourceTemplates)?Re.resourceTemplates:[]),j(De.prompts);const vt=[`Loaded ${ae.tools.length} tools`];return(Re.resources.length>0||Re.resourceTemplates&&Re.resourceTemplates.length>0)&&(vt.push(`${Re.resources.length} resources`),Array.isArray(Re.resourceTemplates)&&Re.resourceTemplates.length>0&&vt.push(`${Re.resourceTemplates.length} resource templates`)),De.prompts.length>0&&vt.push(`${De.prompts.length} prompts`),S("info",vt.join(", ")+"."),y("ready"),q.current=0,"success"}else return"failed"}catch(ae){S("debug",`Client connect error via ${re.toUpperCase()}:`,ae),S("debug","Connect error details:",{message:ae instanceof Error?ae.message:String(ae),stack:ae instanceof Error?ae.stack:"N/A",name:ae instanceof Error?ae.name:"Unknown",cause:ae instanceof Error?ae.cause:void 0});const Re=ae instanceof Error?ae:new Error(String(ae)),De=Re.message,vt=De.includes("404")||De.includes("Not Found"),nr=De.includes("405")||De.includes("Method Not Allowed"),st=De==="Failed to fetch"||De==="NetworkError when attempting to fetch resource."||De==="Load failed";if(re==="http"&&(vt||nr||st))return S("warn",`HTTP transport failed (${st?"CORS":vt?"404":"405"}).`),"fallback";if(Re instanceof Kn||De.includes("Unauthorized")||De.includes("401")){S("info","Authentication required."),Fl(D.current,"Auth Provider not available for auth flow");const Nn=await D.current.tokens();if(f&&!Nn)return S("info","Authentication required but auto-auth prevented. User action needed."),y("pending_auth"),"auth_redirect";N.current!=="authenticating"&&N.current!=="pending_auth"&&(y("authenticating"),H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{},Nm));try{const W=await $r(D.current,{serverUrl:t});if(!B.current)return"failed";if(W==="AUTHORIZED")return S("info","Authentication successful via existing token or refresh. Re-attempting connection..."),H.current&&clearTimeout(H.current),Z.current=!1,M(),"failed";if(W==="REDIRECT")return S("info","Redirecting for authentication. Waiting for callback..."),"auth_redirect"}catch(W){return B.current&&(H.current&&clearTimeout(H.current),R(`Failed to initiate authentication: ${W instanceof Error?W.message:String(W)}`,W instanceof Error?W:void 0)),"failed"}}return R(`Failed to connect via ${re.toUpperCase()}: ${De}`,Re),"failed"}};let pe="failed";if(console.log({transportType:d}),d==="sse")S("debug","Using SSE-only transport mode"),pe=await ee("sse");else if(d==="http")S("debug","Using HTTP-only transport mode"),pe=await ee("http");else{S("debug","Using auto transport mode (HTTP with SSE fallback)");const re=await ee("http");if(re==="fallback"&&B.current&&N.current!=="authenticating"){S("info","HTTP failed, attempting SSE fallback...");const Fe=await ee("sse");pe=Fe,Fe==="failed"&&B.current}else pe=re}(pe==="success"||pe==="failed")&&(Z.current=!1),S("debug",`Connection sequence finished with status: ${pe}`)},[S,R,E,$r,t,s,n,r,o,i.name,i.version]),K=b.useCallback(async(ee,pe)=>{if(N.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot call tool "${ee}".`);S("info",`Calling tool: ${ee}`,pe);try{const re=await U.current.request({method:"tools/call",params:{name:ee,arguments:pe}},bu);return S("info",`Tool "${ee}" call successful:`,re),re}catch(re){S("error",`Error calling tool "${ee}": ${re instanceof Error?re.message:String(re)}`,re);const Fe=re instanceof Error?re:new Error(String(re));if(Fe instanceof Kn||Fe.message.includes("Unauthorized")||Fe.message.includes("401")){S("warn","Tool call unauthorized, attempting re-authentication..."),y("authenticating"),H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{},Nm);try{Fl(D.current,"Auth Provider not available for tool re-auth");const ae=await $r(D.current,{serverUrl:t});if(!B.current)return;ae==="AUTHORIZED"?(S("info","Re-authentication successful. Retrying tool call is recommended, or reconnecting."),H.current&&clearTimeout(H.current),Z.current=!1,M()):ae==="REDIRECT"&&S("info","Redirecting for re-authentication for tool call.")}catch(ae){if(!B.current)return;H.current&&clearTimeout(H.current),R(`Re-authentication failed: ${ae instanceof Error?ae.message:String(ae)}`,ae instanceof Error?ae:void 0)}}if(N.current!=="authenticating")throw re;return}},[h,t,S,R,M]),G=b.useCallback(()=>{N.current==="failed"?(S("info","Retry requested..."),M()):S("warn",`Retry called but state is not 'failed' (state: ${N.current}). Ignoring.`)},[S,M]),le=b.useCallback(async()=>{var pe;S("info","Manual authentication requested...");const ee=N.current;if(ee==="failed")S("info","Attempting to reconnect and authenticate via retry..."),G();else if(ee==="pending_auth"){S("info","Proceeding with authentication from pending state..."),y("authenticating"),H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{},Nm);try{Fl(D.current,"Auth Provider not available for manual auth");const re=await $r(D.current,{serverUrl:t});if(!B.current)return;re==="AUTHORIZED"?(S("info","Manual authentication successful. Re-attempting connection..."),H.current&&clearTimeout(H.current),Z.current=!1,M()):re==="REDIRECT"&&S("info","Redirecting for manual authentication. Waiting for callback...")}catch(re){if(!B.current)return;H.current&&clearTimeout(H.current),R(`Manual authentication failed: ${re instanceof Error?re.message:String(re)}`,re instanceof Error?re:void 0)}}else if(ee==="authenticating"){S("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const re=(pe=D.current)==null?void 0:pe.getLastAttemptedAuthUrl();re&&!T&&(A(re),S("info","Manual authentication URL retrieved:",re))}else S("info",`Client not in a state requiring manual authentication trigger (state: ${ee}). If needed, try disconnecting and reconnecting.`)},[S,G,T,t,R,M]),se=b.useCallback(()=>{if(D.current){const ee=D.current.clearStorage();S("info",`Cleared ${ee} item(s) from localStorage for ${t}.`),A(void 0),E()}else S("warn","Auth provider not initialized, cannot clear storage.")},[t,S,E]),he=b.useCallback(async()=>{if(N.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot list resources.`);S("info","Listing resources...");try{const ee=await U.current.request({method:"resources/list"},Vf);B.current&&(v(ee.resources),k(Array.isArray(ee.resourceTemplates)?ee.resourceTemplates:[]),S("info",`Listed ${ee.resources.length} resources, ${Array.isArray(ee.resourceTemplates)?ee.resourceTemplates.length:0} resource templates.`))}catch(ee){throw S("error",`Error listing resources: ${ee instanceof Error?ee.message:String(ee)}`,ee),ee}},[h,S]),ke=b.useCallback(async ee=>{if(N.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot read resource "${ee}".`);S("info",`Reading resource: ${ee}`);try{const pe=await U.current.request({method:"resources/read",params:{uri:ee}},hx);return S("info",`Resource "${ee}" read successfully`),pe}catch(pe){throw S("error",`Error reading resource "${ee}": ${pe instanceof Error?pe.message:String(pe)}`,pe),pe}},[h,S]),tt=b.useCallback(async()=>{if(N.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot list prompts.`);S("info","Listing prompts...");try{const ee=await U.current.request({method:"prompts/list"},Hf);B.current&&(j(ee.prompts),S("info",`Listed ${ee.prompts.length} prompts.`))}catch(ee){throw S("error",`Error listing prompts: ${ee instanceof Error?ee.message:String(ee)}`,ee),ee}},[h,S]),yt=b.useCallback(async(ee,pe)=>{if(N.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot get prompt "${ee}".`);S("info",`Getting prompt: ${ee}`,pe);try{const re=await U.current.request({method:"prompts/get",params:{name:ee,arguments:pe}},vx);return S("info",`Prompt "${ee}" retrieved successfully`),re}catch(re){throw S("error",`Error getting prompt "${ee}": ${re instanceof Error?re.message:String(re)}`,re),re}},[h,S]);return b.useEffect(()=>{const ee=pe=>{var re;pe.origin===window.location.origin&&((re=pe.data)==null?void 0:re.type)==="mcp_auth_callback"&&(S("info","Received auth callback message.",pe.data),H.current&&clearTimeout(H.current),pe.data.success?(S("info","Authentication successful via popup. Reconnecting client..."),Z.current=!1,M()):R(`Authentication failed in callback: ${pe.data.error||"Unknown reason."}`))};return window.addEventListener("message",ee),S("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",ee),S("debug","Auth callback message listener removed."),H.current&&clearTimeout(H.current)}},[S,R,M]),b.useEffect(()=>(B.current=!0,S("debug","useMcp mounted, initiating connection."),q.current=0,(!D.current||D.current.serverUrl!==t)&&(D.current=new b1(t,{storageKeyPrefix:s,clientName:n,clientUri:r,callbackUrl:o,preventAutoAuth:f,onPopupWindow:p}),S("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),M(),()=>{B.current=!1,S("debug","useMcp unmounting, disconnecting."),E(!0)}),[t,s,o,n,r,i.name,i.version,M,E]),b.useEffect(()=>{let ee=null;if(h==="failed"&&l&&q.current>0){const pe=typeof l=="number"?l:Uee;S("info",`Connection failed, auto-retrying in ${pe}ms...`),ee=setTimeout(()=>{B.current&&N.current==="failed"&&G()},pe)}return()=>{ee&&clearTimeout(ee)}},[h,l,G,S]),{state:h,tools:m,resources:g,resourceTemplates:w,prompts:C,error:_,log:P,authUrl:T,callTool:K,listResources:he,readResource:ke,listPrompts:tt,getPrompt:yt,retry:G,disconnect:E,authenticate:le,clearStorage:se}}function Vee({service:e,autoConnect:t=!1,onConnected:n,onError:r}){const{toast:o}=Ht(),{state:s,tools:i,resources:a,prompts:l,error:u,authUrl:d,callTool:f,readResource:p,listResources:h,getPrompt:y,listPrompts:m,retry:x,disconnect:g,authenticate:v,clearStorage:w}=qee({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}),k=s==="ready",C=s==="connecting"||s==="loading",j=s==="authenticating"||s==="pending_auth",_=s==="failed";return Kr.useEffect(()=>{k&&n&&(n(),o({title:"Connected to MCP service",description:`Successfully connected to ${e.name}`}))},[k,n,e.name,o]),Kr.useEffect(()=>{_&&u&&r&&(r(u),o({title:"MCP connection failed",description:u,variant:"destructive"}))},[_,u,r,o]),{isConnected:k,isConnecting:C,isAuthenticating:j,hasError:_,error:u,tools:i,resources:a,prompts:l,connect:()=>{x()},disconnect:g,retry:x,authenticate:v,callTool:async(U,z)=>{try{return await f(U,z)}catch(D){const Z=D instanceof Error?D.message:"Unknown error";throw o({title:"Tool call failed",description:Z,variant:"destructive"}),D}},readResource:async U=>{try{return await p(U)}catch(z){const D=z instanceof Error?z.message:"Unknown error";throw o({title:"Resource read failed",description:D,variant:"destructive"}),z}},listResources:async()=>{try{await h()}catch(U){const z=U instanceof Error?U.message:"Unknown error";throw o({title:"Resource listing failed",description:z,variant:"destructive"}),U}},getPrompt:async(U,z)=>{try{return await y(U,z)}catch(D){const Z=D instanceof Error?D.message:"Unknown error";throw o({title:"Prompt retrieval failed",description:Z,variant:"destructive"}),D}},listPrompts:async()=>{try{await m()}catch(U){const z=U instanceof Error?U.message:"Unknown error";throw o({title:"Prompt listing failed",description:z,variant:"destructive"}),U}},authUrl:d,clearStorage:w}}function Hee(){const[e,t]=b.useState("https://api.githubcopilot.com/mcp"),[n,r]=b.useState("get_me"),[o,s]=b.useState("{}"),[i,a]=b.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:x,connect:g,disconnect:v,retry:w,authenticate:k,callTool:C,authUrl:j,clearStorage:_}=Vee({service:l,autoConnect:!1,onConnected:()=>{console.log("Connected to test MCP service")},onError:T=>{console.error("Test MCP service error:",T)}}),P=d?{status:"connecting",icon:Zb,color:"text-yellow-500"}:f?{status:"authenticating",icon:Wu,color:"text-blue-500"}:u?{status:"connected",icon:Lg,color:"text-green-500"}:p?{status:"error",icon:Kb,color:"text-red-500"}:{status:"disconnected",icon:Kb,color:"text-gray-500"},$=async()=>{try{let T={};o.trim()&&(T=JSON.parse(o));const A=await C(n,T);a(JSON.stringify(A,null,2))}catch(T){a(`Error: ${T instanceof Error?T.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(es,{children:[c.jsxs(Gs,{children:[c.jsxs(Js,{className:"flex items-center gap-2",children:[c.jsx(P.icon,{className:`w-5 h-5 ${P.color}`}),"Connection Status: ",P.status]}),c.jsx(Ld,{children:"Current connection state and available actions"})]}),c.jsxs(ts,{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(Be,{children:"Service URL"}),c.jsx(Xe,{value:e,onChange:T=>t(T.target.value),placeholder:"Enter MCP service URL"})]}),c.jsxs("div",{className:"flex gap-2",children:[!u&&!d&&c.jsx(ne,{onClick:g,children:"Connect"}),u&&c.jsx(ne,{onClick:v,variant:"outline",children:"Disconnect"}),p&&c.jsxs(ne,{onClick:w,variant:"outline",children:[c.jsx(Zb,{className:"w-4 h-4 mr-1"}),"Retry"]}),j&&!u&&c.jsxs(ne,{onClick:k,variant:"outline",children:[c.jsx(Wu,{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(YE,{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(es,{children:[c.jsx(Gs,{children:c.jsxs(Js,{className:"flex items-center gap-2",children:[c.jsx(e0,{className:"w-4 h-4"}),"Tools (",y.length,")"]})}),c.jsx(ts,{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((T,A)=>c.jsx("div",{className:"text-sm",children:c.jsx(Xt,{variant:"outline",className:"text-xs",children:T.name})},A)),y.length>5&&c.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",y.length-5," more tools"]})]})})]}),c.jsxs(es,{children:[c.jsx(Gs,{children:c.jsxs(Js,{children:["Resources (",m.length,")"]})}),c.jsx(ts,{children:c.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${m.length} resources available`:"Connect to see resources"})})]}),c.jsxs(es,{children:[c.jsx(Gs,{children:c.jsxs(Js,{children:["Prompts (",x.length,")"]})}),c.jsx(ts,{children:c.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${x.length} prompts available`:"Connect to see prompts"})})]})]}),u&&c.jsxs(es,{children:[c.jsxs(Gs,{children:[c.jsx(Js,{children:"Test Tool Call"}),c.jsx(Ld,{children:"Test calling a tool on the connected MCP service"})]}),c.jsxs(ts,{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(Be,{htmlFor:"toolName",children:"Tool Name"}),c.jsx(Xe,{id:"toolName",value:n,onChange:T=>r(T.target.value),placeholder:"e.g., get_me"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Be,{htmlFor:"toolArgs",children:"Arguments (JSON)"}),c.jsx(Xe,{id:"toolArgs",value:o,onChange:T=>s(T.target.value),placeholder:'{"key": "value"}'})]})]}),c.jsxs(ne,{onClick:$,disabled:!u,children:[c.jsx(f4,{className:"w-4 h-4 mr-1"}),"Call Tool"]}),i&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(Be,{children:"Result"}),c.jsx(_o,{value:i,readOnly:!0,rows:10,className:"font-mono text-sm"})]})]})]}),j&&c.jsxs(es,{children:[c.jsxs(Gs,{children:[c.jsxs(Js,{className:"flex items-center gap-2",children:[c.jsx(Wu,{className:"w-4 h-4"}),"OAuth Authentication"]}),c.jsx(Ld,{children:"This service requires OAuth authentication"})]}),c.jsxs(ts,{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(ne,{onClick:k,variant:"outline",children:[c.jsx(Wu,{className:"w-4 h-4 mr-1"}),"Start OAuth Flow"]}),c.jsx(ne,{onClick:_,variant:"outline",children:"Clear OAuth Data"})]})]})]})]})}function yR(e){return e.before.title!==e.after.title||e.before.body!==e.after.body||e.before.triggers.join(`
472
- `)!==e.after.triggers.join(`
473
- `)}class Bee{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const s=this.castInput(t,r),i=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(a,l,r,o)}diffWithOptionsObj(t,n,r,o){var s;const i=v=>{if(v=this.postProcess(v,r),o){setTimeout(function(){o(v)},0);return}else return v},a=n.length,l=t.length;let u=1,d=a+l;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s: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>=a)return i(this.buildValues(h[0].lastComponent,n,t));let m=-1/0,x=1/0;const g=()=>{for(let v=Math.max(m,-u);v<=Math.min(x,u);v+=2){let w;const k=h[v-1],C=h[v+1];k&&(h[v-1]=void 0);let j=!1;if(C){const I=C.oldPos-v;j=C&&0<=I&&I<a}const _=k&&k.oldPos+1<l;if(!j&&!_){h[v]=void 0;continue}if(!_||j&&k.oldPos<C.oldPos?w=this.addToPath(C,!0,!1,0,r):w=this.addToPath(k,!1,!0,1,r),y=this.extractCommon(w,n,t,v,r),w.oldPos+1>=l&&y+1>=a)return i(this.buildValues(w.lastComponent,n,t))||!0;h[v]=w,w.oldPos+1>=l&&(x=Math.min(x,v-1)),y+1>=a&&(m=Math.max(m,v+1))}u++};if(o)(function v(){setTimeout(function(){if(u>d||Date.now()>p)return o(void 0);g()||v()},0)})();else for(;u<=d&&Date.now()<=p;){const v=g();if(v)return v}}addToPath(t,n,r,o,s){const i=t.lastComponent;return i&&!s.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,o,s){const i=n.length,a=r.length;let l=t.oldPos,u=l-o,d=0;for(;u+1<i&&l+1<a&&this.equals(r[l+1],n[u+1],s);)u++,l++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.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 o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const i=o.length;let a=0,l=0,u=0;for(;a<i;a++){const d=o[a];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 o}}class Kee extends Bee{constructor(){super(...arguments),this.tokenize=Qee}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
474
- `))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
475
- `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
476
- `)&&(t=t.slice(0,-1)),n.endsWith(`
477
- `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const Wee=new Kee;function Zee(e,t,n){return Wee.diff(e,t,n)}function Qee(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
478
- `));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const s=r[o];o%2&&!t.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}const jm=3,Gee=10;function Jee(e){return e===""?[]:e.replace(/\n$/,"").split(`
479
- `)}function Yee(e,t){const n=Zee(e,t),r=[];let o=1,s=1;for(const i of n){const a=Jee(i.value);if(!i.added&&!i.removed&&a.length>=Gee){const u=a.slice(0,jm),d=a.slice(-jm),f=a.length-jm*2;for(const p of u)r.push({kind:"unchanged",text:p,oldLine:o++,newLine:s++});f>0&&(r.push({kind:"ellipsis",text:`${f} unchanged lines`}),o+=f,s+=f);for(const p of d)r.push({kind:"unchanged",text:p,oldLine:o++,newLine:s++});continue}for(const u of a)i.added?r.push({kind:"added",text:u,newLine:s++}):i.removed?r.push({kind:"removed",text:u,oldLine:o++}):r.push({kind:"unchanged",text:u,oldLine:o++,newLine:s++})}return r}function Xee(e){return e.some(t=>t.kind==="added"||t.kind==="removed")}const pw="max-w-full overflow-x-auto rounded-md border border-gray-800 bg-gray-950 font-mono text-xs leading-5";function ete(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 tte(e){switch(e){case"added":return"+";case"removed":return"-";case"ellipsis":return"…";default:return" "}}function nte({rows:e,emptyLabel:t}){return e.length===0?c.jsx("p",{className:"text-sm text-gray-500",children:t}):c.jsx("div",{className:pw,children:e.map((n,r)=>c.jsxs("div",{className:`grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] gap-0 ${ete(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:tte(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 rte({before:e,after:t}){const n=e.filter(o=>!t.includes(o)),r=t.filter(o=>!e.includes(o));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:`${pw} p-0`,children:[n.map(o=>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:o})]})]},`removed-${o}`)),r.map(o=>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:o})]})]},`added-${o}`))]})]})}function ote({preview:e}){const t=yR(e),n=Yee(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))&&Xee(n),o=e.before.title!==e.after.title,s=e.before.triggers.join(`
480
- `)!==e.after.triggers.join(`
481
- `);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."}),o&&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:`${pw} 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(nte,{rows:n,emptyLabel:"No body changes."})]}),s&&c.jsx(rte,{before:e.before.triggers,after:e.after.triggers})]})}function ste(e){if(!e)return[];try{return JSON.parse(e)}catch{return[]}}function ite({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(Xt,{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 md=8,ate=[{value:"proposed",label:"Waiting"},{value:"accepted",label:"Accepted"},{value:"rejected",label:"Rejected"},{value:"stale",label:"Stale"},{value:"all",label:"All"}];function lte(e){if(!e.evidenceJson)return null;try{return JSON.parse(e.evidenceJson)}catch{return null}}function b_(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"stale":return"border-amber-500/40 text-amber-200"}}function cte(){const[e,t]=b.useState(null),[n,r]=b.useState(""),[o,s]=b.useState(!1),[i,a]=b.useState("proposed"),[l,u]=b.useState(0),{toast:d}=Ht(),f=Zt();function p(D){t(D),r(""),s(!1)}function h(D){a(D),u(0),t(null),r(""),s(!1)}const{data:y=[]}=ut({queryKey:["/api/playbook-patches","proposed"],queryFn:()=>Gg("proposed")}),m=i==="all"?void 0:i,{data:x=[],isLoading:g}=ut({queryKey:["/api/playbook-patches",i],queryFn:()=>Gg(m)}),v=Math.max(1,Math.ceil(x.length/md)),w=Math.min(l,v-1),k=b.useMemo(()=>{const D=w*md;return x.slice(D,D+md)},[x,w]);b.useEffect(()=>{l!==w&&u(w)},[l,w]);const{data:C,isLoading:j,isError:_,error:I}=ut({queryKey:["/api/playbook-patches",e,"preview"],queryFn:()=>a3(e),enabled:!!e}),P=C?yR(C):!1,$=x.find(D=>D.id===e)??null,T=($==null?void 0:$.status)==="proposed",A=dt({mutationFn:D=>l3(D),onSuccess:()=>{d({title:"Patch accepted"}),t(null),r(""),s(!1),f.invalidateQueries({queryKey:["/api/playbook-patches"]}),f.invalidateQueries({queryKey:["/api/playbooks"]}),f.invalidateQueries({queryKey:["/api/feedback-signals"]})},onError:D=>{d({title:"Accept failed",description:D.message,variant:"destructive"})}}),U=dt({mutationFn:({id:D,reason:Z})=>c3(D,Z),onSuccess:()=>{d({title:"Patch rejected"}),t(null),r(""),s(!1),f.invalidateQueries({queryKey:["/api/playbook-patches"]}),f.invalidateQueries({queryKey:["/api/feedback-signals"]})},onError:D=>{d({title:"Reject failed",description:D.message,variant:"destructive"})}}),z=i==="proposed"?"No proposals waiting for review.":i==="all"?"No playbook patches yet.":`No ${i} 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(Ya,{href:"/",children:c.jsxs(ne,{variant:"ghost",size:"sm",className:"text-gray-300",children:[c.jsx(WE,{className:"mr-1 h-4 w-4"}),"Deck"]})}),c.jsx("h1",{className:"text-lg font-semibold",children:"Playbook review queue"}),c.jsxs(Xt,{variant:"secondary",children:[y.length," waiting"]}),c.jsx(Ya,{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:ate.map(({value:D,label:Z})=>{const B=i===D;return c.jsx(ne,{size:"sm",variant:B?"gold":"outline",className:B?void 0:"border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800 hover:text-gray-100","aria-pressed":B,onClick:()=>h(D),children:Z},D)})}),c.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[g&&c.jsx("p",{className:"text-sm text-gray-500",children:"Loading…"}),!g&&x.length===0&&c.jsx("p",{className:"text-sm text-gray-500",children:z}),c.jsx("ul",{className:"space-y-2",children:k.map(D=>c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>p(D.id),className:`w-full rounded-lg border p-3 text-left transition ${e===D.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:D.kind==="create"?`New: ${D.displayTitle}`:D.displayTitle}),D.playbookId&&D.kind!=="create"&&c.jsx("span",{className:"mt-0.5 block truncate font-mono text-xs text-gray-600",children:D.playbookId}),kk(D.deckNames)&&c.jsxs("span",{className:"mt-1 block text-xs text-gray-500",children:["Decks: ",kk(D.deckNames)]})]}),c.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[c.jsx(Xt,{variant:"outline",className:"shrink-0",children:D.kind}),i!=="proposed"&&c.jsx(Xt,{variant:"outline",className:`shrink-0 ${b_(D.status)}`,children:D.status})]})]}),c.jsx("p",{className:"mt-1 line-clamp-2 text-sm text-gray-400",children:D.rationale}),c.jsxs("p",{className:"mt-1 text-xs text-gray-600",children:[D.source," · ",new Date(D.createdAt).toLocaleString()]})]})},D.id))})]}),x.length>md&&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(ne,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800",disabled:w<=0,onClick:()=>u(D=>Math.max(0,D-1)),children:[c.jsx(GE,{className:"mr-1 h-4 w-4"}),"Newer"]}),c.jsxs("span",{className:"text-xs text-gray-500",children:[w+1," / ",v,c.jsxs("span",{className:"ml-1 text-gray-600",children:["(",x.length,")"]})]}),c.jsxs(ne,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800",disabled:w>=v-1,onClick:()=>u(D=>Math.min(v-1,D+1)),children:["Older",c.jsx(JE,{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.jsx("p",{className:"text-sm text-gray-500",children:"Select a proposal to preview the diff."}),$&&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(Xt,{variant:"outline",className:b_($.status),children:$.status}),$.resolvedAt&&c.jsxs("span",{className:"text-xs text-gray-500",children:["Resolved ",new Date($.resolvedAt).toLocaleString()]})]}),c.jsx("p",{className:"text-sm leading-relaxed text-gray-300",children:$.rationale}),$.status==="rejected"&&$.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:$.rejectionReason})]}),(()=>{const D=lte($);return D?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:["“",D.user_feedback_excerpt,"”"]}),D.failure_summary&&c.jsx("p",{className:"mt-2 text-gray-400",children:D.failure_summary})]}):null})(),(()=>{const D=ste($.conflictsJson),Z=(C==null?void 0:C.trigger_conflicts)??[],B=Z.length>0?Z:D;return c.jsx(ite,{conflicts:B})})(),j&&c.jsx("p",{className:"text-sm text-gray-500",children:"Loading preview…"}),_&&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 —"," ",(I==null?void 0:I.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."]}),C&&c.jsx(ote,{preview: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(ne,{variant:"gold",onClick:()=>A.mutate($.id),disabled:A.isPending||_||!P,children:"Accept"}),c.jsx(ne,{variant:o?"secondary":"destructive",onClick:()=>{s(D=>(D&&r(""),!D))},disabled:U.isPending,children:o?"Cancel reject":"Reject"})]}),o&&c.jsxs("div",{className:"space-y-2 rounded-md border border-gray-800 bg-gray-900/80 p-3",children:[c.jsx(_o,{autoFocus:!0,placeholder:"Rejection reason (required)",value:n,onChange:D=>r(D.target.value),className:"min-h-[88px] bg-gray-950"}),c.jsx(ne,{variant:"destructive",disabled:!n.trim()||U.isPending,onClick:()=>U.mutate({id:$.id,reason:n.trim()}),children:"Confirm 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 ",$.status,". Switch to Waiting to review open proposals."]})]})]})]})]})}const k_="border-[#C4B643] data-[state=checked]:bg-[#C4B643] data-[state=checked]:text-[#0A0A07] data-[state=indeterminate]:bg-[#C4B643] data-[state=indeterminate]:text-[#0A0A07]";function ute(){const{toast:e}=Ht(),t=Zt(),[n,r]=b.useState("open"),[o,s]=b.useState(""),[i,a]=b.useState(!1),[l,u]=b.useState(new Set),{data:d}=ut({queryKey:["/api/playbooks/vault"]}),f=(d==null?void 0:d.data)??[],p=b.useMemo(()=>{const _=new Map;for(const I of f)_.set(I.id,I.title);return _},[f]),h={status:n==="all"?void 0:n,playbookId:o||void 0,excludeInProposal:n==="open"?!i:void 0},{data:y=[],isLoading:m}=ut({queryKey:["/api/feedback-signals",h],queryFn:()=>d3(h)}),x=dt({mutationFn:_=>f3(_),onSuccess:_=>{e({title:`Discarded ${_.discarded} signal(s)`}),u(new Set),t.invalidateQueries({queryKey:["/api/feedback-signals"]})},onError:_=>{e({title:"Discard failed",description:_.message,variant:"destructive"})}}),g=_=>{u(I=>{const P=new Set(I);return P.has(_)?P.delete(_):P.add(_),P})},v=async()=>{const _=l.size>0?y.filter(I=>l.has(I.id)):y;if(_.length!==0){if(_.some(I=>!I.id)){e({title:"Copy blocked",description:"Every signal must include an id for tracking.",variant:"destructive"});return}try{await navigator.clipboard.writeText(m3(_)),e({title:"Copied curation prompt",description:`${_.length} signal id(s) included — paste into your IDE agent.`})}catch(I){e({title:"Copy failed",description:I instanceof Error?I.message:"Clipboard unavailable",variant:"destructive"})}}},w=[...l].filter(_=>{const I=y.find(P=>P.id===_);return(I==null?void 0:I.status)==="open"}),k=y.length>0&&y.every(_=>l.has(_.id)),C=y.some(_=>l.has(_.id)),j=()=>{if(k){u(new Set);return}u(new Set(y.map(_=>_.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(Ya,{href:"/",children:c.jsxs(ne,{variant:"ghost",size:"sm",className:"text-gray-300",children:[c.jsx(WE,{className:"mr-1 h-4 w-4"}),"Home"]})}),c.jsx("h1",{className:"text-lg font-semibold",children:"Feedback"}),c.jsx(Xt,{variant:"outline",children:y.length}),c.jsx(Ya,{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:o,onChange:_=>{s(_.target.value),u(new Set)},children:[c.jsx("option",{value:"",children:"All"}),f.map(_=>c.jsx("option",{value:_.id,children:_.title},_.id))]})]}),c.jsx("div",{className:"flex flex-wrap gap-1",children:[["open","Open"],["actioned","Actioned"],["discarded","Discarded"],["all","All"]].map(([_,I])=>{const P=n===_;return c.jsx(ne,{size:"sm",variant:P?"gold":"outline",className:P?void 0:"border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800 hover:text-gray-100","aria-pressed":P,onClick:()=>{r(_),u(new Set)},children:I},_)})}),n==="open"&&c.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-400",children:[c.jsx("input",{type:"checkbox",checked:i,onChange:_=>a(_.target.checked)}),"Include already in an open proposal"]}),c.jsxs("div",{className:"ml-auto flex flex-wrap gap-2",children:[c.jsxs(ne,{size:"sm",variant:"outline",disabled:y.length===0,onClick:()=>void v(),children:[c.jsx(Xv,{className:"mr-1 h-3.5 w-3.5"}),"Copy for agent",l.size>0?` (${l.size})`:""]}),c.jsxs(ne,{size:"sm",variant:"destructive",disabled:w.length===0||x.isPending,onClick:()=>x.mutate(w),children:[c.jsx(su,{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($f,{checked:k?!0:C?"indeterminate":!1,onCheckedChange:j,"aria-label":"Select all visible signals",disabled:y.length===0,className:k_})}),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(_=>{const I=h3(_);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($f,{checked:l.has(_.id),onCheckedChange:()=>g(_.id),"aria-label":`Select ${_.id}`,className:k_})}),c.jsxs("td",{className:"px-3 py-2",children:[c.jsx("p",{className:"font-mono text-[11px] text-gray-600",children:_.id}),c.jsxs("p",{className:"text-gray-200",children:["“",_.userFeedbackExcerpt,"”"]}),I&&c.jsx(Xt,{variant:"outline",className:"mt-1 text-[10px]",children:"In proposal"})]}),c.jsx("td",{className:"px-3 py-2 text-gray-400",children:_.failureSummary}),c.jsx("td",{className:"px-3 py-2 text-gray-300",children:_.candidatePlaybookId?p.get(_.candidatePlaybookId)??_.candidatePlaybookId:"—"}),c.jsx("td",{className:"px-3 py-2 text-gray-500",children:_.source}),c.jsx("td",{className:"px-3 py-2 whitespace-nowrap text-gray-500",children:new Date(_.createdAt).toLocaleString()})]},_.id)})})]})})]})]})}function dte(){return c.jsxs(_O,{children:[c.jsx(qi,{path:"/",component:cH}),c.jsx(qi,{path:"/oauth/callback",component:fH}),c.jsx(qi,{path:"/playbook-patches",component:cte}),c.jsx(qi,{path:"/feedback-signals",component:ute}),c.jsx(qi,{path:"/mcp-test",component:Hee}),c.jsx(qi,{component:dH})]})}function fte(){return c.jsx(HO,{client:sM,children:c.jsxs(ML,{children:[c.jsx(Y4,{}),c.jsx(dte,{})]})})}BC(document.getElementById("root")).render(c.jsx(b.StrictMode,{children:c.jsx(fte,{})}));