@agent-deck/backend 1.3.0 → 1.3.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.
Files changed (38) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/cli-runtime.d.ts +23 -1
  3. package/dist/cli-runtime.d.ts.map +1 -1
  4. package/dist/cli-runtime.js +54 -1
  5. package/dist/cli-runtime.js.map +1 -1
  6. package/dist/export-import/export-bundle.d.ts +9 -0
  7. package/dist/export-import/export-bundle.d.ts.map +1 -0
  8. package/dist/export-import/export-bundle.js +78 -0
  9. package/dist/export-import/export-bundle.js.map +1 -0
  10. package/dist/export-import/import-bundle.d.ts +8 -0
  11. package/dist/export-import/import-bundle.d.ts.map +1 -0
  12. package/dist/export-import/import-bundle.js +267 -0
  13. package/dist/export-import/import-bundle.js.map +1 -0
  14. package/dist/export-import/index.d.ts +4 -0
  15. package/dist/export-import/index.d.ts.map +1 -0
  16. package/dist/export-import/index.js +15 -0
  17. package/dist/export-import/index.js.map +1 -0
  18. package/dist/export-import/sanitize-for-export.d.ts +8 -0
  19. package/dist/export-import/sanitize-for-export.d.ts.map +1 -0
  20. package/dist/export-import/sanitize-for-export.js +75 -0
  21. package/dist/export-import/sanitize-for-export.js.map +1 -0
  22. package/dist/models/database.d.ts +8 -0
  23. package/dist/models/database.d.ts.map +1 -1
  24. package/dist/models/database.js +151 -67
  25. package/dist/models/database.js.map +1 -1
  26. package/dist/routes/export-import.d.ts +3 -0
  27. package/dist/routes/export-import.d.ts.map +1 -0
  28. package/dist/routes/export-import.js +52 -0
  29. package/dist/routes/export-import.js.map +1 -0
  30. package/dist/server/index.d.ts.map +1 -1
  31. package/dist/server/index.js +2 -0
  32. package/dist/server/index.js.map +1 -1
  33. package/package.json +2 -2
  34. package/static-ui/assets/index-BkYGH65z.js +420 -0
  35. package/static-ui/assets/index-DMYIwycS.css +1 -0
  36. package/static-ui/index.html +2 -2
  37. package/static-ui/assets/index-CQoBRW1p.js +0 -409
  38. package/static-ui/assets/index-wleyGzod.css +0 -1
@@ -1,409 +0,0 @@
1
- var t$=Object.defineProperty;var c0=e=>{throw TypeError(e)};var r$=(e,t,r)=>t in e?t$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ln=(e,t,r)=>r$(e,typeof t!="symbol"?t+"":t,r),Bf=(e,t,r)=>t.has(e)||c0("Cannot "+r);var R=(e,t,r)=>(Bf(e,t,"read from private field"),r?r.call(e):t.get(e)),ge=(e,t,r)=>t.has(e)?c0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ne=(e,t,r,n)=>(Bf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ne=(e,t,r)=>(Bf(e,t,"access private method"),r);var $c=(e,t,r,n)=>({set _(s){ne(e,t,s,r)},get _(){return R(e,t,n)}});function n$(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(n,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>n[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();function Bd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $b={exports:{}},Wd={},Pb={exports:{}},Re={};/**
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 ic=Symbol.for("react.element"),s$=Symbol.for("react.portal"),o$=Symbol.for("react.fragment"),i$=Symbol.for("react.strict_mode"),a$=Symbol.for("react.profiler"),l$=Symbol.for("react.provider"),c$=Symbol.for("react.context"),u$=Symbol.for("react.forward_ref"),d$=Symbol.for("react.suspense"),f$=Symbol.for("react.memo"),h$=Symbol.for("react.lazy"),u0=Symbol.iterator;function p$(e){return e===null||typeof e!="object"?null:(e=u0&&e[u0]||e["@@iterator"],typeof e=="function"?e:null)}var Tb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Rb=Object.assign,Ib={};function Ca(e,t,r){this.props=e,this.context=t,this.refs=Ib,this.updater=r||Tb}Ca.prototype.isReactComponent={};Ca.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")};Ca.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ab(){}Ab.prototype=Ca.prototype;function ng(e,t,r){this.props=e,this.context=t,this.refs=Ib,this.updater=r||Tb}var sg=ng.prototype=new Ab;sg.constructor=ng;Rb(sg,Ca.prototype);sg.isPureReactComponent=!0;var d0=Array.isArray,Ob=Object.prototype.hasOwnProperty,og={current:null},Mb={key:!0,ref:!0,__self:!0,__source:!0};function Db(e,t,r){var n,s={},o=null,i=null;if(t!=null)for(n in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Ob.call(t,n)&&!Mb.hasOwnProperty(n)&&(s[n]=t[n]);var a=arguments.length-2;if(a===1)s.children=r;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(n in a=e.defaultProps,a)s[n]===void 0&&(s[n]=a[n]);return{$$typeof:ic,type:e,key:o,ref:i,props:s,_owner:og.current}}function m$(e,t){return{$$typeof:ic,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ig(e){return typeof e=="object"&&e!==null&&e.$$typeof===ic}function g$(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var f0=/\/+/g;function Wf(e,t){return typeof e=="object"&&e!==null&&e.key!=null?g$(""+e.key):t.toString(36)}function mu(e,t,r,n,s){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case ic:case s$:i=!0}}if(i)return i=e,s=s(i),e=n===""?"."+Wf(i,0):n,d0(s)?(r="",e!=null&&(r=e.replace(f0,"$&/")+"/"),mu(s,t,r,"",function(u){return u})):s!=null&&(ig(s)&&(s=m$(s,r+(!s.key||i&&i.key===s.key?"":(""+s.key).replace(f0,"$&/")+"/")+e)),t.push(s)),1;if(i=0,n=n===""?".":n+":",d0(e))for(var a=0;a<e.length;a++){o=e[a];var c=n+Wf(o,a);i+=mu(o,t,r,c,s)}else if(c=p$(e),typeof c=="function")for(e=c.call(e),a=0;!(o=e.next()).done;)o=o.value,c=n+Wf(o,a++),i+=mu(o,t,r,c,s);else if(o==="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 Pc(e,t,r){if(e==null)return e;var n=[],s=0;return mu(e,n,"","",function(o){return t.call(r,o,s++)}),n}function v$(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var sr={current:null},gu={transition:null},y$={ReactCurrentDispatcher:sr,ReactCurrentBatchConfig:gu,ReactCurrentOwner:og};function zb(){throw Error("act(...) is not supported in production builds of React.")}Re.Children={map:Pc,forEach:function(e,t,r){Pc(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Pc(e,function(){t++}),t},toArray:function(e){return Pc(e,function(t){return t})||[]},only:function(e){if(!ig(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Re.Component=Ca;Re.Fragment=o$;Re.Profiler=a$;Re.PureComponent=ng;Re.StrictMode=i$;Re.Suspense=d$;Re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=y$;Re.act=zb;Re.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=Rb({},e.props),s=e.key,o=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,i=og.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(c in t)Ob.call(t,c)&&!Mb.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&a!==void 0?a[c]:t[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];n.children=a}return{$$typeof:ic,type:e.type,key:s,ref:o,props:n,_owner:i}};Re.createContext=function(e){return e={$$typeof:c$,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:l$,_context:e},e.Consumer=e};Re.createElement=Db;Re.createFactory=function(e){var t=Db.bind(null,e);return t.type=e,t};Re.createRef=function(){return{current:null}};Re.forwardRef=function(e){return{$$typeof:u$,render:e}};Re.isValidElement=ig;Re.lazy=function(e){return{$$typeof:h$,_payload:{_status:-1,_result:e},_init:v$}};Re.memo=function(e,t){return{$$typeof:f$,type:e,compare:t===void 0?null:t}};Re.startTransition=function(e){var t=gu.transition;gu.transition={};try{e()}finally{gu.transition=t}};Re.unstable_act=zb;Re.useCallback=function(e,t){return sr.current.useCallback(e,t)};Re.useContext=function(e){return sr.current.useContext(e)};Re.useDebugValue=function(){};Re.useDeferredValue=function(e){return sr.current.useDeferredValue(e)};Re.useEffect=function(e,t){return sr.current.useEffect(e,t)};Re.useId=function(){return sr.current.useId()};Re.useImperativeHandle=function(e,t,r){return sr.current.useImperativeHandle(e,t,r)};Re.useInsertionEffect=function(e,t){return sr.current.useInsertionEffect(e,t)};Re.useLayoutEffect=function(e,t){return sr.current.useLayoutEffect(e,t)};Re.useMemo=function(e,t){return sr.current.useMemo(e,t)};Re.useReducer=function(e,t,r){return sr.current.useReducer(e,t,r)};Re.useRef=function(e){return sr.current.useRef(e)};Re.useState=function(e){return sr.current.useState(e)};Re.useSyncExternalStore=function(e,t,r){return sr.current.useSyncExternalStore(e,t,r)};Re.useTransition=function(){return sr.current.useTransition()};Re.version="18.3.1";Pb.exports=Re;var w=Pb.exports;const yn=Bd(w),ag=n$({__proto__:null,default:yn},[w]);/**
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 w$=w,x$=Symbol.for("react.element"),b$=Symbol.for("react.fragment"),_$=Object.prototype.hasOwnProperty,S$=w$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,k$={key:!0,ref:!0,__self:!0,__source:!0};function Lb(e,t,r){var n,s={},o=null,i=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(n in t)_$.call(t,n)&&!k$.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)s[n]===void 0&&(s[n]=t[n]);return{$$typeof:x$,type:e,key:o,ref:i,props:s,_owner:S$.current}}Wd.Fragment=b$;Wd.jsx=Lb;Wd.jsxs=Lb;$b.exports=Wd;var l=$b.exports,Fb={exports:{}},Nr={},Ub={exports:{}},qb={};/**
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,V){var z=q.length;q.push(V);e:for(;0<z;){var I=z-1>>>1,F=q[I];if(0<s(F,V))q[I]=V,q[z]=F,z=I;else break e}}function r(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var V=q[0],z=q.pop();if(z!==V){q[0]=z;e:for(var I=0,F=q.length,N=F>>>1;I<N;){var S=2*(I+1)-1,E=q[S],D=S+1,K=q[D];if(0>s(E,z))D<F&&0>s(K,E)?(q[I]=K,q[D]=z,I=D):(q[I]=E,q[S]=z,I=S);else if(D<F&&0>s(K,z))q[I]=K,q[D]=z,I=D;else break e}}return V}function s(q,V){var z=q.sortIndex-V.sortIndex;return z!==0?z:q.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var c=[],u=[],d=1,f=null,g=3,v=!1,b=!1,p=!1,y=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(q){for(var V=r(u);V!==null;){if(V.callback===null)n(u);else if(V.startTime<=q)n(u),V.sortIndex=V.expirationTime,t(c,V);else break;V=r(u)}}function _(q){if(p=!1,x(q),!b)if(r(c)!==null)b=!0,H(C);else{var V=r(u);V!==null&&G(_,V.startTime-q)}}function C(q,V){b=!1,p&&(p=!1,m(O),O=-1),v=!0;var z=g;try{for(x(V),f=r(c);f!==null&&(!(f.expirationTime>V)||q&&!j());){var I=f.callback;if(typeof I=="function"){f.callback=null,g=f.priorityLevel;var F=I(f.expirationTime<=V);V=e.unstable_now(),typeof F=="function"?f.callback=F:f===r(c)&&n(c),x(V)}else n(c);f=r(c)}if(f!==null)var N=!0;else{var S=r(u);S!==null&&G(_,S.startTime-V),N=!1}return N}finally{f=null,g=z,v=!1}}var T=!1,$=null,O=-1,M=5,U=-1;function j(){return!(e.unstable_now()-U<M)}function k(){if($!==null){var q=e.unstable_now();U=q;var V=!0;try{V=$(!0,q)}finally{V?L():(T=!1,$=null)}}else T=!1}var L;if(typeof h=="function")L=function(){h(k)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,B=P.port2;P.port1.onmessage=k,L=function(){B.postMessage(null)}}else L=function(){y(k,0)};function H(q){$=q,T||(T=!0,L())}function G(q,V){O=y(function(){q(e.unstable_now())},V)}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(){b||v||(b=!0,H(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"):M=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(q){switch(g){case 1:case 2:case 3:var V=3;break;default:V=g}var z=g;g=V;try{return q()}finally{g=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(q,V){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var z=g;g=q;try{return V()}finally{g=z}},e.unstable_scheduleCallback=function(q,V,z){var I=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?I+z:I):z=I,q){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=z+F,q={id:d++,callback:V,priorityLevel:q,startTime:z,expirationTime:F,sortIndex:-1},z>I?(q.sortIndex=z,t(u,q),r(c)===null&&q===r(u)&&(p?(m(O),O=-1):p=!0,G(_,z-I))):(q.sortIndex=F,t(c,q),b||v||(b=!0,H(C))),q},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(q){var V=g;return function(){var z=g;g=V;try{return q.apply(this,arguments)}finally{g=z}}}})(qb);Ub.exports=qb;var C$=Ub.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 E$=w,Er=C$;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);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 Vb=new Set,Rl={};function si(e,t){ca(e,t),ca(e+"Capture",t)}function ca(e,t){for(Rl[e]=t,e=0;e<t.length;e++)Vb.add(t[e])}var ns=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yh=Object.prototype.hasOwnProperty,N$=/^[: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]*$/,h0={},p0={};function j$(e){return Yh.call(p0,e)?!0:Yh.call(h0,e)?!1:N$.test(e)?p0[e]=!0:(h0[e]=!0,!1)}function $$(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function P$(e,t,r,n){if(t===null||typeof t>"u"||$$(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.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 or(e,t,r,n,s,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var Lt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Lt[e]=new or(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Lt[t]=new or(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Lt[e]=new or(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Lt[e]=new or(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){Lt[e]=new or(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Lt[e]=new or(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Lt[e]=new or(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Lt[e]=new or(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Lt[e]=new or(e,5,!1,e.toLowerCase(),null,!1,!1)});var lg=/[\-:]([a-z])/g;function cg(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(lg,cg);Lt[t]=new or(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(lg,cg);Lt[t]=new or(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(lg,cg);Lt[t]=new or(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Lt[e]=new or(e,1,!1,e.toLowerCase(),null,!1,!1)});Lt.xlinkHref=new or("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Lt[e]=new or(e,1,!1,e.toLowerCase(),null,!0,!0)});function ug(e,t,r,n){var s=Lt.hasOwnProperty(t)?Lt[t]:null;(s!==null?s.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(P$(t,r,s,n)&&(r=null),n||s===null?j$(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):s.mustUseProperty?e[s.propertyName]=r===null?s.type===3?!1:"":r:(t=s.attributeName,n=s.attributeNamespace,r===null?e.removeAttribute(t):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var us=E$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Tc=Symbol.for("react.element"),_i=Symbol.for("react.portal"),Si=Symbol.for("react.fragment"),dg=Symbol.for("react.strict_mode"),Xh=Symbol.for("react.profiler"),Hb=Symbol.for("react.provider"),Kb=Symbol.for("react.context"),fg=Symbol.for("react.forward_ref"),ep=Symbol.for("react.suspense"),tp=Symbol.for("react.suspense_list"),hg=Symbol.for("react.memo"),xs=Symbol.for("react.lazy"),Bb=Symbol.for("react.offscreen"),m0=Symbol.iterator;function Ua(e){return e===null||typeof e!="object"?null:(e=m0&&e[m0]||e["@@iterator"],typeof e=="function"?e:null)}var dt=Object.assign,Zf;function tl(e){if(Zf===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Zf=t&&t[1]||""}return`
34
- `+Zf+e}var Gf=!1;function Qf(e,t){if(!e||Gf)return"";Gf=!0;var r=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 n=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){n=u}e.call(t.prototype)}else{try{throw Error()}catch(u){n=u}e()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
35
- `),o=n.stack.split(`
36
- `),i=s.length-1,a=o.length-1;1<=i&&0<=a&&s[i]!==o[a];)a--;for(;1<=i&&0<=a;i--,a--)if(s[i]!==o[a]){if(i!==1||a!==1)do if(i--,a--,0>a||s[i]!==o[a]){var c=`
37
- `+s[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=a);break}}}finally{Gf=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?tl(e):""}function T$(e){switch(e.tag){case 5:return tl(e.type);case 16:return tl("Lazy");case 13:return tl("Suspense");case 19:return tl("SuspenseList");case 0:case 2:case 15:return e=Qf(e.type,!1),e;case 11:return e=Qf(e.type.render,!1),e;case 1:return e=Qf(e.type,!0),e;default:return""}}function rp(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 Si:return"Fragment";case _i:return"Portal";case Xh:return"Profiler";case dg:return"StrictMode";case ep:return"Suspense";case tp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Kb:return(e.displayName||"Context")+".Consumer";case Hb:return(e._context.displayName||"Context")+".Provider";case fg:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case hg:return t=e.displayName||null,t!==null?t:rp(e.type)||"Memo";case xs:t=e._payload,e=e._init;try{return rp(e(t))}catch{}}return null}function R$(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 rp(t);case 8:return t===dg?"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 Ys(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wb(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function I$(e){var t=Wb(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){n=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(i){n=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Rc(e){e._valueTracker||(e._valueTracker=I$(e))}function Zb(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Wb(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Hu(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 np(e,t){var r=t.checked;return dt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function g0(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Ys(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Gb(e,t){t=t.checked,t!=null&&ug(e,"checked",t,!1)}function sp(e,t){Gb(e,t);var r=Ys(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?op(e,t.type,r):t.hasOwnProperty("defaultValue")&&op(e,t.type,Ys(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function v0(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function op(e,t,r){(t!=="number"||Hu(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var rl=Array.isArray;function Di(e,t,r,n){if(e=e.options,t){t={};for(var s=0;s<r.length;s++)t["$"+r[s]]=!0;for(r=0;r<e.length;r++)s=t.hasOwnProperty("$"+e[r].value),e[r].selected!==s&&(e[r].selected=s),s&&n&&(e[r].defaultSelected=!0)}else{for(r=""+Ys(r),t=null,s=0;s<e.length;s++){if(e[s].value===r){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function ip(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return dt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function y0(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(Q(92));if(rl(r)){if(1<r.length)throw Error(Q(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Ys(r)}}function Qb(e,t){var r=Ys(t.value),n=Ys(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function w0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Jb(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 ap(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Jb(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ic,Yb=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,s){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Ic=Ic||document.createElement("div"),Ic.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ic.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Il(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var hl={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},A$=["Webkit","ms","Moz","O"];Object.keys(hl).forEach(function(e){A$.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),hl[t]=hl[e]})});function Xb(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||hl.hasOwnProperty(e)&&hl[e]?(""+t).trim():t+"px"}function e_(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Xb(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var O$=dt({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 lp(e,t){if(t){if(O$[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function cp(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 up=null;function pg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var dp=null,zi=null,Li=null;function x0(e){if(e=cc(e)){if(typeof dp!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=Yd(t),dp(e.stateNode,e.type,t))}}function t_(e){zi?Li?Li.push(e):Li=[e]:zi=e}function r_(){if(zi){var e=zi,t=Li;if(Li=zi=null,x0(e),t)for(e=0;e<t.length;e++)x0(t[e])}}function n_(e,t){return e(t)}function s_(){}var Jf=!1;function o_(e,t,r){if(Jf)return e(t,r);Jf=!0;try{return n_(e,t,r)}finally{Jf=!1,(zi!==null||Li!==null)&&(s_(),r_())}}function Al(e,t){var r=e.stateNode;if(r===null)return null;var n=Yd(r);if(n===null)return null;r=n[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":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(Q(231,t,typeof r));return r}var fp=!1;if(ns)try{var qa={};Object.defineProperty(qa,"passive",{get:function(){fp=!0}}),window.addEventListener("test",qa,qa),window.removeEventListener("test",qa,qa)}catch{fp=!1}function M$(e,t,r,n,s,o,i,a,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(d){this.onError(d)}}var pl=!1,Ku=null,Bu=!1,hp=null,D$={onError:function(e){pl=!0,Ku=e}};function z$(e,t,r,n,s,o,i,a,c){pl=!1,Ku=null,M$.apply(D$,arguments)}function L$(e,t,r,n,s,o,i,a,c){if(z$.apply(this,arguments),pl){if(pl){var u=Ku;pl=!1,Ku=null}else throw Error(Q(198));Bu||(Bu=!0,hp=u)}}function oi(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function i_(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 b0(e){if(oi(e)!==e)throw Error(Q(188))}function F$(e){var t=e.alternate;if(!t){if(t=oi(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var r=e,n=t;;){var s=r.return;if(s===null)break;var o=s.alternate;if(o===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===r)return b0(s),e;if(o===n)return b0(s),t;o=o.sibling}throw Error(Q(188))}if(r.return!==n.return)r=s,n=o;else{for(var i=!1,a=s.child;a;){if(a===r){i=!0,r=s,n=o;break}if(a===n){i=!0,n=s,r=o;break}a=a.sibling}if(!i){for(a=o.child;a;){if(a===r){i=!0,r=o,n=s;break}if(a===n){i=!0,n=o,r=s;break}a=a.sibling}if(!i)throw Error(Q(189))}}if(r.alternate!==n)throw Error(Q(190))}if(r.tag!==3)throw Error(Q(188));return r.stateNode.current===r?e:t}function a_(e){return e=F$(e),e!==null?l_(e):null}function l_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=l_(e);if(t!==null)return t;e=e.sibling}return null}var c_=Er.unstable_scheduleCallback,_0=Er.unstable_cancelCallback,U$=Er.unstable_shouldYield,q$=Er.unstable_requestPaint,yt=Er.unstable_now,V$=Er.unstable_getCurrentPriorityLevel,mg=Er.unstable_ImmediatePriority,u_=Er.unstable_UserBlockingPriority,Wu=Er.unstable_NormalPriority,H$=Er.unstable_LowPriority,d_=Er.unstable_IdlePriority,Zd=null,Pn=null;function K$(e){if(Pn&&typeof Pn.onCommitFiberRoot=="function")try{Pn.onCommitFiberRoot(Zd,e,void 0,(e.current.flags&128)===128)}catch{}}var sn=Math.clz32?Math.clz32:Z$,B$=Math.log,W$=Math.LN2;function Z$(e){return e>>>=0,e===0?32:31-(B$(e)/W$|0)|0}var Ac=64,Oc=4194304;function nl(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 Zu(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,o=e.pingedLanes,i=r&268435455;if(i!==0){var a=i&~s;a!==0?n=nl(a):(o&=i,o!==0&&(n=nl(o)))}else i=r&~s,i!==0?n=nl(i):o!==0&&(n=nl(o));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-sn(t),s=1<<r,n|=e[r],t&=~s;return n}function G$(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 Q$(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-sn(o),a=1<<i,c=s[i];c===-1?(!(a&r)||a&n)&&(s[i]=G$(a,t)):c<=t&&(e.expiredLanes|=a),o&=~a}}function pp(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function f_(){var e=Ac;return Ac<<=1,!(Ac&4194240)&&(Ac=64),e}function Yf(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function ac(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-sn(t),e[t]=r}function J$(e,t){var r=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 n=e.eventTimes;for(e=e.expirationTimes;0<r;){var s=31-sn(r),o=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~o}}function gg(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-sn(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var Ve=0;function h_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var p_,vg,m_,g_,v_,mp=!1,Mc=[],Us=null,qs=null,Vs=null,Ol=new Map,Ml=new Map,Cs=[],Y$="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 S0(e,t){switch(e){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":qs=null;break;case"mouseover":case"mouseout":Vs=null;break;case"pointerover":case"pointerout":Ol.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ml.delete(t.pointerId)}}function Va(e,t,r,n,s,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:o,targetContainers:[s]},t!==null&&(t=cc(t),t!==null&&vg(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function X$(e,t,r,n,s){switch(t){case"focusin":return Us=Va(Us,e,t,r,n,s),!0;case"dragenter":return qs=Va(qs,e,t,r,n,s),!0;case"mouseover":return Vs=Va(Vs,e,t,r,n,s),!0;case"pointerover":var o=s.pointerId;return Ol.set(o,Va(Ol.get(o)||null,e,t,r,n,s)),!0;case"gotpointercapture":return o=s.pointerId,Ml.set(o,Va(Ml.get(o)||null,e,t,r,n,s)),!0}return!1}function y_(e){var t=Po(e.target);if(t!==null){var r=oi(t);if(r!==null){if(t=r.tag,t===13){if(t=i_(r),t!==null){e.blockedOn=t,v_(e.priority,function(){m_(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function vu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=gp(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);up=n,r.target.dispatchEvent(n),up=null}else return t=cc(r),t!==null&&vg(t),e.blockedOn=r,!1;t.shift()}return!0}function k0(e,t,r){vu(e)&&r.delete(t)}function eP(){mp=!1,Us!==null&&vu(Us)&&(Us=null),qs!==null&&vu(qs)&&(qs=null),Vs!==null&&vu(Vs)&&(Vs=null),Ol.forEach(k0),Ml.forEach(k0)}function Ha(e,t){e.blockedOn===t&&(e.blockedOn=null,mp||(mp=!0,Er.unstable_scheduleCallback(Er.unstable_NormalPriority,eP)))}function Dl(e){function t(s){return Ha(s,e)}if(0<Mc.length){Ha(Mc[0],e);for(var r=1;r<Mc.length;r++){var n=Mc[r];n.blockedOn===e&&(n.blockedOn=null)}}for(Us!==null&&Ha(Us,e),qs!==null&&Ha(qs,e),Vs!==null&&Ha(Vs,e),Ol.forEach(t),Ml.forEach(t),r=0;r<Cs.length;r++)n=Cs[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Cs.length&&(r=Cs[0],r.blockedOn===null);)y_(r),r.blockedOn===null&&Cs.shift()}var Fi=us.ReactCurrentBatchConfig,Gu=!0;function tP(e,t,r,n){var s=Ve,o=Fi.transition;Fi.transition=null;try{Ve=1,yg(e,t,r,n)}finally{Ve=s,Fi.transition=o}}function rP(e,t,r,n){var s=Ve,o=Fi.transition;Fi.transition=null;try{Ve=4,yg(e,t,r,n)}finally{Ve=s,Fi.transition=o}}function yg(e,t,r,n){if(Gu){var s=gp(e,t,r,n);if(s===null)lh(e,t,n,Qu,r),S0(e,n);else if(X$(s,e,t,r,n))n.stopPropagation();else if(S0(e,n),t&4&&-1<Y$.indexOf(e)){for(;s!==null;){var o=cc(s);if(o!==null&&p_(o),o=gp(e,t,r,n),o===null&&lh(e,t,n,Qu,r),o===s)break;s=o}s!==null&&n.stopPropagation()}else lh(e,t,n,null,r)}}var Qu=null;function gp(e,t,r,n){if(Qu=null,e=pg(n),e=Po(e),e!==null)if(t=oi(e),t===null)e=null;else if(r=t.tag,r===13){if(e=i_(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Qu=e,null}function w_(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(V$()){case mg:return 1;case u_:return 4;case Wu:case H$:return 16;case d_:return 536870912;default:return 16}default:return 16}}var Ds=null,wg=null,yu=null;function x_(){if(yu)return yu;var e,t=wg,r=t.length,n,s="value"in Ds?Ds.value:Ds.textContent,o=s.length;for(e=0;e<r&&t[e]===s[e];e++);var i=r-e;for(n=1;n<=i&&t[r-n]===s[o-n];n++);return yu=s.slice(e,1<n?1-n:void 0)}function wu(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 Dc(){return!0}function C0(){return!1}function jr(e){function t(r,n,s,o,i){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(r=e[a],this[a]=r?r(o):o[a]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Dc:C0,this.isPropagationStopped=C0,this}return dt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Dc)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Dc)},persist:function(){},isPersistent:Dc}),t}var Ea={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xg=jr(Ea),lc=dt({},Ea,{view:0,detail:0}),nP=jr(lc),Xf,eh,Ka,Gd=dt({},lc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bg,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!==Ka&&(Ka&&e.type==="mousemove"?(Xf=e.screenX-Ka.screenX,eh=e.screenY-Ka.screenY):eh=Xf=0,Ka=e),Xf)},movementY:function(e){return"movementY"in e?e.movementY:eh}}),E0=jr(Gd),sP=dt({},Gd,{dataTransfer:0}),oP=jr(sP),iP=dt({},lc,{relatedTarget:0}),th=jr(iP),aP=dt({},Ea,{animationName:0,elapsedTime:0,pseudoElement:0}),lP=jr(aP),cP=dt({},Ea,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),uP=jr(cP),dP=dt({},Ea,{data:0}),N0=jr(dP),fP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hP={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"},pP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mP(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=pP[e])?!!t[e]:!1}function bg(){return mP}var gP=dt({},lc,{key:function(e){if(e.key){var t=fP[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=wu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?hP[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bg,charCode:function(e){return e.type==="keypress"?wu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?wu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),vP=jr(gP),yP=dt({},Gd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),j0=jr(yP),wP=dt({},lc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bg}),xP=jr(wP),bP=dt({},Ea,{propertyName:0,elapsedTime:0,pseudoElement:0}),_P=jr(bP),SP=dt({},Gd,{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}),kP=jr(SP),CP=[9,13,27,32],_g=ns&&"CompositionEvent"in window,ml=null;ns&&"documentMode"in document&&(ml=document.documentMode);var EP=ns&&"TextEvent"in window&&!ml,b_=ns&&(!_g||ml&&8<ml&&11>=ml),$0=" ",P0=!1;function __(e,t){switch(e){case"keyup":return CP.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ki=!1;function NP(e,t){switch(e){case"compositionend":return S_(t);case"keypress":return t.which!==32?null:(P0=!0,$0);case"textInput":return e=t.data,e===$0&&P0?null:e;default:return null}}function jP(e,t){if(ki)return e==="compositionend"||!_g&&__(e,t)?(e=x_(),yu=wg=Ds=null,ki=!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 b_&&t.locale!=="ko"?null:t.data;default:return null}}var $P={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 T0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!$P[e.type]:t==="textarea"}function k_(e,t,r,n){t_(n),t=Ju(t,"onChange"),0<t.length&&(r=new xg("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var gl=null,zl=null;function PP(e){O_(e,0)}function Qd(e){var t=Ni(e);if(Zb(t))return e}function TP(e,t){if(e==="change")return t}var C_=!1;if(ns){var rh;if(ns){var nh="oninput"in document;if(!nh){var R0=document.createElement("div");R0.setAttribute("oninput","return;"),nh=typeof R0.oninput=="function"}rh=nh}else rh=!1;C_=rh&&(!document.documentMode||9<document.documentMode)}function I0(){gl&&(gl.detachEvent("onpropertychange",E_),zl=gl=null)}function E_(e){if(e.propertyName==="value"&&Qd(zl)){var t=[];k_(t,zl,e,pg(e)),o_(PP,t)}}function RP(e,t,r){e==="focusin"?(I0(),gl=t,zl=r,gl.attachEvent("onpropertychange",E_)):e==="focusout"&&I0()}function IP(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qd(zl)}function AP(e,t){if(e==="click")return Qd(t)}function OP(e,t){if(e==="input"||e==="change")return Qd(t)}function MP(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ln=typeof Object.is=="function"?Object.is:MP;function Ll(e,t){if(ln(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!Yh.call(t,s)||!ln(e[s],t[s]))return!1}return!0}function A0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function O0(e,t){var r=A0(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=A0(r)}}function N_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?N_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function j_(){for(var e=window,t=Hu();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Hu(e.document)}return t}function Sg(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 DP(e){var t=j_(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&N_(r.ownerDocument.documentElement,r)){if(n!==null&&Sg(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,o=Math.min(n.start,s);n=n.end===void 0?o:Math.min(n.end,s),!e.extend&&o>n&&(s=n,n=o,o=s),s=O0(r,o);var i=O0(r,n);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>n?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var zP=ns&&"documentMode"in document&&11>=document.documentMode,Ci=null,vp=null,vl=null,yp=!1;function M0(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;yp||Ci==null||Ci!==Hu(n)||(n=Ci,"selectionStart"in n&&Sg(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),vl&&Ll(vl,n)||(vl=n,n=Ju(vp,"onSelect"),0<n.length&&(t=new xg("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Ci)))}function zc(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Ei={animationend:zc("Animation","AnimationEnd"),animationiteration:zc("Animation","AnimationIteration"),animationstart:zc("Animation","AnimationStart"),transitionend:zc("Transition","TransitionEnd")},sh={},$_={};ns&&($_=document.createElement("div").style,"AnimationEvent"in window||(delete Ei.animationend.animation,delete Ei.animationiteration.animation,delete Ei.animationstart.animation),"TransitionEvent"in window||delete Ei.transitionend.transition);function Jd(e){if(sh[e])return sh[e];if(!Ei[e])return e;var t=Ei[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in $_)return sh[e]=t[r];return e}var P_=Jd("animationend"),T_=Jd("animationiteration"),R_=Jd("animationstart"),I_=Jd("transitionend"),A_=new Map,D0="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 oo(e,t){A_.set(e,t),si(t,[e])}for(var oh=0;oh<D0.length;oh++){var ih=D0[oh],LP=ih.toLowerCase(),FP=ih[0].toUpperCase()+ih.slice(1);oo(LP,"on"+FP)}oo(P_,"onAnimationEnd");oo(T_,"onAnimationIteration");oo(R_,"onAnimationStart");oo("dblclick","onDoubleClick");oo("focusin","onFocus");oo("focusout","onBlur");oo(I_,"onTransitionEnd");ca("onMouseEnter",["mouseout","mouseover"]);ca("onMouseLeave",["mouseout","mouseover"]);ca("onPointerEnter",["pointerout","pointerover"]);ca("onPointerLeave",["pointerout","pointerover"]);si("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));si("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));si("onBeforeInput",["compositionend","keypress","textInput","paste"]);si("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));si("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));si("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sl="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(" "),UP=new Set("cancel close invalid load scroll toggle".split(" ").concat(sl));function z0(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,L$(n,t,void 0,e),e.currentTarget=null}function O_(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],s=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var i=n.length-1;0<=i;i--){var a=n[i],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==o&&s.isPropagationStopped())break e;z0(s,a,u),o=c}else for(i=0;i<n.length;i++){if(a=n[i],c=a.instance,u=a.currentTarget,a=a.listener,c!==o&&s.isPropagationStopped())break e;z0(s,a,u),o=c}}}if(Bu)throw e=hp,Bu=!1,hp=null,e}function Qe(e,t){var r=t[Sp];r===void 0&&(r=t[Sp]=new Set);var n=e+"__bubble";r.has(n)||(M_(t,e,2,!1),r.add(n))}function ah(e,t,r){var n=0;t&&(n|=4),M_(r,e,n,t)}var Lc="_reactListening"+Math.random().toString(36).slice(2);function Fl(e){if(!e[Lc]){e[Lc]=!0,Vb.forEach(function(r){r!=="selectionchange"&&(UP.has(r)||ah(r,!1,e),ah(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Lc]||(t[Lc]=!0,ah("selectionchange",!1,t))}}function M_(e,t,r,n){switch(w_(t)){case 1:var s=tP;break;case 4:s=rP;break;default:s=yg}r=s.bind(null,t,r,e),s=void 0,!fp||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,r,{capture:!0,passive:s}):e.addEventListener(t,r,!0):s!==void 0?e.addEventListener(t,r,{passive:s}):e.addEventListener(t,r,!1)}function lh(e,t,r,n,s){var o=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var i=n.tag;if(i===3||i===4){var a=n.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.parentNode===s)break;if(i===4)for(i=n.return;i!==null;){var c=i.tag;if((c===3||c===4)&&(c=i.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;i=i.return}for(;a!==null;){if(i=Po(a),i===null)return;if(c=i.tag,c===5||c===6){n=o=i;continue e}a=a.parentNode}}n=n.return}o_(function(){var u=o,d=pg(r),f=[];e:{var g=A_.get(e);if(g!==void 0){var v=xg,b=e;switch(e){case"keypress":if(wu(r)===0)break e;case"keydown":case"keyup":v=vP;break;case"focusin":b="focus",v=th;break;case"focusout":b="blur",v=th;break;case"beforeblur":case"afterblur":v=th;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=E0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=oP;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=xP;break;case P_:case T_:case R_:v=lP;break;case I_:v=_P;break;case"scroll":v=nP;break;case"wheel":v=kP;break;case"copy":case"cut":case"paste":v=uP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=j0}var p=(t&4)!==0,y=!p&&e==="scroll",m=p?g!==null?g+"Capture":null:g;p=[];for(var h=u,x;h!==null;){x=h;var _=x.stateNode;if(x.tag===5&&_!==null&&(x=_,m!==null&&(_=Al(h,m),_!=null&&p.push(Ul(h,_,x)))),y)break;h=h.return}0<p.length&&(g=new v(g,b,null,r,d),f.push({event:g,listeners:p}))}}if(!(t&7)){e:{if(g=e==="mouseover"||e==="pointerover",v=e==="mouseout"||e==="pointerout",g&&r!==up&&(b=r.relatedTarget||r.fromElement)&&(Po(b)||b[ss]))break e;if((v||g)&&(g=d.window===d?d:(g=d.ownerDocument)?g.defaultView||g.parentWindow:window,v?(b=r.relatedTarget||r.toElement,v=u,b=b?Po(b):null,b!==null&&(y=oi(b),b!==y||b.tag!==5&&b.tag!==6)&&(b=null)):(v=null,b=u),v!==b)){if(p=E0,_="onMouseLeave",m="onMouseEnter",h="mouse",(e==="pointerout"||e==="pointerover")&&(p=j0,_="onPointerLeave",m="onPointerEnter",h="pointer"),y=v==null?g:Ni(v),x=b==null?g:Ni(b),g=new p(_,h+"leave",v,r,d),g.target=y,g.relatedTarget=x,_=null,Po(d)===u&&(p=new p(m,h+"enter",b,r,d),p.target=x,p.relatedTarget=y,_=p),y=_,v&&b)t:{for(p=v,m=b,h=0,x=p;x;x=ci(x))h++;for(x=0,_=m;_;_=ci(_))x++;for(;0<h-x;)p=ci(p),h--;for(;0<x-h;)m=ci(m),x--;for(;h--;){if(p===m||m!==null&&p===m.alternate)break t;p=ci(p),m=ci(m)}p=null}else p=null;v!==null&&L0(f,g,v,p,!1),b!==null&&y!==null&&L0(f,y,b,p,!0)}}e:{if(g=u?Ni(u):window,v=g.nodeName&&g.nodeName.toLowerCase(),v==="select"||v==="input"&&g.type==="file")var C=TP;else if(T0(g))if(C_)C=OP;else{C=IP;var T=RP}else(v=g.nodeName)&&v.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(C=AP);if(C&&(C=C(e,u))){k_(f,C,r,d);break e}T&&T(e,g,u),e==="focusout"&&(T=g._wrapperState)&&T.controlled&&g.type==="number"&&op(g,"number",g.value)}switch(T=u?Ni(u):window,e){case"focusin":(T0(T)||T.contentEditable==="true")&&(Ci=T,vp=u,vl=null);break;case"focusout":vl=vp=Ci=null;break;case"mousedown":yp=!0;break;case"contextmenu":case"mouseup":case"dragend":yp=!1,M0(f,r,d);break;case"selectionchange":if(zP)break;case"keydown":case"keyup":M0(f,r,d)}var $;if(_g)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else ki?__(e,r)&&(O="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(O="onCompositionStart");O&&(b_&&r.locale!=="ko"&&(ki||O!=="onCompositionStart"?O==="onCompositionEnd"&&ki&&($=x_()):(Ds=d,wg="value"in Ds?Ds.value:Ds.textContent,ki=!0)),T=Ju(u,O),0<T.length&&(O=new N0(O,e,null,r,d),f.push({event:O,listeners:T}),$?O.data=$:($=S_(r),$!==null&&(O.data=$)))),($=EP?NP(e,r):jP(e,r))&&(u=Ju(u,"onBeforeInput"),0<u.length&&(d=new N0("onBeforeInput","beforeinput",null,r,d),f.push({event:d,listeners:u}),d.data=$))}O_(f,t)})}function Ul(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Ju(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,o=s.stateNode;s.tag===5&&o!==null&&(s=o,o=Al(e,r),o!=null&&n.unshift(Ul(e,o,s)),o=Al(e,t),o!=null&&n.push(Ul(e,o,s))),e=e.return}return n}function ci(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function L0(e,t,r,n,s){for(var o=t._reactName,i=[];r!==null&&r!==n;){var a=r,c=a.alternate,u=a.stateNode;if(c!==null&&c===n)break;a.tag===5&&u!==null&&(a=u,s?(c=Al(r,o),c!=null&&i.unshift(Ul(r,c,a))):s||(c=Al(r,o),c!=null&&i.push(Ul(r,c,a)))),r=r.return}i.length!==0&&e.push({event:t,listeners:i})}var qP=/\r\n?/g,VP=/\u0000|\uFFFD/g;function F0(e){return(typeof e=="string"?e:""+e).replace(qP,`
38
- `).replace(VP,"")}function Fc(e,t,r){if(t=F0(t),F0(e)!==t&&r)throw Error(Q(425))}function Yu(){}var wp=null,xp=null;function bp(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 _p=typeof setTimeout=="function"?setTimeout:void 0,HP=typeof clearTimeout=="function"?clearTimeout:void 0,U0=typeof Promise=="function"?Promise:void 0,KP=typeof queueMicrotask=="function"?queueMicrotask:typeof U0<"u"?function(e){return U0.resolve(null).then(e).catch(BP)}:_p;function BP(e){setTimeout(function(){throw e})}function ch(e,t){var r=t,n=0;do{var s=r.nextSibling;if(e.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){e.removeChild(s),Dl(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Dl(t)}function Hs(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 q0(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var Na=Math.random().toString(36).slice(2),_n="__reactFiber$"+Na,ql="__reactProps$"+Na,ss="__reactContainer$"+Na,Sp="__reactEvents$"+Na,WP="__reactListeners$"+Na,ZP="__reactHandles$"+Na;function Po(e){var t=e[_n];if(t)return t;for(var r=e.parentNode;r;){if(t=r[ss]||r[_n]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=q0(e);e!==null;){if(r=e[_n])return r;e=q0(e)}return t}e=r,r=e.parentNode}return null}function cc(e){return e=e[_n]||e[ss],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ni(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function Yd(e){return e[ql]||null}var kp=[],ji=-1;function io(e){return{current:e}}function Xe(e){0>ji||(e.current=kp[ji],kp[ji]=null,ji--)}function We(e,t){ji++,kp[ji]=e.current,e.current=t}var Xs={},Qt=io(Xs),mr=io(!1),Ho=Xs;function ua(e,t){var r=e.type.contextTypes;if(!r)return Xs;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in r)s[o]=t[o];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function gr(e){return e=e.childContextTypes,e!=null}function Xu(){Xe(mr),Xe(Qt)}function V0(e,t,r){if(Qt.current!==Xs)throw Error(Q(168));We(Qt,t),We(mr,r)}function D_(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in t))throw Error(Q(108,R$(e)||"Unknown",s));return dt({},r,n)}function ed(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Xs,Ho=Qt.current,We(Qt,e),We(mr,mr.current),!0}function H0(e,t,r){var n=e.stateNode;if(!n)throw Error(Q(169));r?(e=D_(e,t,Ho),n.__reactInternalMemoizedMergedChildContext=e,Xe(mr),Xe(Qt),We(Qt,e)):Xe(mr),We(mr,r)}var Hn=null,Xd=!1,uh=!1;function z_(e){Hn===null?Hn=[e]:Hn.push(e)}function GP(e){Xd=!0,z_(e)}function ao(){if(!uh&&Hn!==null){uh=!0;var e=0,t=Ve;try{var r=Hn;for(Ve=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}Hn=null,Xd=!1}catch(s){throw Hn!==null&&(Hn=Hn.slice(e+1)),c_(mg,ao),s}finally{Ve=t,uh=!1}}return null}var $i=[],Pi=0,td=null,rd=0,Or=[],Mr=0,Ko=null,Gn=1,Qn="";function bo(e,t){$i[Pi++]=rd,$i[Pi++]=td,td=e,rd=t}function L_(e,t,r){Or[Mr++]=Gn,Or[Mr++]=Qn,Or[Mr++]=Ko,Ko=e;var n=Gn;e=Qn;var s=32-sn(n)-1;n&=~(1<<s),r+=1;var o=32-sn(t)+s;if(30<o){var i=s-s%5;o=(n&(1<<i)-1).toString(32),n>>=i,s-=i,Gn=1<<32-sn(t)+s|r<<s|n,Qn=o+e}else Gn=1<<o|r<<s|n,Qn=e}function kg(e){e.return!==null&&(bo(e,1),L_(e,1,0))}function Cg(e){for(;e===td;)td=$i[--Pi],$i[Pi]=null,rd=$i[--Pi],$i[Pi]=null;for(;e===Ko;)Ko=Or[--Mr],Or[Mr]=null,Qn=Or[--Mr],Or[Mr]=null,Gn=Or[--Mr],Or[Mr]=null}var kr=null,Sr=null,nt=!1,en=null;function F_(e,t){var r=Dr(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function K0(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,kr=e,Sr=Hs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,kr=e,Sr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=Ko!==null?{id:Gn,overflow:Qn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Dr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,kr=e,Sr=null,!0):!1;default:return!1}}function Cp(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ep(e){if(nt){var t=Sr;if(t){var r=t;if(!K0(e,t)){if(Cp(e))throw Error(Q(418));t=Hs(r.nextSibling);var n=kr;t&&K0(e,t)?F_(n,r):(e.flags=e.flags&-4097|2,nt=!1,kr=e)}}else{if(Cp(e))throw Error(Q(418));e.flags=e.flags&-4097|2,nt=!1,kr=e}}}function B0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;kr=e}function Uc(e){if(e!==kr)return!1;if(!nt)return B0(e),nt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!bp(e.type,e.memoizedProps)),t&&(t=Sr)){if(Cp(e))throw U_(),Error(Q(418));for(;t;)F_(e,t),t=Hs(t.nextSibling)}if(B0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Sr=Hs(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Sr=null}}else Sr=kr?Hs(e.stateNode.nextSibling):null;return!0}function U_(){for(var e=Sr;e;)e=Hs(e.nextSibling)}function da(){Sr=kr=null,nt=!1}function Eg(e){en===null?en=[e]:en.push(e)}var QP=us.ReactCurrentBatchConfig;function Ba(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(Q(309));var n=r.stateNode}if(!n)throw Error(Q(147,e));var s=n,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(i){var a=s.refs;i===null?delete a[o]:a[o]=i},t._stringRef=o,t)}if(typeof e!="string")throw Error(Q(284));if(!r._owner)throw Error(Q(290,e))}return e}function qc(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function W0(e){var t=e._init;return t(e._payload)}function q_(e){function t(m,h){if(e){var x=m.deletions;x===null?(m.deletions=[h],m.flags|=16):x.push(h)}}function r(m,h){if(!e)return null;for(;h!==null;)t(m,h),h=h.sibling;return null}function n(m,h){for(m=new Map;h!==null;)h.key!==null?m.set(h.key,h):m.set(h.index,h),h=h.sibling;return m}function s(m,h){return m=Zs(m,h),m.index=0,m.sibling=null,m}function o(m,h,x){return m.index=x,e?(x=m.alternate,x!==null?(x=x.index,x<h?(m.flags|=2,h):x):(m.flags|=2,h)):(m.flags|=1048576,h)}function i(m){return e&&m.alternate===null&&(m.flags|=2),m}function a(m,h,x,_){return h===null||h.tag!==6?(h=vh(x,m.mode,_),h.return=m,h):(h=s(h,x),h.return=m,h)}function c(m,h,x,_){var C=x.type;return C===Si?d(m,h,x.props.children,_,x.key):h!==null&&(h.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===xs&&W0(C)===h.type)?(_=s(h,x.props),_.ref=Ba(m,h,x),_.return=m,_):(_=Eu(x.type,x.key,x.props,null,m.mode,_),_.ref=Ba(m,h,x),_.return=m,_)}function u(m,h,x,_){return h===null||h.tag!==4||h.stateNode.containerInfo!==x.containerInfo||h.stateNode.implementation!==x.implementation?(h=yh(x,m.mode,_),h.return=m,h):(h=s(h,x.children||[]),h.return=m,h)}function d(m,h,x,_,C){return h===null||h.tag!==7?(h=Vo(x,m.mode,_,C),h.return=m,h):(h=s(h,x),h.return=m,h)}function f(m,h,x){if(typeof h=="string"&&h!==""||typeof h=="number")return h=vh(""+h,m.mode,x),h.return=m,h;if(typeof h=="object"&&h!==null){switch(h.$$typeof){case Tc:return x=Eu(h.type,h.key,h.props,null,m.mode,x),x.ref=Ba(m,null,h),x.return=m,x;case _i:return h=yh(h,m.mode,x),h.return=m,h;case xs:var _=h._init;return f(m,_(h._payload),x)}if(rl(h)||Ua(h))return h=Vo(h,m.mode,x,null),h.return=m,h;qc(m,h)}return null}function g(m,h,x,_){var C=h!==null?h.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return C!==null?null:a(m,h,""+x,_);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Tc:return x.key===C?c(m,h,x,_):null;case _i:return x.key===C?u(m,h,x,_):null;case xs:return C=x._init,g(m,h,C(x._payload),_)}if(rl(x)||Ua(x))return C!==null?null:d(m,h,x,_,null);qc(m,x)}return null}function v(m,h,x,_,C){if(typeof _=="string"&&_!==""||typeof _=="number")return m=m.get(x)||null,a(h,m,""+_,C);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Tc:return m=m.get(_.key===null?x:_.key)||null,c(h,m,_,C);case _i:return m=m.get(_.key===null?x:_.key)||null,u(h,m,_,C);case xs:var T=_._init;return v(m,h,x,T(_._payload),C)}if(rl(_)||Ua(_))return m=m.get(x)||null,d(h,m,_,C,null);qc(h,_)}return null}function b(m,h,x,_){for(var C=null,T=null,$=h,O=h=0,M=null;$!==null&&O<x.length;O++){$.index>O?(M=$,$=null):M=$.sibling;var U=g(m,$,x[O],_);if(U===null){$===null&&($=M);break}e&&$&&U.alternate===null&&t(m,$),h=o(U,h,O),T===null?C=U:T.sibling=U,T=U,$=M}if(O===x.length)return r(m,$),nt&&bo(m,O),C;if($===null){for(;O<x.length;O++)$=f(m,x[O],_),$!==null&&(h=o($,h,O),T===null?C=$:T.sibling=$,T=$);return nt&&bo(m,O),C}for($=n(m,$);O<x.length;O++)M=v($,m,O,x[O],_),M!==null&&(e&&M.alternate!==null&&$.delete(M.key===null?O:M.key),h=o(M,h,O),T===null?C=M:T.sibling=M,T=M);return e&&$.forEach(function(j){return t(m,j)}),nt&&bo(m,O),C}function p(m,h,x,_){var C=Ua(x);if(typeof C!="function")throw Error(Q(150));if(x=C.call(x),x==null)throw Error(Q(151));for(var T=C=null,$=h,O=h=0,M=null,U=x.next();$!==null&&!U.done;O++,U=x.next()){$.index>O?(M=$,$=null):M=$.sibling;var j=g(m,$,U.value,_);if(j===null){$===null&&($=M);break}e&&$&&j.alternate===null&&t(m,$),h=o(j,h,O),T===null?C=j:T.sibling=j,T=j,$=M}if(U.done)return r(m,$),nt&&bo(m,O),C;if($===null){for(;!U.done;O++,U=x.next())U=f(m,U.value,_),U!==null&&(h=o(U,h,O),T===null?C=U:T.sibling=U,T=U);return nt&&bo(m,O),C}for($=n(m,$);!U.done;O++,U=x.next())U=v($,m,O,U.value,_),U!==null&&(e&&U.alternate!==null&&$.delete(U.key===null?O:U.key),h=o(U,h,O),T===null?C=U:T.sibling=U,T=U);return e&&$.forEach(function(k){return t(m,k)}),nt&&bo(m,O),C}function y(m,h,x,_){if(typeof x=="object"&&x!==null&&x.type===Si&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Tc:e:{for(var C=x.key,T=h;T!==null;){if(T.key===C){if(C=x.type,C===Si){if(T.tag===7){r(m,T.sibling),h=s(T,x.props.children),h.return=m,m=h;break e}}else if(T.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===xs&&W0(C)===T.type){r(m,T.sibling),h=s(T,x.props),h.ref=Ba(m,T,x),h.return=m,m=h;break e}r(m,T);break}else t(m,T);T=T.sibling}x.type===Si?(h=Vo(x.props.children,m.mode,_,x.key),h.return=m,m=h):(_=Eu(x.type,x.key,x.props,null,m.mode,_),_.ref=Ba(m,h,x),_.return=m,m=_)}return i(m);case _i:e:{for(T=x.key;h!==null;){if(h.key===T)if(h.tag===4&&h.stateNode.containerInfo===x.containerInfo&&h.stateNode.implementation===x.implementation){r(m,h.sibling),h=s(h,x.children||[]),h.return=m,m=h;break e}else{r(m,h);break}else t(m,h);h=h.sibling}h=yh(x,m.mode,_),h.return=m,m=h}return i(m);case xs:return T=x._init,y(m,h,T(x._payload),_)}if(rl(x))return b(m,h,x,_);if(Ua(x))return p(m,h,x,_);qc(m,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,h!==null&&h.tag===6?(r(m,h.sibling),h=s(h,x),h.return=m,m=h):(r(m,h),h=vh(x,m.mode,_),h.return=m,m=h),i(m)):r(m,h)}return y}var fa=q_(!0),V_=q_(!1),nd=io(null),sd=null,Ti=null,Ng=null;function jg(){Ng=Ti=sd=null}function $g(e){var t=nd.current;Xe(nd),e._currentValue=t}function Np(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Ui(e,t){sd=e,Ng=Ti=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(pr=!0),e.firstContext=null)}function Lr(e){var t=e._currentValue;if(Ng!==e)if(e={context:e,memoizedValue:t,next:null},Ti===null){if(sd===null)throw Error(Q(308));Ti=e,sd.dependencies={lanes:0,firstContext:e}}else Ti=Ti.next=e;return t}var To=null;function Pg(e){To===null?To=[e]:To.push(e)}function H_(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,Pg(t)):(r.next=s.next,s.next=r),t.interleaved=r,os(e,n)}function os(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var bs=!1;function Tg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function K_(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 Yn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ks(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,ze&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,os(e,r)}return s=n.interleaved,s===null?(t.next=t,Pg(n)):(t.next=s.next,s.next=t),n.interleaved=t,os(e,r)}function xu(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,gg(e,r)}}function Z0(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,o=null;if(r=r.firstBaseUpdate,r!==null){do{var i={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};o===null?s=o=i:o=o.next=i,r=r.next}while(r!==null);o===null?s=o=t:o=o.next=t}else s=o=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function od(e,t,r,n){var s=e.updateQueue;bs=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var c=a,u=c.next;c.next=null,i===null?o=u:i.next=u,i=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==i&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(o!==null){var f=s.baseState;i=0,d=u=c=null,a=o;do{var g=a.lane,v=a.eventTime;if((n&g)===g){d!==null&&(d=d.next={eventTime:v,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var b=e,p=a;switch(g=t,v=r,p.tag){case 1:if(b=p.payload,typeof b=="function"){f=b.call(v,f,g);break e}f=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=p.payload,g=typeof b=="function"?b.call(v,f,g):b,g==null)break e;f=dt({},f,g);break e;case 2:bs=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,g=s.effects,g===null?s.effects=[a]:g.push(a))}else v={eventTime:v,lane:g,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=v,c=f):d=d.next=v,i|=g;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;g=a,a=g.next,g.next=null,s.lastBaseUpdate=g,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);Wo|=i,e.lanes=i,e.memoizedState=f}}function G0(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error(Q(191,s));s.call(n)}}}var uc={},Tn=io(uc),Vl=io(uc),Hl=io(uc);function Ro(e){if(e===uc)throw Error(Q(174));return e}function Rg(e,t){switch(We(Hl,t),We(Vl,e),We(Tn,uc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ap(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ap(t,e)}Xe(Tn),We(Tn,t)}function ha(){Xe(Tn),Xe(Vl),Xe(Hl)}function B_(e){Ro(Hl.current);var t=Ro(Tn.current),r=ap(t,e.type);t!==r&&(We(Vl,e),We(Tn,r))}function Ig(e){Vl.current===e&&(Xe(Tn),Xe(Vl))}var at=io(0);function id(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.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 dh=[];function Ag(){for(var e=0;e<dh.length;e++)dh[e]._workInProgressVersionPrimary=null;dh.length=0}var bu=us.ReactCurrentDispatcher,fh=us.ReactCurrentBatchConfig,Bo=0,ct=null,_t=null,Pt=null,ad=!1,yl=!1,Kl=0,JP=0;function Ht(){throw Error(Q(321))}function Og(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!ln(e[r],t[r]))return!1;return!0}function Mg(e,t,r,n,s,o){if(Bo=o,ct=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,bu.current=e===null||e.memoizedState===null?tT:rT,e=r(n,s),yl){o=0;do{if(yl=!1,Kl=0,25<=o)throw Error(Q(301));o+=1,Pt=_t=null,t.updateQueue=null,bu.current=nT,e=r(n,s)}while(yl)}if(bu.current=ld,t=_t!==null&&_t.next!==null,Bo=0,Pt=_t=ct=null,ad=!1,t)throw Error(Q(300));return e}function Dg(){var e=Kl!==0;return Kl=0,e}function gn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?ct.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function Fr(){if(_t===null){var e=ct.alternate;e=e!==null?e.memoizedState:null}else e=_t.next;var t=Pt===null?ct.memoizedState:Pt.next;if(t!==null)Pt=t,_t=e;else{if(e===null)throw Error(Q(310));_t=e,e={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},Pt===null?ct.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function Bl(e,t){return typeof t=="function"?t(e):t}function hh(e){var t=Fr(),r=t.queue;if(r===null)throw Error(Q(311));r.lastRenderedReducer=e;var n=_t,s=n.baseQueue,o=r.pending;if(o!==null){if(s!==null){var i=s.next;s.next=o.next,o.next=i}n.baseQueue=s=o,r.pending=null}if(s!==null){o=s.next,n=n.baseState;var a=i=null,c=null,u=o;do{var d=u.lane;if((Bo&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:e(n,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(a=c=f,i=n):c=c.next=f,ct.lanes|=d,Wo|=d}u=u.next}while(u!==null&&u!==o);c===null?i=n:c.next=a,ln(n,t.memoizedState)||(pr=!0),t.memoizedState=n,t.baseState=i,t.baseQueue=c,r.lastRenderedState=n}if(e=r.interleaved,e!==null){s=e;do o=s.lane,ct.lanes|=o,Wo|=o,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function ph(e){var t=Fr(),r=t.queue;if(r===null)throw Error(Q(311));r.lastRenderedReducer=e;var n=r.dispatch,s=r.pending,o=t.memoizedState;if(s!==null){r.pending=null;var i=s=s.next;do o=e(o,i.action),i=i.next;while(i!==s);ln(o,t.memoizedState)||(pr=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),r.lastRenderedState=o}return[o,n]}function W_(){}function Z_(e,t){var r=ct,n=Fr(),s=t(),o=!ln(n.memoizedState,s);if(o&&(n.memoizedState=s,pr=!0),n=n.queue,zg(J_.bind(null,r,n,e),[e]),n.getSnapshot!==t||o||Pt!==null&&Pt.memoizedState.tag&1){if(r.flags|=2048,Wl(9,Q_.bind(null,r,n,s,t),void 0,null),Tt===null)throw Error(Q(349));Bo&30||G_(r,t,s)}return s}function G_(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ct.updateQueue,t===null?(t={lastEffect:null,stores:null},ct.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Q_(e,t,r,n){t.value=r,t.getSnapshot=n,Y_(t)&&X_(e)}function J_(e,t,r){return r(function(){Y_(t)&&X_(e)})}function Y_(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!ln(e,r)}catch{return!0}}function X_(e){var t=os(e,1);t!==null&&on(t,e,1,-1)}function Q0(e){var t=gn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Bl,lastRenderedState:e},t.queue=e,e=e.dispatch=eT.bind(null,ct,e),[t.memoizedState,e]}function Wl(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ct.updateQueue,t===null?(t={lastEffect:null,stores:null},ct.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function eS(){return Fr().memoizedState}function _u(e,t,r,n){var s=gn();ct.flags|=e,s.memoizedState=Wl(1|t,r,void 0,n===void 0?null:n)}function ef(e,t,r,n){var s=Fr();n=n===void 0?null:n;var o=void 0;if(_t!==null){var i=_t.memoizedState;if(o=i.destroy,n!==null&&Og(n,i.deps)){s.memoizedState=Wl(t,r,o,n);return}}ct.flags|=e,s.memoizedState=Wl(1|t,r,o,n)}function J0(e,t){return _u(8390656,8,e,t)}function zg(e,t){return ef(2048,8,e,t)}function tS(e,t){return ef(4,2,e,t)}function rS(e,t){return ef(4,4,e,t)}function nS(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 sS(e,t,r){return r=r!=null?r.concat([e]):null,ef(4,4,nS.bind(null,t,e),r)}function Lg(){}function oS(e,t){var r=Fr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Og(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function iS(e,t){var r=Fr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Og(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function aS(e,t,r){return Bo&21?(ln(r,t)||(r=f_(),ct.lanes|=r,Wo|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,pr=!0),e.memoizedState=r)}function YP(e,t){var r=Ve;Ve=r!==0&&4>r?r:4,e(!0);var n=fh.transition;fh.transition={};try{e(!1),t()}finally{Ve=r,fh.transition=n}}function lS(){return Fr().memoizedState}function XP(e,t,r){var n=Ws(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},cS(e))uS(t,r);else if(r=H_(e,t,r,n),r!==null){var s=nr();on(r,e,n,s),dS(r,t,n)}}function eT(e,t,r){var n=Ws(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(cS(e))uS(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,a=o(i,r);if(s.hasEagerState=!0,s.eagerState=a,ln(a,i)){var c=t.interleaved;c===null?(s.next=s,Pg(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}r=H_(e,t,s,n),r!==null&&(s=nr(),on(r,e,n,s),dS(r,t,n))}}function cS(e){var t=e.alternate;return e===ct||t!==null&&t===ct}function uS(e,t){yl=ad=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function dS(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,gg(e,r)}}var ld={readContext:Lr,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},tT={readContext:Lr,useCallback:function(e,t){return gn().memoizedState=[e,t===void 0?null:t],e},useContext:Lr,useEffect:J0,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,_u(4194308,4,nS.bind(null,t,e),r)},useLayoutEffect:function(e,t){return _u(4194308,4,e,t)},useInsertionEffect:function(e,t){return _u(4,2,e,t)},useMemo:function(e,t){var r=gn();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=gn();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=XP.bind(null,ct,e),[n.memoizedState,e]},useRef:function(e){var t=gn();return e={current:e},t.memoizedState=e},useState:Q0,useDebugValue:Lg,useDeferredValue:function(e){return gn().memoizedState=e},useTransition:function(){var e=Q0(!1),t=e[0];return e=YP.bind(null,e[1]),gn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ct,s=gn();if(nt){if(r===void 0)throw Error(Q(407));r=r()}else{if(r=t(),Tt===null)throw Error(Q(349));Bo&30||G_(n,t,r)}s.memoizedState=r;var o={value:r,getSnapshot:t};return s.queue=o,J0(J_.bind(null,n,o,e),[e]),n.flags|=2048,Wl(9,Q_.bind(null,n,o,r,t),void 0,null),r},useId:function(){var e=gn(),t=Tt.identifierPrefix;if(nt){var r=Qn,n=Gn;r=(n&~(1<<32-sn(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Kl++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=JP++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},rT={readContext:Lr,useCallback:oS,useContext:Lr,useEffect:zg,useImperativeHandle:sS,useInsertionEffect:tS,useLayoutEffect:rS,useMemo:iS,useReducer:hh,useRef:eS,useState:function(){return hh(Bl)},useDebugValue:Lg,useDeferredValue:function(e){var t=Fr();return aS(t,_t.memoizedState,e)},useTransition:function(){var e=hh(Bl)[0],t=Fr().memoizedState;return[e,t]},useMutableSource:W_,useSyncExternalStore:Z_,useId:lS,unstable_isNewReconciler:!1},nT={readContext:Lr,useCallback:oS,useContext:Lr,useEffect:zg,useImperativeHandle:sS,useInsertionEffect:tS,useLayoutEffect:rS,useMemo:iS,useReducer:ph,useRef:eS,useState:function(){return ph(Bl)},useDebugValue:Lg,useDeferredValue:function(e){var t=Fr();return _t===null?t.memoizedState=e:aS(t,_t.memoizedState,e)},useTransition:function(){var e=ph(Bl)[0],t=Fr().memoizedState;return[e,t]},useMutableSource:W_,useSyncExternalStore:Z_,useId:lS,unstable_isNewReconciler:!1};function Gr(e,t){if(e&&e.defaultProps){t=dt({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function jp(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:dt({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var tf={isMounted:function(e){return(e=e._reactInternals)?oi(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=nr(),s=Ws(e),o=Yn(n,s);o.payload=t,r!=null&&(o.callback=r),t=Ks(e,o,s),t!==null&&(on(t,e,s,n),xu(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=nr(),s=Ws(e),o=Yn(n,s);o.tag=1,o.payload=t,r!=null&&(o.callback=r),t=Ks(e,o,s),t!==null&&(on(t,e,s,n),xu(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=nr(),n=Ws(e),s=Yn(r,n);s.tag=2,t!=null&&(s.callback=t),t=Ks(e,s,n),t!==null&&(on(t,e,n,r),xu(t,e,n))}};function Y0(e,t,r,n,s,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,o,i):t.prototype&&t.prototype.isPureReactComponent?!Ll(r,n)||!Ll(s,o):!0}function fS(e,t,r){var n=!1,s=Xs,o=t.contextType;return typeof o=="object"&&o!==null?o=Lr(o):(s=gr(t)?Ho:Qt.current,n=t.contextTypes,o=(n=n!=null)?ua(e,s):Xs),t=new t(r,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=tf,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=o),t}function X0(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&tf.enqueueReplaceState(t,t.state,null)}function $p(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},Tg(e);var o=t.contextType;typeof o=="object"&&o!==null?s.context=Lr(o):(o=gr(t)?Ho:Qt.current,s.context=ua(e,o)),s.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(jp(e,t,o,r),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&tf.enqueueReplaceState(s,s.state,null),od(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function pa(e,t){try{var r="",n=t;do r+=T$(n),n=n.return;while(n);var s=r}catch(o){s=`
39
- Error generating stack: `+o.message+`
40
- `+o.stack}return{value:e,source:t,stack:s,digest:null}}function mh(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Pp(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var sT=typeof WeakMap=="function"?WeakMap:Map;function hS(e,t,r){r=Yn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){ud||(ud=!0,Fp=n),Pp(e,t)},r}function pS(e,t,r){r=Yn(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var s=t.value;r.payload=function(){return n(s)},r.callback=function(){Pp(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(r.callback=function(){Pp(e,t),typeof n!="function"&&(Bs===null?Bs=new Set([this]):Bs.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),r}function ew(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new sT;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(r)||(s.add(r),e=yT.bind(null,e,t,r),t.then(e,e))}function tw(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 rw(e,t,r,n,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Yn(-1,1),t.tag=2,Ks(r,t,1))),r.lanes|=1),e)}var oT=us.ReactCurrentOwner,pr=!1;function er(e,t,r,n){t.child=e===null?V_(t,null,r,n):fa(t,e.child,r,n)}function nw(e,t,r,n,s){r=r.render;var o=t.ref;return Ui(t,s),n=Mg(e,t,r,n,o,s),r=Dg(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,is(e,t,s)):(nt&&r&&kg(t),t.flags|=1,er(e,t,n,s),t.child)}function sw(e,t,r,n,s){if(e===null){var o=r.type;return typeof o=="function"&&!Wg(o)&&o.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=o,mS(e,t,o,n,s)):(e=Eu(r.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&s)){var i=o.memoizedProps;if(r=r.compare,r=r!==null?r:Ll,r(i,n)&&e.ref===t.ref)return is(e,t,s)}return t.flags|=1,e=Zs(o,n),e.ref=t.ref,e.return=t,t.child=e}function mS(e,t,r,n,s){if(e!==null){var o=e.memoizedProps;if(Ll(o,n)&&e.ref===t.ref)if(pr=!1,t.pendingProps=n=o,(e.lanes&s)!==0)e.flags&131072&&(pr=!0);else return t.lanes=e.lanes,is(e,t,s)}return Tp(e,t,r,n,s)}function gS(e,t,r){var n=t.pendingProps,s=n.children,o=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},We(Ii,xr),xr|=r;else{if(!(r&1073741824))return e=o!==null?o.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,We(Ii,xr),xr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=o!==null?o.baseLanes:r,We(Ii,xr),xr|=n}else o!==null?(n=o.baseLanes|r,t.memoizedState=null):n=r,We(Ii,xr),xr|=n;return er(e,t,s,r),t.child}function vS(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Tp(e,t,r,n,s){var o=gr(r)?Ho:Qt.current;return o=ua(t,o),Ui(t,s),r=Mg(e,t,r,n,o,s),n=Dg(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,is(e,t,s)):(nt&&n&&kg(t),t.flags|=1,er(e,t,r,s),t.child)}function ow(e,t,r,n,s){if(gr(r)){var o=!0;ed(t)}else o=!1;if(Ui(t,s),t.stateNode===null)Su(e,t),fS(t,r,n),$p(t,r,n,s),n=!0;else if(e===null){var i=t.stateNode,a=t.memoizedProps;i.props=a;var c=i.context,u=r.contextType;typeof u=="object"&&u!==null?u=Lr(u):(u=gr(r)?Ho:Qt.current,u=ua(t,u));var d=r.getDerivedStateFromProps,f=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==n||c!==u)&&X0(t,i,n,u),bs=!1;var g=t.memoizedState;i.state=g,od(t,n,i,s),c=t.memoizedState,a!==n||g!==c||mr.current||bs?(typeof d=="function"&&(jp(t,r,d,n),c=t.memoizedState),(a=bs||Y0(t,r,a,n,g,c,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=n,t.memoizedState=c),i.props=n,i.state=c,i.context=u,n=a):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{i=t.stateNode,K_(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Gr(t.type,a),i.props=u,f=t.pendingProps,g=i.context,c=r.contextType,typeof c=="object"&&c!==null?c=Lr(c):(c=gr(r)?Ho:Qt.current,c=ua(t,c));var v=r.getDerivedStateFromProps;(d=typeof v=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==f||g!==c)&&X0(t,i,n,c),bs=!1,g=t.memoizedState,i.state=g,od(t,n,i,s);var b=t.memoizedState;a!==f||g!==b||mr.current||bs?(typeof v=="function"&&(jp(t,r,v,n),b=t.memoizedState),(u=bs||Y0(t,r,u,n,g,b,c)||!1)?(d||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(n,b,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(n,b,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=b),i.props=n,i.state=b,i.context=c,n=u):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),n=!1)}return Rp(e,t,r,n,o,s)}function Rp(e,t,r,n,s,o){vS(e,t);var i=(t.flags&128)!==0;if(!n&&!i)return s&&H0(t,r,!1),is(e,t,o);n=t.stateNode,oT.current=t;var a=i&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&i?(t.child=fa(t,e.child,null,o),t.child=fa(t,null,a,o)):er(e,t,a,o),t.memoizedState=n.state,s&&H0(t,r,!0),t.child}function yS(e){var t=e.stateNode;t.pendingContext?V0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&V0(e,t.context,!1),Rg(e,t.containerInfo)}function iw(e,t,r,n,s){return da(),Eg(s),t.flags|=256,er(e,t,r,n),t.child}var Ip={dehydrated:null,treeContext:null,retryLane:0};function Ap(e){return{baseLanes:e,cachePool:null,transitions:null}}function wS(e,t,r){var n=t.pendingProps,s=at.current,o=!1,i=(t.flags&128)!==0,a;if((a=i)||(a=e!==null&&e.memoizedState===null?!1:(s&2)!==0),a?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),We(at,s&1),e===null)return Ep(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=n.children,e=n.fallback,o?(n=t.mode,o=t.child,i={mode:"hidden",children:i},!(n&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=sf(i,n,0,null),e=Vo(e,n,r,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Ap(r),t.memoizedState=Ip,e):Fg(t,i));if(s=e.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return iT(e,t,i,n,a,s,r);if(o){o=n.fallback,i=t.mode,s=e.child,a=s.sibling;var c={mode:"hidden",children:n.children};return!(i&1)&&t.child!==s?(n=t.child,n.childLanes=0,n.pendingProps=c,t.deletions=null):(n=Zs(s,c),n.subtreeFlags=s.subtreeFlags&14680064),a!==null?o=Zs(a,o):(o=Vo(o,i,r,null),o.flags|=2),o.return=t,n.return=t,n.sibling=o,t.child=n,n=o,o=t.child,i=e.child.memoizedState,i=i===null?Ap(r):{baseLanes:i.baseLanes|r,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~r,t.memoizedState=Ip,n}return o=e.child,e=o.sibling,n=Zs(o,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function Fg(e,t){return t=sf({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Vc(e,t,r,n){return n!==null&&Eg(n),fa(t,e.child,null,r),e=Fg(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function iT(e,t,r,n,s,o,i){if(r)return t.flags&256?(t.flags&=-257,n=mh(Error(Q(422))),Vc(e,t,i,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=n.fallback,s=t.mode,n=sf({mode:"visible",children:n.children},s,0,null),o=Vo(o,s,i,null),o.flags|=2,n.return=t,o.return=t,n.sibling=o,t.child=n,t.mode&1&&fa(t,e.child,null,i),t.child.memoizedState=Ap(i),t.memoizedState=Ip,o);if(!(t.mode&1))return Vc(e,t,i,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var a=n.dgst;return n=a,o=Error(Q(419)),n=mh(o,n,void 0),Vc(e,t,i,n)}if(a=(i&e.childLanes)!==0,pr||a){if(n=Tt,n!==null){switch(i&-i){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|i)?0:s,s!==0&&s!==o.retryLane&&(o.retryLane=s,os(e,s),on(n,e,s,-1))}return Bg(),n=mh(Error(Q(421))),Vc(e,t,i,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=wT.bind(null,e),s._reactRetry=t,null):(e=o.treeContext,Sr=Hs(s.nextSibling),kr=t,nt=!0,en=null,e!==null&&(Or[Mr++]=Gn,Or[Mr++]=Qn,Or[Mr++]=Ko,Gn=e.id,Qn=e.overflow,Ko=t),t=Fg(t,n.children),t.flags|=4096,t)}function aw(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Np(e.return,t,r)}function gh(e,t,r,n,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=r,o.tailMode=s)}function xS(e,t,r){var n=t.pendingProps,s=n.revealOrder,o=n.tail;if(er(e,t,n.children,r),n=at.current,n&2)n=n&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&&aw(e,r,t);else if(e.tag===19)aw(e,r,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}n&=1}if(We(at,n),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(r=t.child,s=null;r!==null;)e=r.alternate,e!==null&&id(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),gh(t,!1,s,r,o);break;case"backwards":for(r=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&id(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}gh(t,!0,r,null,o);break;case"together":gh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Su(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function is(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Wo|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,r=Zs(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Zs(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function aT(e,t,r){switch(t.tag){case 3:yS(t),da();break;case 5:B_(t);break;case 1:gr(t.type)&&ed(t);break;case 4:Rg(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;We(nd,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(We(at,at.current&1),t.flags|=128,null):r&t.child.childLanes?wS(e,t,r):(We(at,at.current&1),e=is(e,t,r),e!==null?e.sibling:null);We(at,at.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return xS(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),We(at,at.current),n)break;return null;case 22:case 23:return t.lanes=0,gS(e,t,r)}return is(e,t,r)}var bS,Op,_S,SS;bS=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Op=function(){};_S=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,Ro(Tn.current);var o=null;switch(r){case"input":s=np(e,s),n=np(e,n),o=[];break;case"select":s=dt({},s,{value:void 0}),n=dt({},n,{value:void 0}),o=[];break;case"textarea":s=ip(e,s),n=ip(e,n),o=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Yu)}lp(r,n);var i;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var a=s[u];for(i in a)a.hasOwnProperty(i)&&(r||(r={}),r[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Rl.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in n){var c=n[u];if(a=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&c!==a&&(c!=null||a!=null))if(u==="style")if(a){for(i in a)!a.hasOwnProperty(i)||c&&c.hasOwnProperty(i)||(r||(r={}),r[i]="");for(i in c)c.hasOwnProperty(i)&&a[i]!==c[i]&&(r||(r={}),r[i]=c[i])}else r||(o||(o=[]),o.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,a=a?a.__html:void 0,c!=null&&a!==c&&(o=o||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Rl.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Qe("scroll",e),o||a===c||(o=[])):(o=o||[]).push(u,c))}r&&(o=o||[]).push("style",r);var u=o;(t.updateQueue=u)&&(t.flags|=4)}};SS=function(e,t,r,n){r!==n&&(t.flags|=4)};function Wa(e,t){if(!nt)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Kt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function lT(e,t,r){var n=t.pendingProps;switch(Cg(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(t),null;case 1:return gr(t.type)&&Xu(),Kt(t),null;case 3:return n=t.stateNode,ha(),Xe(mr),Xe(Qt),Ag(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Uc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,en!==null&&(Vp(en),en=null))),Op(e,t),Kt(t),null;case 5:Ig(t);var s=Ro(Hl.current);if(r=t.type,e!==null&&t.stateNode!=null)_S(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(Q(166));return Kt(t),null}if(e=Ro(Tn.current),Uc(t)){n=t.stateNode,r=t.type;var o=t.memoizedProps;switch(n[_n]=t,n[ql]=o,e=(t.mode&1)!==0,r){case"dialog":Qe("cancel",n),Qe("close",n);break;case"iframe":case"object":case"embed":Qe("load",n);break;case"video":case"audio":for(s=0;s<sl.length;s++)Qe(sl[s],n);break;case"source":Qe("error",n);break;case"img":case"image":case"link":Qe("error",n),Qe("load",n);break;case"details":Qe("toggle",n);break;case"input":g0(n,o),Qe("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!o.multiple},Qe("invalid",n);break;case"textarea":y0(n,o),Qe("invalid",n)}lp(r,o),s=null;for(var i in o)if(o.hasOwnProperty(i)){var a=o[i];i==="children"?typeof a=="string"?n.textContent!==a&&(o.suppressHydrationWarning!==!0&&Fc(n.textContent,a,e),s=["children",a]):typeof a=="number"&&n.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&Fc(n.textContent,a,e),s=["children",""+a]):Rl.hasOwnProperty(i)&&a!=null&&i==="onScroll"&&Qe("scroll",n)}switch(r){case"input":Rc(n),v0(n,o,!0);break;case"textarea":Rc(n),w0(n);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(n.onclick=Yu)}n=s,t.updateQueue=n,n!==null&&(t.flags|=4)}else{i=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Jb(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=i.createElement(r,{is:n.is}):(e=i.createElement(r),r==="select"&&(i=e,n.multiple?i.multiple=!0:n.size&&(i.size=n.size))):e=i.createElementNS(e,r),e[_n]=t,e[ql]=n,bS(e,t,!1,!1),t.stateNode=e;e:{switch(i=cp(r,n),r){case"dialog":Qe("cancel",e),Qe("close",e),s=n;break;case"iframe":case"object":case"embed":Qe("load",e),s=n;break;case"video":case"audio":for(s=0;s<sl.length;s++)Qe(sl[s],e);s=n;break;case"source":Qe("error",e),s=n;break;case"img":case"image":case"link":Qe("error",e),Qe("load",e),s=n;break;case"details":Qe("toggle",e),s=n;break;case"input":g0(e,n),s=np(e,n),Qe("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=dt({},n,{value:void 0}),Qe("invalid",e);break;case"textarea":y0(e,n),s=ip(e,n),Qe("invalid",e);break;default:s=n}lp(r,s),a=s;for(o in a)if(a.hasOwnProperty(o)){var c=a[o];o==="style"?e_(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Yb(e,c)):o==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&Il(e,c):typeof c=="number"&&Il(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Rl.hasOwnProperty(o)?c!=null&&o==="onScroll"&&Qe("scroll",e):c!=null&&ug(e,o,c,i))}switch(r){case"input":Rc(e),v0(e,n,!1);break;case"textarea":Rc(e),w0(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Ys(n.value));break;case"select":e.multiple=!!n.multiple,o=n.value,o!=null?Di(e,!!n.multiple,o,!1):n.defaultValue!=null&&Di(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Yu)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Kt(t),null;case 6:if(e&&t.stateNode!=null)SS(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(Q(166));if(r=Ro(Hl.current),Ro(Tn.current),Uc(t)){if(n=t.stateNode,r=t.memoizedProps,n[_n]=t,(o=n.nodeValue!==r)&&(e=kr,e!==null))switch(e.tag){case 3:Fc(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Fc(n.nodeValue,r,(e.mode&1)!==0)}o&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[_n]=t,t.stateNode=n}return Kt(t),null;case 13:if(Xe(at),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(nt&&Sr!==null&&t.mode&1&&!(t.flags&128))U_(),da(),t.flags|=98560,o=!1;else if(o=Uc(t),n!==null&&n.dehydrated!==null){if(e===null){if(!o)throw Error(Q(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(Q(317));o[_n]=t}else da(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kt(t),o=!1}else en!==null&&(Vp(en),en=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||at.current&1?Et===0&&(Et=3):Bg())),t.updateQueue!==null&&(t.flags|=4),Kt(t),null);case 4:return ha(),Op(e,t),e===null&&Fl(t.stateNode.containerInfo),Kt(t),null;case 10:return $g(t.type._context),Kt(t),null;case 17:return gr(t.type)&&Xu(),Kt(t),null;case 19:if(Xe(at),o=t.memoizedState,o===null)return Kt(t),null;if(n=(t.flags&128)!==0,i=o.rendering,i===null)if(n)Wa(o,!1);else{if(Et!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=id(e),i!==null){for(t.flags|=128,Wa(o,!1),n=i.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)o=r,e=n,o.flags&=14680066,i=o.alternate,i===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return We(at,at.current&1|2),t.child}e=e.sibling}o.tail!==null&&yt()>ma&&(t.flags|=128,n=!0,Wa(o,!1),t.lanes=4194304)}else{if(!n)if(e=id(i),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Wa(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!nt)return Kt(t),null}else 2*yt()-o.renderingStartTime>ma&&r!==1073741824&&(t.flags|=128,n=!0,Wa(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(r=o.last,r!==null?r.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=yt(),t.sibling=null,r=at.current,We(at,n?r&1|2:r&1),t):(Kt(t),null);case 22:case 23:return Kg(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?xr&1073741824&&(Kt(t),t.subtreeFlags&6&&(t.flags|=8192)):Kt(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function cT(e,t){switch(Cg(t),t.tag){case 1:return gr(t.type)&&Xu(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ha(),Xe(mr),Xe(Qt),Ag(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ig(t),null;case 13:if(Xe(at),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));da()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Xe(at),null;case 4:return ha(),null;case 10:return $g(t.type._context),null;case 22:case 23:return Kg(),null;case 24:return null;default:return null}}var Hc=!1,Zt=!1,uT=typeof WeakSet=="function"?WeakSet:Set,ae=null;function Ri(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){mt(e,t,n)}else r.current=null}function Mp(e,t,r){try{r()}catch(n){mt(e,t,n)}}var lw=!1;function dT(e,t){if(wp=Gu,e=j_(),Sg(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var i=0,a=-1,c=-1,u=0,d=0,f=e,g=null;t:for(;;){for(var v;f!==r||s!==0&&f.nodeType!==3||(a=i+s),f!==o||n!==0&&f.nodeType!==3||(c=i+n),f.nodeType===3&&(i+=f.nodeValue.length),(v=f.firstChild)!==null;)g=f,f=v;for(;;){if(f===e)break t;if(g===r&&++u===s&&(a=i),g===o&&++d===n&&(c=i),(v=f.nextSibling)!==null)break;f=g,g=f.parentNode}f=v}r=a===-1||c===-1?null:{start:a,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(xp={focusedElem:e,selectionRange:r},Gu=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;try{var b=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var p=b.memoizedProps,y=b.memoizedState,m=t.stateNode,h=m.getSnapshotBeforeUpdate(t.elementType===t.type?p:Gr(t.type,p),y);m.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(_){mt(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return b=lw,lw=!1,b}function wl(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&Mp(t,r,o)}s=s.next}while(s!==n)}}function rf(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Dp(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function kS(e){var t=e.alternate;t!==null&&(e.alternate=null,kS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[_n],delete t[ql],delete t[Sp],delete t[WP],delete t[ZP])),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 CS(e){return e.tag===5||e.tag===3||e.tag===4}function cw(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||CS(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 zp(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Yu));else if(n!==4&&(e=e.child,e!==null))for(zp(e,t,r),e=e.sibling;e!==null;)zp(e,t,r),e=e.sibling}function Lp(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Lp(e,t,r),e=e.sibling;e!==null;)Lp(e,t,r),e=e.sibling}var At=null,Xr=!1;function hs(e,t,r){for(r=r.child;r!==null;)ES(e,t,r),r=r.sibling}function ES(e,t,r){if(Pn&&typeof Pn.onCommitFiberUnmount=="function")try{Pn.onCommitFiberUnmount(Zd,r)}catch{}switch(r.tag){case 5:Zt||Ri(r,t);case 6:var n=At,s=Xr;At=null,hs(e,t,r),At=n,Xr=s,At!==null&&(Xr?(e=At,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):At.removeChild(r.stateNode));break;case 18:At!==null&&(Xr?(e=At,r=r.stateNode,e.nodeType===8?ch(e.parentNode,r):e.nodeType===1&&ch(e,r),Dl(e)):ch(At,r.stateNode));break;case 4:n=At,s=Xr,At=r.stateNode.containerInfo,Xr=!0,hs(e,t,r),At=n,Xr=s;break;case 0:case 11:case 14:case 15:if(!Zt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var o=s,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&Mp(r,t,i),s=s.next}while(s!==n)}hs(e,t,r);break;case 1:if(!Zt&&(Ri(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){mt(r,t,a)}hs(e,t,r);break;case 21:hs(e,t,r);break;case 22:r.mode&1?(Zt=(n=Zt)||r.memoizedState!==null,hs(e,t,r),Zt=n):hs(e,t,r);break;default:hs(e,t,r)}}function uw(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new uT),t.forEach(function(n){var s=xT.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function Hr(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var o=e,i=t,a=i;e:for(;a!==null;){switch(a.tag){case 5:At=a.stateNode,Xr=!1;break e;case 3:At=a.stateNode.containerInfo,Xr=!0;break e;case 4:At=a.stateNode.containerInfo,Xr=!0;break e}a=a.return}if(At===null)throw Error(Q(160));ES(o,i,s),At=null,Xr=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){mt(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)NS(t,e),t=t.sibling}function NS(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Hr(t,e),pn(e),n&4){try{wl(3,e,e.return),rf(3,e)}catch(p){mt(e,e.return,p)}try{wl(5,e,e.return)}catch(p){mt(e,e.return,p)}}break;case 1:Hr(t,e),pn(e),n&512&&r!==null&&Ri(r,r.return);break;case 5:if(Hr(t,e),pn(e),n&512&&r!==null&&Ri(r,r.return),e.flags&32){var s=e.stateNode;try{Il(s,"")}catch(p){mt(e,e.return,p)}}if(n&4&&(s=e.stateNode,s!=null)){var o=e.memoizedProps,i=r!==null?r.memoizedProps:o,a=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{a==="input"&&o.type==="radio"&&o.name!=null&&Gb(s,o),cp(a,i);var u=cp(a,o);for(i=0;i<c.length;i+=2){var d=c[i],f=c[i+1];d==="style"?e_(s,f):d==="dangerouslySetInnerHTML"?Yb(s,f):d==="children"?Il(s,f):ug(s,d,f,u)}switch(a){case"input":sp(s,o);break;case"textarea":Qb(s,o);break;case"select":var g=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!o.multiple;var v=o.value;v!=null?Di(s,!!o.multiple,v,!1):g!==!!o.multiple&&(o.defaultValue!=null?Di(s,!!o.multiple,o.defaultValue,!0):Di(s,!!o.multiple,o.multiple?[]:"",!1))}s[ql]=o}catch(p){mt(e,e.return,p)}}break;case 6:if(Hr(t,e),pn(e),n&4){if(e.stateNode===null)throw Error(Q(162));s=e.stateNode,o=e.memoizedProps;try{s.nodeValue=o}catch(p){mt(e,e.return,p)}}break;case 3:if(Hr(t,e),pn(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Dl(t.containerInfo)}catch(p){mt(e,e.return,p)}break;case 4:Hr(t,e),pn(e);break;case 13:Hr(t,e),pn(e),s=e.child,s.flags&8192&&(o=s.memoizedState!==null,s.stateNode.isHidden=o,!o||s.alternate!==null&&s.alternate.memoizedState!==null||(Vg=yt())),n&4&&uw(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(Zt=(u=Zt)||d,Hr(t,e),Zt=u):Hr(t,e),pn(e),n&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(ae=e,d=e.child;d!==null;){for(f=ae=d;ae!==null;){switch(g=ae,v=g.child,g.tag){case 0:case 11:case 14:case 15:wl(4,g,g.return);break;case 1:Ri(g,g.return);var b=g.stateNode;if(typeof b.componentWillUnmount=="function"){n=g,r=g.return;try{t=n,b.props=t.memoizedProps,b.state=t.memoizedState,b.componentWillUnmount()}catch(p){mt(n,r,p)}}break;case 5:Ri(g,g.return);break;case 22:if(g.memoizedState!==null){fw(f);continue}}v!==null?(v.return=g,ae=v):fw(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{s=f.stateNode,u?(o=s.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(a=f.stateNode,c=f.memoizedProps.style,i=c!=null&&c.hasOwnProperty("display")?c.display:null,a.style.display=Xb("display",i))}catch(p){mt(e,e.return,p)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(p){mt(e,e.return,p)}}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:Hr(t,e),pn(e),n&4&&uw(e);break;case 21:break;default:Hr(t,e),pn(e)}}function pn(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(CS(r)){var n=r;break e}r=r.return}throw Error(Q(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(Il(s,""),n.flags&=-33);var o=cw(e);Lp(e,o,s);break;case 3:case 4:var i=n.stateNode.containerInfo,a=cw(e);zp(e,a,i);break;default:throw Error(Q(161))}}catch(c){mt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function fT(e,t,r){ae=e,jS(e)}function jS(e,t,r){for(var n=(e.mode&1)!==0;ae!==null;){var s=ae,o=s.child;if(s.tag===22&&n){var i=s.memoizedState!==null||Hc;if(!i){var a=s.alternate,c=a!==null&&a.memoizedState!==null||Zt;a=Hc;var u=Zt;if(Hc=i,(Zt=c)&&!u)for(ae=s;ae!==null;)i=ae,c=i.child,i.tag===22&&i.memoizedState!==null?hw(s):c!==null?(c.return=i,ae=c):hw(s);for(;o!==null;)ae=o,jS(o),o=o.sibling;ae=s,Hc=a,Zt=u}dw(e)}else s.subtreeFlags&8772&&o!==null?(o.return=s,ae=o):dw(e)}}function dw(e){for(;ae!==null;){var t=ae;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Zt||rf(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Zt)if(r===null)n.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:Gr(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&G0(t,o,n);break;case 3:var i=t.updateQueue;if(i!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}G0(t,i,r)}break;case 5:var a=t.stateNode;if(r===null&&t.flags&4){r=a;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.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&&Dl(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}Zt||t.flags&512&&Dp(t)}catch(g){mt(t,t.return,g)}}if(t===e){ae=null;break}if(r=t.sibling,r!==null){r.return=t.return,ae=r;break}ae=t.return}}function fw(e){for(;ae!==null;){var t=ae;if(t===e){ae=null;break}var r=t.sibling;if(r!==null){r.return=t.return,ae=r;break}ae=t.return}}function hw(e){for(;ae!==null;){var t=ae;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{rf(4,t)}catch(c){mt(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(c){mt(t,s,c)}}var o=t.return;try{Dp(t)}catch(c){mt(t,o,c)}break;case 5:var i=t.return;try{Dp(t)}catch(c){mt(t,i,c)}}}catch(c){mt(t,t.return,c)}if(t===e){ae=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ae=a;break}ae=t.return}}var hT=Math.ceil,cd=us.ReactCurrentDispatcher,Ug=us.ReactCurrentOwner,zr=us.ReactCurrentBatchConfig,ze=0,Tt=null,wt=null,zt=0,xr=0,Ii=io(0),Et=0,Zl=null,Wo=0,nf=0,qg=0,xl=null,fr=null,Vg=0,ma=1/0,Vn=null,ud=!1,Fp=null,Bs=null,Kc=!1,zs=null,dd=0,bl=0,Up=null,ku=-1,Cu=0;function nr(){return ze&6?yt():ku!==-1?ku:ku=yt()}function Ws(e){return e.mode&1?ze&2&&zt!==0?zt&-zt:QP.transition!==null?(Cu===0&&(Cu=f_()),Cu):(e=Ve,e!==0||(e=window.event,e=e===void 0?16:w_(e.type)),e):1}function on(e,t,r,n){if(50<bl)throw bl=0,Up=null,Error(Q(185));ac(e,r,n),(!(ze&2)||e!==Tt)&&(e===Tt&&(!(ze&2)&&(nf|=r),Et===4&&Es(e,zt)),vr(e,n),r===1&&ze===0&&!(t.mode&1)&&(ma=yt()+500,Xd&&ao()))}function vr(e,t){var r=e.callbackNode;Q$(e,t);var n=Zu(e,e===Tt?zt:0);if(n===0)r!==null&&_0(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&_0(r),t===1)e.tag===0?GP(pw.bind(null,e)):z_(pw.bind(null,e)),KP(function(){!(ze&6)&&ao()}),r=null;else{switch(h_(n)){case 1:r=mg;break;case 4:r=u_;break;case 16:r=Wu;break;case 536870912:r=d_;break;default:r=Wu}r=MS(r,$S.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function $S(e,t){if(ku=-1,Cu=0,ze&6)throw Error(Q(327));var r=e.callbackNode;if(qi()&&e.callbackNode!==r)return null;var n=Zu(e,e===Tt?zt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=fd(e,n);else{t=n;var s=ze;ze|=2;var o=TS();(Tt!==e||zt!==t)&&(Vn=null,ma=yt()+500,qo(e,t));do try{gT();break}catch(a){PS(e,a)}while(!0);jg(),cd.current=o,ze=s,wt!==null?t=0:(Tt=null,zt=0,t=Et)}if(t!==0){if(t===2&&(s=pp(e),s!==0&&(n=s,t=qp(e,s))),t===1)throw r=Zl,qo(e,0),Es(e,n),vr(e,yt()),r;if(t===6)Es(e,n);else{if(s=e.current.alternate,!(n&30)&&!pT(s)&&(t=fd(e,n),t===2&&(o=pp(e),o!==0&&(n=o,t=qp(e,o))),t===1))throw r=Zl,qo(e,0),Es(e,n),vr(e,yt()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(Q(345));case 2:_o(e,fr,Vn);break;case 3:if(Es(e,n),(n&130023424)===n&&(t=Vg+500-yt(),10<t)){if(Zu(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){nr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=_p(_o.bind(null,e,fr,Vn),t);break}_o(e,fr,Vn);break;case 4:if(Es(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var i=31-sn(n);o=1<<i,i=t[i],i>s&&(s=i),n&=~o}if(n=s,n=yt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*hT(n/1960))-n,10<n){e.timeoutHandle=_p(_o.bind(null,e,fr,Vn),n);break}_o(e,fr,Vn);break;case 5:_o(e,fr,Vn);break;default:throw Error(Q(329))}}}return vr(e,yt()),e.callbackNode===r?$S.bind(null,e):null}function qp(e,t){var r=xl;return e.current.memoizedState.isDehydrated&&(qo(e,t).flags|=256),e=fd(e,t),e!==2&&(t=fr,fr=r,t!==null&&Vp(t)),e}function Vp(e){fr===null?fr=e:fr.push.apply(fr,e)}function pT(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var s=r[n],o=s.getSnapshot;s=s.value;try{if(!ln(o(),s))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;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 Es(e,t){for(t&=~qg,t&=~nf,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-sn(t),n=1<<r;e[r]=-1,t&=~n}}function pw(e){if(ze&6)throw Error(Q(327));qi();var t=Zu(e,0);if(!(t&1))return vr(e,yt()),null;var r=fd(e,t);if(e.tag!==0&&r===2){var n=pp(e);n!==0&&(t=n,r=qp(e,n))}if(r===1)throw r=Zl,qo(e,0),Es(e,t),vr(e,yt()),r;if(r===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,_o(e,fr,Vn),vr(e,yt()),null}function Hg(e,t){var r=ze;ze|=1;try{return e(t)}finally{ze=r,ze===0&&(ma=yt()+500,Xd&&ao())}}function Zo(e){zs!==null&&zs.tag===0&&!(ze&6)&&qi();var t=ze;ze|=1;var r=zr.transition,n=Ve;try{if(zr.transition=null,Ve=1,e)return e()}finally{Ve=n,zr.transition=r,ze=t,!(ze&6)&&ao()}}function Kg(){xr=Ii.current,Xe(Ii)}function qo(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,HP(r)),wt!==null)for(r=wt.return;r!==null;){var n=r;switch(Cg(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Xu();break;case 3:ha(),Xe(mr),Xe(Qt),Ag();break;case 5:Ig(n);break;case 4:ha();break;case 13:Xe(at);break;case 19:Xe(at);break;case 10:$g(n.type._context);break;case 22:case 23:Kg()}r=r.return}if(Tt=e,wt=e=Zs(e.current,null),zt=xr=t,Et=0,Zl=null,qg=nf=Wo=0,fr=xl=null,To!==null){for(t=0;t<To.length;t++)if(r=To[t],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,o=r.pending;if(o!==null){var i=o.next;o.next=s,n.next=i}r.pending=n}To=null}return e}function PS(e,t){do{var r=wt;try{if(jg(),bu.current=ld,ad){for(var n=ct.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}ad=!1}if(Bo=0,Pt=_t=ct=null,yl=!1,Kl=0,Ug.current=null,r===null||r.return===null){Et=1,Zl=t,wt=null;break}e:{var o=e,i=r.return,a=r,c=t;if(t=zt,a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=a,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var g=d.alternate;g?(d.updateQueue=g.updateQueue,d.memoizedState=g.memoizedState,d.lanes=g.lanes):(d.updateQueue=null,d.memoizedState=null)}var v=tw(i);if(v!==null){v.flags&=-257,rw(v,i,a,o,t),v.mode&1&&ew(o,u,t),t=v,c=u;var b=t.updateQueue;if(b===null){var p=new Set;p.add(c),t.updateQueue=p}else b.add(c);break e}else{if(!(t&1)){ew(o,u,t),Bg();break e}c=Error(Q(426))}}else if(nt&&a.mode&1){var y=tw(i);if(y!==null){!(y.flags&65536)&&(y.flags|=256),rw(y,i,a,o,t),Eg(pa(c,a));break e}}o=c=pa(c,a),Et!==4&&(Et=2),xl===null?xl=[o]:xl.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var m=hS(o,c,t);Z0(o,m);break e;case 1:a=c;var h=o.type,x=o.stateNode;if(!(o.flags&128)&&(typeof h.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Bs===null||!Bs.has(x)))){o.flags|=65536,t&=-t,o.lanes|=t;var _=pS(o,a,t);Z0(o,_);break e}}o=o.return}while(o!==null)}IS(r)}catch(C){t=C,wt===r&&r!==null&&(wt=r=r.return);continue}break}while(!0)}function TS(){var e=cd.current;return cd.current=ld,e===null?ld:e}function Bg(){(Et===0||Et===3||Et===2)&&(Et=4),Tt===null||!(Wo&268435455)&&!(nf&268435455)||Es(Tt,zt)}function fd(e,t){var r=ze;ze|=2;var n=TS();(Tt!==e||zt!==t)&&(Vn=null,qo(e,t));do try{mT();break}catch(s){PS(e,s)}while(!0);if(jg(),ze=r,cd.current=n,wt!==null)throw Error(Q(261));return Tt=null,zt=0,Et}function mT(){for(;wt!==null;)RS(wt)}function gT(){for(;wt!==null&&!U$();)RS(wt)}function RS(e){var t=OS(e.alternate,e,xr);e.memoizedProps=e.pendingProps,t===null?IS(e):wt=t,Ug.current=null}function IS(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=cT(r,t),r!==null){r.flags&=32767,wt=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Et=6,wt=null;return}}else if(r=lT(r,t,xr),r!==null){wt=r;return}if(t=t.sibling,t!==null){wt=t;return}wt=t=e}while(t!==null);Et===0&&(Et=5)}function _o(e,t,r){var n=Ve,s=zr.transition;try{zr.transition=null,Ve=1,vT(e,t,r,n)}finally{zr.transition=s,Ve=n}return null}function vT(e,t,r,n){do qi();while(zs!==null);if(ze&6)throw Error(Q(327));r=e.finishedWork;var s=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(Q(177));e.callbackNode=null,e.callbackPriority=0;var o=r.lanes|r.childLanes;if(J$(e,o),e===Tt&&(wt=Tt=null,zt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Kc||(Kc=!0,MS(Wu,function(){return qi(),null})),o=(r.flags&15990)!==0,r.subtreeFlags&15990||o){o=zr.transition,zr.transition=null;var i=Ve;Ve=1;var a=ze;ze|=4,Ug.current=null,dT(e,r),NS(r,e),DP(xp),Gu=!!wp,xp=wp=null,e.current=r,fT(r),q$(),ze=a,Ve=i,zr.transition=o}else e.current=r;if(Kc&&(Kc=!1,zs=e,dd=s),o=e.pendingLanes,o===0&&(Bs=null),K$(r.stateNode),vr(e,yt()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)s=t[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(ud)throw ud=!1,e=Fp,Fp=null,e;return dd&1&&e.tag!==0&&qi(),o=e.pendingLanes,o&1?e===Up?bl++:(bl=0,Up=e):bl=0,ao(),null}function qi(){if(zs!==null){var e=h_(dd),t=zr.transition,r=Ve;try{if(zr.transition=null,Ve=16>e?16:e,zs===null)var n=!1;else{if(e=zs,zs=null,dd=0,ze&6)throw Error(Q(331));var s=ze;for(ze|=4,ae=e.current;ae!==null;){var o=ae,i=o.child;if(ae.flags&16){var a=o.deletions;if(a!==null){for(var c=0;c<a.length;c++){var u=a[c];for(ae=u;ae!==null;){var d=ae;switch(d.tag){case 0:case 11:case 15:wl(8,d,o)}var f=d.child;if(f!==null)f.return=d,ae=f;else for(;ae!==null;){d=ae;var g=d.sibling,v=d.return;if(kS(d),d===u){ae=null;break}if(g!==null){g.return=v,ae=g;break}ae=v}}}var b=o.alternate;if(b!==null){var p=b.child;if(p!==null){b.child=null;do{var y=p.sibling;p.sibling=null,p=y}while(p!==null)}}ae=o}}if(o.subtreeFlags&2064&&i!==null)i.return=o,ae=i;else e:for(;ae!==null;){if(o=ae,o.flags&2048)switch(o.tag){case 0:case 11:case 15:wl(9,o,o.return)}var m=o.sibling;if(m!==null){m.return=o.return,ae=m;break e}ae=o.return}}var h=e.current;for(ae=h;ae!==null;){i=ae;var x=i.child;if(i.subtreeFlags&2064&&x!==null)x.return=i,ae=x;else e:for(i=h;ae!==null;){if(a=ae,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:rf(9,a)}}catch(C){mt(a,a.return,C)}if(a===i){ae=null;break e}var _=a.sibling;if(_!==null){_.return=a.return,ae=_;break e}ae=a.return}}if(ze=s,ao(),Pn&&typeof Pn.onPostCommitFiberRoot=="function")try{Pn.onPostCommitFiberRoot(Zd,e)}catch{}n=!0}return n}finally{Ve=r,zr.transition=t}}return!1}function mw(e,t,r){t=pa(r,t),t=hS(e,t,1),e=Ks(e,t,1),t=nr(),e!==null&&(ac(e,1,t),vr(e,t))}function mt(e,t,r){if(e.tag===3)mw(e,e,r);else for(;t!==null;){if(t.tag===3){mw(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Bs===null||!Bs.has(n))){e=pa(r,e),e=pS(t,e,1),t=Ks(t,e,1),e=nr(),t!==null&&(ac(t,1,e),vr(t,e));break}}t=t.return}}function yT(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=nr(),e.pingedLanes|=e.suspendedLanes&r,Tt===e&&(zt&r)===r&&(Et===4||Et===3&&(zt&130023424)===zt&&500>yt()-Vg?qo(e,0):qg|=r),vr(e,t)}function AS(e,t){t===0&&(e.mode&1?(t=Oc,Oc<<=1,!(Oc&130023424)&&(Oc=4194304)):t=1);var r=nr();e=os(e,t),e!==null&&(ac(e,t,r),vr(e,r))}function wT(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),AS(e,r)}function xT(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Q(314))}n!==null&&n.delete(t),AS(e,r)}var OS;OS=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||mr.current)pr=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return pr=!1,aT(e,t,r);pr=!!(e.flags&131072)}else pr=!1,nt&&t.flags&1048576&&L_(t,rd,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Su(e,t),e=t.pendingProps;var s=ua(t,Qt.current);Ui(t,r),s=Mg(null,t,n,e,s,r);var o=Dg();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,gr(n)?(o=!0,ed(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Tg(t),s.updater=tf,t.stateNode=s,s._reactInternals=t,$p(t,n,e,r),t=Rp(null,t,n,!0,o,r)):(t.tag=0,nt&&o&&kg(t),er(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Su(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=_T(n),e=Gr(n,e),s){case 0:t=Tp(null,t,n,e,r);break e;case 1:t=ow(null,t,n,e,r);break e;case 11:t=nw(null,t,n,e,r);break e;case 14:t=sw(null,t,n,Gr(n.type,e),r);break e}throw Error(Q(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Gr(n,s),Tp(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Gr(n,s),ow(e,t,n,s,r);case 3:e:{if(yS(t),e===null)throw Error(Q(387));n=t.pendingProps,o=t.memoizedState,s=o.element,K_(e,t),od(t,n,null,r);var i=t.memoizedState;if(n=i.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=pa(Error(Q(423)),t),t=iw(e,t,n,r,s);break e}else if(n!==s){s=pa(Error(Q(424)),t),t=iw(e,t,n,r,s);break e}else for(Sr=Hs(t.stateNode.containerInfo.firstChild),kr=t,nt=!0,en=null,r=V_(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(da(),n===s){t=is(e,t,r);break e}er(e,t,n,r)}t=t.child}return t;case 5:return B_(t),e===null&&Ep(t),n=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,bp(n,s)?i=null:o!==null&&bp(n,o)&&(t.flags|=32),vS(e,t),er(e,t,i,r),t.child;case 6:return e===null&&Ep(t),null;case 13:return wS(e,t,r);case 4:return Rg(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=fa(t,null,n,r):er(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Gr(n,s),nw(e,t,n,s,r);case 7:return er(e,t,t.pendingProps,r),t.child;case 8:return er(e,t,t.pendingProps.children,r),t.child;case 12:return er(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,o=t.memoizedProps,i=s.value,We(nd,n._currentValue),n._currentValue=i,o!==null)if(ln(o.value,i)){if(o.children===s.children&&!mr.current){t=is(e,t,r);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){i=o.child;for(var c=a.firstContext;c!==null;){if(c.context===n){if(o.tag===1){c=Yn(-1,r&-r),c.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}o.lanes|=r,c=o.alternate,c!==null&&(c.lanes|=r),Np(o.return,r,t),a.lanes|=r;break}c=c.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(Q(341));i.lanes|=r,a=i.alternate,a!==null&&(a.lanes|=r),Np(i,r,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}er(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Ui(t,r),s=Lr(s),n=n(s),t.flags|=1,er(e,t,n,r),t.child;case 14:return n=t.type,s=Gr(n,t.pendingProps),s=Gr(n.type,s),sw(e,t,n,s,r);case 15:return mS(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Gr(n,s),Su(e,t),t.tag=1,gr(n)?(e=!0,ed(t)):e=!1,Ui(t,r),fS(t,n,s),$p(t,n,s,r),Rp(null,t,n,!0,e,r);case 19:return xS(e,t,r);case 22:return gS(e,t,r)}throw Error(Q(156,t.tag))};function MS(e,t){return c_(e,t)}function bT(e,t,r,n){this.tag=e,this.key=r,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dr(e,t,r,n){return new bT(e,t,r,n)}function Wg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _T(e){if(typeof e=="function")return Wg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===fg)return 11;if(e===hg)return 14}return 2}function Zs(e,t){var r=e.alternate;return r===null?(r=Dr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Eu(e,t,r,n,s,o){var i=2;if(n=e,typeof e=="function")Wg(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Si:return Vo(r.children,s,o,t);case dg:i=8,s|=8;break;case Xh:return e=Dr(12,r,t,s|2),e.elementType=Xh,e.lanes=o,e;case ep:return e=Dr(13,r,t,s),e.elementType=ep,e.lanes=o,e;case tp:return e=Dr(19,r,t,s),e.elementType=tp,e.lanes=o,e;case Bb:return sf(r,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Hb:i=10;break e;case Kb:i=9;break e;case fg:i=11;break e;case hg:i=14;break e;case xs:i=16,n=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=Dr(i,r,t,s),t.elementType=e,t.type=n,t.lanes=o,t}function Vo(e,t,r,n){return e=Dr(7,e,n,t),e.lanes=r,e}function sf(e,t,r,n){return e=Dr(22,e,n,t),e.elementType=Bb,e.lanes=r,e.stateNode={isHidden:!1},e}function vh(e,t,r){return e=Dr(6,e,null,t),e.lanes=r,e}function yh(e,t,r){return t=Dr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ST(e,t,r,n,s){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=Yf(0),this.expirationTimes=Yf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yf(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Zg(e,t,r,n,s,o,i,a,c){return e=new ST(e,t,r,a,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Dr(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tg(o),e}function kT(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_i,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function DS(e){if(!e)return Xs;e=e._reactInternals;e:{if(oi(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(gr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var r=e.type;if(gr(r))return D_(e,r,t)}return t}function zS(e,t,r,n,s,o,i,a,c){return e=Zg(r,n,!0,e,s,o,i,a,c),e.context=DS(null),r=e.current,n=nr(),s=Ws(r),o=Yn(n,s),o.callback=t??null,Ks(r,o,s),e.current.lanes=s,ac(e,s,n),vr(e,n),e}function of(e,t,r,n){var s=t.current,o=nr(),i=Ws(s);return r=DS(r),t.context===null?t.context=r:t.pendingContext=r,t=Yn(o,i),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=Ks(s,t,i),e!==null&&(on(e,s,i,o),xu(e,s,i)),i}function hd(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 gw(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Gg(e,t){gw(e,t),(e=e.alternate)&&gw(e,t)}function CT(){return null}var LS=typeof reportError=="function"?reportError:function(e){console.error(e)};function Qg(e){this._internalRoot=e}af.prototype.render=Qg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));of(e,t,null,null)};af.prototype.unmount=Qg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zo(function(){of(null,e,null,null)}),t[ss]=null}};function af(e){this._internalRoot=e}af.prototype.unstable_scheduleHydration=function(e){if(e){var t=g_();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Cs.length&&t!==0&&t<Cs[r].priority;r++);Cs.splice(r,0,e),r===0&&y_(e)}};function Jg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function lf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function vw(){}function ET(e,t,r,n,s){if(s){if(typeof n=="function"){var o=n;n=function(){var u=hd(i);o.call(u)}}var i=zS(t,n,e,0,null,!1,!1,"",vw);return e._reactRootContainer=i,e[ss]=i.current,Fl(e.nodeType===8?e.parentNode:e),Zo(),i}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var a=n;n=function(){var u=hd(c);a.call(u)}}var c=Zg(e,0,!1,null,null,!1,!1,"",vw);return e._reactRootContainer=c,e[ss]=c.current,Fl(e.nodeType===8?e.parentNode:e),Zo(function(){of(t,c,r,n)}),c}function cf(e,t,r,n,s){var o=r._reactRootContainer;if(o){var i=o;if(typeof s=="function"){var a=s;s=function(){var c=hd(i);a.call(c)}}of(t,i,e,s)}else i=ET(r,t,e,s,n);return hd(i)}p_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=nl(t.pendingLanes);r!==0&&(gg(t,r|1),vr(t,yt()),!(ze&6)&&(ma=yt()+500,ao()))}break;case 13:Zo(function(){var n=os(e,1);if(n!==null){var s=nr();on(n,e,1,s)}}),Gg(e,1)}};vg=function(e){if(e.tag===13){var t=os(e,134217728);if(t!==null){var r=nr();on(t,e,134217728,r)}Gg(e,134217728)}};m_=function(e){if(e.tag===13){var t=Ws(e),r=os(e,t);if(r!==null){var n=nr();on(r,e,t,n)}Gg(e,t)}};g_=function(){return Ve};v_=function(e,t){var r=Ve;try{return Ve=e,t()}finally{Ve=r}};dp=function(e,t,r){switch(t){case"input":if(sp(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var s=Yd(n);if(!s)throw Error(Q(90));Zb(n),sp(n,s)}}}break;case"textarea":Qb(e,r);break;case"select":t=r.value,t!=null&&Di(e,!!r.multiple,t,!1)}};n_=Hg;s_=Zo;var NT={usingClientEntryPoint:!1,Events:[cc,Ni,Yd,t_,r_,Hg]},Za={findFiberByHostInstance:Po,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jT={bundleType:Za.bundleType,version:Za.version,rendererPackageName:Za.rendererPackageName,rendererConfig:Za.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:us.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=a_(e),e===null?null:e.stateNode},findFiberByHostInstance:Za.findFiberByHostInstance||CT,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 Bc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bc.isDisabled&&Bc.supportsFiber)try{Zd=Bc.inject(jT),Pn=Bc}catch{}}Nr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=NT;Nr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Jg(t))throw Error(Q(200));return kT(e,t,null,r)};Nr.createRoot=function(e,t){if(!Jg(e))throw Error(Q(299));var r=!1,n="",s=LS;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Zg(e,1,!1,null,null,r,!1,n,s),e[ss]=t.current,Fl(e.nodeType===8?e.parentNode:e),new Qg(t)};Nr.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(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=a_(t),e=e===null?null:e.stateNode,e};Nr.flushSync=function(e){return Zo(e)};Nr.hydrate=function(e,t,r){if(!lf(t))throw Error(Q(200));return cf(null,e,t,!0,r)};Nr.hydrateRoot=function(e,t,r){if(!Jg(e))throw Error(Q(405));var n=r!=null&&r.hydratedSources||null,s=!1,o="",i=LS;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(o=r.identifierPrefix),r.onRecoverableError!==void 0&&(i=r.onRecoverableError)),t=zS(t,null,e,1,r??null,s,!1,o,i),e[ss]=t.current,Fl(e),n)for(e=0;e<n.length;e++)r=n[e],s=r._getVersion,s=s(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,s]:t.mutableSourceEagerHydrationData.push(r,s);return new af(t)};Nr.render=function(e,t,r){if(!lf(t))throw Error(Q(200));return cf(null,e,t,!1,r)};Nr.unmountComponentAtNode=function(e){if(!lf(e))throw Error(Q(40));return e._reactRootContainer?(Zo(function(){cf(null,null,e,!1,function(){e._reactRootContainer=null,e[ss]=null})}),!0):!1};Nr.unstable_batchedUpdates=Hg;Nr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!lf(r))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return cf(e,t,r,!1,n)};Nr.version="18.3.1-next-f1338f8080-20240426";function FS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(FS)}catch(e){console.error(e)}}FS(),Fb.exports=Nr;var ii=Fb.exports;const $T=Bd(ii);var US,yw=ii;US=yw.createRoot,yw.hydrateRoot;function PT(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var r,n,s,o,i=[],a="",c=e.split("/");for(c[0]||c.shift();s=c.shift();)r=s[0],r==="*"?(i.push(r),a+=s[1]==="?"?"(?:/(.*))?":"/(.*)"):r===":"?(n=s.indexOf("?",1),o=s.indexOf(".",1),i.push(s.substring(1,~n?n:~o?o:s.length)),a+=~n&&!~o?"(?:/([^/]+?))?":"/([^/]+?)",~o&&(a+=(~n?"?":"")+"\\"+s.substring(o))):a+="/"+s;return{keys:i,pattern:new RegExp("^"+a+(t?"(?=$|/)":"/?$"),"i")}}var qS={exports:{}},VS={};/**
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 ga=w;function TT(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var RT=typeof Object.is=="function"?Object.is:TT,IT=ga.useState,AT=ga.useEffect,OT=ga.useLayoutEffect,MT=ga.useDebugValue;function DT(e,t){var r=t(),n=IT({inst:{value:r,getSnapshot:t}}),s=n[0].inst,o=n[1];return OT(function(){s.value=r,s.getSnapshot=t,wh(s)&&o({inst:s})},[e,r,t]),AT(function(){return wh(s)&&o({inst:s}),e(function(){wh(s)&&o({inst:s})})},[e]),MT(r),r}function wh(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!RT(e,r)}catch{return!0}}function zT(e,t){return t()}var LT=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?zT:DT;VS.useSyncExternalStore=ga.useSyncExternalStore!==void 0?ga.useSyncExternalStore:LT;qS.exports=VS;var FT=qS.exports;const UT=ag.useInsertionEffect,qT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",VT=qT?w.useLayoutEffect:w.useEffect,HT=UT||VT,HS=e=>{const t=w.useRef([e,(...r)=>t[0](...r)]).current;return HT(()=>{t[0]=e}),t[1]},KT="popstate",Yg="pushState",Xg="replaceState",BT="hashchange",ww=[KT,Yg,Xg,BT],WT=e=>{for(const t of ww)addEventListener(t,e);return()=>{for(const t of ww)removeEventListener(t,e)}},KS=(e,t)=>FT.useSyncExternalStore(WT,e,t),ZT=()=>location.search,GT=({ssrSearch:e=""}={})=>KS(ZT,()=>e),xw=()=>location.pathname,QT=({ssrPath:e}={})=>KS(xw,e?()=>e:xw),JT=(e,{replace:t=!1,state:r=null}={})=>history[t?Xg:Yg](r,"",e),YT=(e={})=>[QT(e),JT],bw=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[bw]>"u"){for(const e of[Yg,Xg]){const t=history[e];history[e]=function(){const r=t.apply(this,arguments),n=new Event(e);return n.arguments=arguments,dispatchEvent(n),r}}Object.defineProperty(window,bw,{value:!0})}const XT=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",BS=(e="")=>e==="/"?"":e,eR=(e,t)=>e[0]==="~"?e.slice(1):BS(t)+e,tR=(e="",t)=>XT(_w(BS(e)),_w(t)),_w=e=>{try{return decodeURI(e)}catch{return e}},WS={hook:YT,searchHook:GT,parser:PT,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},ZS=w.createContext(WS),dc=()=>w.useContext(ZS),GS={},QS=w.createContext(GS),rR=()=>w.useContext(QS),uf=e=>{const[t,r]=e.hook(e);return[tR(e.base,t),HS((n,s)=>r(eR(n,e.base),s))]},nR=()=>uf(dc()),JS=(e,t,r,n)=>{const{pattern:s,keys:o}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",n),i=s.exec(r)||[],[a,...c]=i;return a!==void 0?[!0,(()=>{const u=o!==!1?Object.fromEntries(o.map((f,g)=>[f,c[g]])):i.groups;let d={...c};return u&&Object.assign(d,u),d})(),...n?[a]:[]]:[!1,null]},sR=({children:e,...t})=>{var d,f;const r=dc(),n=t.hook?WS:r;let s=n;const[o,i]=((d=t.ssrPath)==null?void 0:d.split("?"))??[];i&&(t.ssrSearch=i,t.ssrPath=o),t.hrefs=t.hrefs??((f=t.hook)==null?void 0:f.hrefs);let a=w.useRef({}),c=a.current,u=c;for(let g in n){const v=g==="base"?n[g]+(t[g]||""):t[g]||n[g];c===u&&v!==u[g]&&(a.current=u={...u}),u[g]=v,(v!==n[g]||v!==s[g])&&(s=u)}return w.createElement(ZS.Provider,{value:s,children:e})},Sw=({children:e,component:t},r)=>t?w.createElement(t,{params:r}):typeof e=="function"?e(r):e,oR=e=>{let t=w.useRef(GS);const r=t.current;return t.current=Object.keys(e).length!==Object.keys(r).length||Object.entries(e).some(([n,s])=>s!==r[n])?e:r},Wc=({path:e,nest:t,match:r,...n})=>{const s=dc(),[o]=uf(s),[i,a,c]=r??JS(s.parser,e,o,t),u=oR({...rR(),...a});if(!i)return null;const d=c?w.createElement(sR,{base:c},Sw(n,u)):Sw(n,u);return w.createElement(QS.Provider,{value:u,children:d})};w.forwardRef((e,t)=>{const r=dc(),[n,s]=uf(r),{to:o="",href:i=o,onClick:a,asChild:c,children:u,className:d,replace:f,state:g,...v}=e,b=HS(y=>{y.ctrlKey||y.metaKey||y.altKey||y.shiftKey||y.button!==0||(a==null||a(y),y.defaultPrevented||(y.preventDefault(),s(i,e)))}),p=r.hrefs(i[0]==="~"?i.slice(1):r.base+i,r);return c&&w.isValidElement(u)?w.cloneElement(u,{onClick:b,href:p}):w.createElement("a",{...v,onClick:b,href:p,className:d!=null&&d.call?d(n===i):d,children:u,ref:t})});const YS=e=>Array.isArray(e)?e.flatMap(t=>YS(t&&t.type===w.Fragment?t.props.children:t)):[e],iR=({children:e,location:t})=>{const r=dc(),[n]=uf(r);for(const s of YS(e)){let o=0;if(w.isValidElement(s)&&(o=JS(r.parser,s.props.path,t||n,s.props.nest))[0])return w.cloneElement(s,{match:o})}return null};var ja=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(){}},Go=typeof window>"u"||"Deno"in globalThis;function rr(){}function aR(e,t){return typeof e=="function"?e(t):e}function Hp(e){return typeof e=="number"&&e>=0&&e!==1/0}function XS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Gs(e,t){return typeof e=="function"?e(t):e}function Ar(e,t){return typeof e=="function"?e(t):e}function kw(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:o,queryKey:i,stale:a}=e;if(i){if(n){if(t.queryHash!==ev(i,t.options))return!1}else if(!Gl(t.queryKey,i))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||o&&!o(t))}function Cw(e,t){const{exact:r,status:n,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(Qo(t.options.mutationKey)!==Qo(o))return!1}else if(!Gl(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function ev(e,t){return((t==null?void 0:t.queryKeyHashFn)||Qo)(e)}function Qo(e){return JSON.stringify(e,(t,r)=>Kp(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Gl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Gl(e[r],t[r])):!1}function e1(e,t){if(e===t)return e;const r=Ew(e)&&Ew(t);if(r||Kp(e)&&Kp(t)){const n=r?e:Object.keys(e),s=n.length,o=r?t:Object.keys(t),i=o.length,a=r?[]:{},c=new Set(n);let u=0;for(let d=0;d<i;d++){const f=r?d:o[d];(!r&&c.has(f)||r)&&e[f]===void 0&&t[f]===void 0?(a[f]=void 0,u++):(a[f]=e1(e[f],t[f]),a[f]===e[f]&&e[f]!==void 0&&u++)}return s===i&&u===s?e:a}return t}function pd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Ew(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Kp(e){if(!Nw(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Nw(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Nw(e){return Object.prototype.toString.call(e)==="[object Object]"}function lR(e){return new Promise(t=>{setTimeout(t,e)})}function Bp(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?e1(e,t):t}function cR(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function uR(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var tv=Symbol();function t1(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===tv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function r1(e,t){return typeof e=="function"?e(...t):!!e}var Ao,js,Qi,wb,dR=(wb=class extends ja{constructor(){super();ge(this,Ao);ge(this,js);ge(this,Qi);ne(this,Qi,t=>{if(!Go&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){R(this,js)||this.setEventListener(R(this,Qi))}onUnsubscribe(){var t;this.hasListeners()||((t=R(this,js))==null||t.call(this),ne(this,js,void 0))}setEventListener(t){var r;ne(this,Qi,t),(r=R(this,js))==null||r.call(this),ne(this,js,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){R(this,Ao)!==t&&(ne(this,Ao,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof R(this,Ao)=="boolean"?R(this,Ao):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ao=new WeakMap,js=new WeakMap,Qi=new WeakMap,wb),rv=new dR,Ji,$s,Yi,xb,fR=(xb=class extends ja{constructor(){super();ge(this,Ji,!0);ge(this,$s);ge(this,Yi);ne(this,Yi,t=>{if(!Go&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){R(this,$s)||this.setEventListener(R(this,Yi))}onUnsubscribe(){var t;this.hasListeners()||((t=R(this,$s))==null||t.call(this),ne(this,$s,void 0))}setEventListener(t){var r;ne(this,Yi,t),(r=R(this,$s))==null||r.call(this),ne(this,$s,t(this.setOnline.bind(this)))}setOnline(t){R(this,Ji)!==t&&(ne(this,Ji,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return R(this,Ji)}},Ji=new WeakMap,$s=new WeakMap,Yi=new WeakMap,xb),md=new fR;function Wp(){let e,t;const r=new Promise((s,o)=>{e=s,t=o});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}function hR(e){return Math.min(1e3*2**e,3e4)}function n1(e){return(e??"online")==="online"?md.isOnline():!0}var s1=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function o1(e){let t=!1,r=0,n;const s=Wp(),o=()=>s.status!=="pending",i=p=>{var y;o()||(g(new s1(p)),(y=e.abort)==null||y.call(e))},a=()=>{t=!0},c=()=>{t=!1},u=()=>rv.isFocused()&&(e.networkMode==="always"||md.isOnline())&&e.canRun(),d=()=>n1(e.networkMode)&&e.canRun(),f=p=>{o()||(n==null||n(),s.resolve(p))},g=p=>{o()||(n==null||n(),s.reject(p))},v=()=>new Promise(p=>{var y;n=m=>{(o()||u())&&p(m)},(y=e.onPause)==null||y.call(e)}).then(()=>{var p;n=void 0,o()||(p=e.onContinue)==null||p.call(e)}),b=()=>{if(o())return;let p;const y=r===0?e.initialPromise:void 0;try{p=y??e.fn()}catch(m){p=Promise.reject(m)}Promise.resolve(p).then(f).catch(m=>{var T;if(o())return;const h=e.retry??(Go?0:3),x=e.retryDelay??hR,_=typeof x=="function"?x(r,m):x,C=h===!0||typeof h=="number"&&r<h||typeof h=="function"&&h(r,m);if(t||!C){g(m);return}r++,(T=e.onFail)==null||T.call(e,r,m),lR(_).then(()=>u()?void 0:v()).then(()=>{t?g(m):b()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?b():v().then(b),s)}}var pR=e=>setTimeout(e,0);function mR(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=pR;const o=a=>{t?e.push(a):s(()=>{r(a)})},i=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||i()}return c},batchCalls:a=>(...c)=>{o(()=>{a(...c)})},schedule:o,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var kt=mR(),Oo,bb,i1=(bb=class{constructor(){ge(this,Oo)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Hp(this.gcTime)&&ne(this,Oo,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Go?1/0:5*60*1e3))}clearGcTimeout(){R(this,Oo)&&(clearTimeout(R(this,Oo)),ne(this,Oo,void 0))}},Oo=new WeakMap,bb),Xi,ea,Rr,Mo,$t,rc,Do,Jr,Un,_b,gR=(_b=class extends i1{constructor(t){super();ge(this,Jr);ge(this,Xi);ge(this,ea);ge(this,Rr);ge(this,Mo);ge(this,$t);ge(this,rc);ge(this,Do);ne(this,Do,!1),ne(this,rc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ne(this,Mo,t.client),ne(this,Rr,R(this,Mo).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ne(this,Xi,vR(this.options)),this.state=t.state??R(this,Xi),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=R(this,$t))==null?void 0:t.promise}setOptions(t){this.options={...R(this,rc),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&R(this,Rr).remove(this)}setData(t,r){const n=Bp(this.state.data,t,this.options);return Ne(this,Jr,Un).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Ne(this,Jr,Un).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=R(this,$t))==null?void 0:n.promise;return(s=R(this,$t))==null||s.cancel(t),r?r.then(rr).catch(rr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(R(this,Xi))}isActive(){return this.observers.some(t=>Ar(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===tv||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Gs(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:!XS(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=R(this,$t))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=R(this,$t))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),R(this,Rr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(R(this,$t)&&(R(this,Do)?R(this,$t).cancel({revert:!0}):R(this,$t).cancelRetry()),this.scheduleGc()),R(this,Rr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ne(this,Jr,Un).call(this,{type:"invalidate"})}async fetch(t,r){var c,u,d,f,g,v,b,p,y,m,h,x;if(this.state.fetchStatus!=="idle"&&((c=R(this,$t))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(R(this,$t))return R(this,$t).continueRetry(),R(this,$t).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(C=>C.options.queryFn);_&&this.setOptions(_.options)}const n=new AbortController,s=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(ne(this,Do,!0),n.signal)})},o=()=>{const _=t1(this.options,r),T=(()=>{const $={client:R(this,Mo),queryKey:this.queryKey,meta:this.meta};return s($),$})();return ne(this,Do,!1),this.options.persister?this.options.persister(_,T,this):_(T)},a=(()=>{const _={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:R(this,Mo),state:this.state,fetchFn:o};return s(_),_})();(u=this.options.behavior)==null||u.onFetch(a,this),ne(this,ea,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Ne(this,Jr,Un).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),ne(this,$t,o1({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,abort:n.abort.bind(n),onFail:(_,C)=>{Ne(this,Jr,Un).call(this,{type:"failed",failureCount:_,error:C})},onPause:()=>{Ne(this,Jr,Un).call(this,{type:"pause"})},onContinue:()=>{Ne(this,Jr,Un).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const _=await R(this,$t).start();if(_===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(_),(v=(g=R(this,Rr).config).onSuccess)==null||v.call(g,_,this),(p=(b=R(this,Rr).config).onSettled)==null||p.call(b,_,this.state.error,this),_}catch(_){if(_ instanceof s1){if(_.silent)return R(this,$t).promise;if(_.revert){if(this.setState({...R(this,ea),fetchStatus:"idle"}),this.state.data===void 0)throw _;return this.state.data}}throw Ne(this,Jr,Un).call(this,{type:"error",error:_}),(m=(y=R(this,Rr).config).onError)==null||m.call(y,_,this),(x=(h=R(this,Rr).config).onSettled)==null||x.call(h,this.state.data,_,this),_}finally{this.scheduleGc()}}},Xi=new WeakMap,ea=new WeakMap,Rr=new WeakMap,Mo=new WeakMap,$t=new WeakMap,rc=new WeakMap,Do=new WeakMap,Jr=new WeakSet,Un=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...a1(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ne(this,ea,t.manual?s:void 0),s;case"error":const o=t.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),kt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),R(this,Rr).notify({query:this,type:"updated",action:t})})},_b);function a1(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:n1(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function vR(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var wn,Sb,yR=(Sb=class extends ja{constructor(t={}){super();ge(this,wn);this.config=t,ne(this,wn,new Map)}build(t,r,n){const s=r.queryKey,o=r.queryHash??ev(s,r);let i=this.get(o);return i||(i=new gR({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(i)),i}add(t){R(this,wn).has(t.queryHash)||(R(this,wn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=R(this,wn).get(t.queryHash);r&&(t.destroy(),r===t&&R(this,wn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){kt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return R(this,wn).get(t)}getAll(){return[...R(this,wn).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>kw(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>kw(t,n)):r}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){kt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){kt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},wn=new WeakMap,Sb),xn,Yt,zo,bn,ys,kb,wR=(kb=class extends i1{constructor(t){super();ge(this,bn);ge(this,xn);ge(this,Yt);ge(this,zo);this.mutationId=t.mutationId,ne(this,Yt,t.mutationCache),ne(this,xn,[]),this.state=t.state||l1(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){R(this,xn).includes(t)||(R(this,xn).push(t),this.clearGcTimeout(),R(this,Yt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ne(this,xn,R(this,xn).filter(r=>r!==t)),this.scheduleGc(),R(this,Yt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){R(this,xn).length||(this.state.status==="pending"?this.scheduleGc():R(this,Yt).remove(this))}continue(){var t;return((t=R(this,zo))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,a,c,u,d,f,g,v,b,p,y,m,h,x,_,C,T,$,O;const r=()=>{Ne(this,bn,ys).call(this,{type:"continue"})};ne(this,zo,o1({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(M,U)=>{Ne(this,bn,ys).call(this,{type:"failed",failureCount:M,error:U})},onPause:()=>{Ne(this,bn,ys).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>R(this,Yt).canRun(this)}));const n=this.state.status==="pending",s=!R(this,zo).canStart();try{if(n)r();else{Ne(this,bn,ys).call(this,{type:"pending",variables:t,isPaused:s}),await((i=(o=R(this,Yt).config).onMutate)==null?void 0:i.call(o,t,this));const U=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));U!==this.state.context&&Ne(this,bn,ys).call(this,{type:"pending",context:U,variables:t,isPaused:s})}const M=await R(this,zo).start();return await((d=(u=R(this,Yt).config).onSuccess)==null?void 0:d.call(u,M,t,this.state.context,this)),await((g=(f=this.options).onSuccess)==null?void 0:g.call(f,M,t,this.state.context)),await((b=(v=R(this,Yt).config).onSettled)==null?void 0:b.call(v,M,null,this.state.variables,this.state.context,this)),await((y=(p=this.options).onSettled)==null?void 0:y.call(p,M,null,t,this.state.context)),Ne(this,bn,ys).call(this,{type:"success",data:M}),M}catch(M){try{throw await((h=(m=R(this,Yt).config).onError)==null?void 0:h.call(m,M,t,this.state.context,this)),await((_=(x=this.options).onError)==null?void 0:_.call(x,M,t,this.state.context)),await((T=(C=R(this,Yt).config).onSettled)==null?void 0:T.call(C,void 0,M,this.state.variables,this.state.context,this)),await((O=($=this.options).onSettled)==null?void 0:O.call($,void 0,M,t,this.state.context)),M}finally{Ne(this,bn,ys).call(this,{type:"error",error:M})}}finally{R(this,Yt).runNext(this)}}},xn=new WeakMap,Yt=new WeakMap,zo=new WeakMap,bn=new WeakSet,ys=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),kt.batch(()=>{R(this,xn).forEach(n=>{n.onMutationUpdate(t)}),R(this,Yt).notify({mutation:this,type:"updated",action:t})})},kb);function l1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Kn,Yr,nc,Cb,xR=(Cb=class extends ja{constructor(t={}){super();ge(this,Kn);ge(this,Yr);ge(this,nc);this.config=t,ne(this,Kn,new Set),ne(this,Yr,new Map),ne(this,nc,0)}build(t,r,n){const s=new wR({mutationCache:this,mutationId:++$c(this,nc)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){R(this,Kn).add(t);const r=Zc(t);if(typeof r=="string"){const n=R(this,Yr).get(r);n?n.push(t):R(this,Yr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(R(this,Kn).delete(t)){const r=Zc(t);if(typeof r=="string"){const n=R(this,Yr).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&R(this,Yr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Zc(t);if(typeof r=="string"){const n=R(this,Yr).get(r),s=n==null?void 0:n.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Zc(t);if(typeof r=="string"){const s=(n=R(this,Yr).get(r))==null?void 0:n.find(o=>o!==t&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){kt.batch(()=>{R(this,Kn).forEach(t=>{this.notify({type:"removed",mutation:t})}),R(this,Kn).clear(),R(this,Yr).clear()})}getAll(){return Array.from(R(this,Kn))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Cw(r,n))}findAll(t={}){return this.getAll().filter(r=>Cw(t,r))}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return kt.batch(()=>Promise.all(t.map(r=>r.continue().catch(rr))))}},Kn=new WeakMap,Yr=new WeakMap,nc=new WeakMap,Cb);function Zc(e){var t;return(t=e.options.scope)==null?void 0:t.id}function jw(e){return{onFetch:(t,r)=>{var d,f,g,v,b;const n=t.options,s=(g=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:g.direction,o=((v=t.state.data)==null?void 0:v.pages)||[],i=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const y=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?p=!0:t.signal.addEventListener("abort",()=>{p=!0}),t.signal)})},m=t1(t.options,t.fetchOptions),h=async(x,_,C)=>{if(p)return Promise.reject();if(_==null&&x.pages.length)return Promise.resolve(x);const $=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:_,direction:C?"backward":"forward",meta:t.options.meta};return y(j),j})(),O=await m($),{maxPages:M}=t.options,U=C?uR:cR;return{pages:U(x.pages,O,M),pageParams:U(x.pageParams,_,M)}};if(s&&o.length){const x=s==="backward",_=x?bR:$w,C={pages:o,pageParams:i},T=_(n,C);a=await h(C,T,x)}else{const x=e??o.length;do{const _=c===0?i[0]??n.initialPageParam:$w(n,a);if(c>0&&_==null)break;a=await h(a,_),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var p,y;return(y=(p=t.options).persister)==null?void 0:y.call(p,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function $w(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function bR(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var pt,Ps,Ts,ta,ra,Rs,na,sa,Eb,_R=(Eb=class{constructor(e={}){ge(this,pt);ge(this,Ps);ge(this,Ts);ge(this,ta);ge(this,ra);ge(this,Rs);ge(this,na);ge(this,sa);ne(this,pt,e.queryCache||new yR),ne(this,Ps,e.mutationCache||new xR),ne(this,Ts,e.defaultOptions||{}),ne(this,ta,new Map),ne(this,ra,new Map),ne(this,Rs,0)}mount(){$c(this,Rs)._++,R(this,Rs)===1&&(ne(this,na,rv.subscribe(async e=>{e&&(await this.resumePausedMutations(),R(this,pt).onFocus())})),ne(this,sa,md.subscribe(async e=>{e&&(await this.resumePausedMutations(),R(this,pt).onOnline())})))}unmount(){var e,t;$c(this,Rs)._--,R(this,Rs)===0&&((e=R(this,na))==null||e.call(this),ne(this,na,void 0),(t=R(this,sa))==null||t.call(this),ne(this,sa,void 0))}isFetching(e){return R(this,pt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return R(this,Ps).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=R(this,pt).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=R(this,pt).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Gs(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return R(this,pt).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=R(this,pt).get(n.queryHash),o=s==null?void 0:s.state.data,i=aR(t,o);if(i!==void 0)return R(this,pt).build(this,n).setData(i,{...r,manual:!0})}setQueriesData(e,t,r){return kt.batch(()=>R(this,pt).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=R(this,pt).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=R(this,pt);kt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=R(this,pt);return kt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=kt.batch(()=>R(this,pt).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(rr).catch(rr)}invalidateQueries(e,t={}){return kt.batch(()=>(R(this,pt).findAll(e).forEach(r=>{r.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 r={...t,cancelRefetch:t.cancelRefetch??!0},n=kt.batch(()=>R(this,pt).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,r);return r.throwOnError||(o=o.catch(rr)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(rr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=R(this,pt).build(this,t);return r.isStaleByTime(Gs(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rr).catch(rr)}fetchInfiniteQuery(e){return e.behavior=jw(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rr).catch(rr)}ensureInfiniteQueryData(e){return e.behavior=jw(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return md.isOnline()?R(this,Ps).resumePausedMutations():Promise.resolve()}getQueryCache(){return R(this,pt)}getMutationCache(){return R(this,Ps)}getDefaultOptions(){return R(this,Ts)}setDefaultOptions(e){ne(this,Ts,e)}setQueryDefaults(e,t){R(this,ta).set(Qo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...R(this,ta).values()],r={};return t.forEach(n=>{Gl(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){R(this,ra).set(Qo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...R(this,ra).values()],r={};return t.forEach(n=>{Gl(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...R(this,Ts).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ev(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===tv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...R(this,Ts).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){R(this,pt).clear(),R(this,Ps).clear()}},pt=new WeakMap,Ps=new WeakMap,Ts=new WeakMap,ta=new WeakMap,ra=new WeakMap,Rs=new WeakMap,na=new WeakMap,sa=new WeakMap,Eb),ar,Ae,sc,Xt,Lo,oa,Bn,Is,oc,ia,aa,Fo,Uo,As,la,Ue,ol,Zp,Gp,Qp,Jp,Yp,Xp,em,c1,Nb,SR=(Nb=class extends ja{constructor(t,r){super();ge(this,Ue);ge(this,ar);ge(this,Ae);ge(this,sc);ge(this,Xt);ge(this,Lo);ge(this,oa);ge(this,Bn);ge(this,Is);ge(this,oc);ge(this,ia);ge(this,aa);ge(this,Fo);ge(this,Uo);ge(this,As);ge(this,la,new Set);this.options=r,ne(this,ar,t),ne(this,Is,null),ne(this,Bn,Wp()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(R(this,Ae).addObserver(this),Pw(R(this,Ae),this.options)?Ne(this,Ue,ol).call(this):this.updateResult(),Ne(this,Ue,Jp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return tm(R(this,Ae),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return tm(R(this,Ae),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ne(this,Ue,Yp).call(this),Ne(this,Ue,Xp).call(this),R(this,Ae).removeObserver(this)}setOptions(t){const r=this.options,n=R(this,Ae);if(this.options=R(this,ar).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ar(this.options.enabled,R(this,Ae))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ne(this,Ue,em).call(this),R(this,Ae).setOptions(this.options),r._defaulted&&!pd(this.options,r)&&R(this,ar).getQueryCache().notify({type:"observerOptionsUpdated",query:R(this,Ae),observer:this});const s=this.hasListeners();s&&Tw(R(this,Ae),n,this.options,r)&&Ne(this,Ue,ol).call(this),this.updateResult(),s&&(R(this,Ae)!==n||Ar(this.options.enabled,R(this,Ae))!==Ar(r.enabled,R(this,Ae))||Gs(this.options.staleTime,R(this,Ae))!==Gs(r.staleTime,R(this,Ae)))&&Ne(this,Ue,Zp).call(this);const o=Ne(this,Ue,Gp).call(this);s&&(R(this,Ae)!==n||Ar(this.options.enabled,R(this,Ae))!==Ar(r.enabled,R(this,Ae))||o!==R(this,As))&&Ne(this,Ue,Qp).call(this,o)}getOptimisticResult(t){const r=R(this,ar).getQueryCache().build(R(this,ar),t),n=this.createResult(r,t);return CR(this,n)&&(ne(this,Xt,n),ne(this,oa,this.options),ne(this,Lo,R(this,Ae).state)),n}getCurrentResult(){return R(this,Xt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&!this.options.experimental_prefetchInRender&&R(this,Bn).status==="pending"&&R(this,Bn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(n,s))})}trackProp(t){R(this,la).add(t)}getCurrentQuery(){return R(this,Ae)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=R(this,ar).defaultQueryOptions(t),n=R(this,ar).getQueryCache().build(R(this,ar),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Ne(this,Ue,ol).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),R(this,Xt)))}createResult(t,r){var M;const n=R(this,Ae),s=this.options,o=R(this,Xt),i=R(this,Lo),a=R(this,oa),u=t!==n?t.state:R(this,sc),{state:d}=t;let f={...d},g=!1,v;if(r._optimisticResults){const U=this.hasListeners(),j=!U&&Pw(t,r),k=U&&Tw(t,n,r,s);(j||k)&&(f={...f,...a1(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:p,status:y}=f;v=f.data;let m=!1;if(r.placeholderData!==void 0&&v===void 0&&y==="pending"){let U;o!=null&&o.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(U=o.data,m=!0):U=typeof r.placeholderData=="function"?r.placeholderData((M=R(this,aa))==null?void 0:M.state.data,R(this,aa)):r.placeholderData,U!==void 0&&(y="success",v=Bp(o==null?void 0:o.data,U,r),g=!0)}if(r.select&&v!==void 0&&!m)if(o&&v===(i==null?void 0:i.data)&&r.select===R(this,oc))v=R(this,ia);else try{ne(this,oc,r.select),v=r.select(v),v=Bp(o==null?void 0:o.data,v,r),ne(this,ia,v),ne(this,Is,null)}catch(U){ne(this,Is,U)}R(this,Is)&&(b=R(this,Is),v=R(this,ia),p=Date.now(),y="error");const h=f.fetchStatus==="fetching",x=y==="pending",_=y==="error",C=x&&h,T=v!==void 0,O={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:_,isInitialLoading:C,isLoading:C,data:v,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:p,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:h,isRefetching:h&&!x,isLoadingError:_&&!T,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:_&&T,isStale:nv(t,r),refetch:this.refetch,promise:R(this,Bn),isEnabled:Ar(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const U=L=>{O.status==="error"?L.reject(O.error):O.data!==void 0&&L.resolve(O.data)},j=()=>{const L=ne(this,Bn,O.promise=Wp());U(L)},k=R(this,Bn);switch(k.status){case"pending":t.queryHash===n.queryHash&&U(k);break;case"fulfilled":(O.status==="error"||O.data!==k.value)&&j();break;case"rejected":(O.status!=="error"||O.error!==k.reason)&&j();break}}return O}updateResult(){const t=R(this,Xt),r=this.createResult(R(this,Ae),this.options);if(ne(this,Lo,R(this,Ae).state),ne(this,oa,this.options),R(this,Lo).data!==void 0&&ne(this,aa,R(this,Ae)),pd(r,t))return;ne(this,Xt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!R(this,la).size)return!0;const i=new Set(o??R(this,la));return this.options.throwOnError&&i.add("error"),Object.keys(R(this,Xt)).some(a=>{const c=a;return R(this,Xt)[c]!==t[c]&&i.has(c)})};Ne(this,Ue,c1).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ne(this,Ue,Jp).call(this)}},ar=new WeakMap,Ae=new WeakMap,sc=new WeakMap,Xt=new WeakMap,Lo=new WeakMap,oa=new WeakMap,Bn=new WeakMap,Is=new WeakMap,oc=new WeakMap,ia=new WeakMap,aa=new WeakMap,Fo=new WeakMap,Uo=new WeakMap,As=new WeakMap,la=new WeakMap,Ue=new WeakSet,ol=function(t){Ne(this,Ue,em).call(this);let r=R(this,Ae).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(rr)),r},Zp=function(){Ne(this,Ue,Yp).call(this);const t=Gs(this.options.staleTime,R(this,Ae));if(Go||R(this,Xt).isStale||!Hp(t))return;const n=XS(R(this,Xt).dataUpdatedAt,t)+1;ne(this,Fo,setTimeout(()=>{R(this,Xt).isStale||this.updateResult()},n))},Gp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(R(this,Ae)):this.options.refetchInterval)??!1},Qp=function(t){Ne(this,Ue,Xp).call(this),ne(this,As,t),!(Go||Ar(this.options.enabled,R(this,Ae))===!1||!Hp(R(this,As))||R(this,As)===0)&&ne(this,Uo,setInterval(()=>{(this.options.refetchIntervalInBackground||rv.isFocused())&&Ne(this,Ue,ol).call(this)},R(this,As)))},Jp=function(){Ne(this,Ue,Zp).call(this),Ne(this,Ue,Qp).call(this,Ne(this,Ue,Gp).call(this))},Yp=function(){R(this,Fo)&&(clearTimeout(R(this,Fo)),ne(this,Fo,void 0))},Xp=function(){R(this,Uo)&&(clearInterval(R(this,Uo)),ne(this,Uo,void 0))},em=function(){const t=R(this,ar).getQueryCache().build(R(this,ar),this.options);if(t===R(this,Ae))return;const r=R(this,Ae);ne(this,Ae,t),ne(this,sc,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},c1=function(t){kt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(R(this,Xt))}),R(this,ar).getQueryCache().notify({query:R(this,Ae),type:"observerResultsUpdated"})})},Nb);function kR(e,t){return Ar(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Pw(e,t){return kR(e,t)||e.state.data!==void 0&&tm(e,t,t.refetchOnMount)}function tm(e,t,r){if(Ar(t.enabled,e)!==!1&&Gs(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&nv(e,t)}return!1}function Tw(e,t,r,n){return(e!==t||Ar(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&nv(e,r)}function nv(e,t){return Ar(t.enabled,e)!==!1&&e.isStaleByTime(Gs(t.staleTime,e))}function CR(e,t){return!pd(e.getCurrentResult(),t)}var Os,Ms,lr,Wn,rs,Nu,rm,jb,ER=(jb=class extends ja{constructor(r,n){super();ge(this,rs);ge(this,Os);ge(this,Ms);ge(this,lr);ge(this,Wn);ne(this,Os,r),this.setOptions(n),this.bindMethods(),Ne(this,rs,Nu).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var s;const n=this.options;this.options=R(this,Os).defaultMutationOptions(r),pd(this.options,n)||R(this,Os).getMutationCache().notify({type:"observerOptionsUpdated",mutation:R(this,lr),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Qo(n.mutationKey)!==Qo(this.options.mutationKey)?this.reset():((s=R(this,lr))==null?void 0:s.state.status)==="pending"&&R(this,lr).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=R(this,lr))==null||r.removeObserver(this)}onMutationUpdate(r){Ne(this,rs,Nu).call(this),Ne(this,rs,rm).call(this,r)}getCurrentResult(){return R(this,Ms)}reset(){var r;(r=R(this,lr))==null||r.removeObserver(this),ne(this,lr,void 0),Ne(this,rs,Nu).call(this),Ne(this,rs,rm).call(this)}mutate(r,n){var s;return ne(this,Wn,n),(s=R(this,lr))==null||s.removeObserver(this),ne(this,lr,R(this,Os).getMutationCache().build(R(this,Os),this.options)),R(this,lr).addObserver(this),R(this,lr).execute(r)}},Os=new WeakMap,Ms=new WeakMap,lr=new WeakMap,Wn=new WeakMap,rs=new WeakSet,Nu=function(){var n;const r=((n=R(this,lr))==null?void 0:n.state)??l1();ne(this,Ms,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},rm=function(r){kt.batch(()=>{var n,s,o,i,a,c,u,d;if(R(this,Wn)&&this.hasListeners()){const f=R(this,Ms).variables,g=R(this,Ms).context;(r==null?void 0:r.type)==="success"?((s=(n=R(this,Wn)).onSuccess)==null||s.call(n,r.data,f,g),(i=(o=R(this,Wn)).onSettled)==null||i.call(o,r.data,null,f,g)):(r==null?void 0:r.type)==="error"&&((c=(a=R(this,Wn)).onError)==null||c.call(a,r.error,f,g),(d=(u=R(this,Wn)).onSettled)==null||d.call(u,void 0,r.error,f,g))}this.listeners.forEach(f=>{f(R(this,Ms))})})},jb),u1=w.createContext(void 0),yr=e=>{const t=w.useContext(u1);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},NR=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(u1.Provider,{value:e,children:t})),d1=w.createContext(!1),jR=()=>w.useContext(d1);d1.Provider;function $R(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var PR=w.createContext($R()),TR=()=>w.useContext(PR),RR=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},IR=e=>{w.useEffect(()=>{e.clearReset()},[e])},AR=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||r1(r,[e.error,n])),OR=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},MR=(e,t)=>e.isLoading&&e.isFetching&&!t,DR=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Rw=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function zR(e,t,r){var f,g,v,b,p;const n=jR(),s=TR(),o=yr(),i=o.defaultQueryOptions(e);(g=(f=o.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||g.call(f,i),i._optimisticResults=n?"isRestoring":"optimistic",OR(i),RR(i,s),IR(s);const a=!o.getQueryCache().get(i.queryHash),[c]=w.useState(()=>new t(o,i)),u=c.getOptimisticResult(i),d=!n&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(y=>{const m=d?c.subscribe(kt.batchCalls(y)):rr;return c.updateResult(),m},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(i)},[i,c]),DR(i,u))throw Rw(i,c,s);if(AR({result:u,errorResetBoundary:s,throwOnError:i.throwOnError,query:o.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw u.error;if((b=(v=o.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||b.call(v,i,u),i.experimental_prefetchInRender&&!Go&&MR(u,n)){const y=a?Rw(i,c,s):(p=o.getQueryCache().get(i.queryHash))==null?void 0:p.promise;y==null||y.catch(rr).finally(()=>{c.updateResult()})}return i.notifyOnChangeProps?u:c.trackResult(u)}function Gt(e,t){return zR(e,SR)}function Ct(e,t){const r=yr(),[n]=w.useState(()=>new ER(r,e));w.useEffect(()=>{n.setOptions(e)},[n,e]);const s=w.useSyncExternalStore(w.useCallback(i=>n.subscribe(kt.batchCalls(i)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=w.useCallback((i,a)=>{n.mutate(i,a).catch(rr)},[n]);if(s.error&&r1(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}const LR="x-agent-deck-client",FR="dashboard",f1={[LR]:FR};async function h1(e){if(e.ok)return;let t=e.statusText;try{const r=await e.text();try{const n=JSON.parse(r);t=n.error||n.message||t}catch{r.trim()&&(t=`${e.status}: ${r}`)}}catch(r){console.warn("Response body parsing failed:",r)}throw new Error(t)}async function Ee(e,t,r){const n=await fetch(t,{method:e,headers:{...f1,...r?{"Content-Type":"application/json"}:{}},body:r?JSON.stringify(r):void 0});return await h1(n),n}const UR=({on401:e})=>async({queryKey:t})=>{const r=t.join("/"),n=await fetch(r,{headers:f1});return await h1(n),await n.json()},qR=new _R({defaultOptions:{queries:{queryFn:UR({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:10*60*1e3,retry:!1},mutations:{retry:!1}}}),VR=1,HR=1e6;let xh=0;function KR(){return xh=(xh+1)%Number.MAX_SAFE_INTEGER,xh.toString()}const bh=new Map,Iw=e=>{if(bh.has(e))return;const t=setTimeout(()=>{bh.delete(e),_l({type:"REMOVE_TOAST",toastId:e})},HR);bh.set(e,t)},BR=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,VR)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?Iw(r):e.toasts.forEach(n=>{Iw(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},ju=[];let $u={toasts:[]};function _l(e){$u=BR($u,e),ju.forEach(t=>{t($u)})}function WR({...e}){const t=KR(),r=s=>_l({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>_l({type:"DISMISS_TOAST",toastId:t});return _l({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function ir(){const[e,t]=w.useState($u);return w.useEffect(()=>(ju.push(t),()=>{const r=ju.indexOf(t);r>-1&&ju.splice(r,1)}),[e]),{...e,toast:WR,dismiss:r=>_l({type:"DISMISS_TOAST",toastId:r})}}function pe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Aw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function p1(...e){return t=>{let r=!1;const n=e.map(s=>{const o=Aw(s,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<n.length;s++){const o=n[s];typeof o=="function"?o():Aw(e[s],null)}}}}function qe(...e){return w.useCallback(p1(...e),e)}function ZR(e,t){const r=w.createContext(t),n=o=>{const{children:i,...a}=o,c=w.useMemo(()=>a,Object.values(a));return l.jsx(r.Provider,{value:c,children:i})};n.displayName=e+"Provider";function s(o){const i=w.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[n,s]}function An(e,t=[]){let r=[];function n(o,i){const a=w.createContext(i),c=r.length;r=[...r,i];const u=f=>{var m;const{scope:g,children:v,...b}=f,p=((m=g==null?void 0:g[e])==null?void 0:m[c])||a,y=w.useMemo(()=>b,Object.values(b));return l.jsx(p.Provider,{value:y,children:v})};u.displayName=o+"Provider";function d(f,g){var p;const v=((p=g==null?void 0:g[e])==null?void 0:p[c])||a,b=w.useContext(v);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const s=()=>{const o=r.map(i=>w.createContext(i));return function(a){const c=(a==null?void 0:a[e])||o;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[n,GR(s,...t)]}function GR(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...a,...f}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function Jo(e){const t=JR(e),r=w.forwardRef((n,s)=>{const{children:o,...i}=n,a=w.Children.toArray(o),c=a.find(XR);if(c){const u=c.props.children,d=a.map(f=>f===c?w.Children.count(u)>1?w.Children.only(null):w.isValidElement(u)?u.props.children:null:f);return l.jsx(t,{...i,ref:s,children:w.isValidElement(u)?w.cloneElement(u,void 0,d):null})}return l.jsx(t,{...i,ref:s,children:o})});return r.displayName=`${e}.Slot`,r}var QR=Jo("Slot");function JR(e){const t=w.forwardRef((r,n)=>{const{children:s,...o}=r;if(w.isValidElement(s)){const i=t2(s),a=e2(o,s.props);return s.type!==w.Fragment&&(a.ref=n?p1(n,i):i),w.cloneElement(s,a)}return w.Children.count(s)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var m1=Symbol("radix.slottable");function YR(e){const t=({children:r})=>l.jsx(l.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=m1,t}function XR(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===m1}function e2(e,t){const r={...t};for(const n in t){const s=e[n],o=t[n];/^on[A-Z]/.test(n)?s&&o?r[n]=(...a)=>{const c=o(...a);return s(...a),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...o}:n==="className"&&(r[n]=[s,o].filter(Boolean).join(" "))}return{...e,...r}}function t2(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function sv(e){const t=e+"CollectionProvider",[r,n]=An(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:y,children:m}=p,h=yn.useRef(null),x=yn.useRef(new Map).current;return l.jsx(s,{scope:y,itemMap:x,collectionRef:h,children:m})};i.displayName=t;const a=e+"CollectionSlot",c=Jo(a),u=yn.forwardRef((p,y)=>{const{scope:m,children:h}=p,x=o(a,m),_=qe(y,x.collectionRef);return l.jsx(c,{ref:_,children:h})});u.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",g=Jo(d),v=yn.forwardRef((p,y)=>{const{scope:m,children:h,...x}=p,_=yn.useRef(null),C=qe(y,_),T=o(d,m);return yn.useEffect(()=>(T.itemMap.set(_,{ref:_,...x}),()=>void T.itemMap.delete(_))),l.jsx(g,{[f]:"",ref:C,children:h})});v.displayName=d;function b(p){const y=o(e+"CollectionConsumer",p);return yn.useCallback(()=>{const h=y.collectionRef.current;if(!h)return[];const x=Array.from(h.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((T,$)=>x.indexOf(T.ref.current)-x.indexOf($.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:u,ItemSlot:v},b,n]}var r2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],be=r2.reduce((e,t)=>{const r=Jo(`Primitive.${t}`),n=w.forwardRef((s,o)=>{const{asChild:i,...a}=s,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function g1(e,t){e&&ii.flushSync(()=>e.dispatchEvent(t))}function Ur(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function n2(e,t=globalThis==null?void 0:globalThis.document){const r=Ur(e);w.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var s2="DismissableLayer",nm="dismissableLayer.update",o2="dismissableLayer.pointerDownOutside",i2="dismissableLayer.focusOutside",Ow,v1=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$a=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=e,u=w.useContext(v1),[d,f]=w.useState(null),g=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=w.useState({}),b=qe(t,$=>f($)),p=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),m=p.indexOf(y),h=d?p.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,_=h>=m,C=l2($=>{const O=$.target,M=[...u.branches].some(U=>U.contains(O));!_||M||(s==null||s($),i==null||i($),$.defaultPrevented||a==null||a())},g),T=c2($=>{const O=$.target;[...u.branches].some(U=>U.contains(O))||(o==null||o($),i==null||i($),$.defaultPrevented||a==null||a())},g);return n2($=>{h===u.layers.size-1&&(n==null||n($),!$.defaultPrevented&&a&&($.preventDefault(),a()))},g),w.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ow=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Mw(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Ow)}},[d,g,r,u]),w.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Mw())},[d,u]),w.useEffect(()=>{const $=()=>v({});return document.addEventListener(nm,$),()=>document.removeEventListener(nm,$)},[]),l.jsx(be.div,{...c,ref:b,style:{pointerEvents:x?_?"auto":"none":void 0,...e.style},onFocusCapture:pe(e.onFocusCapture,T.onFocusCapture),onBlurCapture:pe(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:pe(e.onPointerDownCapture,C.onPointerDownCapture)})});$a.displayName=s2;var a2="DismissableLayerBranch",y1=w.forwardRef((e,t)=>{const r=w.useContext(v1),n=w.useRef(null),s=qe(t,n);return w.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),l.jsx(be.div,{...e,ref:s})});y1.displayName=a2;function l2(e,t=globalThis==null?void 0:globalThis.document){const r=Ur(e),n=w.useRef(!1),s=w.useRef(()=>{});return w.useEffect(()=>{const o=a=>{if(a.target&&!n.current){let c=function(){w1(o2,r,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function c2(e,t=globalThis==null?void 0:globalThis.document){const r=Ur(e),n=w.useRef(!1);return w.useEffect(()=>{const s=o=>{o.target&&!n.current&&w1(i2,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Mw(){const e=new CustomEvent(nm);document.dispatchEvent(e)}function w1(e,t,r,{discrete:n}){const s=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?g1(s,o):s.dispatchEvent(o)}var u2=$a,d2=y1,Ft=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},f2="Portal",fc=w.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[s,o]=w.useState(!1);Ft(()=>o(!0),[]);const i=r||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?$T.createPortal(l.jsx(be.div,{...n,ref:t}),i):null});fc.displayName=f2;function h2(e,t){return w.useReducer((r,n)=>t[r][n]??r,e)}var On=e=>{const{present:t,children:r}=e,n=p2(t),s=typeof r=="function"?r({present:n.isPresent}):w.Children.only(r),o=qe(n.ref,m2(s));return typeof r=="function"||n.isPresent?w.cloneElement(s,{ref:o}):null};On.displayName="Presence";function p2(e){const[t,r]=w.useState(),n=w.useRef(null),s=w.useRef(e),o=w.useRef("none"),i=e?"mounted":"unmounted",[a,c]=h2(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const u=Gc(n.current);o.current=a==="mounted"?u:"none"},[a]),Ft(()=>{const u=n.current,d=s.current;if(d!==e){const g=o.current,v=Gc(u);e?c("MOUNT"):v==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&g!==v?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Ft(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=v=>{const p=Gc(n.current).includes(CSS.escape(v.animationName));if(v.target===t&&p&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},g=v=>{v.target===t&&(o.current=Gc(n.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function Gc(e){return(e==null?void 0:e.animationName)||"none"}function m2(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var g2=ag[" useInsertionEffect ".trim().toString()]||Ft;function eo({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,i]=v2({defaultProp:t,onChange:r}),a=e!==void 0,c=a?e:s;{const d=w.useRef(e!==void 0);w.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${n} 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,n])}const u=w.useCallback(d=>{var f;if(a){const g=y2(d)?d(e):d;g!==e&&((f=i.current)==null||f.call(i,g))}else o(d)},[a,e,o,i]);return[c,u]}function v2({defaultProp:e,onChange:t}){const[r,n]=w.useState(e),s=w.useRef(r),o=w.useRef(t);return g2(()=>{o.current=t},[t]),w.useEffect(()=>{var i;s.current!==r&&((i=o.current)==null||i.call(o,r),s.current=r)},[r,s]),[r,n,o]}function y2(e){return typeof e=="function"}var x1=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"}),w2="VisuallyHidden",df=w.forwardRef((e,t)=>l.jsx(be.span,{...e,ref:t,style:{...x1,...e.style}}));df.displayName=w2;var x2=df,ov="ToastProvider",[iv,b2,_2]=sv("Toast"),[b1,SH]=An("Toast",[_2]),[S2,ff]=b1(ov),_1=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[a,c]=w.useState(null),[u,d]=w.useState(0),f=w.useRef(!1),g=w.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${ov}\`. Expected non-empty \`string\`.`),l.jsx(iv.Provider,{scope:t,children:l.jsx(S2,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:c,onToastAdd:w.useCallback(()=>d(v=>v+1),[]),onToastRemove:w.useCallback(()=>d(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:g,children:i})})};_1.displayName=ov;var S1="ToastViewport",k2=["F8"],sm="toast.viewportPause",om="toast.viewportResume",k1=w.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=k2,label:s="Notifications ({hotkey})",...o}=e,i=ff(S1,r),a=b2(r),c=w.useRef(null),u=w.useRef(null),d=w.useRef(null),f=w.useRef(null),g=qe(t,f,i.onViewportChange),v=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=i.toastCount>0;w.useEffect(()=>{const y=m=>{var x;n.length!==0&&n.every(_=>m[_]||m.code===_)&&((x=f.current)==null||x.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n]),w.useEffect(()=>{const y=c.current,m=f.current;if(b&&y&&m){const h=()=>{if(!i.isClosePausedRef.current){const T=new CustomEvent(sm);m.dispatchEvent(T),i.isClosePausedRef.current=!0}},x=()=>{if(i.isClosePausedRef.current){const T=new CustomEvent(om);m.dispatchEvent(T),i.isClosePausedRef.current=!1}},_=T=>{!y.contains(T.relatedTarget)&&x()},C=()=>{y.contains(document.activeElement)||x()};return y.addEventListener("focusin",h),y.addEventListener("focusout",_),y.addEventListener("pointermove",h),y.addEventListener("pointerleave",C),window.addEventListener("blur",h),window.addEventListener("focus",x),()=>{y.removeEventListener("focusin",h),y.removeEventListener("focusout",_),y.removeEventListener("pointermove",h),y.removeEventListener("pointerleave",C),window.removeEventListener("blur",h),window.removeEventListener("focus",x)}}},[b,i.isClosePausedRef]);const p=w.useCallback(({tabbingDirection:y})=>{const h=a().map(x=>{const _=x.ref.current,C=[_,...D2(_)];return y==="forwards"?C:C.reverse()});return(y==="forwards"?h.reverse():h).flat()},[a]);return w.useEffect(()=>{const y=f.current;if(y){const m=h=>{var C,T,$;const x=h.altKey||h.ctrlKey||h.metaKey;if(h.key==="Tab"&&!x){const O=document.activeElement,M=h.shiftKey;if(h.target===y&&M){(C=u.current)==null||C.focus();return}const k=p({tabbingDirection:M?"backwards":"forwards"}),L=k.findIndex(P=>P===O);_h(k.slice(L+1))?h.preventDefault():M?(T=u.current)==null||T.focus():($=d.current)==null||$.focus()}};return y.addEventListener("keydown",m),()=>y.removeEventListener("keydown",m)}},[a,p]),l.jsxs(d2,{ref:c,role:"region","aria-label":s.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&l.jsx(im,{ref:u,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"forwards"});_h(y)}}),l.jsx(iv.Slot,{scope:r,children:l.jsx(be.ol,{tabIndex:-1,...o,ref:g})}),b&&l.jsx(im,{ref:d,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"backwards"});_h(y)}})]})});k1.displayName=S1;var C1="ToastFocusProxy",im=w.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=ff(C1,r);return l.jsx(df,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&n()}})});im.displayName=C1;var hc="Toast",C2="toast.swipeStart",E2="toast.swipeMove",N2="toast.swipeCancel",j2="toast.swipeEnd",E1=w.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[a,c]=eo({prop:n,defaultProp:s??!0,onChange:o,caller:hc});return l.jsx(On,{present:r||a,children:l.jsx(T2,{open:a,...i,ref:t,onClose:()=>c(!1),onPause:Ur(e.onPause),onResume:Ur(e.onResume),onSwipeStart:pe(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:pe(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:pe(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:pe(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`),c(!1)})})})});E1.displayName=hc;var[$2,P2]=b1(hc,{onClose(){}}),T2=w.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:g,onSwipeEnd:v,...b}=e,p=ff(hc,r),[y,m]=w.useState(null),h=qe(t,P=>m(P)),x=w.useRef(null),_=w.useRef(null),C=s||p.duration,T=w.useRef(0),$=w.useRef(C),O=w.useRef(0),{onToastAdd:M,onToastRemove:U}=p,j=Ur(()=>{var B;(y==null?void 0:y.contains(document.activeElement))&&((B=p.viewport)==null||B.focus()),i()}),k=w.useCallback(P=>{!P||P===1/0||(window.clearTimeout(O.current),T.current=new Date().getTime(),O.current=window.setTimeout(j,P))},[j]);w.useEffect(()=>{const P=p.viewport;if(P){const B=()=>{k($.current),u==null||u()},H=()=>{const G=new Date().getTime()-T.current;$.current=$.current-G,window.clearTimeout(O.current),c==null||c()};return P.addEventListener(sm,H),P.addEventListener(om,B),()=>{P.removeEventListener(sm,H),P.removeEventListener(om,B)}}},[p.viewport,C,c,u,k]),w.useEffect(()=>{o&&!p.isClosePausedRef.current&&k(C)},[o,C,p.isClosePausedRef,k]),w.useEffect(()=>(M(),()=>U()),[M,U]);const L=w.useMemo(()=>y?I1(y):null,[y]);return p.viewport?l.jsxs(l.Fragment,{children:[L&&l.jsx(R2,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite",children:L}),l.jsx($2,{scope:r,onClose:j,children:ii.createPortal(l.jsx(iv.ItemSlot,{scope:r,children:l.jsx(u2,{asChild:!0,onEscapeKeyDown:pe(a,()=>{p.isFocusedToastEscapeKeyDownRef.current||j(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(be.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":p.swipeDirection,...b,ref:h,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:pe(e.onKeyDown,P=>{P.key==="Escape"&&(a==null||a(P.nativeEvent),P.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,j()))}),onPointerDown:pe(e.onPointerDown,P=>{P.button===0&&(x.current={x:P.clientX,y:P.clientY})}),onPointerMove:pe(e.onPointerMove,P=>{if(!x.current)return;const B=P.clientX-x.current.x,H=P.clientY-x.current.y,G=!!_.current,q=["left","right"].includes(p.swipeDirection),V=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,z=q?V(0,B):0,I=q?0:V(0,H),F=P.pointerType==="touch"?10:2,N={x:z,y:I},S={originalEvent:P,delta:N};G?(_.current=N,Qc(E2,f,S,{discrete:!1})):Dw(N,p.swipeDirection,F)?(_.current=N,Qc(C2,d,S,{discrete:!1}),P.target.setPointerCapture(P.pointerId)):(Math.abs(B)>F||Math.abs(H)>F)&&(x.current=null)}),onPointerUp:pe(e.onPointerUp,P=>{const B=_.current,H=P.target;if(H.hasPointerCapture(P.pointerId)&&H.releasePointerCapture(P.pointerId),_.current=null,x.current=null,B){const G=P.currentTarget,q={originalEvent:P,delta:B};Dw(B,p.swipeDirection,p.swipeThreshold)?Qc(j2,v,q,{discrete:!0}):Qc(N2,g,q,{discrete:!0}),G.addEventListener("click",V=>V.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),R2=e=>{const{__scopeToast:t,children:r,...n}=e,s=ff(hc,t),[o,i]=w.useState(!1),[a,c]=w.useState(!1);return O2(()=>i(!0)),w.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:l.jsx(fc,{asChild:!0,children:l.jsx(df,{...n,children:o&&l.jsxs(l.Fragment,{children:[s.label," ",r]})})})},I2="ToastTitle",N1=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(be.div,{...n,ref:t})});N1.displayName=I2;var A2="ToastDescription",j1=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(be.div,{...n,ref:t})});j1.displayName=A2;var $1="ToastAction",P1=w.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?l.jsx(R1,{altText:r,asChild:!0,children:l.jsx(av,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${$1}\`. Expected non-empty \`string\`.`),null)});P1.displayName=$1;var T1="ToastClose",av=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=P2(T1,r);return l.jsx(R1,{asChild:!0,children:l.jsx(be.button,{type:"button",...n,ref:t,onClick:pe(e.onClick,s.onClose)})})});av.displayName=T1;var R1=w.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return l.jsx(be.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function I1(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),M2(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=n.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...I1(n))}}),t}function Qc(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?g1(s,o):s.dispatchEvent(o)}var Dw=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),o=n>s;return t==="left"||t==="right"?o&&n>r:!o&&s>r};function O2(e=()=>{}){const t=Ur(e);Ft(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function M2(e){return e.nodeType===e.ELEMENT_NODE}function D2(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function _h(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var z2=_1,A1=k1,O1=E1,M1=N1,D1=j1,z1=P1,L1=av;function F1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=F1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function U1(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=F1(e))&&(n&&(n+=" "),n+=t);return n}const zw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Lw=U1,hf=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return Lw(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(u=>{const d=r==null?void 0:r[u],f=o==null?void 0:o[u];if(d===null)return null;const g=zw(d)||zw(f);return s[u][g]}),a=r&&Object.entries(r).reduce((u,d)=>{let[f,g]=d;return g===void 0||(u[f]=g),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:g,...v}=d;return Object.entries(v).every(b=>{let[p,y]=b;return Array.isArray(y)?y.includes({...o,...a}[p]):{...o,...a}[p]===y})?[...u,f,g]:u},[]);return Lw(e,i,c,r==null?void 0:r.class,r==null?void 0:r.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 L2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q1=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).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 F2={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 U2=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:i,...a},c)=>w.createElement("svg",{ref:c,...F2,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:q1("lucide",s),...a},[...i.map(([u,d])=>w.createElement(u,d)),...Array.isArray(o)?o:[o]]));/**
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 De=(e,t)=>{const r=w.forwardRef(({className:n,...s},o)=>w.createElement(U2,{ref:o,iconNode:t,className:q1(`lucide-${L2(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
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 q2=De("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 V1=De("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"}]]);/**
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 lv=De("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"}]]);/**
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 V2=De("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"}]]);/**
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 Sh=De("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"}]]);/**
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 H1=De("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
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 cv=De("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
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 H2=De("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
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 K2=De("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
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 B2=De("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
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 K1=De("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"}]]);/**
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 am=De("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
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 Fw=De("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"}]]);/**
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 W2=De("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"}]]);/**
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 B1=De("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"}]]);/**
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 Uw=De("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"}]]);/**
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 Jn=De("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"}]]);/**
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 Z2=De("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
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 lm=De("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"}]]);/**
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 Jc=De("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"}]]);/**
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 cm=De("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"}]]);/**
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 G2=De("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"}]]);/**
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 qw=De("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 Q2=De("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 Ls=De("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
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 J2=De("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"}]]);/**
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 W1=De("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 gd=De("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"}]]);/**
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 Y2=De("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
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 pf=De("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"}]]);/**
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 tn=De("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"}]]);/**
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 X2=De("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"}]]);/**
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 vd=De("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"}]]);/**
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 yd=De("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),uv="-",eI=e=>{const t=rI(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{const a=i.split(uv);return a[0]===""&&a.length!==1&&a.shift(),Z1(a,t)||tI(i)},getConflictingClassGroupIds:(i,a)=>{const c=r[i]||[];return a&&n[i]?[...c,...n[i]]:c}}},Z1=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?Z1(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(uv);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},Vw=/^\[(.+)\]$/,tI=e=>{if(Vw.test(e)){const t=Vw.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},rI=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return sI(Object.entries(e.classGroups),r).forEach(([o,i])=>{um(i,n,o,t)}),n},um=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:Hw(t,s);o.classGroupId=r;return}if(typeof s=="function"){if(nI(s)){um(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([o,i])=>{um(i,Hw(t,o),r,n)})})},Hw=(e,t)=>{let r=e;return t.split(uv).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},nI=e=>e.isThemeGetter,sI=(e,t)=>t?e.map(([r,n])=>{const s=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,a])=>[t+i,a])):o);return[r,s]}):e,oI=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(o,i)=>{r.set(o,i),t++,t>e&&(t=0,n=r,r=new Map)};return{get(o){let i=r.get(o);if(i!==void 0)return i;if((i=n.get(o))!==void 0)return s(o,i),i},set(o,i){r.has(o)?r.set(o,i):s(o,i)}}},G1="!",iI=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],o=t.length,i=a=>{const c=[];let u=0,d=0,f;for(let y=0;y<a.length;y++){let m=a[y];if(u===0){if(m===s&&(n||a.slice(y,y+o)===t)){c.push(a.slice(d,y)),d=y+o;continue}if(m==="/"){f=y;continue}}m==="["?u++:m==="]"&&u--}const g=c.length===0?a:a.substring(d),v=g.startsWith(G1),b=v?g.substring(1):g,p=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:p}};return r?a=>r({className:a,parseClassName:i}):i},aI=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},lI=e=>({cache:oI(e.cacheSize),parseClassName:iI(e),...eI(e)}),cI=/\s+/,uI=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(cI);let a="";for(let c=i.length-1;c>=0;c-=1){const u=i[c],{modifiers:d,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:v}=r(u);let b=!!v,p=n(b?g.substring(0,v):g);if(!p){if(!b){a=u+(a.length>0?" "+a:a);continue}if(p=n(g),!p){a=u+(a.length>0?" "+a:a);continue}b=!1}const y=aI(d).join(":"),m=f?y+G1:y,h=m+p;if(o.includes(h))continue;o.push(h);const x=s(p,b);for(let _=0;_<x.length;++_){const C=x[_];o.push(m+C)}a=u+(a.length>0?" "+a:a)}return a};function dI(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Q1(t))&&(n&&(n+=" "),n+=r);return n}const Q1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Q1(e[n]))&&(r&&(r+=" "),r+=t);return r};function fI(e,...t){let r,n,s,o=i;function i(c){const u=t.reduce((d,f)=>f(d),e());return r=lI(u),n=r.cache.get,s=r.cache.set,o=a,a(c)}function a(c){const u=n(c);if(u)return u;const d=uI(c,r);return s(c,d),d}return function(){return o(dI.apply(null,arguments))}}const Ge=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},J1=/^\[(?:([a-z-]+):)?(.+)\]$/i,hI=/^\d+\/\d+$/,pI=new Set(["px","full","screen"]),mI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gI=/\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$/,vI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,yI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,wI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fn=e=>Vi(e)||pI.has(e)||hI.test(e),ps=e=>Pa(e,"length",NI),Vi=e=>!!e&&!Number.isNaN(Number(e)),kh=e=>Pa(e,"number",Vi),Ga=e=>!!e&&Number.isInteger(Number(e)),xI=e=>e.endsWith("%")&&Vi(e.slice(0,-1)),ke=e=>J1.test(e),ms=e=>mI.test(e),bI=new Set(["length","size","percentage"]),_I=e=>Pa(e,bI,Y1),SI=e=>Pa(e,"position",Y1),kI=new Set(["image","url"]),CI=e=>Pa(e,kI,$I),EI=e=>Pa(e,"",jI),Qa=()=>!0,Pa=(e,t,r)=>{const n=J1.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},NI=e=>gI.test(e)&&!vI.test(e),Y1=()=>!1,jI=e=>yI.test(e),$I=e=>wI.test(e),PI=()=>{const e=Ge("colors"),t=Ge("spacing"),r=Ge("blur"),n=Ge("brightness"),s=Ge("borderColor"),o=Ge("borderRadius"),i=Ge("borderSpacing"),a=Ge("borderWidth"),c=Ge("contrast"),u=Ge("grayscale"),d=Ge("hueRotate"),f=Ge("invert"),g=Ge("gap"),v=Ge("gradientColorStops"),b=Ge("gradientColorStopPositions"),p=Ge("inset"),y=Ge("margin"),m=Ge("opacity"),h=Ge("padding"),x=Ge("saturate"),_=Ge("scale"),C=Ge("sepia"),T=Ge("skew"),$=Ge("space"),O=Ge("translate"),M=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",ke,t],k=()=>[ke,t],L=()=>["",Fn,ps],P=()=>["auto",Vi,ke],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],G=()=>["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"],V=()=>["","0",ke],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Vi,ke];return{cacheSize:500,separator:":",theme:{colors:[Qa],spacing:[Fn,ps],blur:["none","",ms,ke],brightness:I(),borderColor:[e],borderRadius:["none","","full",ms,ke],borderSpacing:k(),borderWidth:L(),contrast:I(),grayscale:V(),hueRotate:I(),invert:V(),gap:k(),gradientColorStops:[e],gradientColorStopPositions:[xI,ps],inset:j(),margin:j(),opacity:I(),padding:k(),saturate:I(),scale:I(),sepia:V(),skew:I(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",ke]}],container:["container"],columns:[{columns:[ms]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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:[...B(),ke]}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ga,ke]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ke]}],grow:[{grow:V()}],shrink:[{shrink:V()}],order:[{order:["first","last","none",Ga,ke]}],"grid-cols":[{"grid-cols":[Qa]}],"col-start-end":[{col:["auto",{span:["full",Ga,ke]},ke]}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":[Qa]}],"row-start-end":[{row:["auto",{span:[Ga,ke]},ke]}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ke]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ke]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"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:[h]}],px:[{px:[h]}],py:[{py:[h]}],ps:[{ps:[h]}],pe:[{pe:[h]}],pt:[{pt:[h]}],pr:[{pr:[h]}],pb:[{pb:[h]}],pl:[{pl:[h]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"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",ke,t]}],"min-w":[{"min-w":[ke,t,"min","max","fit"]}],"max-w":[{"max-w":[ke,t,"none","full","min","max","fit","prose",{screen:[ms]},ms]}],h:[{h:[ke,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ke,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ke,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ke,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ms,ps]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kh]}],"font-family":[{font:[Qa]}],"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",ke]}],"line-clamp":[{"line-clamp":["none",Vi,kh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Fn,ke]}],"list-image":[{"list-image":["none",ke]}],"list-style-type":[{list:["none","disc","decimal",ke]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[m]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Fn,ps]}],"underline-offset":[{"underline-offset":["auto",Fn,ke]}],"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:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke]}],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",ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[m]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),SI]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",_I]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},CI]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"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":[m]}],"border-style":[{border:[...H(),"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":[m]}],"divide-style":[{divide:H()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...H()]}],"outline-offset":[{"outline-offset":[Fn,ke]}],"outline-w":[{outline:[Fn,ps]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[Fn,ps]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ms,EI]}],"shadow-color":[{shadow:[Qa]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ms,ke]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[m]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"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",ke]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",ke]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",ke]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Ga,ke]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ke]}],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",ke]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",ke]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Fn,ps,kh]}],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"]}}},TI=fI(PI);function xe(...e){return TI(U1(e))}const RI=z2,X1=w.forwardRef(({className:e,...t},r)=>l.jsx(A1,{ref:r,className:xe("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}));X1.displayName=A1.displayName;const II=hf("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"}}),ek=w.forwardRef(({className:e,variant:t,...r},n)=>l.jsx(O1,{ref:n,className:xe(II({variant:t}),e),...r}));ek.displayName=O1.displayName;const AI=w.forwardRef(({className:e,...t},r)=>l.jsx(z1,{ref:r,className:xe("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}));AI.displayName=z1.displayName;const tk=w.forwardRef(({className:e,...t},r)=>l.jsx(L1,{ref:r,className:xe("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:l.jsx(yd,{className:"h-4 w-4"})}));tk.displayName=L1.displayName;const rk=w.forwardRef(({className:e,...t},r)=>l.jsx(M1,{ref:r,className:xe("text-sm font-semibold",e),...t}));rk.displayName=M1.displayName;const nk=w.forwardRef(({className:e,...t},r)=>l.jsx(D1,{ref:r,className:xe("text-sm opacity-90",e),...t}));nk.displayName=D1.displayName;function OI(){const{toasts:e}=ir();return l.jsxs(RI,{children:[e.map(function({id:t,title:r,description:n,action:s,...o}){return l.jsxs(ek,{...o,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(rk,{children:r}),n&&l.jsx(nk,{children:n})]}),s,l.jsx(tk,{})]},t)}),l.jsx(X1,{})]})}var MI=ag[" useId ".trim().toString()]||(()=>{}),DI=0;function Xn(e){const[t,r]=w.useState(MI());return Ft(()=>{r(n=>n??String(DI++))},[e]),t?`radix-${t}`:""}const zI=["top","right","bottom","left"],to=Math.min,br=Math.max,wd=Math.round,Yc=Math.floor,Rn=e=>({x:e,y:e}),LI={left:"right",right:"left",bottom:"top",top:"bottom"},FI={start:"end",end:"start"};function dm(e,t,r){return br(e,to(t,r))}function as(e,t){return typeof e=="function"?e(t):e}function ls(e){return e.split("-")[0]}function Ta(e){return e.split("-")[1]}function dv(e){return e==="x"?"y":"x"}function fv(e){return e==="y"?"height":"width"}const UI=new Set(["top","bottom"]);function Nn(e){return UI.has(ls(e))?"y":"x"}function hv(e){return dv(Nn(e))}function qI(e,t,r){r===void 0&&(r=!1);const n=Ta(e),s=hv(e),o=fv(s);let i=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=xd(i)),[i,xd(i)]}function VI(e){const t=xd(e);return[fm(e),t,fm(t)]}function fm(e){return e.replace(/start|end/g,t=>FI[t])}const Kw=["left","right"],Bw=["right","left"],HI=["top","bottom"],KI=["bottom","top"];function BI(e,t,r){switch(e){case"top":case"bottom":return r?t?Bw:Kw:t?Kw:Bw;case"left":case"right":return t?HI:KI;default:return[]}}function WI(e,t,r,n){const s=Ta(e);let o=BI(ls(e),r==="start",n);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(fm)))),o}function xd(e){return e.replace(/left|right|bottom|top/g,t=>LI[t])}function ZI(e){return{top:0,right:0,bottom:0,left:0,...e}}function sk(e){return typeof e!="number"?ZI(e):{top:e,right:e,bottom:e,left:e}}function bd(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function Ww(e,t,r){let{reference:n,floating:s}=e;const o=Nn(t),i=hv(t),a=fv(i),c=ls(t),u=o==="y",d=n.x+n.width/2-s.width/2,f=n.y+n.height/2-s.height/2,g=n[a]/2-s[a]/2;let v;switch(c){case"top":v={x:d,y:n.y-s.height};break;case"bottom":v={x:d,y:n.y+n.height};break;case"right":v={x:n.x+n.width,y:f};break;case"left":v={x:n.x-s.width,y:f};break;default:v={x:n.x,y:n.y}}switch(Ta(t)){case"start":v[i]-=g*(r&&u?-1:1);break;case"end":v[i]+=g*(r&&u?-1:1);break}return v}const GI=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:i}=r,a=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:f}=Ww(u,n,c),g=n,v={},b=0;for(let p=0;p<a.length;p++){const{name:y,fn:m}=a[p],{x:h,y:x,data:_,reset:C}=await m({x:d,y:f,initialPlacement:n,placement:g,strategy:s,middlewareData:v,rects:u,platform:i,elements:{reference:e,floating:t}});d=h??d,f=x??f,v={...v,[y]:{...v[y],..._}},C&&b<=50&&(b++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:d,y:f}=Ww(u,g,c)),p=-1)}return{x:d,y:f,placement:g,strategy:s,middlewareData:v}};async function Ql(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:o,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:g=!1,padding:v=0}=as(t,e),b=sk(v),y=a[g?f==="floating"?"reference":"floating":f],m=bd(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(y)))==null||r?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),h=f==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),_=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},C=bd(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:h,offsetParent:x,strategy:c}):h);return{top:(m.top-C.top+b.top)/_.y,bottom:(C.bottom-m.bottom+b.bottom)/_.y,left:(m.left-C.left+b.left)/_.x,right:(C.right-m.right+b.right)/_.x}}const QI=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:o,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=as(e,t)||{};if(u==null)return{};const f=sk(d),g={x:r,y:n},v=hv(s),b=fv(v),p=await i.getDimensions(u),y=v==="y",m=y?"top":"left",h=y?"bottom":"right",x=y?"clientHeight":"clientWidth",_=o.reference[b]+o.reference[v]-g[v]-o.floating[b],C=g[v]-o.reference[v],T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let $=T?T[x]:0;(!$||!await(i.isElement==null?void 0:i.isElement(T)))&&($=a.floating[x]||o.floating[b]);const O=_/2-C/2,M=$/2-p[b]/2-1,U=to(f[m],M),j=to(f[h],M),k=U,L=$-p[b]-j,P=$/2-p[b]/2+O,B=dm(k,P,L),H=!c.arrow&&Ta(s)!=null&&P!==B&&o.reference[b]/2-(P<k?U:j)-p[b]/2<0,G=H?P<k?P-k:P-L:0;return{[v]:g[v]+G,data:{[v]:B,centerOffset:P-B-G,...H&&{alignmentOffset:G}},reset:H}}}),JI=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:o,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:p=!0,...y}=as(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const m=ls(s),h=Nn(a),x=ls(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=g||(x||!p?[xd(a)]:VI(a)),T=b!=="none";!g&&T&&C.push(...WI(a,p,b,_));const $=[a,...C],O=await Ql(t,y),M=[];let U=((n=o.flip)==null?void 0:n.overflows)||[];if(d&&M.push(O[m]),f){const P=qI(s,i,_);M.push(O[P[0]],O[P[1]])}if(U=[...U,{placement:s,overflows:M}],!M.every(P=>P<=0)){var j,k;const P=(((j=o.flip)==null?void 0:j.index)||0)+1,B=$[P];if(B&&(!(f==="alignment"?h!==Nn(B):!1)||U.every(q=>Nn(q.placement)===h?q.overflows[0]>0:!0)))return{data:{index:P,overflows:U},reset:{placement:B}};let H=(k=U.filter(G=>G.overflows[0]<=0).sort((G,q)=>G.overflows[1]-q.overflows[1])[0])==null?void 0:k.placement;if(!H)switch(v){case"bestFit":{var L;const G=(L=U.filter(q=>{if(T){const V=Nn(q.placement);return V===h||V==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(V=>V>0).reduce((V,z)=>V+z,0)]).sort((q,V)=>q[1]-V[1])[0])==null?void 0:L[0];G&&(H=G);break}case"initialPlacement":H=a;break}if(s!==H)return{reset:{placement:H}}}return{}}}};function Zw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Gw(e){return zI.some(t=>e[t]>=0)}const YI=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...s}=as(e,t);switch(n){case"referenceHidden":{const o=await Ql(t,{...s,elementContext:"reference"}),i=Zw(o,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Gw(i)}}}case"escaped":{const o=await Ql(t,{...s,altBoundary:!0}),i=Zw(o,r.floating);return{data:{escapedOffsets:i,escaped:Gw(i)}}}default:return{}}}}},ok=new Set(["left","top"]);async function XI(e,t){const{placement:r,platform:n,elements:s}=e,o=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=ls(r),a=Ta(r),c=Nn(r)==="y",u=ok.has(i)?-1:1,d=o&&c?-1:1,f=as(t,e);let{mainAxis:g,crossAxis:v,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(v=a==="end"?b*-1:b),c?{x:v*d,y:g*u}:{x:g*u,y:v*d}}const eA=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:o,placement:i,middlewareData:a}=t,c=await XI(t,e);return i===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:i}}}}},tA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x:m,y:h}=y;return{x:m,y:h}}},...c}=as(e,t),u={x:r,y:n},d=await Ql(t,c),f=Nn(ls(s)),g=dv(f);let v=u[g],b=u[f];if(o){const y=g==="y"?"top":"left",m=g==="y"?"bottom":"right",h=v+d[y],x=v-d[m];v=dm(h,v,x)}if(i){const y=f==="y"?"top":"left",m=f==="y"?"bottom":"right",h=b+d[y],x=b-d[m];b=dm(h,b,x)}const p=a.fn({...t,[g]:v,[f]:b});return{...p,data:{x:p.x-r,y:p.y-n,enabled:{[g]:o,[f]:i}}}}}},rA=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=as(e,t),d={x:r,y:n},f=Nn(s),g=dv(f);let v=d[g],b=d[f];const p=as(a,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const x=g==="y"?"height":"width",_=o.reference[g]-o.floating[x]+y.mainAxis,C=o.reference[g]+o.reference[x]-y.mainAxis;v<_?v=_:v>C&&(v=C)}if(u){var m,h;const x=g==="y"?"width":"height",_=ok.has(ls(s)),C=o.reference[f]-o.floating[x]+(_&&((m=i.offset)==null?void 0:m[f])||0)+(_?0:y.crossAxis),T=o.reference[f]+o.reference[x]+(_?0:((h=i.offset)==null?void 0:h[f])||0)-(_?y.crossAxis:0);b<C?b=C:b>T&&(b=T)}return{[g]:v,[f]:b}}}},nA=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:o,platform:i,elements:a}=t,{apply:c=()=>{},...u}=as(e,t),d=await Ql(t,u),f=ls(s),g=Ta(s),v=Nn(s)==="y",{width:b,height:p}=o.floating;let y,m;f==="top"||f==="bottom"?(y=f,m=g===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(m=f,y=g==="end"?"top":"bottom");const h=p-d.top-d.bottom,x=b-d.left-d.right,_=to(p-d[y],h),C=to(b-d[m],x),T=!t.middlewareData.shift;let $=_,O=C;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(O=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&($=h),T&&!g){const U=br(d.left,0),j=br(d.right,0),k=br(d.top,0),L=br(d.bottom,0);v?O=b-2*(U!==0||j!==0?U+j:br(d.left,d.right)):$=p-2*(k!==0||L!==0?k+L:br(d.top,d.bottom))}await c({...t,availableWidth:O,availableHeight:$});const M=await i.getDimensions(a.floating);return b!==M.width||p!==M.height?{reset:{rects:!0}}:{}}}};function mf(){return typeof window<"u"}function Ra(e){return ik(e)?(e.nodeName||"").toLowerCase():"#document"}function Cr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mn(e){var t;return(t=(ik(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ik(e){return mf()?e instanceof Node||e instanceof Cr(e).Node:!1}function cn(e){return mf()?e instanceof Element||e instanceof Cr(e).Element:!1}function In(e){return mf()?e instanceof HTMLElement||e instanceof Cr(e).HTMLElement:!1}function Qw(e){return!mf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Cr(e).ShadowRoot}const sA=new Set(["inline","contents"]);function pc(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=un(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!sA.has(s)}const oA=new Set(["table","td","th"]);function iA(e){return oA.has(Ra(e))}const aA=[":popover-open",":modal"];function gf(e){return aA.some(t=>{try{return e.matches(t)}catch{return!1}})}const lA=["transform","translate","scale","rotate","perspective"],cA=["transform","translate","scale","rotate","perspective","filter"],uA=["paint","layout","strict","content"];function pv(e){const t=mv(),r=cn(e)?un(e):e;return lA.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||cA.some(n=>(r.willChange||"").includes(n))||uA.some(n=>(r.contain||"").includes(n))}function dA(e){let t=ro(e);for(;In(t)&&!va(t);){if(pv(t))return t;if(gf(t))return null;t=ro(t)}return null}function mv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const fA=new Set(["html","body","#document"]);function va(e){return fA.has(Ra(e))}function un(e){return Cr(e).getComputedStyle(e)}function vf(e){return cn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ro(e){if(Ra(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qw(e)&&e.host||Mn(e);return Qw(t)?t.host:t}function ak(e){const t=ro(e);return va(t)?e.ownerDocument?e.ownerDocument.body:e.body:In(t)&&pc(t)?t:ak(t)}function Jl(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=ak(e),o=s===((n=e.ownerDocument)==null?void 0:n.body),i=Cr(s);if(o){const a=hm(i);return t.concat(i,i.visualViewport||[],pc(s)?s:[],a&&r?Jl(a):[])}return t.concat(s,Jl(s,[],r))}function hm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function lk(e){const t=un(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=In(e),o=s?e.offsetWidth:r,i=s?e.offsetHeight:n,a=wd(r)!==o||wd(n)!==i;return a&&(r=o,n=i),{width:r,height:n,$:a}}function gv(e){return cn(e)?e:e.contextElement}function Hi(e){const t=gv(e);if(!In(t))return Rn(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:o}=lk(t);let i=(o?wd(r.width):r.width)/n,a=(o?wd(r.height):r.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const hA=Rn(0);function ck(e){const t=Cr(e);return!mv()||!t.visualViewport?hA:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pA(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Cr(e)?!1:t}function Yo(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),o=gv(e);let i=Rn(1);t&&(n?cn(n)&&(i=Hi(n)):i=Hi(e));const a=pA(o,r,n)?ck(o):Rn(0);let c=(s.left+a.x)/i.x,u=(s.top+a.y)/i.y,d=s.width/i.x,f=s.height/i.y;if(o){const g=Cr(o),v=n&&cn(n)?Cr(n):n;let b=g,p=hm(b);for(;p&&n&&v!==b;){const y=Hi(p),m=p.getBoundingClientRect(),h=un(p),x=m.left+(p.clientLeft+parseFloat(h.paddingLeft))*y.x,_=m.top+(p.clientTop+parseFloat(h.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,f*=y.y,c+=x,u+=_,b=Cr(p),p=hm(b)}}return bd({width:d,height:f,x:c,y:u})}function yf(e,t){const r=vf(e).scrollLeft;return t?t.left+r:Yo(Mn(e)).left+r}function uk(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-yf(e,r),s=r.top+t.scrollTop;return{x:n,y:s}}function mA(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const o=s==="fixed",i=Mn(n),a=t?gf(t.floating):!1;if(n===i||a&&o)return r;let c={scrollLeft:0,scrollTop:0},u=Rn(1);const d=Rn(0),f=In(n);if((f||!f&&!o)&&((Ra(n)!=="body"||pc(i))&&(c=vf(n)),In(n))){const v=Yo(n);u=Hi(n),d.x=v.x+n.clientLeft,d.y=v.y+n.clientTop}const g=i&&!f&&!o?uk(i,c):Rn(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+g.x,y:r.y*u.y-c.scrollTop*u.y+d.y+g.y}}function gA(e){return Array.from(e.getClientRects())}function vA(e){const t=Mn(e),r=vf(e),n=e.ownerDocument.body,s=br(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=br(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+yf(e);const a=-r.scrollTop;return un(n).direction==="rtl"&&(i+=br(t.clientWidth,n.clientWidth)-s),{width:s,height:o,x:i,y:a}}const Jw=25;function yA(e,t){const r=Cr(e),n=Mn(e),s=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,a=0,c=0;if(s){o=s.width,i=s.height;const d=mv();(!d||d&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}const u=yf(n);if(u<=0){const d=n.ownerDocument,f=d.body,g=getComputedStyle(f),v=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,b=Math.abs(n.clientWidth-f.clientWidth-v);b<=Jw&&(o-=b)}else u<=Jw&&(o+=u);return{width:o,height:i,x:a,y:c}}const wA=new Set(["absolute","fixed"]);function xA(e,t){const r=Yo(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,o=In(e)?Hi(e):Rn(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,c=s*o.x,u=n*o.y;return{width:i,height:a,x:c,y:u}}function Yw(e,t,r){let n;if(t==="viewport")n=yA(e,r);else if(t==="document")n=vA(Mn(e));else if(cn(t))n=xA(t,r);else{const s=ck(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return bd(n)}function dk(e,t){const r=ro(e);return r===t||!cn(r)||va(r)?!1:un(r).position==="fixed"||dk(r,t)}function bA(e,t){const r=t.get(e);if(r)return r;let n=Jl(e,[],!1).filter(a=>cn(a)&&Ra(a)!=="body"),s=null;const o=un(e).position==="fixed";let i=o?ro(e):e;for(;cn(i)&&!va(i);){const a=un(i),c=pv(i);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&!!s&&wA.has(s.position)||pc(i)&&!c&&dk(e,i))?n=n.filter(d=>d!==i):s=a,i=ro(i)}return t.set(e,n),n}function _A(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const i=[...r==="clippingAncestors"?gf(t)?[]:bA(t,this._c):[].concat(r),n],a=i[0],c=i.reduce((u,d)=>{const f=Yw(t,d,s);return u.top=br(f.top,u.top),u.right=to(f.right,u.right),u.bottom=to(f.bottom,u.bottom),u.left=br(f.left,u.left),u},Yw(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function SA(e){const{width:t,height:r}=lk(e);return{width:t,height:r}}function kA(e,t,r){const n=In(t),s=Mn(t),o=r==="fixed",i=Yo(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Rn(0);function u(){c.x=yf(s)}if(n||!n&&!o)if((Ra(t)!=="body"||pc(s))&&(a=vf(t)),n){const v=Yo(t,!0,o,t);c.x=v.x+t.clientLeft,c.y=v.y+t.clientTop}else s&&u();o&&!n&&s&&u();const d=s&&!n&&!o?uk(s,a):Rn(0),f=i.left+a.scrollLeft-c.x-d.x,g=i.top+a.scrollTop-c.y-d.y;return{x:f,y:g,width:i.width,height:i.height}}function Ch(e){return un(e).position==="static"}function Xw(e,t){if(!In(e)||un(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Mn(e)===r&&(r=r.ownerDocument.body),r}function fk(e,t){const r=Cr(e);if(gf(e))return r;if(!In(e)){let s=ro(e);for(;s&&!va(s);){if(cn(s)&&!Ch(s))return s;s=ro(s)}return r}let n=Xw(e,t);for(;n&&iA(n)&&Ch(n);)n=Xw(n,t);return n&&va(n)&&Ch(n)&&!pv(n)?r:n||dA(e)||r}const CA=async function(e){const t=this.getOffsetParent||fk,r=this.getDimensions,n=await r(e.floating);return{reference:kA(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function EA(e){return un(e).direction==="rtl"}const NA={convertOffsetParentRelativeRectToViewportRelativeRect:mA,getDocumentElement:Mn,getClippingRect:_A,getOffsetParent:fk,getElementRects:CA,getClientRects:gA,getDimensions:SA,getScale:Hi,isElement:cn,isRTL:EA};function hk(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jA(e,t){let r=null,n;const s=Mn(e);function o(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:d,top:f,width:g,height:v}=u;if(a||t(),!g||!v)return;const b=Yc(f),p=Yc(s.clientWidth-(d+g)),y=Yc(s.clientHeight-(f+v)),m=Yc(d),x={rootMargin:-b+"px "+-p+"px "+-y+"px "+-m+"px",threshold:br(0,to(1,c))||1};let _=!0;function C(T){const $=T[0].intersectionRatio;if($!==c){if(!_)return i();$?i(!1,$):n=setTimeout(()=>{i(!1,1e-7)},1e3)}$===1&&!hk(u,e.getBoundingClientRect())&&i(),_=!1}try{r=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{r=new IntersectionObserver(C,x)}r.observe(e)}return i(!0),o}function $A(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=gv(e),d=s||o?[...u?Jl(u):[],...Jl(t)]:[];d.forEach(m=>{s&&m.addEventListener("scroll",r,{passive:!0}),o&&m.addEventListener("resize",r)});const f=u&&a?jA(u,r):null;let g=-1,v=null;i&&(v=new ResizeObserver(m=>{let[h]=m;h&&h.target===u&&v&&(v.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=v)==null||x.observe(t)})),r()}),u&&!c&&v.observe(u),v.observe(t));let b,p=c?Yo(e):null;c&&y();function y(){const m=Yo(e);p&&!hk(p,m)&&r(),p=m,b=requestAnimationFrame(y)}return r(),()=>{var m;d.forEach(h=>{s&&h.removeEventListener("scroll",r),o&&h.removeEventListener("resize",r)}),f==null||f(),(m=v)==null||m.disconnect(),v=null,c&&cancelAnimationFrame(b)}}const PA=eA,TA=tA,RA=JI,IA=nA,AA=YI,ex=QI,OA=rA,MA=(e,t,r)=>{const n=new Map,s={platform:NA,...r},o={...s.platform,_c:n};return GI(e,t,{...s,platform:o})};var DA=typeof document<"u",zA=function(){},Pu=DA?w.useLayoutEffect:zA;function _d(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 r,n,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!_d(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const o=s[n];if(!(o==="_owner"&&e.$$typeof)&&!_d(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function pk(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tx(e,t){const r=pk(e);return Math.round(t*r)/r}function Eh(e){const t=w.useRef(e);return Pu(()=>{t.current=e}),t}function LA(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,f]=w.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[g,v]=w.useState(n);_d(g,n)||v(n);const[b,p]=w.useState(null),[y,m]=w.useState(null),h=w.useCallback(q=>{q!==T.current&&(T.current=q,p(q))},[]),x=w.useCallback(q=>{q!==$.current&&($.current=q,m(q))},[]),_=o||b,C=i||y,T=w.useRef(null),$=w.useRef(null),O=w.useRef(d),M=c!=null,U=Eh(c),j=Eh(s),k=Eh(u),L=w.useCallback(()=>{if(!T.current||!$.current)return;const q={placement:t,strategy:r,middleware:g};j.current&&(q.platform=j.current),MA(T.current,$.current,q).then(V=>{const z={...V,isPositioned:k.current!==!1};P.current&&!_d(O.current,z)&&(O.current=z,ii.flushSync(()=>{f(z)}))})},[g,t,r,j,k]);Pu(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(q=>({...q,isPositioned:!1})))},[u]);const P=w.useRef(!1);Pu(()=>(P.current=!0,()=>{P.current=!1}),[]),Pu(()=>{if(_&&(T.current=_),C&&($.current=C),_&&C){if(U.current)return U.current(_,C,L);L()}},[_,C,L,U,M]);const B=w.useMemo(()=>({reference:T,floating:$,setReference:h,setFloating:x}),[h,x]),H=w.useMemo(()=>({reference:_,floating:C}),[_,C]),G=w.useMemo(()=>{const q={position:r,left:0,top:0};if(!H.floating)return q;const V=tx(H.floating,d.x),z=tx(H.floating,d.y);return a?{...q,transform:"translate("+V+"px, "+z+"px)",...pk(H.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:V,top:z}},[r,a,H.floating,d.x,d.y]);return w.useMemo(()=>({...d,update:L,refs:B,elements:H,floatingStyles:G}),[d,L,B,H,G])}const FA=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?ex({element:n.current,padding:s}).fn(r):{}:n?ex({element:n,padding:s}).fn(r):{}}}},UA=(e,t)=>({...PA(e),options:[e,t]}),qA=(e,t)=>({...TA(e),options:[e,t]}),VA=(e,t)=>({...OA(e),options:[e,t]}),HA=(e,t)=>({...RA(e),options:[e,t]}),KA=(e,t)=>({...IA(e),options:[e,t]}),BA=(e,t)=>({...AA(e),options:[e,t]}),WA=(e,t)=>({...FA(e),options:[e,t]});var ZA="Arrow",mk=w.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...o}=e;return l.jsx(be.svg,{...o,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});mk.displayName=ZA;var GA=mk;function gk(e){const[t,r]=w.useState(void 0);return Ft(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,a;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;r({width:i,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var vv="Popper",[vk,Ia]=An(vv),[QA,yk]=vk(vv),wk=e=>{const{__scopePopper:t,children:r}=e,[n,s]=w.useState(null);return l.jsx(QA,{scope:t,anchor:n,onAnchorChange:s,children:r})};wk.displayName=vv;var xk="PopperAnchor",bk=w.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,o=yk(xk,r),i=w.useRef(null),a=qe(t,i),c=w.useRef(null);return w.useEffect(()=>{const u=c.current;c.current=(n==null?void 0:n.current)||i.current,u!==c.current&&o.onAnchorChange(c.current)}),n?null:l.jsx(be.div,{...s,ref:a})});bk.displayName=xk;var yv="PopperContent",[JA,YA]=vk(yv),_k=w.forwardRef((e,t)=>{var K,Z,ce,re,X,ve;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:b,...p}=e,y=yk(yv,r),[m,h]=w.useState(null),x=qe(t,Le=>h(Le)),[_,C]=w.useState(null),T=gk(_),$=(T==null?void 0:T.width)??0,O=(T==null?void 0:T.height)??0,M=n+(o!=="center"?"-"+o:""),U=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},j=Array.isArray(u)?u:[u],k=j.length>0,L={padding:U,boundary:j.filter(eO),altBoundary:k},{refs:P,floatingStyles:B,placement:H,isPositioned:G,middlewareData:q}=LA({strategy:"fixed",placement:M,whileElementsMounted:(...Le)=>$A(...Le,{animationFrame:v==="always"}),elements:{reference:y.anchor},middleware:[UA({mainAxis:s+O,alignmentAxis:i}),c&&qA({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?VA():void 0,...L}),c&&HA({...L}),KA({...L,apply:({elements:Le,rects:gt,availableWidth:Y,availableHeight:me})=>{const{width:J,height:Me}=gt.reference,ie=Le.floating.style;ie.setProperty("--radix-popper-available-width",`${Y}px`),ie.setProperty("--radix-popper-available-height",`${me}px`),ie.setProperty("--radix-popper-anchor-width",`${J}px`),ie.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),_&&WA({element:_,padding:a}),tO({arrowWidth:$,arrowHeight:O}),g&&BA({strategy:"referenceHidden",...L})]}),[V,z]=Ck(H),I=Ur(b);Ft(()=>{G&&(I==null||I())},[G,I]);const F=(K=q.arrow)==null?void 0:K.x,N=(Z=q.arrow)==null?void 0:Z.y,S=((ce=q.arrow)==null?void 0:ce.centerOffset)!==0,[E,D]=w.useState();return Ft(()=>{m&&D(window.getComputedStyle(m).zIndex)},[m]),l.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:G?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:E,"--radix-popper-transform-origin":[(re=q.transformOrigin)==null?void 0:re.x,(X=q.transformOrigin)==null?void 0:X.y].join(" "),...((ve=q.hide)==null?void 0:ve.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(JA,{scope:r,placedSide:V,onArrowChange:C,arrowX:F,arrowY:N,shouldHideArrow:S,children:l.jsx(be.div,{"data-side":V,"data-align":z,...p,ref:x,style:{...p.style,animation:G?void 0:"none"}})})})});_k.displayName=yv;var Sk="PopperArrow",XA={top:"bottom",right:"left",bottom:"top",left:"right"},kk=w.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,o=YA(Sk,n),i=XA[o.placedSide];return l.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:l.jsx(GA,{...s,ref:r,style:{...s.style,display:"block"}})})});kk.displayName=Sk;function eO(e){return e!==null}var tO=e=>({name:"transformOrigin",options:e,fn(t){var y,m,h;const{placement:r,rects:n,middlewareData:s}=t,i=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=Ck(r),f={start:"0%",center:"50%",end:"100%"}[d],g=(((m=s.arrow)==null?void 0:m.x)??0)+a/2,v=(((h=s.arrow)==null?void 0:h.y)??0)+c/2;let b="",p="";return u==="bottom"?(b=i?f:`${g}px`,p=`${-c}px`):u==="top"?(b=i?f:`${g}px`,p=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,p=i?f:`${v}px`):u==="left"&&(b=`${n.floating.width+c}px`,p=i?f:`${v}px`),{data:{x:b,y:p}}}});function Ck(e){const[t,r="center"]=e.split("-");return[t,r]}var Ek=wk,wf=bk,wv=_k,xv=kk,[xf,kH]=An("Tooltip",[Ia]),bv=Ia(),Nk="TooltipProvider",rO=700,rx="tooltip.open",[nO,jk]=xf(Nk),$k=e=>{const{__scopeTooltip:t,delayDuration:r=rO,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,i=w.useRef(!0),a=w.useRef(!1),c=w.useRef(0);return w.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(nO,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:w.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:a,onPointerInTransitChange:w.useCallback(u=>{a.current=u},[]),disableHoverableContent:s,children:o})};$k.displayName=Nk;var Pk="Tooltip",[CH,bf]=xf(Pk),pm="TooltipTrigger",sO=w.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=bf(pm,r),o=jk(pm,r),i=bv(r),a=w.useRef(null),c=qe(t,a,s.onTriggerChange),u=w.useRef(!1),d=w.useRef(!1),f=w.useCallback(()=>u.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(wf,{asChild:!0,...i,children:l.jsx(be.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:pe(e.onPointerMove,g=>{g.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:pe(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:pe(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:pe(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:pe(e.onBlur,s.onClose),onClick:pe(e.onClick,s.onClose)})})});sO.displayName=pm;var oO="TooltipPortal",[EH,iO]=xf(oO,{forceMount:void 0}),ya="TooltipContent",Tk=w.forwardRef((e,t)=>{const r=iO(ya,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=bf(ya,e.__scopeTooltip);return l.jsx(On,{present:n||i.open,children:i.disableHoverableContent?l.jsx(Rk,{side:s,...o,ref:t}):l.jsx(aO,{side:s,...o,ref:t})})}),aO=w.forwardRef((e,t)=>{const r=bf(ya,e.__scopeTooltip),n=jk(ya,e.__scopeTooltip),s=w.useRef(null),o=qe(t,s),[i,a]=w.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:f}=n,g=w.useCallback(()=>{a(null),f(!1)},[f]),v=w.useCallback((b,p)=>{const y=b.currentTarget,m={x:b.clientX,y:b.clientY},h=fO(m,y.getBoundingClientRect()),x=hO(m,h),_=pO(p.getBoundingClientRect()),C=gO([...x,..._]);a(C),f(!0)},[f]);return w.useEffect(()=>()=>g(),[g]),w.useEffect(()=>{if(c&&d){const b=y=>v(y,d),p=y=>v(y,c);return c.addEventListener("pointerleave",b),d.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",b),d.removeEventListener("pointerleave",p)}}},[c,d,v,g]),w.useEffect(()=>{if(i){const b=p=>{const y=p.target,m={x:p.clientX,y:p.clientY},h=(c==null?void 0:c.contains(y))||(d==null?void 0:d.contains(y)),x=!mO(m,i);h?g():x&&(g(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,d,i,u,g]),l.jsx(Rk,{...e,ref:o})}),[lO,cO]=xf(Pk,{isInside:!1}),uO=YR("TooltipContent"),Rk=w.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,c=bf(ya,r),u=bv(r),{onClose:d}=c;return w.useEffect(()=>(document.addEventListener(rx,d),()=>document.removeEventListener(rx,d)),[d]),w.useEffect(()=>{if(c.trigger){const f=g=>{const v=g.target;v!=null&&v.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx($a,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(wv,{"data-state":c.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:[l.jsx(uO,{children:n}),l.jsx(lO,{scope:r,isInside:!0,children:l.jsx(x2,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Tk.displayName=ya;var Ik="TooltipArrow",dO=w.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=bv(r);return cO(Ik,r).isInside?null:l.jsx(xv,{...s,...n,ref:t})});dO.displayName=Ik;function fO(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function hO(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function pO(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function mO(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const a=t[o],c=t[i],u=a.x,d=a.y,f=c.x,g=c.y;d>n!=g>n&&r<(f-u)*(n-d)/(g-d)+u&&(s=!s)}return s}function gO(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),vO(t)}function vO(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const s=e[n];for(;t.length>=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const o=r[r.length-1],i=r[r.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var yO=$k,Ak=Tk;const wO=yO,xO=w.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(Ak,{ref:n,sideOffset:t,className:xe("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),...r}));xO.displayName=Ak.displayName;const bO={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 _O(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))}:bO}const Wt="#92E4DD",ur="#F9386D",Qr="#FFFFFF",Sn="bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900";function vn(e){return e.type==="mcp"||e.type==="local-mcp"?Wt:e.cardColor??Wt}function kn(e){return{borderColor:e,color:e,boxShadow:`0 0 20px ${e}20`}}const SO=hf("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:{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"}}),le=w.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},o)=>{const i=n?QR:"button";return l.jsx(i,{className:xe(SO({variant:t,size:r,className:e})),ref:o,...s})});le.displayName="Button";function Ki({warnings:e}){if(!(e!=null&&e.length))return null;const t=e.find(n=>n.severity==="error")??e[0],r=t.severity==="error";return l.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 ${r?"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(n=>n.message).join(" · "),"data-testid":"card-warning-badge",children:[l.jsx(tn,{className:"h-2.5 w-2.5 shrink-0"}),l.jsx("span",{className:"max-w-[72px] truncate",children:t.message})]})}const nx="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 kO(e){return e.iconUrl?e.iconUrl:null}function Ok({service:e}){const t=vn(e),r=kO(e),[n,s]=w.useState(!1);return r&&!n?l.jsx("img",{src:r,alt:"",className:"w-7 h-7 object-contain rounded-sm",draggable:!1,onError:()=>s(!0)}):l.jsx("div",{style:{width:28,height:28,backgroundColor:t,WebkitMask:`url(${nx}) no-repeat center / contain`,mask:`url(${nx}) no-repeat center / contain`},"aria-hidden":!0})}function _v(e){return e?"ring-2 ring-inset ring-yellow-400/90 shadow-[0_0_10px_rgba(250,204,21,0.2)]":""}function Sv(){return l.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 CO({service:e,onDragStart:t,onDragEnd:r,isInActiveDeck:n,onCardClick:s,isInCollection:o=!1,onMouseEnter:i,onMouseLeave:a,activeDeck:c,warnings:u}){const d=yr(),{toast:f}=ir(),g=vn(e),v=Ct({mutationFn:async()=>{if(!c)throw new Error("No active deck found");return Ee("POST",`/api/decks/${c.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:m=>{f({title:"Failed to add service",description:m.message,variant:"destructive"})}}),b=Ct({mutationFn:async()=>Ee("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:m=>{f({title:"Failed to delete service",description:m.message,variant:"destructive"})}}),p=m=>{m.stopPropagation(),v.mutate()},y=m=>{m.stopPropagation(),window.confirm(`Are you sure you want to delete ${e.name}? This action cannot be undone.`)&&b.mutate()};return l.jsx("div",{className:"relative group cursor-pointer",draggable:!n,onDragStart:m=>t(m,e),onDragEnd:r,onClick:()=>s==null?void 0:s(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:l.jsxs("div",{className:`
239
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
240
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
241
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
242
- relative overflow-hidden
243
- ${_v(n)}
244
- ${o?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
245
- `,style:{borderColor:g,boxShadow:`0 0 20px ${g}20`},children:[l.jsx(Ki,{warnings:u}),n&&l.jsx(Sv,{}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:g},children:e.type==="mcp"?"RM":e.type==="local-mcp"?"LM":"A"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:g},children:e.type==="mcp"?"RM":e.type==="local-mcp"?"LM":"A"})}),l.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:l.jsx(le,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:y,title:`Delete ${e.name}`,children:l.jsx(pf,{className:"w-3 h-3"})})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:g},children:l.jsx(Ok,{service:e})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2","data-testid":`text-service-name-${e.id}`,style:{color:g},children:e.name}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:g,borderColor:g},children:e.type==="mcp"?"Remote MCP":e.type==="local-mcp"?"Local MCP":"A2A"})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(le,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:g,borderColor:g},onClick:p,disabled:n||v.isPending,"data-testid":`button-add-to-deck-${e.id}`,children:n?"IN DECK":"ADD"})}),l.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 EO=w.memo(CO);function NO(e){return e.iconUrl?e.iconUrl:null}function Mk({credential:e,color:t}){const r=NO(e);return r?l.jsx("img",{src:r,alt:"",className:"h-7 w-7 object-contain rounded-sm",draggable:!1}):l.jsx(lm,{className:"h-7 w-7",strokeWidth:2.25,style:{color:t}})}function jO({credential:e,isInActiveDeck:t,activeDeck:r,isInCollection:n=!0,onDragStart:s,onDragEnd:o,onMouseEnter:i,onMouseLeave:a,onCardClick:c,warnings:u}){const d=yr(),{toast:f}=ir(),g=ur,v=Ct({mutationFn:async()=>{if(!r)throw new Error("No active deck found");return Ee("POST",`/api/decks/${r.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:p=>{f({title:"Failed to add to deck",description:p.message,variant:"destructive"})}}),b=Ct({mutationFn:async()=>Ee("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:p=>{f({title:"Failed to remove API key",description:p.message,variant:"destructive"})}});return l.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!s,onDragStart:s?p=>s(p,e):void 0,onDragEnd:o,onClick:()=>c==null?void 0:c(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:l.jsxs("div",{className:`
246
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
247
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
248
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
249
- relative overflow-hidden
250
- ${_v(t)}
251
- ${n?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
252
- `,style:{borderColor:g,boxShadow:`0 0 20px ${g}20`},children:[l.jsx(Ki,{warnings:u}),t&&l.jsx(Sv,{}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:g},children:"AK"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:g},children:"AK"})}),l.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:l.jsx(le,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:p=>{p.stopPropagation(),window.confirm(`Remove ${e.label} from your vault?`)&&b.mutate()},title:`Remove ${e.label}`,children:l.jsx(pf,{className:"w-3 h-3"})})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:g},children:l.jsx(Mk,{credential:e,color:g})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2","data-testid":`text-credential-name-${e.id}`,style:{color:g},children:e.label}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:g,borderColor:g},children:e.hasSecret?"API Key":"Missing key"})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(le,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:g,borderColor:g},onClick:p=>{p.stopPropagation(),v.mutate()},disabled:t||v.isPending||!r,"data-testid":`button-add-to-deck-${e.id}`,children:t?"IN DECK":"ADD"})}),l.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 $O=w.memo(jO);function PO({playbook:e,isInActiveDeck:t,activeDeck:r,isInCollection:n=!0,onDragStart:s,onDragEnd:o,onMouseEnter:i,onMouseLeave:a,onCardClick:c,warnings:u}){const d=yr(),{toast:f}=ir(),g=Qr,v=e.dependsOnCredentialIds.length+e.dependsOnServiceIds.length,b=Ct({mutationFn:async()=>{if(!r)throw new Error("No deck selected");return Ee("POST",`/api/decks/${r.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:y=>{f({title:"Failed to add playbook",description:y.message,variant:"destructive"})}}),p=Ct({mutationFn:async()=>Ee("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:y=>{f({title:"Failed to delete playbook",description:y.message,variant:"destructive"})}});return l.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!s,onDragStart:s?y=>s(y,e):void 0,onDragEnd:o,onClick:()=>c==null?void 0:c(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:l.jsxs("div",{className:`
253
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
254
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
255
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
256
- relative overflow-hidden
257
- ${_v(t)}
258
- ${n?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
259
- `,style:{borderColor:g,boxShadow:`0 0 20px ${g}20`},children:[l.jsx(Ki,{warnings:u}),t&&l.jsx(Sv,{}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:g},children:"PB"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:g},children:"PB"})}),l.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:l.jsx(le,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:y=>{y.stopPropagation(),window.confirm(`Delete playbook "${e.title}"?`)&&p.mutate()},title:`Delete ${e.title}`,children:l.jsx(pf,{className:"w-3 h-3"})})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:g},children:l.jsx(lv,{className:"h-7 w-7",strokeWidth:2.25})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:g},children:e.title}),l.jsxs("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:g,borderColor:g},children:["Playbook",v>0?` · ${v} deps`:""]})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(le,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:g,borderColor:g},onClick:y=>{y.stopPropagation(),b.mutate()},disabled:t||b.isPending||!r,children:t?"IN DECK":"ADD"})}),l.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 TO=w.memo(PO),Sd=128,RO=192,wa=48,IO=10,kd=12,Xc=64,eu=4,sx=14,Dk=12,zk=1.08;function AO(e=Dk,t=zk){const r=e*Math.PI/180,n=Sd*Math.sin(r)+RO*Math.cos(r);return Math.ceil(n*t)+8}const ox=AO();function Lk(e,t=wa){return e===0?0:Sd+Math.max(0,e-1)*(Sd-t)}function OO(e=IO,t=wa,r=kd){return Lk(e,t)+2*r}function MO(e,t=wa){return Lk(e,t)+2*kd}const DO=OO();function zO(e,t,r,n=Dk){const s=t+r/2,o=r/2;if(o<=0)return 0;const i=(e-s)/o;return Math.max(-n,Math.min(n,i*n))}function LO(e){return{flexShrink:0,marginLeft:e===0?0:`-${wa}px`}}function FO(e,t,r){return r===e?999999:t-e}function UO({cardCount:e,children:t}){const r=w.useRef(null),n=w.useRef([]),s=w.useRef(0),o=w.useRef(void 0),[i,a]=w.useState(!1),[c,u]=w.useState(!1),[d,f]=w.useState(!1),[g,v]=w.useState(!1),[b,p]=w.useState(!1),y=w.useRef(!1),m=w.useRef(!1),[h,x]=w.useState(null),_=w.useRef(null);_.current=h;const C=w.useCallback(()=>{const j=r.current;if(!j)return;const k=j.getBoundingClientRect(),L=_.current;n.current.forEach((P,B)=>{if(!P)return;const H=P.getBoundingClientRect(),G=H.left+H.width/2,q=L===B?0:zO(G,k.left,k.width),V=L===B?zk:1;P.style.transform=`rotate(${q}deg) scale(${V})`,P.style.transformOrigin="center center",P.style.zIndex=String(FO(B,e,L))})},[e]),T=w.useCallback(j=>{const k=r.current;if(!k)return;const L=Sd-wa;k.scrollBy({left:j==="left"?-L:L,behavior:"smooth"})},[]),$=w.useCallback(()=>{const j=r.current;if(!j)return;const L=MO(e,wa)>j.clientWidth+2;a(L),u(L&&j.scrollLeft>4),f(L&&j.scrollLeft+j.clientWidth<j.scrollWidth-4),C()},[e,C]);w.useLayoutEffect(()=>{const j=r.current;if(!j)return;$();const k=new ResizeObserver($);return k.observe(j),j.addEventListener("scroll",$,{passive:!0}),()=>{k.disconnect(),j.removeEventListener("scroll",$)}},[e,$]),w.useEffect(()=>{const j=()=>{const k=r.current,L=s.current;if(k&&L!==0){k.scrollLeft+=L,C();const H=k.scrollLeft>4,G=k.scrollLeft+k.clientWidth<k.scrollWidth-4;u(H),f(G)}const P=L<0,B=L>0;P!==y.current&&(y.current=P,v(P)),B!==m.current&&(m.current=B,p(B)),o.current=requestAnimationFrame(j)};return o.current=requestAnimationFrame(j),()=>{o.current!==void 0&&cancelAnimationFrame(o.current)}},[C]);const O=j=>{const k=r.current;if(!k||!i){s.current=0;return}const L=k.getBoundingClientRect(),P=j.clientX-L.left;if(P<Xc&&c){const B=1-P/Xc;s.current=-(eu+B*(sx-eu))}else if(P>L.width-Xc&&d){const B=1-(L.width-P)/Xc;s.current=eu+B*(sx-eu)}else s.current=0;C()},M=()=>{s.current=0,y.current=!1,m.current=!1,v(!1),p(!1)};if(w.useLayoutEffect(()=>{n.current.length=e,C()},[e,h,C]),e===0)return l.jsx(l.Fragment,{children:t});const U=(j,k)=>`absolute ${j==="left"?"left-2":"right-2"} top-1/2 z-30 -translate-y-1/2 rounded-full bg-gray-950/90 p-1.5 text-yellow-300 shadow-lg ring-1 ring-black/50 transition-all duration-150 hover:bg-gray-950 hover:ring-yellow-300/40 ${k?"scale-110":"scale-100"}`;return l.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:O,onMouseLeave:M,children:[i&&c&&l.jsx("button",{type:"button",className:U("left",g),"aria-label":"Scroll deck left","data-testid":"deck-scroll-left",onClick:()=>T("left"),children:l.jsx(H2,{className:"h-6 w-6",strokeWidth:2.5})}),i&&d&&l.jsx("button",{type:"button",className:U("right",b),"aria-label":"Scroll deck right","data-testid":"deck-scroll-right",onClick:()=>T("right"),children:l.jsx(K2,{className:"h-6 w-6",strokeWidth:2.5})}),l.jsx("div",{ref:r,className:"max-w-full overflow-x-auto overflow-y-visible [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:{width:DO,maxWidth:"100%"},children:l.jsx("div",{className:"flex items-center justify-start isolate group/fan",style:{minHeight:ox,paddingLeft:kd,paddingRight:kd},children:w.Children.map(t,(j,k)=>l.jsx("div",{ref:L=>{n.current[k]=L},className:"relative flex items-center justify-center transition-[transform,box-shadow] duration-500 will-change-transform",style:{...LO(k),minHeight:ox},onMouseEnter:()=>x(k),onMouseLeave:()=>x(null),children:j},j&&typeof j=="object"&&"key"in j?j.key:k))})})]})}function qO({deck:e,services:t,credentials:r=[],playbooks:n=[],collectionWarnings:s,onDrop:o,onDragStart:i,onCredentialDragStart:a,onPlaybookDragStart:c,onDragEnd:u,onCardClick:d,onPlaybookClick:f,onCredentialClick:g}){const v=y=>{y.preventDefault(),o(y)},b=y=>{y.preventDefault()},p=t.length+r.length+n.length;return l.jsxs("div",{className:"flex h-full min-w-0 flex-col overflow-hidden",children:[l.jsxs("h3",{className:"mb-4 shrink-0 text-lg font-bold flex items-center min-w-0",children:[l.jsx("i",{className:"fas fa-layer-group mr-2 text-blue-400"}),"Deck",l.jsx("span",{className:"ml-2 text-sm font-normal text-gray-400 truncate",children:e.name}),l.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400 shrink-0",children:["(",p," cards)"]})]}),l.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:v,onDragOver:b,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:l.jsx("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden min-w-0",children:p===0?l.jsx("div",{className:"text-center",children:l.jsx("div",{className:"w-32 h-48 border-2 border-dashed border-gray-500 rounded-lg flex items-center justify-center opacity-50 hover:opacity-75 transition-all mb-4",children:l.jsx(Ls,{className:"w-8 h-8 text-gray-500"})})}):l.jsxs(UO,{cardCount:p,children:[r.map((y,m)=>l.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:ur,boxShadow:`0 0 20px ${ur}20`},draggable:!0,onDragStart:h=>a(h,y,!0),onDragEnd:u,onClick:()=>g==null?void 0:g(y),"data-testid":`deck-card-${y.id}`,children:[l.jsx(Ki,{warnings:s==null?void 0:s.credentialWarnings.get(y.id)}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:ur},children:"AK"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:ur},children:"AK"})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:ur},children:l.jsx(Mk,{credential:y,color:ur})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:ur},children:y.label}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:ur,borderColor:ur},children:y.hasSecret?"API Key":"Missing key"})]})]},y.id)),n.map((y,m)=>l.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:Qr,boxShadow:`0 0 20px ${Qr}20`},draggable:!0,onDragStart:h=>c(h,y,!0),onDragEnd:u,onClick:()=>f==null?void 0:f(y),"data-testid":`deck-card-${y.id}`,children:[l.jsx(Ki,{warnings:s==null?void 0:s.playbookWarnings.get(y.id)}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:Qr},children:"PB"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:Qr},children:"PB"})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:Qr},children:l.jsx(lv,{className:"h-7 w-7",strokeWidth:2.25})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Qr},children:y.title}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Qr,borderColor:Qr},children:"Playbook"})]})]},y.id)),t.map(y=>l.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:vn(y),boxShadow:`0 0 20px ${vn(y)}20`},draggable:!0,onDragStart:m=>i(m,y,!0),onDragEnd:u,onClick:()=>d==null?void 0:d(y),"data-testid":`deck-card-${y.id}`,children:[l.jsx(Ki,{warnings:s==null?void 0:s.serviceWarnings.get(y.id)}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:vn(y)},children:y.type==="mcp"?"RM":y.type==="local-mcp"?"LM":"A"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:vn(y)},children:y.type==="mcp"?"RM":y.type==="local-mcp"?"LM":"A"})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:vn(y)},children:l.jsx(Ok,{service:y})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:vn(y)},children:y.name}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:vn(y),borderColor:vn(y)},children:y.type==="mcp"?"Remote MCP":y.type==="local-mcp"?"Local MCP":"A2A"})]})]},y.id))]})})})]})}var Nh=0;function kv(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ix()),document.body.insertAdjacentElement("beforeend",e[1]??ix()),Nh++,()=>{Nh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Nh--}},[])}function ix(){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 jh="focusScope.autoFocusOnMount",$h="focusScope.autoFocusOnUnmount",ax={bubbles:!1,cancelable:!0},VO="FocusScope",_f=w.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[a,c]=w.useState(null),u=Ur(s),d=Ur(o),f=w.useRef(null),g=qe(t,p=>c(p)),v=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(n){let p=function(x){if(v.paused||!a)return;const _=x.target;a.contains(_)?f.current=_:ws(f.current,{select:!0})},y=function(x){if(v.paused||!a)return;const _=x.relatedTarget;_!==null&&(a.contains(_)||ws(f.current,{select:!0}))},m=function(x){if(document.activeElement===document.body)for(const C of x)C.removedNodes.length>0&&ws(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const h=new MutationObserver(m);return a&&h.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),h.disconnect()}}},[n,a,v.paused]),w.useEffect(()=>{if(a){cx.add(v);const p=document.activeElement;if(!a.contains(p)){const m=new CustomEvent(jh,ax);a.addEventListener(jh,u),a.dispatchEvent(m),m.defaultPrevented||(HO(GO(Fk(a)),{select:!0}),document.activeElement===p&&ws(a))}return()=>{a.removeEventListener(jh,u),setTimeout(()=>{const m=new CustomEvent($h,ax);a.addEventListener($h,d),a.dispatchEvent(m),m.defaultPrevented||ws(p??document.body,{select:!0}),a.removeEventListener($h,d),cx.remove(v)},0)}}},[a,u,d,v]);const b=w.useCallback(p=>{if(!r&&!n||v.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,m=document.activeElement;if(y&&m){const h=p.currentTarget,[x,_]=KO(h);x&&_?!p.shiftKey&&m===_?(p.preventDefault(),r&&ws(x,{select:!0})):p.shiftKey&&m===x&&(p.preventDefault(),r&&ws(_,{select:!0})):m===h&&p.preventDefault()}},[r,n,v.paused]);return l.jsx(be.div,{tabIndex:-1,...i,ref:g,onKeyDown:b})});_f.displayName=VO;function HO(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ws(n,{select:t}),document.activeElement!==r)return}function KO(e){const t=Fk(e),r=lx(t,e),n=lx(t.reverse(),e);return[r,n]}function Fk(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function lx(e,t){for(const r of e)if(!BO(r,{upTo:t}))return r}function BO(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 WO(e){return e instanceof HTMLInputElement&&"select"in e}function ws(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&WO(e)&&t&&e.select()}}var cx=ZO();function ZO(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=ux(e,t),e.unshift(t)},remove(t){var r;e=ux(e,t),(r=e[0])==null||r.resume()}}}function ux(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function GO(e){return e.filter(t=>t.tagName!=="A")}var QO=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ui=new WeakMap,tu=new WeakMap,ru={},Ph=0,Uk=function(e){return e&&(e.host||Uk(e.parentNode))},JO=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Uk(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},YO=function(e,t,r,n){var s=JO(t,Array.isArray(e)?e:[e]);ru[r]||(ru[r]=new WeakMap);var o=ru[r],i=[],a=new Set,c=new Set(s),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};s.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(g){if(a.has(g))d(g);else try{var v=g.getAttribute(n),b=v!==null&&v!=="false",p=(ui.get(g)||0)+1,y=(o.get(g)||0)+1;ui.set(g,p),o.set(g,y),i.push(g),p===1&&b&&tu.set(g,!0),y===1&&g.setAttribute(r,"true"),b||g.setAttribute(n,"true")}catch(m){console.error("aria-hidden: cannot operate on ",g,m)}})};return d(t),a.clear(),Ph++,function(){i.forEach(function(f){var g=ui.get(f)-1,v=o.get(f)-1;ui.set(f,g),o.set(f,v),g||(tu.has(f)||f.removeAttribute(n),tu.delete(f)),v||f.removeAttribute(r)}),Ph--,Ph||(ui=new WeakMap,ui=new WeakMap,tu=new WeakMap,ru={})}},Cv=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=QO(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),YO(n,s,r,"aria-hidden")):function(){return null}},Cn=function(){return Cn=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},Cn.apply(this,arguments)};function qk(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function XO(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,o;n<s;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}var Tu="right-scroll-bar-position",Ru="width-before-scroll-bar",eM="with-scroll-bars-hidden",tM="--removed-body-scroll-bar-size";function Th(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function rM(e,t){var r=w.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var nM=typeof window<"u"?w.useLayoutEffect:w.useEffect,dx=new WeakMap;function sM(e,t){var r=rM(null,function(n){return e.forEach(function(s){return Th(s,n)})});return nM(function(){var n=dx.get(r);if(n){var s=new Set(n),o=new Set(e),i=r.current;s.forEach(function(a){o.has(a)||Th(a,null)}),o.forEach(function(a){s.has(a)||Th(a,i)})}dx.set(r,e)},[e]),r}function oM(e){return e}function iM(e,t){t===void 0&&(t=oM);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(o){var i=t(o,n);return r.push(i),function(){r=r.filter(function(a){return a!==i})}},assignSyncMedium:function(o){for(n=!0;r.length;){var i=r;r=[],i.forEach(o)}r={push:function(a){return o(a)},filter:function(){return r}}},assignMedium:function(o){n=!0;var i=[];if(r.length){var a=r;r=[],a.forEach(o),i=r}var c=function(){var d=i;i=[],d.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),r}}}};return s}function aM(e){e===void 0&&(e={});var t=iM(null);return t.options=Cn({async:!0,ssr:!1},e),t}var Vk=function(e){var t=e.sideCar,r=qk(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return w.createElement(n,Cn({},r))};Vk.isSideCarExport=!0;function lM(e,t){return e.useMedium(t),Vk}var Hk=aM(),Rh=function(){},Sf=w.forwardRef(function(e,t){var r=w.useRef(null),n=w.useState({onScrollCapture:Rh,onWheelCapture:Rh,onTouchMoveCapture:Rh}),s=n[0],o=n[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,g=e.sideCar,v=e.noRelative,b=e.noIsolation,p=e.inert,y=e.allowPinchZoom,m=e.as,h=m===void 0?"div":m,x=e.gapMode,_=qk(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,T=sM([r,t]),$=Cn(Cn({},_),s);return w.createElement(w.Fragment,null,d&&w.createElement(C,{sideCar:Hk,removeScrollBar:u,shards:f,noRelative:v,noIsolation:b,inert:p,setCallbacks:o,allowPinchZoom:!!y,lockRef:r,gapMode:x}),i?w.cloneElement(w.Children.only(a),Cn(Cn({},$),{ref:T})):w.createElement(h,Cn({},$,{className:c,ref:T}),a))});Sf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Sf.classNames={fullWidth:Ru,zeroRight:Tu};var cM=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function uM(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=cM();return t&&e.setAttribute("nonce",t),e}function dM(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function fM(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var hM=function(){var e=0,t=null;return{add:function(r){e==0&&(t=uM())&&(dM(t,r),fM(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},pM=function(){var e=hM();return function(t,r){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Kk=function(){var e=pM(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},mM={left:0,top:0,right:0,gap:0},Ih=function(e){return parseInt(e||"",10)||0},gM=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Ih(r),Ih(n),Ih(s)]},vM=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return mM;var t=gM(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},yM=Kk(),Bi="data-scroll-locked",wM=function(e,t,r,n){var s=e.left,o=e.top,i=e.right,a=e.gap;return r===void 0&&(r="margin"),`
260
- .`.concat(eM,` {
261
- overflow: hidden `).concat(n,`;
262
- padding-right: `).concat(a,"px ").concat(n,`;
263
- }
264
- body[`).concat(Bi,`] {
265
- overflow: hidden `).concat(n,`;
266
- overscroll-behavior: contain;
267
- `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
268
- padding-left: `.concat(s,`px;
269
- padding-top: `).concat(o,`px;
270
- padding-right: `).concat(i,`px;
271
- margin-left:0;
272
- margin-top:0;
273
- margin-right: `).concat(a,"px ").concat(n,`;
274
- `),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
275
- }
276
-
277
- .`).concat(Tu,` {
278
- right: `).concat(a,"px ").concat(n,`;
279
- }
280
-
281
- .`).concat(Ru,` {
282
- margin-right: `).concat(a,"px ").concat(n,`;
283
- }
284
-
285
- .`).concat(Tu," .").concat(Tu,` {
286
- right: 0 `).concat(n,`;
287
- }
288
-
289
- .`).concat(Ru," .").concat(Ru,` {
290
- margin-right: 0 `).concat(n,`;
291
- }
292
-
293
- body[`).concat(Bi,`] {
294
- `).concat(tM,": ").concat(a,`px;
295
- }
296
- `)},fx=function(){var e=parseInt(document.body.getAttribute(Bi)||"0",10);return isFinite(e)?e:0},xM=function(){w.useEffect(function(){return document.body.setAttribute(Bi,(fx()+1).toString()),function(){var e=fx()-1;e<=0?document.body.removeAttribute(Bi):document.body.setAttribute(Bi,e.toString())}},[])},bM=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;xM();var o=w.useMemo(function(){return vM(s)},[s]);return w.createElement(yM,{styles:wM(o,!t,s,r?"":"!important")})},mm=!1;if(typeof window<"u")try{var nu=Object.defineProperty({},"passive",{get:function(){return mm=!0,!0}});window.addEventListener("test",nu,nu),window.removeEventListener("test",nu,nu)}catch{mm=!1}var di=mm?{passive:!1}:!1,_M=function(e){return e.tagName==="TEXTAREA"},Bk=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!_M(e)&&r[t]==="visible")},SM=function(e){return Bk(e,"overflowY")},kM=function(e){return Bk(e,"overflowX")},hx=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=Wk(e,n);if(s){var o=Zk(e,n),i=o[1],a=o[2];if(i>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},CM=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},EM=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Wk=function(e,t){return e==="v"?SM(t):kM(t)},Zk=function(e,t){return e==="v"?CM(t):EM(t)},NM=function(e,t){return e==="h"&&t==="rtl"?-1:1},jM=function(e,t,r,n,s){var o=NM(e,window.getComputedStyle(t).direction),i=o*n,a=r.target,c=t.contains(a),u=!1,d=i>0,f=0,g=0;do{if(!a)break;var v=Zk(e,a),b=v[0],p=v[1],y=v[2],m=p-y-o*b;(b||m)&&Wk(e,a)&&(f+=m,g+=b);var h=a.parentNode;a=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(f)<1||!d&&Math.abs(g)<1)&&(u=!0),u},su=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},px=function(e){return[e.deltaX,e.deltaY]},mx=function(e){return e&&"current"in e?e.current:e},$M=function(e,t){return e[0]===t[0]&&e[1]===t[1]},PM=function(e){return`
297
- .block-interactivity-`.concat(e,` {pointer-events: none;}
298
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
299
- `)},TM=0,fi=[];function RM(e){var t=w.useRef([]),r=w.useRef([0,0]),n=w.useRef(),s=w.useState(TM++)[0],o=w.useState(Kk)[0],i=w.useRef(e);w.useEffect(function(){i.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var p=XO([e.lockRef.current],(e.shards||[]).map(mx),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var m=su(p),h=r.current,x="deltaX"in p?p.deltaX:h[0]-m[0],_="deltaY"in p?p.deltaY:h[1]-m[1],C,T=p.target,$=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in p&&$==="h"&&T.type==="range")return!1;var O=hx($,T);if(!O)return!0;if(O?C=$:(C=$==="v"?"h":"v",O=hx($,T)),!O)return!1;if(!n.current&&"changedTouches"in p&&(x||_)&&(n.current=C),!C)return!0;var M=n.current||C;return jM(M,y,p,M==="h"?x:_)},[]),c=w.useCallback(function(p){var y=p;if(!(!fi.length||fi[fi.length-1]!==o)){var m="deltaY"in y?px(y):su(y),h=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&$M(C.delta,m)})[0];if(h&&h.should){y.cancelable&&y.preventDefault();return}if(!h){var x=(i.current.shards||[]).map(mx).filter(Boolean).filter(function(C){return C.contains(y.target)}),_=x.length>0?a(y,x[0]):!i.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),u=w.useCallback(function(p,y,m,h){var x={name:p,delta:y,target:m,should:h,shadowParent:IM(m)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(_){return _!==x})},1)},[]),d=w.useCallback(function(p){r.current=su(p),n.current=void 0},[]),f=w.useCallback(function(p){u(p.type,px(p),p.target,a(p,e.lockRef.current))},[]),g=w.useCallback(function(p){u(p.type,su(p),p.target,a(p,e.lockRef.current))},[]);w.useEffect(function(){return fi.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",c,di),document.addEventListener("touchmove",c,di),document.addEventListener("touchstart",d,di),function(){fi=fi.filter(function(p){return p!==o}),document.removeEventListener("wheel",c,di),document.removeEventListener("touchmove",c,di),document.removeEventListener("touchstart",d,di)}},[]);var v=e.removeScrollBar,b=e.inert;return w.createElement(w.Fragment,null,b?w.createElement(o,{styles:PM(s)}):null,v?w.createElement(bM,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function IM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const AM=lM(Hk,RM);var kf=w.forwardRef(function(e,t){return w.createElement(Sf,Cn({},e,{ref:t,sideCar:AM}))});kf.classNames=Sf.classNames;var Cf="Popover",[Gk,NH]=An(Cf,[Ia]),mc=Ia(),[OM,lo]=Gk(Cf),Qk=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!1}=e,a=mc(t),c=w.useRef(null),[u,d]=w.useState(!1),[f,g]=eo({prop:n,defaultProp:s??!1,onChange:o,caller:Cf});return l.jsx(Ek,{...a,children:l.jsx(OM,{scope:t,contentId:Xn(),triggerRef:c,open:f,onOpenChange:g,onOpenToggle:w.useCallback(()=>g(v=>!v),[g]),hasCustomAnchor:u,onCustomAnchorAdd:w.useCallback(()=>d(!0),[]),onCustomAnchorRemove:w.useCallback(()=>d(!1),[]),modal:i,children:r})})};Qk.displayName=Cf;var Jk="PopoverAnchor",MM=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=lo(Jk,r),o=mc(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:a}=s;return w.useEffect(()=>(i(),()=>a()),[i,a]),l.jsx(wf,{...o,...n,ref:t})});MM.displayName=Jk;var Yk="PopoverTrigger",Xk=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=lo(Yk,r),o=mc(r),i=qe(t,s.triggerRef),a=l.jsx(be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":sC(s.open),...n,ref:i,onClick:pe(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:l.jsx(wf,{asChild:!0,...o,children:a})});Xk.displayName=Yk;var Ev="PopoverPortal",[DM,zM]=Gk(Ev,{forceMount:void 0}),eC=e=>{const{__scopePopover:t,forceMount:r,children:n,container:s}=e,o=lo(Ev,t);return l.jsx(DM,{scope:t,forceMount:r,children:l.jsx(On,{present:r||o.open,children:l.jsx(fc,{asChild:!0,container:s,children:n})})})};eC.displayName=Ev;var xa="PopoverContent",tC=w.forwardRef((e,t)=>{const r=zM(xa,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,o=lo(xa,e.__scopePopover);return l.jsx(On,{present:n||o.open,children:o.modal?l.jsx(FM,{...s,ref:t}):l.jsx(UM,{...s,ref:t})})});tC.displayName=xa;var LM=Jo("PopoverContent.RemoveScroll"),FM=w.forwardRef((e,t)=>{const r=lo(xa,e.__scopePopover),n=w.useRef(null),s=qe(t,n),o=w.useRef(!1);return w.useEffect(()=>{const i=n.current;if(i)return Cv(i)},[]),l.jsx(kf,{as:LM,allowPinchZoom:!0,children:l.jsx(rC,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:pe(e.onCloseAutoFocus,i=>{var a;i.preventDefault(),o.current||(a=r.triggerRef.current)==null||a.focus()}),onPointerDownOutside:pe(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,c=a.button===0&&a.ctrlKey===!0,u=a.button===2||c;o.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:pe(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),UM=w.forwardRef((e,t)=>{const r=lo(xa,e.__scopePopover),n=w.useRef(!1),s=w.useRef(!1);return l.jsx(rC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),rC=w.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,g=lo(xa,r),v=mc(r);return kv(),l.jsx(_f,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx($a,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>g.onOpenChange(!1),children:l.jsx(wv,{"data-state":sC(g.open),role:"dialog",id:g.contentId,...v,...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)"}})})})}),nC="PopoverClose",qM=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=lo(nC,r);return l.jsx(be.button,{type:"button",...n,ref:t,onClick:pe(e.onClick,()=>s.onOpenChange(!1))})});qM.displayName=nC;var VM="PopoverArrow",HM=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=mc(r);return l.jsx(xv,{...s,...n,ref:t})});HM.displayName=VM;function sC(e){return e?"open":"closed"}var KM=Qk,BM=Xk,WM=eC,oC=tC;const ZM=KM,GM=BM,iC=w.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>l.jsx(WM,{children:l.jsx(oC,{ref:s,align:t,sideOffset:r,className:xe("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),...n})}));iC.displayName=oC.displayName;function QM(e,t){const r=new Date(e).getTime();if(Number.isNaN(r))return"";const n=Math.max(0,Math.floor((t.getTime()-r)/1e3));if(n<60)return`${n}s`;const s=Math.floor(n/60);if(s<60)return`${s}m`;const o=Math.floor(s/60);return o<24?`${o}h`:`${Math.floor(o/24)}d`}function JM(e,t=24){return e.length>t?`${e.slice(0,t-1)}…`:e}function YM(e){const t=e.replace(/\/+$/,""),r=t.lastIndexOf("/");return r>=0?t.slice(r+1):t}function XM(e){const t=new Map;for(const r of e)t.set(r.deckId,(t.get(r.deckId)??0)+1);return t}function e4(e,t){const r=e>0?`${e} cards`:"Empty";if(t<=0)return r;const n=t===1?"1 session":`${t} sessions`;return`${r}, ${n}`}const t4=3e3;function r4({highlightDeckId:e}){const{data:t}=Gt({queryKey:["/api/scope/bindings"],refetchInterval:t4}),r=(t==null?void 0:t.data)??[],n=w.useMemo(()=>new Date,[t]),s=w.useMemo(()=>{const i=new Map;for(const a of r){const c=i.get(a.workspaceRoot)??[];c.push(a),i.set(a.workspaceRoot,c)}return[...i.entries()].sort(([a],[c])=>a.localeCompare(c)).map(([a,c])=>({workspaceRoot:a,rows:[...c].sort((u,d)=>u.lastActivityAt<d.lastActivityAt?1:-1)}))},[r]);if(r.length===0)return null;const o=e?r.filter(i=>i.deckId===e).length:0;return l.jsxs(ZM,{children:[l.jsx(GM,{asChild:!0,children:l.jsxs(le,{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:[l.jsx(J2,{className:"mr-1 h-3 w-3",style:{color:Wt},"aria-hidden":!0}),l.jsxs("span",{className:"font-mono",children:["⌘",r.length]}),o>0&&o<r.length?l.jsxs("span",{className:"ml-1 text-gray-400",children:["(",o," here)"]}):null]})}),l.jsxs(iC,{align:"end",className:"w-80 border-white/10 bg-gray-950/95 p-0 text-gray-100","data-testid":"live-session-badges-panel",children:[l.jsxs("div",{className:"border-b border-white/10 px-3 py-2",children:[l.jsx("p",{className:"text-sm font-semibold",style:{color:Wt},children:"Live sessions"}),l.jsxs("p",{className:"text-xs text-gray-400",children:["Match ",l.jsx("span",{className:"font-mono",children:"⌘badge"})," to the chat opener"]})]}),l.jsx("div",{className:"max-h-64 overflow-y-auto p-2",children:s.map(({workspaceRoot:i,rows:a})=>l.jsxs("div",{className:"mb-2 last:mb-0",children:[l.jsxs("p",{className:"px-1 pb-1 text-[10px] uppercase tracking-wide text-gray-500",children:[YM(i),"/"]}),l.jsx("ul",{className:"space-y-1",children:a.map(c=>{const u=c.clientName??"agent",d=QM(c.lastActivityAt,n),f=d?`${u} · ${d}`:u,g=e===c.deckId;return l.jsxs("li",{className:xe("rounded-md px-2 py-1.5 font-mono text-xs",g?"bg-[#92E4DD]/10 ring-1 ring-[#92E4DD]/40":"bg-white/5"),"data-testid":`live-session-row-${c.badge}`,children:[l.jsx("span",{className:"text-gray-100",children:JM(c.deckName)})," ",l.jsxs("span",{style:{color:Wt},children:["⌘",c.badge]}),l.jsx("span",{className:"mt-0.5 block font-sans text-[10px] text-gray-400",children:f})]},c.badge)})})]},i))})]})]})}var Ef="Dialog",[aC,jH]=An(Ef),[n4,dn]=aC(Ef),lC=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=w.useRef(null),c=w.useRef(null),[u,d]=eo({prop:n,defaultProp:s??!1,onChange:o,caller:Ef});return l.jsx(n4,{scope:t,triggerRef:a,contentRef:c,contentId:Xn(),titleId:Xn(),descriptionId:Xn(),open:u,onOpenChange:d,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};lC.displayName=Ef;var cC="DialogTrigger",s4=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=dn(cC,r),o=qe(t,s.triggerRef);return l.jsx(be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":$v(s.open),...n,ref:o,onClick:pe(e.onClick,s.onOpenToggle)})});s4.displayName=cC;var Nv="DialogPortal",[o4,uC]=aC(Nv,{forceMount:void 0}),dC=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=dn(Nv,t);return l.jsx(o4,{scope:t,forceMount:r,children:w.Children.map(n,i=>l.jsx(On,{present:r||o.open,children:l.jsx(fc,{asChild:!0,container:s,children:i})}))})};dC.displayName=Nv;var Cd="DialogOverlay",fC=w.forwardRef((e,t)=>{const r=uC(Cd,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=dn(Cd,e.__scopeDialog);return o.modal?l.jsx(On,{present:n||o.open,children:l.jsx(a4,{...s,ref:t})}):null});fC.displayName=Cd;var i4=Jo("DialogOverlay.RemoveScroll"),a4=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=dn(Cd,r);return l.jsx(kf,{as:i4,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(be.div,{"data-state":$v(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Xo="DialogContent",hC=w.forwardRef((e,t)=>{const r=uC(Xo,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=dn(Xo,e.__scopeDialog);return l.jsx(On,{present:n||o.open,children:o.modal?l.jsx(l4,{...s,ref:t}):l.jsx(c4,{...s,ref:t})})});hC.displayName=Xo;var l4=w.forwardRef((e,t)=>{const r=dn(Xo,e.__scopeDialog),n=w.useRef(null),s=qe(t,r.contentRef,n);return w.useEffect(()=>{const o=n.current;if(o)return Cv(o)},[]),l.jsx(pC,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:pe(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:pe(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:pe(e.onFocusOutside,o=>o.preventDefault())})}),c4=w.forwardRef((e,t)=>{const r=dn(Xo,e.__scopeDialog),n=w.useRef(!1),s=w.useRef(!1);return l.jsx(pC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),pC=w.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=dn(Xo,r),c=w.useRef(null),u=qe(t,c);return kv(),l.jsxs(l.Fragment,{children:[l.jsx(_f,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx($a,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":$v(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(u4,{titleId:a.titleId}),l.jsx(f4,{contentRef:c,descriptionId:a.descriptionId})]})]})}),jv="DialogTitle",mC=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=dn(jv,r);return l.jsx(be.h2,{id:s.titleId,...n,ref:t})});mC.displayName=jv;var gC="DialogDescription",vC=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=dn(gC,r);return l.jsx(be.p,{id:s.descriptionId,...n,ref:t})});vC.displayName=gC;var yC="DialogClose",wC=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=dn(yC,r);return l.jsx(be.button,{type:"button",...n,ref:t,onClick:pe(e.onClick,()=>s.onOpenChange(!1))})});wC.displayName=yC;function $v(e){return e?"open":"closed"}var xC="DialogTitleWarning",[$H,bC]=ZR(xC,{contentName:Xo,titleName:jv,docsSlug:"dialog"}),u4=({titleId:e})=>{const t=bC(xC),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
300
-
301
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
302
-
303
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},d4="DialogDescriptionWarning",f4=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${bC(d4).contentName}}.`;return w.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},h4=lC,p4=dC,_C=fC,SC=hC,kC=mC,CC=vC,m4=wC;const ai=h4,g4=p4,EC=w.forwardRef(({className:e,...t},r)=>l.jsx(_C,{ref:r,className:xe("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}));EC.displayName=_C.displayName;const co=w.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(g4,{children:[l.jsx(EC,{}),l.jsxs(SC,{ref:n,className:xe("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),...r,children:[t,l.jsxs(m4,{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:[l.jsx(yd,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));co.displayName=SC.displayName;const uo=({className:e,...t})=>l.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});uo.displayName="DialogHeader";const fo=w.forwardRef(({className:e,...t},r)=>l.jsx(kC,{ref:r,className:xe("text-lg font-semibold leading-none tracking-tight",e),...t}));fo.displayName=kC.displayName;const Aa=w.forwardRef(({className:e,...t},r)=>l.jsx(CC,{ref:r,className:xe("text-sm text-muted-foreground",e),...t}));Aa.displayName=CC.displayName;const Be=w.forwardRef(({className:e,type:t,...r},n)=>l.jsx("input",{type:t,className:xe("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:n,...r}));Be.displayName="Input";const Zn=w.forwardRef(({className:e,...t},r)=>l.jsx("textarea",{className:xe("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:r,...t}));Zn.displayName="Textarea";var v4="Label",NC=w.forwardRef((e,t)=>l.jsx(be.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));NC.displayName=v4;var jC=NC;const y4=hf("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Oe=w.forwardRef(({className:e,...t},r)=>l.jsx(jC,{ref:r,className:xe(y4(),e),...t}));Oe.displayName=jC.displayName;var w4=w.createContext(void 0);function Pv(e){const t=w.useContext(w4);return e||t||"ltr"}var Ah="rovingFocusGroup.onEntryFocus",x4={bubbles:!1,cancelable:!0},gc="RovingFocusGroup",[gm,$C,b4]=sv(gc),[_4,PC]=An(gc,[b4]),[S4,k4]=_4(gc),TC=w.forwardRef((e,t)=>l.jsx(gm.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(gm.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(C4,{...e,ref:t})})}));TC.displayName=gc;var C4=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,g=w.useRef(null),v=qe(t,g),b=Pv(o),[p,y]=eo({prop:i,defaultProp:a??null,onChange:c,caller:gc}),[m,h]=w.useState(!1),x=Ur(u),_=$C(r),C=w.useRef(!1),[T,$]=w.useState(0);return w.useEffect(()=>{const O=g.current;if(O)return O.addEventListener(Ah,x),()=>O.removeEventListener(Ah,x)},[x]),l.jsx(S4,{scope:r,orientation:n,dir:b,loop:s,currentTabStopId:p,onItemFocus:w.useCallback(O=>y(O),[y]),onItemShiftTab:w.useCallback(()=>h(!0),[]),onFocusableItemAdd:w.useCallback(()=>$(O=>O+1),[]),onFocusableItemRemove:w.useCallback(()=>$(O=>O-1),[]),children:l.jsx(be.div,{tabIndex:m||T===0?-1:0,"data-orientation":n,...f,ref:v,style:{outline:"none",...e.style},onMouseDown:pe(e.onMouseDown,()=>{C.current=!0}),onFocus:pe(e.onFocus,O=>{const M=!C.current;if(O.target===O.currentTarget&&M&&!m){const U=new CustomEvent(Ah,x4);if(O.currentTarget.dispatchEvent(U),!U.defaultPrevented){const j=_().filter(H=>H.focusable),k=j.find(H=>H.active),L=j.find(H=>H.id===p),B=[k,L,...j].filter(Boolean).map(H=>H.ref.current);AC(B,d)}}C.current=!1}),onBlur:pe(e.onBlur,()=>h(!1))})})}),RC="RovingFocusGroupItem",IC=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:o,children:i,...a}=e,c=Xn(),u=o||c,d=k4(RC,r),f=d.currentTabStopId===u,g=$C(r),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:p}=d;return w.useEffect(()=>{if(n)return v(),()=>b()},[n,v,b]),l.jsx(gm.ItemSlot,{scope:r,id:u,focusable:n,active:s,children:l.jsx(be.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:pe(e.onMouseDown,y=>{n?d.onItemFocus(u):y.preventDefault()}),onFocus:pe(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:pe(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const m=j4(y,d.orientation,d.dir);if(m!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let x=g().filter(_=>_.focusable).map(_=>_.ref.current);if(m==="last")x.reverse();else if(m==="prev"||m==="next"){m==="prev"&&x.reverse();const _=x.indexOf(y.currentTarget);x=d.loop?$4(x,_+1):x.slice(_+1)}setTimeout(()=>AC(x))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:p!=null}):i})})});IC.displayName=RC;var E4={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function N4(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function j4(e,t,r){const n=N4(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return E4[n]}function AC(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function $4(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var P4=TC,T4=IC,Nf="Tabs",[R4,PH]=An(Nf,[PC]),OC=PC(),[I4,Tv]=R4(Nf),MC=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Pv(a),[f,g]=eo({prop:n,onChange:s,defaultProp:o??"",caller:Nf});return l.jsx(I4,{scope:r,baseId:Xn(),value:f,onValueChange:g,orientation:i,dir:d,activationMode:c,children:l.jsx(be.div,{dir:d,"data-orientation":i,...u,ref:t})})});MC.displayName=Nf;var DC="TabsList",zC=w.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,o=Tv(DC,r),i=OC(r);return l.jsx(P4,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:l.jsx(be.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});zC.displayName=DC;var LC="TabsTrigger",FC=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...o}=e,i=Tv(LC,r),a=OC(r),c=VC(i.baseId,n),u=HC(i.baseId,n),d=n===i.value;return l.jsx(T4,{asChild:!0,...a,focusable:!s,active:d,children:l.jsx(be.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:t,onMouseDown:pe(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(n):f.preventDefault()}),onKeyDown:pe(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(n)}),onFocus:pe(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(n)})})})});FC.displayName=LC;var UC="TabsContent",qC=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:o,...i}=e,a=Tv(UC,r),c=VC(a.baseId,n),u=HC(a.baseId,n),d=n===a.value,f=w.useRef(d);return w.useEffect(()=>{const g=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(On,{present:s||d,children:({present:g})=>l.jsx(be.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:g&&o})})});qC.displayName=UC;function VC(e,t){return`${e}-trigger-${t}`}function HC(e,t){return`${e}-content-${t}`}var A4=MC,KC=zC,BC=FC,WC=qC;const O4=A4,ZC=w.forwardRef(({className:e,...t},r)=>l.jsx(KC,{ref:r,className:xe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ZC.displayName=KC.displayName;const vm=w.forwardRef(({className:e,...t},r)=>l.jsx(BC,{ref:r,className:xe("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}));vm.displayName=BC.displayName;const ym=w.forwardRef(({className:e,...t},r)=>l.jsx(WC,{ref:r,className:xe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));ym.displayName=WC.displayName;function Sl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function GC(e){return Sl(e)&&typeof e.command=="string"}function Oh(e){return!Sl(e)||Object.keys(e).length===0?!1:Object.values(e).every(GC)}function M4(e){let t=e.trim();return t.startsWith("```")?t.replace(/^```(?:json)?\s*\n?/i,"").replace(/\n?```\s*$/,"").trim():t}function D4(e){if(!Sl(e))throw new Error("Configuration must be a JSON object");if(Sl(e.config)&&Oh(e.config.mcpServers))return{mcpServers:e.config.mcpServers};if(Oh(e.mcpServers))return{mcpServers:e.mcpServers};if(Sl(e)&&typeof e.command=="string"){const t=typeof e.name=="string"&&e.name.trim()?e.name.trim():"local-server",{name:r,...n}=e;if(!GC(n))throw new Error("Missing or invalid command");return{mcpServers:{[t]:n}}}if(Oh(e))return{mcpServers:e};throw new Error(`Invalid configuration: expected a top-level "mcpServers" object. Example:
304
- {
305
- "mcpServers": {
306
- "google-drive": {
307
- "command": "npx",
308
- "args": ["-y", "@piotr-agier/google-drive-mcp"]
309
- }
310
- }
311
- }`)}function z4(e){let t;try{t=JSON.parse(M4(e))}catch(r){throw new Error(`Failed to parse JSON: ${r instanceof Error?r.message:"Unknown error"}`)}return D4(t)}function L4({type:e,open:t,onOpenChange:r}){const[n,s]=w.useState("remote"),[o,i]=w.useState("json"),[a,c]=w.useState(`{
312
- "mcpServers": {
313
- "memory": {
314
- "command": "npx",
315
- "args": ["-y", "@modelcontextprotocol/server-memory"],
316
- "env": {
317
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
318
- }
319
- }
320
- }
321
- }`),[u,d]=w.useState(null),[f,g]=w.useState(null),[v,b]=w.useState(null),[p,y]=w.useState({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:Wt}),[m,h]=w.useState(`{
322
-
323
- }`),[x,_]=w.useState(null),[C,T]=w.useState({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:Wt}),[$,O]=w.useState({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:Wt}),M=yr(),{toast:U}=ir(),j=()=>{try{g(null);const S=z4(a),E=Object.entries(S.mcpServers);if(E.length===0)throw new Error("No MCP servers found in configuration");if(E.length>1)throw new Error("Multiple servers not supported. Please configure one server at a time.");const[D,K]=E[0],{command:Z,args:ce,env:re,description:X}=K;if(!Z||typeof Z!="string")throw new Error("Missing or invalid command");if(!ce||!Array.isArray(ce))throw new Error("Missing or invalid args array");const ve={name:D,command:Z,args:ce.map(String),env:re&&typeof re=="object"?re:void 0,description:X&&typeof X=="string"?X:void 0};d(ve),i("review"),T({name:ve.name,type:"local-mcp",command:ve.command,args:ve.args,env:ve.env||{},description:ve.description||"",cardColor:Wt}),k(D)}catch(S){g(S instanceof Error?S.message:"Failed to parse JSON"),d(null)}},k=async S=>{try{const K=((await Ee("GET","/api/services")).data||[]).find(Z=>Z.name===S);b(K?S:null)}catch(E){console.error("Failed to check name conflict:",E)}},L=async S=>{await k(S)},P=Ct({mutationFn:async S=>{if(e==="mcp"&&n==="local"){const E={mcpServers:{[S.name]:{command:S.command,args:S.args.filter(D=>D.trim()!==""),...Object.keys(S.env).length>0&&{env:S.env}}}};return console.log("Importing local MCP server:",E),Ee("POST","/api/local-mcp/import",{config:JSON.stringify(E)})}else{const E={name:S.name,type:e,url:e==="mcp"?S.url:S.manifest_url,description:S.description,cardColor:S.cardColor,...S.headers_enabled&&{headers:S.headers}};return console.log("Sending service data:",E),Ee("POST","/api/services",E)}},onSuccess:()=>{M.invalidateQueries({queryKey:["/api/services"]}),M.invalidateQueries({queryKey:["/api/collection/warnings"]}),U({title:"Service registered successfully!",description:`${(e==="mcp"?n==="remote"?p:C:$).name} has been added to your collection.`}),H()},onError:S=>{var E;console.error("Registration failed:",S),console.error("Error details:",{message:S==null?void 0:S.message,name:S==null?void 0:S.name,stack:S==null?void 0:S.stack,toString:S==null?void 0:S.toString(),constructor:(E=S==null?void 0:S.constructor)==null?void 0:E.name}),U({title:"Registration failed",description:(S==null?void 0:S.message)||"Failed to register service. Please try again.",variant:"destructive"})}}),B=async()=>{if(e==="mcp"&&n==="local"){if(o==="json")j();else if(o==="review"){if(await L(C.name),v){U({title:"Name Conflict",description:`A service with the name "${C.name}" already exists. Please choose a different name.`,variant:"destructive"});return}P.mutate(C)}}else{const S=e==="mcp"?n==="remote"?p:C:$;if(await L(S.name),v){U({title:"Name Conflict",description:`A service with the name "${S.name}" already exists. Please choose a different name.`,variant:"destructive"});return}if(e==="mcp"&&n==="remote"&&p.headers_enabled){const E=V();if(E===null)return;P.mutate({...p,headers:E});return}P.mutate(S)}},H=()=>{i("json"),c(`{
324
- "mcpServers": {
325
- "memory": {
326
- "command": "npx",
327
- "args": ["-y", "@modelcontextprotocol/server-memory"],
328
- "env": {
329
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
330
- }
331
- }
332
- }
333
- }`),d(null),g(null),b(null),y({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:Wt}),h(`{
334
-
335
- }`),_(null),T({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:Wt}),O({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:Wt}),r(!1)},G=(S,E)=>{y(D=>({...D,[S]:E}))},q=S=>{G("headers_enabled",S),S&&m.trim()===`{
336
-
337
- }`&&h(`{
338
- "Authorization": "Bearer "
339
- }`),S||_(null)},V=()=>{const S=m.trim();if(!S||S==="{}")return{};try{const E=JSON.parse(S);if(typeof E!="object"||E===null||Array.isArray(E))return _('Headers must be a JSON object (e.g. {"Authorization": "Bearer token"})'),null;for(const[D,K]of Object.entries(E))if(typeof K!="string")return _(`Header "${D}" must be a string value`),null;return _(null),E}catch{return _("Invalid JSON — fix syntax before registering"),null}},z=(S,E)=>{T(D=>({...D,[S]:E}))},I=(S,E)=>{O(D=>({...D,[S]:E}))},F=()=>{if(e==="mcp"&&n==="local"){if(o==="json")return"Parse Configuration";if(o==="review")return v?"Register Anyway":"Register Service"}return"Register Service"},N=()=>{var S,E;if(e==="mcp"&&n==="local"){if(o==="json")return!a.trim();if(o==="review")return!C.name.trim()||!C.command.trim()}else{const D=e==="mcp"?n==="remote"?p:C:$;return!D.name.trim()||e==="mcp"&&n==="remote"&&!((S=D.url)!=null&&S.trim())||e==="a2a"&&!((E=D.manifest_url)!=null&&E.trim())}return!1};return l.jsx(ai,{open:t,onOpenChange:r,children:l.jsxs(co,{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:[l.jsxs(uo,{children:[l.jsxs(fo,{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"?l.jsx(gd,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}):l.jsx(V2,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}),"Register ",e==="mcp"?"MCP Server":"A2A Agent"]}),l.jsx(Aa,{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"?l.jsxs(O4,{value:n,onValueChange:S=>s(S),className:"w-full",children:[l.jsxs(ZC,{className:"grid w-full grid-cols-2 bg-white/10 border border-white/20",children:[l.jsxs(vm,{value:"remote",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[l.jsx(gd,{className:"w-4 h-4 mr-2"}),"Remote MCP"]}),l.jsxs(vm,{value:"local",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[l.jsx(Y2,{className:"w-4 h-4 mr-2"}),"Local MCP"]})]}),l.jsxs(ym,{value:"remote",className:"space-y-4 mt-4",children:[l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),l.jsx(Be,{id:"name",placeholder:"e.g., Database Tools",value:p.name,onChange:S=>{G("name",S.target.value),S.target.value.trim()?L(S.target.value):b(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),v&&l.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[l.jsx(tn,{className:"w-4 h-4"}),l.jsx("span",{children:"A service with this name already exists"})]})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"MCP URL"}),l.jsx(Be,{id:"url",type:"url",placeholder:"http://localhost:8080/mcp or https://mcp.notion.com/mcp",value:p.url,onChange:S=>G("url",S.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-mcp-url"}),l.jsxs("div",{className:"mt-1 text-xs text-gray-400",children:[l.jsx("p",{children:"Supported formats:"}),l.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[l.jsxs("li",{children:["HTTP MCP: ",l.jsx("code",{children:"http://localhost:8080/mcp"})]}),l.jsxs("li",{children:["SSE MCP: ",l.jsx("code",{children:"https://be.omnimcp.ai/api/v1/mcp/.../sse"})]}),l.jsxs("li",{children:["Notion MCP: ",l.jsx("code",{children:"https://mcp.notion.com/mcp"})]})]})]})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),l.jsx(Zn,{id:"description",placeholder:"Brief description of capabilities...",value:p.description,onChange:S=>G("description",S.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),l.jsxs(ym,{value:"local",className:"space-y-4 mt-4",children:[o==="json"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"local-json",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Local MCP Configuration (JSON)"}),l.jsx(Zn,{id:"local-json",placeholder:`{
340
- "mcpServers": {
341
- "memory": {
342
- "command": "npx",
343
- "args": ["-y", "@modelcontextprotocol/server-memory"]
344
- }
345
- }
346
- }`,value:a,onChange:S=>c(S.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"}),l.jsxs("div",{className:"mt-2 text-xs text-gray-400",children:[l.jsx("p",{children:"Enter your local MCP server configuration in JSON format."}),l.jsx("p",{children:"Example:"}),l.jsx("pre",{className:"bg-white/10 p-2 rounded-md text-xs text-gray-300",children:`{
347
- "mcpServers": {
348
- "memory": {
349
- "command": "npx",
350
- "args": ["-y", "@modelcontextprotocol/server-memory"],
351
- "env": {
352
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
353
- }
354
- }
355
- }
356
- }`})]})]}),l.jsxs(le,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:j,disabled:!a.trim()||a.trim().length<10,"data-testid":"button-parse-json",children:[l.jsx(am,{className:"w-4 h-4 mr-2",style:{color:"#0A0A07"}}),"Parse Configuration"]})]}),o==="review"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"local-name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),l.jsx(Be,{id:"local-name",placeholder:"e.g., Memory Server",value:C.name,onChange:S=>{z("name",S.target.value),S.target.value.trim()?L(S.target.value):b(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-local-service-name"}),v&&l.jsxs("div",{className:"mt-2 text-xs text-red-400 flex items-center",children:[l.jsx(tn,{className:"w-4 h-4 mr-1"}),'A service with the name "',v,'" already exists.']})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"command",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Command"}),l.jsx(Be,{id:"command",placeholder:"e.g., npx, python, node",value:C.command,onChange:S=>z("command",S.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-command"}),l.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"The command to execute (e.g., npx, python, node)"})]}),l.jsxs("div",{children:[l.jsx(Oe,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Arguments"}),C.args.map((S,E)=>l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Be,{placeholder:`Argument ${E+1}`,value:S,onChange:D=>{const K=[...C.args];K[E]=D.target.value,z("args",K)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-arg-${E}`}),E===C.args.length-1&&l.jsx(le,{type:"button",size:"sm",onClick:()=>z("args",[...C.args,""]),className:"bg-white/20 hover:bg-white/30 text-white",children:l.jsx(Ls,{className:"w-4 h-4"})}),C.args.length>1&&l.jsx(le,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const D=C.args.filter((K,Z)=>Z!==E);z("args",D)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:l.jsx(yd,{className:"w-4 h-4"})})]},E)),l.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"Command arguments (e.g., -y, @modelcontextprotocol/server-memory)"})]}),l.jsxs("div",{children:[l.jsx(Oe,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Environment Variables"}),Object.entries(C.env).length===0?l.jsx("div",{className:"text-gray-400 text-sm italic",children:"No environment variables configured"}):l.jsx("div",{className:"space-y-2",children:Object.entries(C.env).map(([S,E],D)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Be,{placeholder:"Variable name",value:S,onChange:K=>{const Z={...C.env};delete Z[S],Z[K.target.value]=E,z("env",Z)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-key-${D}`}),l.jsx(Be,{placeholder:"Value",value:E,onChange:K=>{const Z={...C.env};Z[S]=K.target.value,z("env",Z)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-value-${D}`}),l.jsx(le,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const K={...C.env};delete K[S],z("env",K)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:l.jsx(yd,{className:"w-4 h-4"})})]},D))}),l.jsxs(le,{type:"button",size:"sm",onClick:()=>{const S={...C.env};S[""]="",z("env",S)},className:"mt-2 bg-white/20 hover:bg-white/30 text-white",children:[l.jsx(Ls,{className:"w-4 h-4 mr-2"}),"Add Environment Variable"]}),l.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"Environment variables for the MCP server process"})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"local-description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),l.jsx(Zn,{id:"local-description",placeholder:"Brief description of capabilities...",value:C.description,onChange:S=>z("description",S.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-local-description"})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx(le,{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"}),l.jsxs(le,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${Sn}`,style:kn(Wt),onClick:B,disabled:N(),"data-testid":"button-register",children:[l.jsx(Ls,{className:"w-4 h-4 mr-2"}),P.isPending?"Registering...":F()]})]})]}),o==="complete"&&l.jsxs("div",{className:"text-center py-8",children:[l.jsx(am,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),l.jsx("h3",{className:"text-xl font-bold mb-2",style:{color:"#92E4DD"},children:"Local MCP Registered!"}),l.jsx("p",{className:"text-gray-400 mb-4",children:"Your local MCP server has been successfully registered."}),l.jsx(le,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:H,"data-testid":"button-close",children:"Close"})]})]})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Agent Name"}),l.jsx(Be,{id:"name",placeholder:"e.g., Code Assistant",value:$.name,onChange:S=>{I("name",S.target.value),S.target.value.trim()?L(S.target.value):b(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),v&&l.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[l.jsx(tn,{className:"w-4 h-4"}),l.jsx("span",{children:"A service with this name already exists"})]})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"manifest_url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Manifest URL"}),l.jsx(Be,{id:"manifest_url",type:"url",placeholder:"http://localhost:8001/.well-known/a2a/manifest.json",value:$.manifest_url,onChange:S=>I("manifest_url",S.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-manifest-url"})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),l.jsx(Zn,{id:"description",placeholder:"Brief description of capabilities...",value:$.description,onChange:S=>I("description",S.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),e==="mcp"&&n==="remote"&&l.jsxs("div",{className:"space-y-4 border border-white/10 rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("input",{type:"checkbox",id:"headers_enabled",checked:p.headers_enabled,onChange:S=>q(S.target.checked),className:"rounded border-white/20 bg-white/10"}),l.jsx(Oe,{htmlFor:"headers_enabled",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"🔐 Authentication Required"})]}),l.jsx("div",{className:"text-xs text-gray-400",children:l.jsx("p",{children:"Enable this if your MCP server requires authentication (API keys, tokens, etc.)."})}),p.headers_enabled&&l.jsxs("div",{className:"space-y-3 pl-6",children:[l.jsxs("div",{className:"text-xs text-gray-400 mb-2",children:[l.jsx("p",{children:"Configure HTTP headers for authentication. Common examples:"}),l.jsxs("ul",{className:"list-disc list-inside ml-2 mt-1 space-y-1",children:[l.jsxs("li",{children:[l.jsx("code",{children:"Authorization: Bearer YOUR_TOKEN"})," - For API tokens"]}),l.jsxs("li",{children:[l.jsx("code",{children:"X-API-Key: YOUR_API_KEY"})," - For API keys"]}),l.jsxs("li",{children:[l.jsx("code",{children:"X-Custom-Header: value"})," - For custom headers"]})]})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"headers",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"HTTP Headers (JSON)"}),l.jsx(Zn,{id:"headers",placeholder:`{
357
- "Authorization": "Bearer YOUR_TOKEN_HERE",
358
- "X-API-Key": "YOUR_API_KEY_HERE"
359
- }`,value:m,onChange:S=>{h(S.target.value),x&&_(null)},onBlur:()=>{m.trim()&&V()},rows:6,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs","data-testid":"textarea-headers"}),x&&l.jsxs("p",{className:"text-red-400 text-xs mt-1 flex items-center gap-1",children:[l.jsx(tn,{className:"w-3 h-3 shrink-0"}),x]}),l.jsx("div",{className:"text-xs text-gray-400 mt-1",children:l.jsx("p",{children:"Enter headers as JSON. Keys are header names, values are header values."})})]})]})]}),f&&l.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[l.jsx(tn,{className:"w-4 h-4 mr-1"}),f]}),v&&l.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[l.jsx(tn,{className:"w-4 h-4 mr-1"}),'A service with the name "',v,'" already exists. You can register it anyway, but it might overwrite the existing one.']}),l.jsxs("div",{className:"flex space-x-3 pt-4",children:[l.jsx(le,{type:"button",variant:"secondary",className:"flex-1 border text-white",style:{background:"#ad095e",borderColor:"#ad095e"},onClick:H,"data-testid":"button-cancel",children:"Cancel"}),!(e==="mcp"&&n==="local")&&l.jsxs(le,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${Sn}`,style:kn(Wt),disabled:P.isPending||N(),"data-testid":"button-register",onClick:B,children:[l.jsx(Ls,{className:"w-4 h-4 mr-2"}),P.isPending?"Registering...":"Register Service"]})]})]})})}function F4({decks:e,editingDeckId:t,onSelectDeck:r,isLoading:n}){const[s,o]=w.useState(!1),[i,a]=w.useState({name:"",description:""}),c=yr(),{toast:u}=ir(),{data:d}=Gt({queryKey:["/api/scope/bindings"],refetchInterval:3e3}),f=w.useMemo(()=>XM((d==null?void 0:d.data)??[]),[d]),g=Ct({mutationFn:async h=>Ee("POST","/api/decks",{name:h.name,description:h.description,isActive:!1}),onSuccess:async h=>{var _;const x=await h.json();c.invalidateQueries({queryKey:["/api/decks"]}),(_=x.data)!=null&&_.id&&r(x.data.id),u({title:"Deck created",description:`${i.name} has been created successfully.`}),o(!1),a({name:"",description:""})},onError:h=>{u({title:"Failed to create deck",description:h.message,variant:"destructive"})}}),v=Ct({mutationFn:async h=>Ee("DELETE",`/api/decks/${h}`,{}),onSuccess:()=>{c.invalidateQueries({queryKey:["/api/decks"]}),u({title:"Deck deleted",description:"Your deck has been deleted successfully."})},onError:h=>{h.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:h.message,variant:"destructive"})}}),b=async(h,x)=>{h.stopPropagation();try{await navigator.clipboard.writeText(x.id),u({title:"Copied deck id",description:"Use with bind_workspace({ workspaceRoot, deckId }) in your agent."})}catch(_){u({title:"Failed to copy deck id",description:_ instanceof Error?_.message:"Unknown error",variant:"destructive"})}},p=(h,x)=>{h.stopPropagation(),window.confirm("Are you sure you want to delete this deck? This action cannot be undone.")&&v.mutate(x)},y=h=>{h.preventDefault(),g.mutate(i)},m=h=>{var x,_,C;return(((x=h.services)==null?void 0:x.length)??0)+(((_=h.credentials)==null?void 0:_.length)??0)+(((C=h.playbooks)==null?void 0:C.length)??0)};return n?l.jsx("div",{className:"bg-black/40 backdrop-blur-md rounded-2xl border border-white/10 p-6 shadow-2xl",children:l.jsxs("div",{className:"animate-pulse space-y-4",children:[l.jsx("div",{className:"h-6 bg-white/10 rounded"}),l.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((h,x)=>l.jsx("div",{className:"h-16 bg-white/5 rounded-lg"},x))})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"h-full flex flex-col","data-testid":"deck-management-panel",children:[l.jsxs("h2",{className:"text-lg font-bold mb-3 flex items-center",children:[l.jsx(cm,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),l.jsx("span",{style:{color:"#92E4DD"},children:"My Decks"})]}),l.jsx("div",{className:"mb-3",children:l.jsxs(le,{onClick:()=>o(!0),className:"w-full border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"create-deck-button",children:[l.jsx(Ls,{className:"w-3 h-3 mr-2"}),"Add Deck"]})}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:l.jsx("div",{className:"space-y-2",children:e.map(h=>{const x=h.id===t,_=m(h),C=f.get(h.id)??0,T=e4(_,C);return l.jsxs("div",{className:`p-2 rounded-lg border cursor-pointer transition-all relative group ${x?"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:()=>r(h.id),"data-testid":`deck-item-${h.id}`,children:[l.jsxs("div",{className:"absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:[l.jsx(le,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:$=>b($,h),title:"Copy deck id for bind_workspace",children:l.jsx(B1,{className:"w-2 h-2"})}),l.jsx(le,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:$=>p($,h.id),title:"Delete deck",children:l.jsx(pf,{className:"w-2 h-2"})})]}),l.jsxs("div",{children:[l.jsx("h3",{className:`font-semibold text-sm pr-12 ${x?"text-yellow-300":"text-white"}`,children:h.name}),l.jsx("p",{className:"text-xs text-gray-400 select-none pointer-events-none",children:T})]})]},h.id)})})})]}),l.jsx(ai,{open:s,onOpenChange:o,children:l.jsxs(co,{className:"sm:max-w-md bg-gradient-to-br from-cosmic-900 to-cosmic-800 border border-white/20 text-white",children:[l.jsx(uo,{children:l.jsxs(fo,{className:"text-xl font-bold flex items-center",children:[l.jsx(Ls,{className:"w-5 h-5 mr-2 text-purple-400"}),"Create New Deck"]})}),l.jsxs("form",{onSubmit:y,className:"space-y-4","data-testid":"form-create-deck",children:[l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"deckName",className:"text-sm font-semibold",children:"Deck Name"}),l.jsx(Be,{id:"deckName",placeholder:"e.g., Hiring stack",value:i.name,onChange:h=>a(x=>({...x,name:h.target.value})),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-deck-name"})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"deckDescription",className:"text-sm font-semibold",children:"Description"}),l.jsx(Zn,{id:"deckDescription",placeholder:"Brief description of this deck...",value:i.description,onChange:h=>a(x=>({...x,description:h.target.value})),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-deck-description"})]}),l.jsxs("div",{className:"flex space-x-3 pt-4",children:[l.jsx(le,{type:"button",variant:"secondary",className:"flex-1",onClick:()=>o(!1),"data-testid":"button-cancel-create",children:"Cancel"}),l.jsx(le,{type:"submit",className:"flex-1 bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700",disabled:g.isPending,"data-testid":"button-submit-create",children:g.isPending?"Creating...":"Create Deck"})]})]})]})})]})}function U4({open:e,onOpenChange:t}){const[r,n]=w.useState(""),[s,o]=w.useState(""),i=yr(),{toast:a}=ir(),c=Ct({mutationFn:async()=>Ee("POST","/api/credentials",{label:r.trim(),value:s}),onSuccess:()=>{i.invalidateQueries({queryKey:["/api/credentials/vault"]}),i.invalidateQueries({queryKey:["/api/decks"]}),a({title:"API key saved",description:`${r.trim()} is stored securely. Your agent can use it from the active deck.`}),t(!1),n(""),o("")},onError:d=>{a({title:"Could not save API key",description:d.message,variant:"destructive"})}}),u=r.trim().length>0&&s.trim().length>0;return l.jsx(ai,{open:e,onOpenChange:t,children:l.jsxs(co,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(uo,{children:[l.jsx(fo,{className:"text-[#E8F6F4]",children:"Register API key"}),l.jsx(Aa,{className:"text-[#A8C4C0]",children:"Name the service and paste the key. Agent Deck handles the rest — stored in your vault, never shown again."})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"credential-name",className:"text-[#CFEAE6]",children:"Service name"}),l.jsx(Be,{id:"credential-name",placeholder:"OpenAI, Linear, Slack…",value:r,onChange:d=>n(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"credential-value",className:"text-[#CFEAE6]",children:"API key"}),l.jsx(Be,{id:"credential-value",type:"password",placeholder:"Paste key from the service dashboard",value:s,onChange:d=>o(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsx(le,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Sn}`,style:kn(ur),onClick:()=>c.mutate(),disabled:!u||c.isPending,children:"Save to vault"})]})]})})}function q4({open:e,onOpenChange:t}){const[r,n]=w.useState(""),[s,o]=w.useState(""),[i,a]=w.useState(""),[c,u]=w.useState(""),[d,f]=w.useState(""),[g,v]=w.useState([]),[b,p]=w.useState([]),y=yr(),{toast:m}=ir(),{data:h}=Gt({queryKey:["/api/credentials/vault"],enabled:e}),{data:x}=Gt({queryKey:["/api/services"],enabled:e}),_=(h==null?void 0:h.data)??[],C=(x==null?void 0:x.data)??[],T=Ct({mutationFn:async()=>Ee("POST","/api/playbooks",{title:r.trim(),body:s,triggers:i.split(",").map(M=>M.trim()).filter(Boolean),dependsOnCredentialIds:g,dependsOnServiceIds:b,exec:c.trim()||void 0,skill:d.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{y.invalidateQueries({queryKey:["/api/playbooks/vault"]}),m({title:"Playbook saved",description:`${r.trim()} is in your collection.`}),t(!1),n(""),o(""),a(""),u(""),f(""),v([]),p([])},onError:M=>{m({title:"Could not save playbook",description:M.message,variant:"destructive"})}}),$=(M,U,j)=>{j(M.includes(U)?M.filter(k=>k!==U):[...M,U])},O=r.trim().length>0&&s.trim().length>0;return l.jsx(ai,{open:e,onOpenChange:t,children:l.jsxs(co,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(uo,{children:[l.jsx(fo,{children:"Register Playbook"}),l.jsxs(Aa,{className:"text-[#A8C4C0]",children:["Prefer"," ",l.jsx("span",{className:"font-mono text-xs",children:"register_playbook"})," /"," ",l.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."]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"playbook-title",children:"Title"}),l.jsx(Be,{id:"playbook-title",placeholder:"Hiring inbox, Ashby API guide…",value:r,onChange:M=>n(M.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"playbook-triggers",children:"Triggers (comma-separated)"}),l.jsx(Be,{id:"playbook-triggers",placeholder:"check inbox, review applicants",value:i,onChange:M=>a(M.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"playbook-body",children:"Instructions (markdown)"}),l.jsx(Zn,{id:"playbook-body",rows:8,placeholder:`# Steps
360
- 1. …
361
- 2. …`,value:s,onChange:M=>o(M.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-sm"})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{children:"Extra API key deps (optional)"}),l.jsx("p",{className:"text-xs text-gray-500",children:"Merged with auto-detected refs from content."}),l.jsx("div",{className:"max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1",children:_.length===0?l.jsx("p",{className:"text-xs text-gray-500",children:"No API keys registered yet."}):_.map(M=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:g.includes(M.id),onChange:()=>$(g,M.id,v)}),M.label]},M.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{children:"Extra MCP deps (optional)"}),l.jsx("p",{className:"text-xs text-gray-500",children:"Merged with auto-detected refs from content."}),l.jsx("div",{className:"max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1",children:C.length===0?l.jsx("p",{className:"text-xs text-gray-500",children:"No MCP services registered yet."}):C.map(M=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:b.includes(M.id),onChange:()=>$(b,M.id,p)}),M.name]},M.id))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"playbook-exec",children:"Suggested exec (optional)"}),l.jsx(Be,{id:"playbook-exec",placeholder:"agent-deck exec --connections … -- uv run …",value:c,onChange:M=>u(M.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"playbook-skill",children:"Skill path hint (optional)"}),l.jsx(Be,{id:"playbook-skill",placeholder:".cursor/skills/…/SKILL.md",value:d,onChange:M=>f(M.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsx(le,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Sn}`,style:kn(Qr),onClick:()=>T.mutate(),disabled:!O||T.isPending,children:"Save to collection"})]})]})})}function V4({playbookId:e,open:t,onOpenChange:r}){const{data:n,isLoading:s}=Gt({queryKey:e?[`/api/playbooks/${e}`]:["playbook-detail-disabled"],enabled:t&&!!e}),o=n==null?void 0:n.data,i=((o==null?void 0:o.dependencies.missingCredentialIds.length)??0)+((o==null?void 0:o.dependencies.missingServiceIds.length)??0);return l.jsx(ai,{open:t,onOpenChange:r,children:l.jsxs(co,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(uo,{children:[l.jsx(fo,{children:(o==null?void 0:o.title)??"Playbook"}),l.jsx(Aa,{className:"text-[#A8C4C0]",children:(o==null?void 0:o.id)??e})]}),s||!o?l.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):l.jsxs("div",{className:"space-y-4 text-sm",children:[l.jsxs("p",{className:"rounded-md border border-white/10 bg-white/5 px-3 py-2 text-[#A8C4C0]",children:["Ask your AI agent to refine this playbook with"," ",l.jsx("span",{className:"font-mono text-xs",children:"update_playbook"})," — dependencies are re-detected from the content automatically."]}),o.triggers.length>0&&l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Triggers"}),l.jsx("p",{className:"text-gray-300",children:o.triggers.join(", ")})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Dependencies"}),o.dependencies.credentials.length===0&&o.dependencies.services.length===0&&i===0?l.jsx("p",{className:"text-gray-400",children:"None declared."}):l.jsxs("ul",{className:"space-y-1 text-gray-300",children:[o.dependencies.credentials.map(a=>l.jsxs("li",{children:["API key: ",a.label]},a.id)),o.dependencies.services.map(a=>l.jsxs("li",{children:["MCP: ",a.label]},a.id)),o.dependencies.missingCredentialIds.map(a=>l.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[l.jsx(tn,{className:"w-3 h-3"})," Missing API key: ",a]},a)),o.dependencies.missingServiceIds.map(a=>l.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[l.jsx(tn,{className:"w-3 h-3"})," Missing MCP: ",a]},a))]})]}),o.exec&&l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Suggested exec"}),l.jsx("pre",{className:"rounded bg-black/40 p-2 text-xs overflow-x-auto",children:o.exec})]}),o.skill&&l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Skill hint"}),l.jsx("p",{className:"font-mono text-xs text-gray-300",children:o.skill})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Instructions"}),l.jsx("div",{className:"rounded bg-black/30 p-3 whitespace-pre-wrap text-gray-200",children:o.body})]})]})]})})}function H4({credentialId:e,open:t,onOpenChange:r}){const n=yr(),{toast:s}=ir(),[o,i]=w.useState(""),[a,c]=w.useState(""),[u,d]=w.useState(""),{data:f,isLoading:g}=Gt({queryKey:e?[`/api/credentials/${e}`]:["credential-detail-disabled"],enabled:t&&!!e}),v=f==null?void 0:f.data;w.useEffect(()=>{v&&(i(v.label),c(v.docsUrl??""),d(""))},[v==null?void 0:v.id,v==null?void 0:v.label,v==null?void 0:v.docsUrl]);const b=Ct({mutationFn:async()=>{if(!e)throw new Error("No credential selected");const y=o.trim();if(!y)throw new Error("Name is required");const m=a.trim();if(m)try{new URL(m)}catch{throw new Error("Documentation link must be a valid URL")}await Ee("PUT",`/api/credentials/${e}`,{label:y,docsUrl:m}),u.trim()&&await Ee("POST",`/api/credentials/${e}/rotate`,{value:u.trim()})},onSuccess:()=>{n.invalidateQueries({queryKey:["/api/credentials/vault"]}),e&&n.invalidateQueries({queryKey:[`/api/credentials/${e}`]}),n.invalidateQueries({queryKey:["/api/collection/warnings"]}),n.invalidateQueries({queryKey:["/api/decks"]}),s({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(""),r(!1)},onError:y=>{s({title:"Could not save API key",description:y.message,variant:"destructive"})}}),p=o.trim().length>0&&(o.trim()!==(v==null?void 0:v.label)||a.trim()!==((v==null?void 0:v.docsUrl)??"")||u.trim().length>0);return l.jsx(ai,{open:t,onOpenChange:r,children:l.jsxs(co,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(uo,{children:[l.jsx(fo,{className:"text-[#E8F6F4]",children:(v==null?void 0:v.label)??"API key"}),l.jsx(Aa,{className:"font-mono text-xs text-[#A8C4C0]",children:(v==null?void 0:v.id)??e})]}),g||!v?l.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):l.jsxs("div",{className:"space-y-4",children:[!v.hasSecret&&l.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:[l.jsx(tn,{className:"mt-0.5 h-4 w-4 shrink-0"}),l.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."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"credential-detail-name",className:"text-[#CFEAE6]",children:"Name"}),l.jsx(Be,{id:"credential-detail-name",value:o,onChange:y=>i(y.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"credential-detail-key",className:"text-[#CFEAE6]",children:v.hasSecret?"Rotate API key":"API key"}),l.jsx(Be,{id:"credential-detail-key",type:"password",placeholder:v.hasSecret?"Leave blank to keep current key":"Paste key from the service dashboard",value:u,onChange:y=>d(y.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),v.hasSecret&&l.jsx("p",{className:"text-xs text-[#6B8581]",children:"Stored securely in Keychain. Enter a new value only when rotating."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"credential-detail-docs",className:"text-[#CFEAE6]",children:"Documentation link"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Be,{id:"credential-detail-docs",type:"url",placeholder:"https://…",value:a,onChange:y=>c(y.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),a.trim()&&l.jsx(le,{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:l.jsx(Jn,{className:"h-4 w-4"})})]})]}),l.jsx(le,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Sn}`,style:kn(ur),onClick:()=>b.mutate(),disabled:!p||b.isPending,children:b.isPending?"Saving…":"Save changes"})]})]})})}const K4=hf("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function mn({className:e,variant:t,...r}){return l.jsx("div",{className:xe(K4({variant:t}),e),...r})}function QC(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var jf="Checkbox",[B4,TH]=An(jf),[W4,Rv]=B4(jf);function Z4(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:s,disabled:o,form:i,name:a,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[g,v]=eo({prop:r,defaultProp:s??!1,onChange:c,caller:jf}),[b,p]=w.useState(null),[y,m]=w.useState(null),h=w.useRef(!1),x=b?!!i||!!b.closest("form"):!0,_={checked:g,disabled:o,setChecked:v,control:b,setControl:p,name:a,form:i,value:d,hasConsumerStoppedPropagationRef:h,required:u,defaultChecked:Qs(s)?!1:s,isFormControl:x,bubbleInput:y,setBubbleInput:m};return l.jsx(W4,{scope:t,..._,children:G4(f)?f(_):n})}var JC="CheckboxTrigger",YC=w.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},s)=>{const{control:o,value:i,disabled:a,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:g,isFormControl:v,bubbleInput:b}=Rv(JC,e),p=qe(s,d),y=w.useRef(c);return w.useEffect(()=>{const m=o==null?void 0:o.form;if(m){const h=()=>f(y.current);return m.addEventListener("reset",h),()=>m.removeEventListener("reset",h)}},[o,f]),l.jsx(be.button,{type:"button",role:"checkbox","aria-checked":Qs(c)?"mixed":c,"aria-required":u,"data-state":nE(c),"data-disabled":a?"":void 0,disabled:a,value:i,...n,ref:p,onKeyDown:pe(t,m=>{m.key==="Enter"&&m.preventDefault()}),onClick:pe(r,m=>{f(h=>Qs(h)?!0:!h),b&&v&&(g.current=m.isPropagationStopped(),g.current||m.stopPropagation())})})});YC.displayName=JC;var Iv=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:o,required:i,disabled:a,value:c,onCheckedChange:u,form:d,...f}=e;return l.jsx(Z4,{__scopeCheckbox:r,checked:s,defaultChecked:o,disabled:a,required:i,onCheckedChange:u,name:n,form:d,value:c,internal_do_not_use_render:({isFormControl:g})=>l.jsxs(l.Fragment,{children:[l.jsx(YC,{...f,ref:t,__scopeCheckbox:r}),g&&l.jsx(rE,{__scopeCheckbox:r})]})})});Iv.displayName=jf;var XC="CheckboxIndicator",eE=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...s}=e,o=Rv(XC,r);return l.jsx(On,{present:n||Qs(o.checked)||o.checked===!0,children:l.jsx(be.span,{"data-state":nE(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});eE.displayName=XC;var tE="CheckboxBubbleInput",rE=w.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:a,disabled:c,name:u,value:d,form:f,bubbleInput:g,setBubbleInput:v}=Rv(tE,e),b=qe(r,v),p=QC(o),y=gk(n);w.useEffect(()=>{const h=g;if(!h)return;const x=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(x,"checked").set,T=!s.current;if(p!==o&&C){const $=new Event("click",{bubbles:T});h.indeterminate=Qs(o),C.call(h,Qs(o)?!1:o),h.dispatchEvent($)}},[g,p,o,s]);const m=w.useRef(Qs(o)?!1:o);return l.jsx(be.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??m.current,required:a,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:b,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});rE.displayName=tE;function G4(e){return typeof e=="function"}function Qs(e){return e==="indeterminate"}function nE(e){return Qs(e)?"indeterminate":e?"checked":"unchecked"}const sE=w.forwardRef(({className:e,...t},r)=>l.jsx(Iv,{ref:r,className:xe("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:l.jsx(eE,{className:xe("flex items-center justify-center text-current"),children:l.jsx(H1,{className:"h-4 w-4"})})}));sE.displayName=Iv.displayName;const oE=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:r,className:xe("w-full caption-bottom text-sm",e),...t})}));oE.displayName="Table";const iE=w.forwardRef(({className:e,...t},r)=>l.jsx("thead",{ref:r,className:xe("[&_tr]:border-b",e),...t}));iE.displayName="TableHeader";const aE=w.forwardRef(({className:e,...t},r)=>l.jsx("tbody",{ref:r,className:xe("[&_tr:last-child]:border-0",e),...t}));aE.displayName="TableBody";const Q4=w.forwardRef(({className:e,...t},r)=>l.jsx("tfoot",{ref:r,className:xe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Q4.displayName="TableFooter";const il=w.forwardRef(({className:e,...t},r)=>l.jsx("tr",{ref:r,className:xe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));il.displayName="TableRow";const Iu=w.forwardRef(({className:e,...t},r)=>l.jsx("th",{ref:r,className:xe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Iu.displayName="TableHead";const gi=w.forwardRef(({className:e,...t},r)=>l.jsx("td",{ref:r,className:xe("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));gi.displayName="TableCell";const J4=w.forwardRef(({className:e,...t},r)=>l.jsx("caption",{ref:r,className:xe("mt-4 text-sm text-muted-foreground",e),...t}));J4.displayName="TableCaption";function Mh(e){return new Set(e.filter(t=>t.enabled===!1).map(t=>t.name))}function Y4({serviceId:e,tools:t,isLoading:r}){const[n,s]=w.useState(""),[o,i]=w.useState(null),[a,c]=w.useState(()=>Mh(t)),u=yr(),{toast:d}=ir(),f=w.useMemo(()=>t.map(h=>`${h.name}:${h.enabled===!1?"0":"1"}`).sort().join("\0"),[t]);w.useEffect(()=>{c(Mh(t))},[e,f]);const g=Ct({mutationFn:async h=>{await Ee("PUT",`/api/services/${e}/tool-settings`,{disabledTools:h})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/services",e,"tools"]}),u.invalidateQueries({queryKey:["/api/services"]})},onError:h=>{d({title:"Could not save tool settings",description:h.message,variant:"destructive"}),c(Mh(t))}}),v=h=>{c(h),g.mutate([...h])},b=(h,x)=>{const _=new Set(a);x?_.delete(h):_.add(h),v(_)},p=h=>{if(h){v(new Set);return}v(new Set(t.map(x=>x.name)))},y=w.useMemo(()=>{const h=n.trim().toLowerCase();return h?t.filter(x=>x.name.toLowerCase().includes(h)||x.description.toLowerCase().includes(h)):t},[t,n]),m=t.length-a.size;return r?l.jsx("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:l.jsx("p",{className:"text-sm text-gray-400",children:"Loading tools…"})}):t.length===0?null:l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("h3",{className:"text-lg font-semibold flex items-center",children:[l.jsx(vd,{className:"w-5 h-5 mr-2"}),"Tools",l.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:[m," of ",t.length," enabled"]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(le,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>p(!0),disabled:a.size===0||g.isPending,children:"Enable all"}),l.jsx(le,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>p(!1),disabled:m===0||g.isPending,children:"Disable all"})]})]}),l.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."}),l.jsxs("div",{className:"relative mb-3",children:[l.jsx(W1,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),l.jsx(Be,{value:n,onChange:h=>s(h.target.value),placeholder:"Search tools…",className:"border-white/15 bg-[#0F0F0C] pl-9 text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsx("div",{className:"rounded-md border border-white/10 overflow-hidden",children:l.jsxs(oE,{children:[l.jsx(iE,{children:l.jsxs(il,{className:"border-white/10 hover:bg-transparent",children:[l.jsx(Iu,{className:"w-[72px] text-center text-[#A8C4C0]",children:"Enabled"}),l.jsx(Iu,{className:"w-[220px] text-[#A8C4C0]",children:"Tool"}),l.jsx(Iu,{className:"text-[#A8C4C0]",children:"Description"})]})}),l.jsx(aE,{children:y.length===0?l.jsx(il,{className:"border-white/10 hover:bg-transparent",children:l.jsx(gi,{colSpan:3,className:"py-8 text-center text-sm text-gray-400",children:"No tools match your search."})}):y.map(h=>{const x=!a.has(h.name),_=o===h.name,C=h.inputSchema&&Object.keys(h.inputSchema).length>0;return l.jsxs(w.Fragment,{children:[l.jsxs(il,{className:`border-white/10 ${x?"hover:bg-white/5":"opacity-60 hover:bg-white/5"}`,children:[l.jsx(gi,{className:"text-center",children:l.jsx("div",{className:"flex justify-center",children:l.jsx(sE,{checked:x,onCheckedChange:T=>b(h.name,T===!0),disabled:g.isPending,"aria-label":`${x?"Disable":"Enable"} ${h.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]"})})}),l.jsx(gi,{children:C?l.jsxs("button",{type:"button",onClick:()=>i(_?null:h.name),className:"flex w-full items-center gap-1 text-left font-mono text-sm text-[#92E4DD] hover:text-white",children:[l.jsx(cv,{className:`h-4 w-4 shrink-0 transition-transform ${_?"rotate-180":""}`}),h.name]}):l.jsx("span",{className:"font-mono text-sm text-[#92E4DD]",children:h.name})}),l.jsx(gi,{className:"text-sm text-gray-300",children:h.description||"—"})]}),C&&_&&l.jsx(il,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:l.jsx(gi,{colSpan:3,className:"py-3",children:l.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(h.inputSchema,null,2)})})})]},h.name)})})]})})]})}function Dh({items:e,className:t}){return e.length===0?null:l.jsx("ol",{className:`list-decimal list-inside space-y-1 text-xs ${t??""}`,children:e.map((r,n)=>l.jsx("li",{children:r},`${n}-${r.slice(0,24)}`))})}function gx({serviceId:e,onConnected:t}){const{toast:r}=ir(),[n,s]=w.useState(""),[o,i]=w.useState(""),[a,c]=w.useState(!1),[u,d]=w.useState(!1),[f,g]=w.useState(!1),{data:v,isLoading:b}=Gt({queryKey:["/api/oauth",e,"setup"],queryFn:async()=>{const C=await Ee("GET",`/api/oauth/${e}/setup`),T=await C.json();if(!C.ok||!T.success)throw new Error(T.error||"Failed to load OAuth setup");return T.data},enabled:!!e}),p=v==null?void 0:v.guide,y=!!(v!=null&&v.hasSavedCredentials),m=()=>{if(!u||(p==null?void 0:p.setupMode)!=="manual")return;const C={};return n.trim()&&(C.clientId=n.trim()),o.trim()&&(C.clientSecret=o.trim()),C},h=async(C,T)=>{try{await navigator.clipboard.writeText(T),r({title:"Copied",description:`${C} copied to clipboard.`})}catch{r({title:"Copy failed",description:"Select and copy manually.",variant:"destructive"})}};w.useEffect(()=>{(p==null?void 0:p.setupMode)==="manual"?d(!0):d(!1),g(!y)},[p==null?void 0:p.setupMode,y]),w.useEffect(()=>{v!=null&&v.savedOAuthClientId&&!n&&s(v.savedOAuthClientId)},[v==null?void 0:v.savedOAuthClientId,n]);const x=async C=>{var T,$,O;c(!0);try{const M=await Ee("POST",`/api/oauth/${e}/connect`,C??{}),U=await M.json();if(!M.ok||!U.success){((T=U.data)!=null&&T.needsCredentials||(($=U.data)==null?void 0:$.setupMode)==="manual")&&d(!0),r({title:"OAuth setup",description:U.error||"Could not start OAuth flow.",variant:"destructive"});return}(O=U.data)!=null&&O.authorizationUrl&&(window.open(U.data.authorizationUrl,"_blank"),r({title:"Continue in browser",description:"Complete sign-in in the new tab, then return here."}),t==null||t())}catch(M){r({title:"OAuth setup failed",description:M instanceof Error?M.message:"Unknown error",variant:"destructive"})}finally{c(!1)}};if(b)return l.jsx("p",{className:"text-sm text-orange-200",children:"Loading setup guide…"});if(!p)return null;if(p.setupMode==="unavailable")return l.jsxs("div",{className:"space-y-3 text-sm text-orange-100",children:[l.jsx("p",{children:p.unavailableReason}),p.docsUrl&&l.jsxs(le,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(p.docsUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"Provider docs"]})]});const _=p.setupMode==="dynamic"||p.setupMode==="managed"||p.setupMode==="manual";return l.jsxs("div",{className:"space-y-4 text-sm text-orange-100",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium text-orange-200",children:p.title}),p.summary&&l.jsx("p",{className:"mt-1 text-xs text-orange-100/90",children:p.summary}),_&&l.jsxs("p",{className:"mt-2 text-xs text-orange-100/80",children:["Redirect URI:"," ",l.jsx("code",{className:"text-orange-50",children:p.redirectUri})]}),p.easierAlternative&&l.jsx("p",{className:"mt-2 text-xs text-orange-100/70 border-l-2 border-orange-500/30 pl-2",children:p.easierAlternative})]}),y&&p.setupMode==="manual"&&l.jsxs("div",{className:"rounded-lg border border-green-500/30 bg-green-500/10 p-3 text-xs text-green-100",children:[l.jsx("p",{className:"font-medium text-green-200",children:"OAuth credentials saved"}),l.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."})]}),p.prerequisites&&p.prerequisites.length>0&&!y&&l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"Before you start"}),l.jsx("ul",{className:"list-disc list-inside space-y-1 text-xs text-orange-100/90",children:p.prerequisites.map(C=>l.jsx("li",{children:C},C))})]}),(p.manifestJson||p.createAppUrl||_)&&l.jsxs("div",{className:"flex flex-wrap gap-2",children:[p.manifestJson&&l.jsxs(le,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void h("App manifest",p.manifestJson),children:[l.jsx(W2,{className:"w-4 h-4 mr-1"}),"Copy manifest"]}),_&&l.jsxs(le,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void h("Redirect URI",p.redirectUri),children:[l.jsx(B1,{className:"w-4 h-4 mr-1"}),"Copy redirect URI"]}),p.createAppUrl&&l.jsxs(le,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(p.createAppUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),p.createAppLabel??"Open app creator"]})]}),p.steps.length>0&&l.jsx("div",{children:y&&p.setupMode==="manual"?l.jsxs("details",{className:"rounded-lg border border-orange-500/20 bg-orange-500/5 p-3",children:[l.jsx("summary",{className:"cursor-pointer text-xs font-medium text-orange-200",children:"First-time Slack app setup"}),l.jsx("div",{className:"mt-2",children:l.jsx(Dh,{items:p.steps})})]}):l.jsxs(l.Fragment,{children:[p.setupMode==="informational"?l.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"What to do"}):null,l.jsx(Dh,{items:p.steps})]})}),p.tokenAlternative&&l.jsxs("p",{className:"text-xs text-orange-100/80 border-l-2 border-orange-500/30 pl-2",children:[l.jsx("span",{className:"font-medium text-orange-200",children:"Alternative: "}),p.tokenAlternative]}),u&&p.setupMode==="manual"&&l.jsxs("div",{className:"space-y-3 rounded-lg border border-orange-500/20 bg-orange-500/5 p-3",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(Oe,{htmlFor:`oauth-client-id-${e}`,className:"text-orange-200",children:"Client ID"}),l.jsx(Be,{id:`oauth-client-id-${e}`,value:n,onChange:C=>s(C.target.value),placeholder:"OAuth Client ID",className:"bg-black/20 border-orange-500/30"})]}),f?l.jsxs("div",{className:"space-y-1",children:[l.jsx(Oe,{htmlFor:`oauth-client-secret-${e}`,className:"text-orange-200",children:"Client Secret"}),l.jsx(Be,{id:`oauth-client-secret-${e}`,type:"password",value:o,onChange:C=>i(C.target.value),placeholder:"OAuth Client Secret",className:"bg-black/20 border-orange-500/30"})]}):l.jsx("p",{className:"text-xs text-orange-200/80",children:"Client secret is saved locally for this service."}),y&&l.jsx(le,{type:"button",size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>g(C=>!C),children:f?"Hide client secret field":"Update client secret"}),(v==null?void 0:v.hasStoredClientSecret)&&f&&l.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."})]}),p.afterConnect&&p.afterConnect.length>0&&l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"After connect"}),l.jsx(Dh,{items:p.afterConnect,className:"text-orange-100/80"})]}),_&&l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(le,{size:"sm",className:"bg-orange-600 hover:bg-orange-700",disabled:a||u&&p.setupMode==="manual"&&!y&&(!n.trim()||!o.trim()),onClick:()=>x(m()),children:a?"Connecting…":y&&p.setupMode==="manual"?"Reconnect":p.setupMode==="dynamic"||p.setupMode==="managed"?"Connect":"Connect with credentials"}),p.docsUrl&&l.jsxs(le,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(p.docsUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"Docs"]})]}),p.setupMode==="informational"&&p.docsUrl&&l.jsxs(le,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(p.docsUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"Docs"]})]})}function X4(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 eD({service:e,isOpen:t,onClose:r}){var He,fn,Tr,hn,xt,ds,mo,fs,go,Fa,zn,Kf,se,jt,vo,yo,n0,s0,o0,i0,a0,l0;const[n,s]=w.useState(null),[o,i]=w.useState(!1),[a,c]=w.useState(""),[u,d]=w.useState(!1),[f,g]=w.useState(!1),[v,b]=w.useState(!1),[p,y]=w.useState(""),[m,h]=w.useState(""),[x,_]=w.useState(!1),[C,T]=w.useState(!1),[$,O]=w.useState(null),M=yr(),{toast:U}=ir(),j=e&&($==null?void 0:$.id)===e.id?$:e,k=j,L=!!(k&&k.id&&k.url),{data:P,isLoading:B,error:H,refetch:G}=Gt({queryKey:["/api/mcp/discover",k==null?void 0:k.url],queryFn:async()=>{if(!k||k.type!=="mcp")return null;console.log(`🔍 Attempting MCP discovery for: ${k.url}`);try{const Se=await(await Ee("POST","/api/mcp/discover",{url:k.url})).json();return console.log(`✅ MCP discovery successful for ${k.url}:`,Se),Se}catch(ue){throw console.log(`❌ MCP discovery failed for ${k.url}:`,ue),ue}},enabled:L&&k.type==="mcp"&&t,staleTime:0,gcTime:2*60*1e3}),q=((fn=(He=P==null?void 0:P.data)==null?void 0:He.oauth)==null?void 0:fn.required)===!0,{data:V,refetch:z}=Gt({queryKey:["/api/oauth",k==null?void 0:k.id,"status"],queryFn:async()=>{const ue=await Ee("GET",`/api/oauth/${k.id}/status`),Se=await ue.json();if(!ue.ok||!Se.success)throw new Error(Se.error||"Failed to load OAuth status");return Se.data},enabled:L&&k.type==="mcp"&&t&&q,refetchInterval:ue=>{const Se=ue.state.data;return Se!=null&&Se.authenticated?!1:2e3}}),F=q?V!=null&&V.authenticated?{status:"authenticated",message:null}:V!=null&&V.hasToken&&(V!=null&&V.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:k==null?void 0:k.id,apiServiceType:k==null?void 0:k.type,apiServiceUrl:k==null?void 0:k.url,isOpen:t,hasValidService:L,enabled:L&&k.type==="mcp"&&t,mcpDiscoveryLoading:B,mcpDiscoveryData:P?JSON.stringify(P,null,2):null,mcpDiscoveryDataKeys:P?Object.keys(P):null,oauthRequired:(hn=(Tr=P==null?void 0:P.data)==null?void 0:Tr.oauth)==null?void 0:hn.required,oauthData:(xt=P==null?void 0:P.data)!=null&&xt.oauth?JSON.stringify(P.data.oauth,null,2):null,toolsQueryEnabled:L&&k.type==="mcp"&&t&&!((mo=(ds=P==null?void 0:P.data)==null?void 0:ds.oauth)!=null&&mo.required)});const{data:N,isLoading:S,error:E,refetch:D}=Gt({queryKey:["/api/services",k==null?void 0:k.id,"tools"],queryFn:async()=>{if(!k||k.type!=="mcp"&&k.type!=="local-mcp")return{data:[]};console.log(`🔍 Attempting to discover tools for MCP service: ${k.id} at ${k.url}`);try{const Se=await(await Ee("GET",`/api/services/${k.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${k.id}:`,Se),Se}catch(ue){throw console.log(`❌ MCP tools discovery failed for ${k.id}:`,ue),ue}},enabled:L&&(k.type==="mcp"||k.type==="local-mcp")&&t&&(k.type==="local-mcp"||F.status==="authenticated"||F.status==="not_required"),staleTime:0,gcTime:2*60*1e3});w.useEffect(()=>{if(!t||!(k!=null&&k.id)||k.type!=="mcp"&&k.type!=="local-mcp"||!(k.type==="local-mcp"||F.status==="authenticated"||F.status==="not_required")||S||E)return;let Se=!1;return(async()=>{try{const Jt=await(await Ee("GET",`/api/services/${k.id}`)).json();!Se&&(Jt!=null&&Jt.success)&&Jt.data&&O(Jt.data),M.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{Se=!0}},[t,k==null?void 0:k.id,k==null?void 0:k.type,S,E,F.status,M]),w.useEffect(()=>{if(!t||!(k!=null&&k.id)||k.type!=="a2a")return;let ue=!1;return(async()=>{try{await Ee("GET",`/api/services/${k.id}/health`);const Vt=await(await Ee("GET",`/api/services/${k.id}`)).json();!ue&&(Vt!=null&&Vt.success)&&Vt.data&&O(Vt.data),M.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{ue=!0}},[t,k==null?void 0:k.id,k==null?void 0:k.type,M]),console.log("MCP Tools Query Debug:",{hasValidService:L,apiServiceType:k==null?void 0:k.type,isOpen:t,oauthRequired:(go=(fs=P==null?void 0:P.data)==null?void 0:fs.oauth)==null?void 0:go.required,oauthStatus:F.status,toolsQueryEnabled:L&&(k.type==="mcp"||k.type==="local-mcp")&&t&&(k.type==="local-mcp"||F.status==="authenticated"||F.status==="not_required"),mcpToolsLoading:S});const{data:K,isLoading:Z,error:ce}=Gt({queryKey:["/api/proxy/a2a",k==null?void 0:k.id,"manifest"],queryFn:async()=>{if(!k||k.type!=="a2a")return null;const Se=await(await Ee("GET",`/api/proxy/a2a/${k.id}/manifest`)).text();return JSON.parse(Se)},enabled:L&&k.type==="a2a"&&t,staleTime:0,gcTime:2*60*1e3}),re=(N==null?void 0:N.data)||[],X=K,ve=S||Z;console.log("ServiceDetailsModal Debug:",{service:e==null?void 0:e.id,serviceType:e==null?void 0:e.type,isOpen:t,mcpDiscoveryLoading:B,mcpDiscoveryData:P,mcpDiscoveryError:H?String(H):null,mcpToolsLoading:S,a2aManifestLoading:Z,mcpToolsError:E?String(E):null,a2aManifestError:ce?String(ce):null,mcpToolsCount:re.length,mcpToolsData:N,hasA2aManifest:!!X,isLoading:ve,oauthRequired:(zn=(Fa=P==null?void 0:P.data)==null?void 0:Fa.oauth)==null?void 0:zn.required,oauthStatus:F.status,oauthMessage:F.message,oauthAuthenticated:V==null?void 0:V.authenticated,expiresAt:V==null?void 0:V.expiresAt}),w.useEffect(()=>{if(!t){O(null);return}e&&(O(e),c(e.cardColor||"#92E4DD"),y(e.name||""),h(e.description||""))},[e,t]);const Le=w.useRef(!1);w.useEffect(()=>{if(!t||!(k!=null&&k.id)){Le.current=!1;return}if(!(V!=null&&V.authenticated)){Le.current=!1;return}if(Le.current)return;Le.current=!0,(async()=>{U({title:"OAuth completed",description:"Authentication successful! Refreshing service status..."}),M.invalidateQueries({queryKey:["/api/services",k.id]}),M.invalidateQueries({queryKey:["/api/mcp/discover",k.url]}),M.invalidateQueries({queryKey:["/api/collection-warnings"]});try{const Se=await Ee("GET",`/api/services/${k.id}`);if(Se.ok){const ht=await Se.json();O(ht.data??ht)}}catch{}await G(),M.invalidateQueries({queryKey:["/api/services",k.id,"tools"]}),await D()})()},[V==null?void 0:V.authenticated,t,k==null?void 0:k.id]),w.useEffect(()=>{const ue=Se=>{const ht=Se.target;o&&!ht.closest(".color-picker-container")&&i(!1)};return document.addEventListener("mousedown",ue),()=>{document.removeEventListener("mousedown",ue)}},[o]);const gt=()=>(e==null?void 0:e.type)==="mcp"?l.jsx(Uw,{className:"w-6 h-6"}):l.jsx(Sh,{className:"w-6 h-6"}),Y=()=>(e==null?void 0:e.type)==="mcp"?"text-blue-400":"text-purple-400",me=()=>(e==null?void 0:e.type)==="mcp"?"bg-blue-500/20":"bg-purple-500/20",J=ue=>new Date(ue).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Me=async ue=>{if(e){d(!0),c(ue);try{if((await Ee("PUT",`/api/services/${e.id}`,{cardColor:ue})).ok)M.invalidateQueries({queryKey:["/api/services"]}),M.invalidateQueries({queryKey:["/api/collection/warnings"]}),M.invalidateQueries({queryKey:["/api/decks"]}),M.invalidateQueries({queryKey:["/api/decks"]}),U({title:"Color updated",description:"Card color has been updated successfully."}),i(!1);else throw new Error("Failed to update color")}catch{c(e.cardColor||"#92E4DD"),U({title:"Update failed",description:"Failed to update card color. Please try again.",variant:"destructive"})}finally{d(!1)}}},ie=async()=>{if(!(!e||!p.trim())){_(!0);try{if((await Ee("PUT",`/api/services/${e.id}`,{name:p.trim()})).ok){if($){const Se={...$,name:p.trim()};O(Se)}M.invalidateQueries({queryKey:["/api/services"]}),M.invalidateQueries({queryKey:["/api/collection/warnings"]}),M.invalidateQueries({queryKey:["/api/decks"]}),M.invalidateQueries({queryKey:["/api/decks"]}),U({title:"Name updated",description:"Service name has been updated successfully."}),g(!1)}else throw new Error("Failed to update name")}catch{U({title:"Update failed",description:"Failed to update service name. Please try again.",variant:"destructive"})}finally{_(!1)}}},Ie=async()=>{if(e){T(!0);try{if((await Ee("PUT",`/api/services/${e.id}`,{description:m.trim()})).ok){if($){const Se={...$,description:m.trim()};O(Se)}M.invalidateQueries({queryKey:["/api/services"]}),M.invalidateQueries({queryKey:["/api/collection/warnings"]}),M.invalidateQueries({queryKey:["/api/decks"]}),M.invalidateQueries({queryKey:["/api/decks"]}),U({title:"Description updated",description:"Service description has been updated successfully."}),b(!1)}else throw new Error("Failed to update description")}catch{U({title:"Update failed",description:"Failed to update service description. Please try again.",variant:"destructive"})}finally{T(!1)}}},Pe=[{value:"#92E4DD",label:"Default"},{value:"#F9386D",label:"Red"},{value:"#E0E0E0",label:"Gray"},{value:"#FF6B00",label:"Orange"}];return l.jsx(ai,{open:t,onOpenChange:r,children:l.jsxs(co,{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:[l.jsx(uo,{children:l.jsxs(fo,{className:"text-2xl font-bold flex items-center",children:[gt(),l.jsx("div",{className:"ml-3 flex items-center",children:f?l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:p,onChange:ue=>y(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"?ie():ue.key==="Escape"&&(g(!1),y((j==null?void 0:j.name)||""))},className:"bg-black/30 border border-white/20 rounded px-2 py-1 text-white text-2xl font-bold focus:outline-none focus:border-white/40",autoFocus:!0}),l.jsx(le,{size:"sm",onClick:ie,disabled:x,className:"h-6 px-2 text-xs",children:x?"Saving...":"Save"}),l.jsx(le,{size:"sm",variant:"outline",onClick:()=>{g(!1),y((j==null?void 0:j.name)||"")},className:"h-6 px-2 text-xs",children:"Cancel"})]}):l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"cursor-pointer hover:bg-white/10 px-2 py-1 rounded transition-colors",onClick:()=>g(!0),title:"Click to edit name",children:j==null?void 0:j.name}),l.jsx(le,{size:"sm",variant:"ghost",onClick:()=>g(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit name",children:l.jsx(vd,{className:"w-3 h-3"})})]})}),l.jsx(mn,{className:`ml-3 ${me()} ${Y()}`,children:(Kf=e==null?void 0:e.type)==null?void 0:Kf.toUpperCase()})]})}),e&&l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("h3",{className:"text-lg font-semibold flex items-center",children:[l.jsx(q2,{className:"w-5 h-5 mr-2"}),"Service Overview"]}),l.jsxs("div",{className:"relative color-picker-container",children:[l.jsx(le,{size:"sm",variant:"outline",className:"h-8 w-8 p-0 border-white/20 hover:bg-white/10",onClick:()=>i(!o),title:"Change card color",children:l.jsx("div",{className:"w-4 h-4 rounded-full border border-white/20",style:{backgroundColor:a||e.cardColor||"#92E4DD"}})}),o&&l.jsxs("div",{className:"absolute top-full right-0 mt-2 bg-black/90 border border-white/20 rounded-lg p-3 z-50 min-w-32",children:[l.jsx("div",{className:"text-xs text-gray-300 mb-2",children:"Choose Color:"}),l.jsx("div",{className:"grid grid-cols-1 gap-1",children:Pe.map(ue=>l.jsxs("button",{className:`flex items-center gap-2 px-2 py-1 rounded text-xs hover:bg-white/10 transition-colors ${(a||e.cardColor)===ue.value?"bg-white/20":""}`,onClick:()=>Me(ue.value),disabled:u,children:[l.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:ue.value}}),l.jsx("span",{className:"text-white",children:ue.label}),u&&e.cardColor===ue.value&&l.jsx("div",{className:"ml-auto w-3 h-3 border border-white/20 border-t-transparent rounded-full animate-spin"})]},ue.value))})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("p",{className:"text-gray-300 text-sm",children:"Description"}),!v&&l.jsx(le,{size:"sm",variant:"ghost",onClick:()=>b(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit description",children:l.jsx(vd,{className:"w-3 h-3"})})]}),v?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{value:m,onChange:ue=>h(ue.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}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(le,{size:"sm",onClick:Ie,disabled:C,className:"h-6 px-2 text-xs",children:C?"Saving...":"Save"}),l.jsx(le,{size:"sm",variant:"outline",onClick:()=>{b(!1),h((j==null?void 0:j.description)||"")},className:"h-6 px-2 text-xs",children:"Cancel"})]})]}):l.jsx("p",{className:"text-white cursor-pointer hover:bg-white/10 px-2 py-1 rounded transition-colors",onClick:()=>b(!0),title:"Click to edit description",children:(j==null?void 0:j.description)||"No description"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Endpoint"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(mn,{variant:"outline",className:"border-blue-500/30 text-blue-300",children:k.type.toUpperCase()}),e.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0&&l.jsx(mn,{variant:"outline",className:"border-green-500/30 text-green-300",children:"Custom Headers"})]}),l.jsx(le,{size:"sm",variant:"ghost",onClick:()=>window.open(k.url,"_blank"),className:"p-1 h-auto",children:l.jsx(Jn,{className:"w-4 h-4"})})]}),l.jsx("div",{className:"text-xs text-gray-400 break-all bg-black/20 p-2 rounded border border-white/10",children:k.url||"No URL available"}),e.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0&&l.jsxs("div",{className:"text-xs text-gray-400 bg-black/20 p-2 rounded border border-white/10",children:[l.jsx("p",{className:"font-semibold mb-1",children:"Custom Headers:"}),l.jsx("pre",{className:"text-xs overflow-x-auto",children:JSON.stringify(e.headers,null,2)})]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Health Status"}),l.jsx(mn,{className:k.health==="healthy"?"bg-green-500/20 text-green-300":k.health==="unhealthy"?"bg-red-500/20 text-red-300":"bg-amber-500/20 text-amber-200",children:k.health==="healthy"?"Healthy":k.health==="unhealthy"?"Unreachable":F.status==="required"||F.status==="expired"?"Auth required":"Unknown"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Registered"}),l.jsx("p",{className:"text-white text-sm",children:J(k.registeredAt)})]})]})]}),ve&&l.jsxs("div",{className:"text-center py-8",children:[l.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4"}),l.jsx("p",{className:"text-gray-400",children:"Fetching service details..."})]}),n&&l.jsx("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:l.jsx("p",{className:"text-red-300",children:n})}),(e.type==="mcp"||e.type==="local-mcp")&&l.jsxs(l.Fragment,{children:[e.type==="local-mcp"&&l.jsxs("div",{className:"bg-cyan-500/15 border border-cyan-500/30 rounded-lg p-4 mb-4",children:[l.jsx("h3",{className:"text-cyan-200 font-semibold mb-2",children:"Local MCP — auth happens outside Agent Deck"}),l.jsx("div",{className:"text-cyan-100/90 text-sm space-y-2",children:X4(k)?l.jsxs(l.Fragment,{children:[l.jsxs("p",{children:["This card runs ",l.jsx("code",{className:"text-xs",children:"@piotr-agier/google-drive-mcp"})," on your machine. Agent Deck does ",l.jsx("strong",{children:"not"}),' handle Google OAuth for it. If Google shows "app not verified", that is ',l.jsx("strong",{children:"your Google Cloud project"}),", not Agent Deck."]}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-1",children:[l.jsxs("li",{children:["Create a GCP OAuth client type ",l.jsx("strong",{children:"Desktop app"})," (not Web)."]}),l.jsxs("li",{children:["Add yourself as a ",l.jsx("strong",{children:"Test user"})," on the consent screen."]}),l.jsxs("li",{children:["Run in terminal first:"," ",l.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"
362
- export GOOGLE_DRIVE_MCP_AUTH_PORT=3100
363
- npx @piotr-agier/google-drive-mcp auth`})]}),l.jsxs("li",{children:["Set ",l.jsx("code",{className:"text-xs",children:"GOOGLE_DRIVE_MCP_TOKEN_PATH"})," in the card env to the same token file (",l.jsx("code",{className:"text-xs",children:"~/.config/google-drive-mcp/tokens.json"}),")."]})]}),l.jsxs("p",{className:"text-xs text-cyan-200/80",children:["Full steps: ",l.jsx("code",{className:"text-xs",children:"docs/GOOGLE_DRIVE_WORKAROUND.md"})," in the repo."]})]}):l.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."})})]}),l.jsx(Y4,{serviceId:k.id,tools:re,isLoading:S})]}),e.type==="a2a"&&X&&l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[l.jsx(X2,{className:"w-5 h-5 mr-2"}),"Agent Overview"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Agent Name"}),l.jsx("p",{className:"text-white font-semibold",children:X.name})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Version"}),l.jsx("p",{className:"text-white",children:X.version})]}),l.jsxs("div",{className:"md:col-span-2",children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Description"}),l.jsx("p",{className:"text-white",children:X.description})]}),X.provider&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Provider"}),l.jsx("p",{className:"text-white",children:X.provider.organization})]}),X.documentationUrl&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Documentation"}),l.jsxs(le,{size:"sm",variant:"ghost",onClick:()=>window.open(X.documentationUrl,"_blank"),className:"p-1 h-auto text-purple-300",children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"View Docs"]})]})]})]}),X.capabilities&&l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[l.jsx(V1,{className:"w-5 h-5 mr-2"}),"Capabilities"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[X.capabilities.streaming&&l.jsx(mn,{className:"bg-green-500/20 text-green-300",children:"Streaming"}),X.capabilities.pushNotifications&&l.jsx(mn,{className:"bg-blue-500/20 text-blue-300",children:"Push Notifications"}),X.capabilities.stateTransitionHistory&&l.jsx(mn,{className:"bg-purple-500/20 text-purple-300",children:"State History"})]})]}),X.skills&&X.skills.length>0&&l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[l.jsx(Sh,{className:"w-5 h-5 mr-2"}),"Skills (",X.skills.length,")"]}),l.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:X.skills.map((ue,Se)=>l.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:[l.jsx("div",{className:"absolute top-2 left-2 text-xs font-bold",children:l.jsx("div",{className:"text-purple-300 leading-none",children:"S"})}),l.jsx("div",{className:"absolute bottom-2 right-2 text-xs font-bold rotate-180",children:l.jsx("div",{className:"text-purple-300 leading-none",children:"S"})}),l.jsxs("div",{className:"absolute inset-x-3 top-8 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"text-purple-300 mb-2",children:l.jsx(Sh,{className:"w-6 h-6"})}),l.jsx("h4",{className:"font-bold text-sm mb-2 line-clamp-2 text-white",children:ue.name}),l.jsx("p",{className:"text-gray-300 text-xs line-clamp-4 mb-2",children:ue.description}),ue.tags&&ue.tags.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1 justify-center",children:ue.tags.slice(0,2).map((ht,Vt)=>l.jsx("span",{className:"text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded",children:ht},Vt))})]}),l.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"})]},Se))})]}),(X.defaultInputModes||X.defaultOutputModes)&&l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("h3",{className:"text-lg font-semibold mb-3 flex items-center",children:[l.jsx(Uw,{className:"w-5 h-5 mr-2"}),"Data Modes"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[X.defaultInputModes&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-2",children:"Input Modes"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:X.defaultInputModes.map((ue,Se)=>l.jsx(mn,{className:"bg-blue-500/20 text-blue-300 text-xs",children:ue},Se))})]}),X.defaultOutputModes&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-2",children:"Output Modes"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:X.defaultOutputModes.map((ue,Se)=>l.jsx(mn,{className:"bg-green-500/20 text-green-300 text-xs",children:ue},Se))})]})]})]})]}),(e==null?void 0:e.type)==="mcp"&&F.status==="not_required"&&(k==null?void 0:k.id)&&l.jsxs("div",{className:"bg-blue-500/20 border border-blue-500/30 rounded-lg p-4 mb-4",children:[l.jsx("h3",{className:"text-blue-300 font-semibold mb-2",children:"How to connect"}),l.jsx(gx,{serviceId:k.id})]}),(e==null?void 0:e.type)==="mcp"&&F.status!=="authenticated"&&F.status!=="not_required"&&l.jsxs("div",{className:`${F.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:[l.jsx("h3",{className:`${F.status==="expired"?"text-red-300":"text-orange-300"} font-semibold mb-2`,children:F.status==="expired"?"⏰ Token Expired":"🔐 Authentication Required"}),l.jsxs("div",{className:`${F.status==="expired"?"text-red-200":"text-orange-200"} text-sm space-y-2`,children:[l.jsx("p",{children:l.jsx("strong",{children:F.message})}),l.jsx("p",{children:F.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."}),(k==null?void 0:k.id)&&l.jsx(gx,{serviceId:k.id,onConnected:()=>void z()}),((jt=(se=P==null?void 0:P.data)==null?void 0:se.oauth)==null?void 0:jt.resourceName)&&l.jsx("div",{className:"mt-3 p-2 bg-orange-500/10 rounded border border-orange-500/20 text-xs text-orange-100",children:l.jsxs("p",{children:[l.jsx("strong",{children:"Resource:"})," ",P.data.oauth.resourceName]})})]})]}),(e==null?void 0:e.type)==="mcp"&&l.jsxs("div",{className:"bg-gray-800/50 border border-gray-600/30 rounded-lg p-4 mb-4",children:[l.jsx("h3",{className:"text-gray-300 font-semibold mb-2",children:"Connection Logs"}),l.jsxs("div",{className:"text-gray-200 text-sm space-y-2",children:[l.jsxs("div",{className:"bg-black/30 p-2 rounded text-xs",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 Attempting to discover tools for MCP service:"})}),l.jsxs("p",{children:["Service ID: ",e==null?void 0:e.id]}),l.jsxs("p",{children:["Service URL: ",k==null?void 0:k.url]}),l.jsxs("p",{children:["Status: ",S?"🔄 Loading...":E?"❌ Failed":"✅ Complete"]})]}),S&&l.jsxs("div",{className:"bg-yellow-500/20 p-2 rounded text-xs",children:[l.jsxs("p",{children:["🔄 Making HTTP request to: ",l.jsxs("code",{children:["GET /api/services/",e==null?void 0:e.id,"/tools"]})]}),l.jsxs("p",{children:["Target MCP server: ",l.jsx("code",{children:k==null?void 0:k.url})]})]}),E&&l.jsxs("div",{className:"bg-red-500/20 p-2 rounded text-xs",children:[l.jsx("p",{children:"❌ Request failed:"}),l.jsx("pre",{className:"whitespace-pre-wrap overflow-x-auto",children:E instanceof Error?E.message:String(E)}),l.jsxs("div",{className:"mt-2 p-2 bg-black/30 rounded",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 What we tried:"})}),l.jsxs("p",{children:["• Service ID: ",e==null?void 0:e.id]}),l.jsxs("p",{children:["• Target URL: ",k==null?void 0:k.url]}),l.jsxs("p",{children:["• Request: GET /api/services/",e==null?void 0:e.id,"/tools"]}),(k==null?void 0:k.headers)&&l.jsxs("div",{children:[l.jsx("p",{children:l.jsx("strong",{children:"📋 Headers sent:"})}),l.jsx("pre",{className:"text-xs overflow-x-auto",children:JSON.stringify(k.headers,null,2)})]}),l.jsxs("div",{className:"mt-2",children:[l.jsx("p",{children:l.jsx("strong",{children:"💡 What this means:"})}),l.jsxs("p",{children:["• The MCP server at ",k==null?void 0:k.url," returned an error"]}),l.jsx("p",{children:"• This could be due to authentication issues, server being down, or invalid configuration"}),l.jsx("p",{children:"• Check the error message above for specific details from the MCP server"})]})]})]}),!S&&!E&&re.length>0&&l.jsx("div",{className:"bg-green-500/20 p-2 rounded text-xs",children:l.jsxs("p",{children:["✅ Successfully discovered ",re.length," tools from MCP server"]})}),!S&&!E&&re.length===0&&l.jsxs("div",{className:"bg-yellow-500/20 p-2 rounded text-xs",children:[l.jsx("p",{children:"⚠️ Connected to MCP server but no tools were found"}),l.jsx("p",{children:"This could mean the server has no tools or requires specific authentication"})]})]})]}),E&&(e.type==="mcp"||e.type==="local-mcp")&&l.jsxs("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:[l.jsx("h3",{className:"text-red-300 font-semibold mb-2",children:"MCP Tool Discovery Failed"}),l.jsxs("div",{className:"text-red-200 text-sm space-y-2",children:[l.jsx("p",{children:l.jsx("strong",{children:"Raw Error:"})}),l.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)}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service URL:"})," ",k==null?void 0:k.url]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service ID:"})," ",k==null?void 0:k.id]}),(k==null?void 0:k.headers)&&l.jsxs("div",{children:[l.jsx("p",{children:l.jsx("strong",{children:"Custom Headers:"})}),l.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto",children:JSON.stringify(k.headers,null,2)})]})]})]}),ce&&e.type==="a2a"&&l.jsxs("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:[l.jsx("h3",{className:"text-red-300 font-semibold mb-2",children:"A2A Manifest Discovery Failed"}),l.jsxs("div",{className:"text-red-200 text-sm space-y-2",children:[l.jsx("p",{children:l.jsx("strong",{children:"Raw Error:"})}),l.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap",children:ce instanceof Error?ce.message:String(ce)}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service URL:"})," ",k==null?void 0:k.url]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service ID:"})," ",k==null?void 0:k.id]})]})]}),!ve&&!E&&!ce&&(e.type==="mcp"||e.type==="local-mcp")&&re.length===0&&(e.type==="local-mcp"||!((yo=(vo=P==null?void 0:P.data)==null?void 0:vo.oauth)!=null&&yo.required))&&l.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4",children:[l.jsx("h3",{className:"text-yellow-300 font-semibold mb-2",children:"No Tools Available"}),l.jsxs("p",{className:"text-yellow-200 text-sm",children:["Successfully connected to MCP server at ",k==null?void 0:k.url,", but no tools were discovered."]}),l.jsxs("div",{className:"text-yellow-200 text-xs mt-2",children:[l.jsx("p",{children:l.jsx("strong",{children:"This could mean:"})}),l.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[l.jsx("li",{children:"The MCP server has no tools registered"}),l.jsx("li",{children:"Tools require specific authentication"}),l.jsx("li",{children:"Tools are only available after certain operations"})]})]})]}),(e.type==="mcp"||e.type==="local-mcp")&&l.jsxs("div",{className:"bg-blue-500/20 border border-blue-500/30 rounded-lg p-4",children:[l.jsx("h3",{className:"text-blue-300 font-semibold mb-2",children:"🔍 MCP Server Analysis"}),l.jsxs("div",{className:"text-blue-200 text-sm space-y-2",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Server URL:"})," ",k==null?void 0:k.url]}),B&&l.jsx("div",{className:"mt-3 p-3 bg-black/30 rounded",children:l.jsx("p",{children:"🔍 Analyzing MCP server configuration..."})}),P&&l.jsxs("div",{className:"mt-3 p-3 bg-black/30 rounded",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 What we discovered:"})}),P.error&&P.analysis&&l.jsxs("div",{className:"text-yellow-200",children:[P.analysis.auth_type==="oauth2"&&l.jsxs("div",{children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),l.jsx("p",{children:"• This MCP server requires OAuth 2.0 Bearer token authentication"}),l.jsx("p",{children:"• You'll need to provide OAuth credentials (client ID, client secret, authorization URL, token URL)"}),l.jsx("p",{children:"• Check the service provider's documentation for OAuth setup instructions"})]}),P.analysis.protocol==="sse"&&l.jsxs("div",{children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"SSE Protocol Required"})]}),l.jsx("p",{children:"• This MCP server uses Server-Sent Events (SSE) protocol"}),l.jsx("p",{children:"• We'll need to connect using event streaming instead of HTTP"})]}),P.analysis.issue==="not_found"&&l.jsxs("div",{children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"Server Not Found"})]}),l.jsx("p",{children:"• The MCP server URL might be incorrect"}),l.jsx("p",{children:"• Check if the server is running and the URL is correct"})]}),P.analysis.issue==="server_error"&&l.jsxs("div",{children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"Server Error"})]}),l.jsx("p",{children:"• The MCP server is experiencing internal errors"}),l.jsx("p",{children:"• Try again later or contact the service provider"})]}),P.analysis.message&&l.jsxs("p",{children:["• ",l.jsx("strong",{children:"Analysis:"})," ",P.analysis.message]})]}),((s0=(n0=P==null?void 0:P.data)==null?void 0:n0.oauth)==null?void 0:s0.required)&&l.jsxs("div",{className:"text-yellow-200",children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),P.data.oauth.authorizationUrl&&l.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[l.jsx(le,{size:"sm",variant:"default",className:"h-7",onClick:async()=>{var ue,Se;if(k!=null&&k.id)try{U({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const ht=await Ee("POST",`/api/oauth/${k.id}/auto-setup`,{});if(!ht.ok){const Jt=await ht.json();(ue=Jt.data)!=null&&ue.registrationUrl?(window.open(Jt.data.registrationUrl,"_blank"),U({title:"OAuth Registration Required",description:`${Jt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):U({title:"OAuth Setup Failed",description:Jt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Vt=await ht.json();Vt.success&&((Se=Vt.data)!=null&&Se.authorizationUrl)?(window.open(Vt.data.authorizationUrl,"_blank"),U({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),z()):U({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(ht){U({title:"OAuth Setup Failed",description:ht instanceof Error?ht.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsxs(le,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(P.data.oauth.authorizationUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),!P.data.oauth.authorizationUrl&&P.data.oauth.protectedResourceConfigUrl&&l.jsx("div",{className:"mt-2",children:l.jsxs(le,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(P.data.oauth.protectedResourceConfigUrl,"_blank"),children:[l.jsx(Jn,{className:"w-4 h-4 mr-1"}),"View OAuth Configuration"]})}),P.data.oauth.authorizationServerMetadataUrl&&l.jsxs("div",{className:"mt-2 text-xs text-gray-300",children:[l.jsx("span",{className:"mr-1",children:"Auth Server Metadata:"}),l.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)&&!((i0=(o0=P==null?void 0:P.data)==null?void 0:o0.oauth)!=null&&i0.required)&&l.jsxs("div",{className:"text-green-200",children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"✅ Server Analysis Complete"})]}),l.jsx("p",{children:"• MCP server is accessible and responding"}),l.jsx("p",{children:"• No authentication issues detected"}),l.jsx("p",{children:"• Protocol compatibility confirmed"})]}),((l0=(a0=P==null?void 0:P.data)==null?void 0:a0.oauth)==null?void 0:l0.required)&&l.jsxs("div",{className:"text-orange-200",children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"🔐 OAuth 2.0 Authentication Required"})]}),l.jsx("p",{children:"• This MCP server requires OAuth authentication"}),P.data.oauth.resourceName&&l.jsxs("p",{children:["• Service: ",P.data.oauth.resourceName]}),P.data.oauth.authorizationUrl&&l.jsxs("p",{children:["• Authorization URL: ",P.data.oauth.authorizationUrl]}),P.data.oauth.tokenUrl&&l.jsxs("p",{children:["• Token URL: ",P.data.oauth.tokenUrl]}),l.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[l.jsx(le,{size:"sm",variant:"default",className:"bg-orange-600 hover:bg-orange-700",onClick:async()=>{var ue,Se;if(k!=null&&k.id)try{U({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const ht=await Ee("POST",`/api/oauth/${k.id}/auto-setup`,{});if(!ht.ok){const Jt=await ht.json();(ue=Jt.data)!=null&&ue.registrationUrl?(window.open(Jt.data.registrationUrl,"_blank"),U({title:"OAuth Registration Required",description:`${Jt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):U({title:"OAuth Setup Failed",description:Jt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Vt=await ht.json();Vt.success&&((Se=Vt.data)!=null&&Se.authorizationUrl)?(window.open(Vt.data.authorizationUrl,"_blank"),U({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),z()):U({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(ht){U({title:"OAuth Setup Failed",description:ht instanceof Error?ht.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsx(le,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-300 hover:bg-orange-500/10",onClick:()=>{const ue=`OAuth Setup Instructions:
364
-
365
- 1. Go to the service provider's OAuth/Developer settings
366
- 2. Create a new OAuth application
367
- 3. Set Redirect URL: http://localhost:8000/api/oauth/${k==null?void 0:k.id}/callback
368
- 4. Copy the Client ID and Client Secret
369
- 5. Edit this service and add the credentials
370
-
371
- ${P.data.oauth.authorizationUrl?`Authorization URL: ${P.data.oauth.authorizationUrl}`:""}
372
- ${P.data.oauth.tokenUrl?`Token URL: ${P.data.oauth.tokenUrl}`:""}
373
- ${P.data.oauth.issuer?`Issuer: ${P.data.oauth.issuer}`:""}`;U({title:"OAuth Setup Instructions",description:ue,duration:1e4})},children:"📋 Setup Instructions"})]})]}),l.jsxs("div",{className:"mt-2 text-xs",children:[l.jsx("p",{children:l.jsx("strong",{children:"💡 Next Steps:"})}),l.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[l.jsx("li",{children:"For OAuth servers: Provide OAuth credentials in service settings"}),l.jsx("li",{children:"For SSE servers: We'll automatically use the correct protocol"}),l.jsx("li",{children:"For connection issues: Verify the server URL and status"})]})]})]}),H&&l.jsxs("div",{className:"mt-3 p-3 bg-red-500/20 rounded",children:[l.jsx("p",{children:l.jsx("strong",{children:"❌ Discovery Failed"})}),l.jsx("p",{children:"Could not analyze MCP server configuration"}),l.jsx("pre",{className:"text-xs overflow-x-auto",children:H instanceof Error?H.message:String(H)})]})]})]}),!ve&&!E&&!ce&&e.type==="a2a"&&!X&&l.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4",children:[l.jsx("h3",{className:"text-yellow-300 font-semibold mb-2",children:"Agent Details Not Available"}),l.jsxs("p",{className:"text-yellow-200 text-sm",children:["Successfully connected to A2A agent at ",k==null?void 0:k.url,", but no manifest was found."]}),l.jsxs("div",{className:"text-yellow-200 text-xs mt-2",children:[l.jsx("p",{children:l.jsx("strong",{children:"This could mean:"})}),l.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[l.jsx("li",{children:"The agent doesn't provide a manifest"}),l.jsx("li",{children:"Manifest endpoint is not implemented"}),l.jsx("li",{children:"Agent requires specific authentication"})]})]})]})]})]})})}function tD(){const[e,t]=w.useState("connecting"),[r,n]=w.useState(null),s=w.useRef(null),o=w.useRef(null),i=yr();return w.useEffect(()=>{const c=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws/events`,u=()=>{try{const d=new WebSocket(c);s.current=d,d.onopen=()=>{console.log("WebSocket connected"),t("connected")},d.onmessage=f=>{try{const g=JSON.parse(f.data);n(g),g.type==="deck_update"?(console.log("Received deck update:",g),i.invalidateQueries({queryKey:["/api/decks"]}),i.invalidateQueries({queryKey:["/api/decks"]})):g.type==="service_update"?(console.log("Received service update:",g),i.invalidateQueries({queryKey:["/api/services"]})):g.type==="connection_status"&&t(g.status==="connected"?"connected":"disconnected")}catch(g){console.error("Failed to parse WebSocket message:",g)}},d.onclose=()=>{console.log("WebSocket disconnected"),t("disconnected"),o.current=setTimeout(()=>{console.log("Attempting to reconnect WebSocket..."),t("connecting"),u()},3e3)},d.onerror=f=>{console.error("WebSocket error:",f),t("disconnected")}}catch(d){console.error("Failed to connect WebSocket:",d),t("disconnected")}};return u(),()=>{o.current&&clearTimeout(o.current),s.current&&s.current.readyState===WebSocket.OPEN&&s.current.close()}},[i]),{connectionStatus:e,lastMessage:r}}async function vx(e,t){const r=e==="credential"?`credentialId=${encodeURIComponent(t)}`:`serviceId=${encodeURIComponent(t)}`;return(await(await Ee("GET",`/api/playbooks/dependents/check?${r}`)).json()).data??[]}function rD(e){const[t,r]=w.useState(null),[n,s]=w.useState(null),[o,i]=w.useState(null),[a,c]=w.useState(!1),u=yr(),{toast:d}=ir(),f=()=>{if(!e)throw new Error("Select a deck to edit first");return e},g=Ct({mutationFn:async j=>{var G,q,V;const k=f(),B=(G=(await(await Ee("GET","/api/decks")).json()).data)==null?void 0:G.find(z=>z.id===k);if(!B)throw new Error("Selected deck not found");if((q=B.services)!=null&&q.some(z=>z.id===j))throw new Error("Service is already in the deck");const H=((V=B.services)==null?void 0:V.length)??0;return Ee("POST",`/api/decks/${k}/services`,{serviceId:j,position:H})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Service added to deck",description:`${(t==null?void 0:t.name)||"Service"} has been added to the deck.`})},onError:j=>{d({title:"Failed to add service",description:j.message,variant:"destructive"})}}),v=Ct({mutationFn:async j=>{var H,G;const k=f(),B=(H=(await(await Ee("GET","/api/decks")).json()).data)==null?void 0:H.find(q=>q.id===k);if((G=B==null?void 0:B.credentials)!=null&&G.some(q=>q.id===j))throw new Error("API key is already in the deck");return Ee("POST",`/api/decks/${k}/credentials`,{credentialId:j})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key added to deck",description:`${(n==null?void 0:n.label)||"API key"} is scoped to this deck.`})},onError:j=>{d({title:"Failed to add API key",description:j.message,variant:"destructive"})}}),b=Ct({mutationFn:async j=>{var H,G;const k=f(),B=(H=(await(await Ee("GET","/api/decks")).json()).data)==null?void 0:H.find(q=>q.id===k);if((G=B==null?void 0:B.playbooks)!=null&&G.some(q=>q.id===j))throw new Error("Playbook is already in the deck");return Ee("POST",`/api/decks/${k}/playbooks`,{playbookId:j})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook added to deck",description:`${(o==null?void 0:o.title)||"Playbook"} is on this deck.`})},onError:j=>{d({title:"Failed to add playbook",description:j.message,variant:"destructive"})}}),p=Ct({mutationFn:async j=>{const k=await vx("service",j);if(k.length>0){const P=k.map(H=>H.title).join(", ");if(!window.confirm(`Warning: ${k.length} playbook(s) depend on this MCP (${P}). Remove from deck anyway?`))throw new Error("Cancelled")}const L=f();return Ee("DELETE",`/api/decks/${L}/services`,{serviceId:j})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Service removed from deck",description:`${(t==null?void 0:t.name)||"Service"} has been removed from the deck.`})},onError:j=>{j.message!=="Cancelled"&&d({title:"Failed to remove service",description:j.message,variant:"destructive"})}}),y=Ct({mutationFn:async j=>{const k=await vx("credential",j);if(k.length>0){const P=k.map(H=>H.title).join(", ");if(!window.confirm(`Warning: ${k.length} playbook(s) depend on this API key (${P}). Remove from deck anyway?`))throw new Error("Cancelled")}const L=f();return Ee("DELETE",`/api/decks/${L}/credentials`,{credentialId:j})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key removed from deck",description:`${(n==null?void 0:n.label)||"API key"} is no longer on this deck.`})},onError:j=>{j.message!=="Cancelled"&&d({title:"Failed to remove API key",description:j.message,variant:"destructive"})}}),m=Ct({mutationFn:async j=>{const k=f();return Ee("DELETE",`/api/decks/${k}/playbooks`,{playbookId:j})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook removed from deck",description:`${(o==null?void 0:o.title)||"Playbook"} is no longer on this deck.`})},onError:j=>{d({title:"Failed to remove playbook",description:j.message,variant:"destructive"})}}),h=(j,k)=>{j.currentTarget instanceof HTMLElement&&(j.currentTarget.style.opacity=k)},x=(j,k)=>{j.dataTransfer.setData("text/plain",k.id),j.dataTransfer.setData("application/json",JSON.stringify(k)),j.dataTransfer.effectAllowed=k.fromDeck?"move":"copy"},_=(j,k,L=!1)=>{r(k),s(null),i(null),c(L),x(j,{kind:"service",id:k.id,fromDeck:L}),h(j,"0.5")},C=(j,k,L=!1)=>{s(k),r(null),i(null),c(L),x(j,{kind:"credential",id:k.id,fromDeck:L}),h(j,"0.5")},T=(j,k,L=!1)=>{i(k),r(null),s(null),c(L),x(j,{kind:"playbook",id:k.id,fromDeck:L}),h(j,"0.5")},$=j=>{r(null),s(null),i(null),h(j,"1")},O=j=>{if(j.kind==="service"){j.fromDeck?p.mutate(j.id):g.mutate(j.id);return}if(j.kind==="credential"){j.fromDeck?y.mutate(j.id):v.mutate(j.id);return}j.fromDeck?m.mutate(j.id):b.mutate(j.id)};return{draggedService:t,draggedCredential:n,draggedPlaybook:o,isDraggingFromDeck:a,handleDragStart:_,handleCredentialDragStart:C,handlePlaybookDragStart:T,handleDragEnd:$,handleDrop:j=>{j.preventDefault();const k=j.dataTransfer.getData("application/json");if(k){try{O(JSON.parse(k))}catch{const L=j.dataTransfer.getData("text/plain");L&&t&&g.mutate(L)}r(null),s(null),i(null),c(!1)}},handleGlobalDrop:j=>{j.preventDefault();const k=j.dataTransfer.getData("application/json");if(k){try{const L=JSON.parse(k);L.fromDeck&&O(L)}catch{}r(null),s(null),i(null),c(!1)}},isDropping:g.isPending||v.isPending||b.isPending||p.isPending||y.isPending||m.isPending}}const zh="agent-deck-editing-deck-id";function nD(e){const[t,r]=w.useState(()=>typeof window>"u"?null:localStorage.getItem(zh));w.useEffect(()=>{if(e.length===0)return;if(!(t&&e.some(i=>i.id===t))){const i=e[0].id;r(i),localStorage.setItem(zh,i)}},[e,t]);const n=o=>{r(o),localStorage.setItem(zh,o)};return{editingDeck:e.find(o=>o.id===t)??null,editingDeckId:t,setEditingDeckId:n}}function yx(e,[t,r]){return Math.min(r,Math.max(t,e))}var sD=[" ","Enter","ArrowUp","ArrowDown"],oD=[" ","Enter"],ei="Select",[$f,Pf,iD]=sv(ei),[Oa,RH]=An(ei,[iD,Ia]),Tf=Ia(),[aD,ho]=Oa(ei),[lD,cD]=Oa(ei),lE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:g,required:v,form:b}=e,p=Tf(t),[y,m]=w.useState(null),[h,x]=w.useState(null),[_,C]=w.useState(!1),T=Pv(u),[$,O]=eo({prop:n,defaultProp:s??!1,onChange:o,caller:ei}),[M,U]=eo({prop:i,defaultProp:a,onChange:c,caller:ei}),j=w.useRef(null),k=y?b||!!y.closest("form"):!0,[L,P]=w.useState(new Set),B=Array.from(L).map(H=>H.props.value).join(";");return l.jsx(Ek,{...p,children:l.jsxs(aD,{required:v,scope:t,trigger:y,onTriggerChange:m,valueNode:h,onValueNodeChange:x,valueNodeHasChildren:_,onValueNodeHasChildrenChange:C,contentId:Xn(),value:M,onValueChange:U,open:$,onOpenChange:O,dir:T,triggerPointerDownPosRef:j,disabled:g,children:[l.jsx($f.Provider,{scope:t,children:l.jsx(lD,{scope:e.__scopeSelect,onNativeOptionAdd:w.useCallback(H=>{P(G=>new Set(G).add(H))},[]),onNativeOptionRemove:w.useCallback(H=>{P(G=>{const q=new Set(G);return q.delete(H),q})},[]),children:r})}),k?l.jsxs(RE,{"aria-hidden":!0,required:v,tabIndex:-1,name:d,autoComplete:f,value:M,onChange:H=>U(H.target.value),disabled:g,form:b,children:[M===void 0?l.jsx("option",{value:""}):null,Array.from(L)]},B):null]})})};lE.displayName=ei;var cE="SelectTrigger",uE=w.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=Tf(r),i=ho(cE,r),a=i.disabled||n,c=qe(t,i.onTriggerChange),u=Pf(r),d=w.useRef("touch"),[f,g,v]=AE(p=>{const y=u().filter(x=>!x.disabled),m=y.find(x=>x.value===i.value),h=OE(y,p,m);h!==void 0&&i.onValueChange(h.value)}),b=p=>{a||(i.onOpenChange(!0),v()),p&&(i.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return l.jsx(wf,{asChild:!0,...o,children:l.jsx(be.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":IE(i.value)?"":void 0,...s,ref:c,onClick:pe(s.onClick,p=>{p.currentTarget.focus(),d.current!=="mouse"&&b(p)}),onPointerDown:pe(s.onPointerDown,p=>{d.current=p.pointerType;const y=p.target;y.hasPointerCapture(p.pointerId)&&y.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(b(p),p.preventDefault())}),onKeyDown:pe(s.onKeyDown,p=>{const y=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&g(p.key),!(y&&p.key===" ")&&sD.includes(p.key)&&(b(),p.preventDefault())})})})});uE.displayName=cE;var dE="SelectValue",fE=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,c=ho(dE,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=qe(t,c.onValueNodeChange);return Ft(()=>{u(d)},[u,d]),l.jsx(be.span,{...a,ref:f,style:{pointerEvents:"none"},children:IE(c.value)?l.jsx(l.Fragment,{children:i}):o})});fE.displayName=dE;var uD="SelectIcon",hE=w.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return l.jsx(be.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});hE.displayName=uD;var dD="SelectPortal",pE=e=>l.jsx(fc,{asChild:!0,...e});pE.displayName=dD;var ti="SelectContent",mE=w.forwardRef((e,t)=>{const r=ho(ti,e.__scopeSelect),[n,s]=w.useState();if(Ft(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?ii.createPortal(l.jsx(gE,{scope:e.__scopeSelect,children:l.jsx($f.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(vE,{...e,ref:t})});mE.displayName=ti;var Wr=10,[gE,po]=Oa(ti),fD="SelectContentImpl",hD=Jo("SelectContent.RemoveScroll"),vE=w.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:p,avoidCollisions:y,...m}=e,h=ho(ti,r),[x,_]=w.useState(null),[C,T]=w.useState(null),$=qe(t,K=>_(K)),[O,M]=w.useState(null),[U,j]=w.useState(null),k=Pf(r),[L,P]=w.useState(!1),B=w.useRef(!1);w.useEffect(()=>{if(x)return Cv(x)},[x]),kv();const H=w.useCallback(K=>{const[Z,...ce]=k().map(ve=>ve.ref.current),[re]=ce.slice(-1),X=document.activeElement;for(const ve of K)if(ve===X||(ve==null||ve.scrollIntoView({block:"nearest"}),ve===Z&&C&&(C.scrollTop=0),ve===re&&C&&(C.scrollTop=C.scrollHeight),ve==null||ve.focus(),document.activeElement!==X))return},[k,C]),G=w.useCallback(()=>H([O,x]),[H,O,x]);w.useEffect(()=>{L&&G()},[L,G]);const{onOpenChange:q,triggerPointerDownPosRef:V}=h;w.useEffect(()=>{if(x){let K={x:0,y:0};const Z=re=>{var X,ve;K={x:Math.abs(Math.round(re.pageX)-(((X=V.current)==null?void 0:X.x)??0)),y:Math.abs(Math.round(re.pageY)-(((ve=V.current)==null?void 0:ve.y)??0))}},ce=re=>{K.x<=10&&K.y<=10?re.preventDefault():x.contains(re.target)||q(!1),document.removeEventListener("pointermove",Z),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",Z),document.addEventListener("pointerup",ce,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Z),document.removeEventListener("pointerup",ce,{capture:!0})}}},[x,q,V]),w.useEffect(()=>{const K=()=>q(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[q]);const[z,I]=AE(K=>{const Z=k().filter(X=>!X.disabled),ce=Z.find(X=>X.ref.current===document.activeElement),re=OE(Z,K,ce);re&&setTimeout(()=>re.ref.current.focus())}),F=w.useCallback((K,Z,ce)=>{const re=!B.current&&!ce;(h.value!==void 0&&h.value===Z||re)&&(M(K),re&&(B.current=!0))},[h.value]),N=w.useCallback(()=>x==null?void 0:x.focus(),[x]),S=w.useCallback((K,Z,ce)=>{const re=!B.current&&!ce;(h.value!==void 0&&h.value===Z||re)&&j(K)},[h.value]),E=n==="popper"?wm:yE,D=E===wm?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:p,avoidCollisions:y}:{};return l.jsx(gE,{scope:r,content:x,viewport:C,onViewportChange:T,itemRefCallback:F,selectedItem:O,onItemLeave:N,itemTextRefCallback:S,focusSelectedItem:G,selectedItemText:U,position:n,isPositioned:L,searchRef:z,children:l.jsx(kf,{as:hD,allowPinchZoom:!0,children:l.jsx(_f,{asChild:!0,trapped:h.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:pe(s,K=>{var Z;(Z=h.trigger)==null||Z.focus({preventScroll:!0}),K.preventDefault()}),children:l.jsx($a,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:l.jsx(E,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:K=>K.preventDefault(),...m,...D,onPlaced:()=>P(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...m.style},onKeyDown:pe(m.onKeyDown,K=>{const Z=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!Z&&K.key.length===1&&I(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let re=k().filter(X=>!X.disabled).map(X=>X.ref.current);if(["ArrowUp","End"].includes(K.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const X=K.target,ve=re.indexOf(X);re=re.slice(ve+1)}setTimeout(()=>H(re)),K.preventDefault()}})})})})})})});vE.displayName=fD;var pD="SelectItemAlignedPosition",yE=w.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=ho(ti,r),i=po(ti,r),[a,c]=w.useState(null),[u,d]=w.useState(null),f=qe(t,$=>d($)),g=Pf(r),v=w.useRef(!1),b=w.useRef(!0),{viewport:p,selectedItem:y,selectedItemText:m,focusSelectedItem:h}=i,x=w.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&p&&y&&m){const $=o.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),M=o.valueNode.getBoundingClientRect(),U=m.getBoundingClientRect();if(o.dir!=="rtl"){const X=U.left-O.left,ve=M.left-X,Le=$.left-ve,gt=$.width+Le,Y=Math.max(gt,O.width),me=window.innerWidth-Wr,J=yx(ve,[Wr,Math.max(Wr,me-Y)]);a.style.minWidth=gt+"px",a.style.left=J+"px"}else{const X=O.right-U.right,ve=window.innerWidth-M.right-X,Le=window.innerWidth-$.right-ve,gt=$.width+Le,Y=Math.max(gt,O.width),me=window.innerWidth-Wr,J=yx(ve,[Wr,Math.max(Wr,me-Y)]);a.style.minWidth=gt+"px",a.style.right=J+"px"}const j=g(),k=window.innerHeight-Wr*2,L=p.scrollHeight,P=window.getComputedStyle(u),B=parseInt(P.borderTopWidth,10),H=parseInt(P.paddingTop,10),G=parseInt(P.borderBottomWidth,10),q=parseInt(P.paddingBottom,10),V=B+H+L+q+G,z=Math.min(y.offsetHeight*5,V),I=window.getComputedStyle(p),F=parseInt(I.paddingTop,10),N=parseInt(I.paddingBottom,10),S=$.top+$.height/2-Wr,E=k-S,D=y.offsetHeight/2,K=y.offsetTop+D,Z=B+H+K,ce=V-Z;if(Z<=S){const X=j.length>0&&y===j[j.length-1].ref.current;a.style.bottom="0px";const ve=u.clientHeight-p.offsetTop-p.offsetHeight,Le=Math.max(E,D+(X?N:0)+ve+G),gt=Z+Le;a.style.height=gt+"px"}else{const X=j.length>0&&y===j[0].ref.current;a.style.top="0px";const Le=Math.max(S,B+p.offsetTop+(X?F:0)+D)+ce;a.style.height=Le+"px",p.scrollTop=Z-S+p.offsetTop}a.style.margin=`${Wr}px 0`,a.style.minHeight=z+"px",a.style.maxHeight=k+"px",n==null||n(),requestAnimationFrame(()=>v.current=!0)}},[g,o.trigger,o.valueNode,a,u,p,y,m,o.dir,n]);Ft(()=>x(),[x]);const[_,C]=w.useState();Ft(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const T=w.useCallback($=>{$&&b.current===!0&&(x(),h==null||h(),b.current=!1)},[x,h]);return l.jsx(gD,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:v,onScrollButtonChange:T,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:l.jsx(be.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});yE.displayName=pD;var mD="SelectPopperPosition",wm=w.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Wr,...o}=e,i=Tf(r);return l.jsx(wv,{...i,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})});wm.displayName=mD;var[gD,Av]=Oa(ti,{}),xm="SelectViewport",wE=w.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=po(xm,r),i=Av(xm,r),a=qe(t,o.onViewportChange),c=w.useRef(0);return l.jsxs(l.Fragment,{children:[l.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:n}),l.jsx($f.Slot,{scope:r,children:l.jsx(be.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:pe(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:g}=i;if(g!=null&&g.current&&f){const v=Math.abs(c.current-d.scrollTop);if(v>0){const b=window.innerHeight-Wr*2,p=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),m=Math.max(p,y);if(m<b){const h=m+v,x=Math.min(b,h),_=h-x;f.style.height=x+"px",f.style.bottom==="0px"&&(d.scrollTop=_>0?_:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});wE.displayName=xm;var xE="SelectGroup",[vD,yD]=Oa(xE),wD=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Xn();return l.jsx(vD,{scope:r,id:s,children:l.jsx(be.div,{role:"group","aria-labelledby":s,...n,ref:t})})});wD.displayName=xE;var bE="SelectLabel",_E=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=yD(bE,r);return l.jsx(be.div,{id:s.id,...n,ref:t})});_E.displayName=bE;var Ed="SelectItem",[xD,SE]=Oa(Ed),kE=w.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=ho(Ed,r),c=po(Ed,r),u=a.value===n,[d,f]=w.useState(o??""),[g,v]=w.useState(!1),b=qe(t,h=>{var x;return(x=c.itemRefCallback)==null?void 0:x.call(c,h,n,s)}),p=Xn(),y=w.useRef("touch"),m=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")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 l.jsx(xD,{scope:r,value:n,disabled:s,textId:p,isSelected:u,onItemTextChange:w.useCallback(h=>{f(x=>x||((h==null?void 0:h.textContent)??"").trim())},[]),children:l.jsx($f.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:l.jsx(be.div,{role:"option","aria-labelledby":p,"data-highlighted":g?"":void 0,"aria-selected":u&&g,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:b,onFocus:pe(i.onFocus,()=>v(!0)),onBlur:pe(i.onBlur,()=>v(!1)),onClick:pe(i.onClick,()=>{y.current!=="mouse"&&m()}),onPointerUp:pe(i.onPointerUp,()=>{y.current==="mouse"&&m()}),onPointerDown:pe(i.onPointerDown,h=>{y.current=h.pointerType}),onPointerMove:pe(i.onPointerMove,h=>{var x;y.current=h.pointerType,s?(x=c.onItemLeave)==null||x.call(c):y.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:pe(i.onPointerLeave,h=>{var x;h.currentTarget===document.activeElement&&((x=c.onItemLeave)==null||x.call(c))}),onKeyDown:pe(i.onKeyDown,h=>{var _;((_=c.searchRef)==null?void 0:_.current)!==""&&h.key===" "||(oD.includes(h.key)&&m(),h.key===" "&&h.preventDefault())})})})})});kE.displayName=Ed;var al="SelectItemText",CE=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=ho(al,r),a=po(al,r),c=SE(al,r),u=cD(al,r),[d,f]=w.useState(null),g=qe(t,m=>f(m),c.onItemTextChange,m=>{var h;return(h=a.itemTextRefCallback)==null?void 0:h.call(a,m,c.value,c.disabled)}),v=d==null?void 0:d.textContent,b=w.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:v},c.value),[c.disabled,c.value,v]),{onNativeOptionAdd:p,onNativeOptionRemove:y}=u;return Ft(()=>(p(b),()=>y(b)),[p,y,b]),l.jsxs(l.Fragment,{children:[l.jsx(be.span,{id:c.textId,...o,ref:g}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?ii.createPortal(o.children,i.valueNode):null]})});CE.displayName=al;var EE="SelectItemIndicator",NE=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return SE(EE,r).isSelected?l.jsx(be.span,{"aria-hidden":!0,...n,ref:t}):null});NE.displayName=EE;var bm="SelectScrollUpButton",jE=w.forwardRef((e,t)=>{const r=po(bm,e.__scopeSelect),n=Av(bm,e.__scopeSelect),[s,o]=w.useState(!1),i=qe(t,n.onScrollButtonChange);return Ft(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(PE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});jE.displayName=bm;var _m="SelectScrollDownButton",$E=w.forwardRef((e,t)=>{const r=po(_m,e.__scopeSelect),n=Av(_m,e.__scopeSelect),[s,o]=w.useState(!1),i=qe(t,n.onScrollButtonChange);return Ft(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;o(d)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(PE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});$E.displayName=_m;var PE=w.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=po("SelectScrollButton",r),i=w.useRef(null),a=Pf(r),c=w.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return w.useEffect(()=>()=>c(),[c]),Ft(()=>{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]),l.jsx(be.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:pe(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:pe(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:pe(s.onPointerLeave,()=>{c()})})}),bD="SelectSeparator",TE=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(be.div,{"aria-hidden":!0,...n,ref:t})});TE.displayName=bD;var Sm="SelectArrow",_D=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Tf(r),o=ho(Sm,r),i=po(Sm,r);return o.open&&i.position==="popper"?l.jsx(xv,{...s,...n,ref:t}):null});_D.displayName=Sm;var SD="SelectBubbleInput",RE=w.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const s=w.useRef(null),o=qe(n,s),i=QC(t);return w.useEffect(()=>{const a=s.current;if(!a)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("change",{bubbles:!0});d.call(a,t),a.dispatchEvent(f)}},[i,t]),l.jsx(be.select,{...r,style:{...x1,...r.style},ref:o,defaultValue:t})});RE.displayName=SD;function IE(e){return e===""||e===void 0}function AE(e){const t=Ur(e),r=w.useRef(""),n=w.useRef(0),s=w.useCallback(i=>{const a=r.current+i;t(a),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=w.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function OE(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=kD(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function kD(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var CD=lE,ME=uE,ED=fE,ND=hE,jD=pE,DE=mE,$D=wE,zE=_E,LE=kE,PD=CE,TD=NE,FE=jE,UE=$E,qE=TE;const RD=CD,ID=ED,VE=w.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(ME,{ref:n,className:xe("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),...r,children:[t,l.jsx(ND,{asChild:!0,children:l.jsx(cv,{className:"h-4 w-4 opacity-50"})})]}));VE.displayName=ME.displayName;const HE=w.forwardRef(({className:e,...t},r)=>l.jsx(FE,{ref:r,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(B2,{className:"h-4 w-4"})}));HE.displayName=FE.displayName;const KE=w.forwardRef(({className:e,...t},r)=>l.jsx(UE,{ref:r,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(cv,{className:"h-4 w-4"})}));KE.displayName=UE.displayName;const BE=w.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>l.jsx(jD,{children:l.jsxs(DE,{ref:s,className:xe("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]",r==="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:r,...n,children:[l.jsx(HE,{}),l.jsx($D,{className:xe("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(KE,{})]})}));BE.displayName=DE.displayName;const AD=w.forwardRef(({className:e,...t},r)=>l.jsx(zE,{ref:r,className:xe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));AD.displayName=zE.displayName;const vi=w.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(LE,{ref:n,className:xe("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),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(TD,{children:l.jsx(H1,{className:"h-4 w-4"})})}),l.jsx(PD,{children:t})]}));vi.displayName=LE.displayName;const OD=w.forwardRef(({className:e,...t},r)=>l.jsx(qE,{ref:r,className:xe("-mx-1 my-1 h-px bg-muted",e),...t}));OD.displayName=qE.displayName;const MD="/assets/AgentDeckLogo3-X5qCXS2A.png";function DD(){const[e,t]=w.useState(""),[r,n]=w.useState(""),[s,o]=w.useState(!1),[i,a]=w.useState(!1),[c,u]=w.useState(null),[d,f]=w.useState(!1),[g,v]=w.useState(!1),[b,p]=w.useState(null),[y,m]=w.useState(!1),[h,x]=w.useState(!1),[_,C]=w.useState(null),[T,$]=w.useState(!1),[O,M]=w.useState(null),{toast:U}=ir(),{connectionStatus:j}=tD(),{data:k,isLoading:L,error:P}=Gt({queryKey:["/api/decks"]}),B=(k==null?void 0:k.data)||[],{editingDeck:H,editingDeckId:G,setEditingDeckId:q}=nD(B),{handleDragStart:V,handleCredentialDragStart:z,handlePlaybookDragStart:I,handleDragEnd:F,handleDrop:N,handleGlobalDrop:S,isDraggingFromDeck:E}=rD(G),{data:D,isLoading:K,error:Z}=Gt({queryKey:["/api/services"]}),{data:ce,isLoading:re}=Gt({queryKey:["/api/credentials/vault"]}),{data:X,isLoading:ve}=Gt({queryKey:["/api/playbooks/vault"]}),{data:Le}=Gt({queryKey:["/api/collection/warnings"],staleTime:6e4}),gt=(D==null?void 0:D.data)||[],Y=(ce==null?void 0:ce.data)||[],me=(X==null?void 0:X.data)||[],J=w.useMemo(()=>_O(Le==null?void 0:Le.data),[Le==null?void 0:Le.data]),Me=(se,jt)=>s?se==="service"?J.serviceWarnings.has(jt):se==="credential"?J.credentialWarnings.has(jt):J.playbookWarnings.has(jt):!0,ie=gt.filter(se=>{var yo;if(!Me("service",se.id)||r==="api-key"||r==="playbook")return!1;const jt=se.name.toLowerCase().includes(e.toLowerCase())||((yo=se.description)==null?void 0:yo.toLowerCase().includes(e.toLowerCase())),vo=!r||r==="all"||se.type===r;return jt&&vo}),Ie=Y.filter(se=>!Me("credential",se.id)||r&&r!=="all"&&r!=="api-key"?!1:se.label.toLowerCase().includes(e.toLowerCase())),Pe=me.filter(se=>!Me("playbook",se.id)||r&&r!=="all"&&r!=="playbook"?!1:se.title.toLowerCase().includes(e.toLowerCase())||se.body.toLowerCase().includes(e.toLowerCase())),He=ie.length+Ie.length+Pe.length;Z&&console.error("Services error:",Z),P&&console.error("Decks error:",P);const fn=()=>{t(""),n(""),o(!1)},Tr=!!(e||r||s),hn=new Set(((H==null?void 0:H.credentials)??[]).map(se=>se.id)),xt=new Set(((H==null?void 0:H.playbooks)??[]).map(se=>se.id)),ds=(H==null?void 0:H.services)||[],mo=(H==null?void 0:H.playbooks)||[],fs=se=>{u(se),f(!0)},go=se=>{C(se.id),$(!0)},Fa=se=>{p(se.id),m(!0)},zn=se=>{M(se)};if(Z||P){const se=(P instanceof Error?P.message:null)??(Z instanceof Error?Z.message:null)??"There was an error loading the application data.";return l.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-900",children:l.jsxs("div",{className:"text-center max-w-lg px-4",children:[l.jsx("h2",{className:"text-2xl font-bold text-red-400 mb-4",children:"Error Loading Data"}),l.jsx("p",{className:"text-gray-300 mb-2",children:"There was an error loading the application data."}),l.jsx("p",{className:"text-gray-400 text-sm mb-4",children:se}),l.jsxs("p",{className:"text-gray-500 text-xs mb-6",children:["Is the API running? Try ",l.jsx("code",{className:"text-gray-300",children:"agent-deck stop && agent-deck start"})]}),l.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 K||L||re||ve?l.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-900",children:l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-yellow-400 mx-auto mb-4"}),l.jsx("p",{className:"text-gray-300",children:"Loading AgentDeck..."})]})}):l.jsxs("div",{className:"min-h-screen",onDrop:S,onDragOver:se=>se.preventDefault(),style:{position:"relative",...E&&{background:"linear-gradient(to bottom right, #1a1a2e, #16213e, #0f3460)"}},children:[l.jsx("header",{className:"relative z-20 bg-black/30 backdrop-blur-md border-b border-white/10",children:l.jsx("div",{className:"container mx-auto px-4 py-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center space-x-4",children:[l.jsx("img",{src:MD,alt:"Agent Deck Logo",className:"h-16 w-16 object-contain"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-bold bg-gradient-to-r from-yellow-400 to-yellow-600 bg-clip-text text-transparent",style:{background:"linear-gradient(to right, #C4B643, #D4C760)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:"AgentDeck"}),l.jsx("p",{className:"text-sm",style:{color:"#92E4DD"},children:"Build tool deck for your agent"})]})]}),l.jsxs("div",{className:"flex items-center space-x-6",children:[l.jsxs("div",{className:`flex items-center space-x-2 px-3 py-1 rounded-full border ${j==="connected"?"bg-emerald-500/20 border-emerald-500/30":"bg-red-500/20 border-red-500/30"}`,children:[l.jsx("div",{className:`w-2 h-2 rounded-full animate-pulse ${j==="connected"?"bg-emerald-400":"bg-red-400"}`}),l.jsx("button",{className:`text-sm hover:underline cursor-pointer ${j==="connected"?"text-emerald-300":"text-red-300"}`,"data-testid":"button-copy-mcp-url",onClick:()=>{navigator.clipboard.writeText("http://localhost:3001/mcp").then(()=>{U({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"})]}),l.jsx(r4,{highlightDeckId:G??void 0})]})]})})}),E&&l.jsx("div",{className:"fixed inset-0 pointer-events-none z-50 flex items-center justify-center",children:l.jsxs("div",{className:"bg-red-500/20 border-2 border-dashed border-red-500/50 rounded-lg p-8 text-center",children:[l.jsx("div",{className:"text-red-400 text-lg font-bold mb-2",children:"Drop to Remove"}),l.jsx("div",{className:"text-red-300 text-sm",children:"Release to remove card from deck"})]})}),l.jsx("main",{className:"container mx-auto px-4 py-6",children:l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-4 gap-6 h-screen min-w-0",children:[l.jsxs("div",{className:"xl:col-span-1 space-y-6 min-w-0",children:[l.jsx("div",{className:"panel-surface p-4 h-80 overflow-hidden min-w-0",children:l.jsx(F4,{decks:B,editingDeckId:G,onSelectDeck:q,isLoading:L})}),l.jsxs("div",{className:"panel-surface p-4",children:[l.jsxs("h2",{className:"text-lg font-bold mb-3 flex items-center",children:[l.jsx(V1,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),l.jsx("span",{style:{color:"#92E4DD"},children:"Add Cards"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(le,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Sn}`,style:kn(Wt),onClick:()=>a(!0),"data-testid":"button-register-mcp",children:[l.jsx(gd,{className:"w-3 h-3 mr-2"}),"Register MCP"]}),l.jsxs(le,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Sn}`,style:kn(ur),onClick:()=>v(!0),"data-testid":"button-register-api-key",children:[l.jsx(lm,{className:"w-3 h-3 mr-2"}),"Register API key"]}),l.jsxs(le,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Sn}`,style:kn(Qr),onClick:()=>x(!0),"data-testid":"button-register-playbook",children:[l.jsx(lv,{className:"w-3 h-3 mr-2"}),"Register Playbook"]})]})]})]}),l.jsxs("div",{className:"xl:col-span-3 flex h-full min-h-0 flex-col gap-6 min-w-0",children:[l.jsx("div",{className:"panel-surface h-80 shrink-0 overflow-hidden p-4 min-w-0",children:H?l.jsx("div",{className:"h-full",children:l.jsx(qO,{deck:H,services:ds,credentials:H.credentials??[],playbooks:mo,allServices:gt,collectionWarnings:J,onDrop:N,onDragStart:V,onCredentialDragStart:z,onPlaybookDragStart:I,onDragEnd:F,onCardClick:fs,onPlaybookClick:go,onCredentialClick:Fa})}):l.jsxs("div",{className:"text-center h-full flex flex-col justify-center",children:[l.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:l.jsx(cm,{className:"w-6 h-6 text-yellow-400"})}),l.jsx("h3",{className:"text-lg font-bold mb-2",style:{color:"#92E4DD"},children:"No deck selected"}),l.jsx("p",{className:"text-gray-300 mb-4 text-sm",children:"Create a deck or select one from the sidebar to edit its cards."}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs(le,{onClick:()=>{const se=document.querySelector('[data-testid="create-deck-button"]');se&&se.click()},className:"border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},children:[l.jsx(Ls,{className:"w-4 h-4 mr-2"}),"Create New Deck"]}),l.jsxs(le,{variant:"outline",className:"border-white/20 text-white hover:bg-white/10 text-sm py-2",onClick:()=>{const se=document.querySelector('[data-testid="deck-management-panel"]');se&&se.scrollIntoView({behavior:"smooth"})},children:[l.jsx(cm,{className:"w-4 h-4 mr-2"}),"Manage Decks"]})]})]})}),l.jsxs("div",{className:"panel-surface flex min-h-0 flex-1 flex-col overflow-hidden p-4 min-w-0","data-testid":"collection-panel",children:[l.jsxs("div",{className:"mb-3 flex shrink-0 flex-wrap items-center justify-between gap-2",children:[l.jsxs("h2",{className:"text-lg font-bold flex items-center",children:[l.jsx(G2,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),l.jsx("span",{style:{color:"#92E4DD"},children:"My Collection"}),l.jsxs("span",{className:"ml-3 text-sm font-normal text-gray-400",children:["(",He," cards)"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(W1,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),l.jsx(Be,{placeholder:"Search...",value:e,onChange:se=>t(se.target.value),className:"w-48 pl-8 h-8 text-sm bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":"input-search"})]}),l.jsxs(RD,{value:r||"all",onValueChange:se=>n(se==="all"?"":se),children:[l.jsxs(VE,{className:"w-[7.5rem] h-8 bg-white/10 border-white/20 text-white text-xs shrink-0","data-testid":"select-type",children:[l.jsx(Z2,{className:"w-3 h-3 mr-1 shrink-0"}),l.jsx(ID,{placeholder:"Type"})]}),l.jsxs(BE,{children:[l.jsx(vi,{value:"all",children:"All"}),l.jsx(vi,{value:"mcp",children:"MCP"}),l.jsx(vi,{value:"local-mcp",children:"Local MCP"}),l.jsx(vi,{value:"api-key",children:"API Key"}),l.jsx(vi,{value:"playbook",children:"Playbook"})]})]}),(e||r||s)&&l.jsx(le,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:fn,title:"Clear all filters",children:"Clear"})]})]}),J.total>0&&l.jsx("button",{type:"button",onClick:()=>o(se=>!se),className:`mb-3 w-full shrink-0 rounded-lg border px-3 py-2 text-left text-sm transition-colors ${s?"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:l.jsxs("span",{className:"flex items-start gap-2",children:[l.jsx(tn,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-300"}),l.jsx("span",{children:s?l.jsxs(l.Fragment,{children:["Showing ",l.jsx("strong",{children:He})," card",He===1?"":"s"," needing attention.",l.jsx("span",{className:"text-amber-200/80",children:" Click to show all cards."})]}):l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:J.total})," card",J.total===1?"":"s"," need attention",J.byKind.oauth_expired+J.byKind.oauth_required>0&&l.jsxs(l.Fragment,{children:[" ","(",J.byKind.oauth_expired+J.byKind.oauth_required," ","OAuth)"]}),". ",l.jsx("span",{className:"text-amber-200/80",children:"Click to filter."})]})})]})}),l.jsx("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-1 py-2",children:K||re||ve?l.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,5rem)] gap-y-2 pr-12",children:Array.from({length:10}).map((se,jt)=>l.jsx("div",{className:"animate-pulse",children:l.jsx("div",{className:"bg-white/10 rounded-lg w-32 h-48 aspect-[2/3]"})},jt))}):He===0?l.jsxs("div",{className:"text-center py-12",children:[l.jsx("div",{className:"text-gray-400 mb-4",children:l.jsx("i",{className:"fas fa-layer-group text-4xl"})}),l.jsx("h3",{className:"text-lg font-semibold text-gray-300 mb-2",children:"No cards yet"}),l.jsx("p",{className:"text-gray-400 text-sm mb-4",children:Tr?s?"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"}),!Tr&&l.jsxs("div",{className:"flex gap-3 justify-center",children:[l.jsxs(le,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${Sn}`,style:kn(Wt),onClick:()=>a(!0),"data-testid":"button-register-mcp-empty",children:[l.jsx(gd,{className:"w-3 h-3 mr-1"}),"Register MCP"]}),l.jsxs(le,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${Sn}`,style:kn(ur),onClick:()=>v(!0),"data-testid":"button-register-api-key-empty",children:[l.jsx(lm,{className:"w-3 h-3 mr-1"}),"Register API key"]})]})]}):l.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:[Pe.map((se,jt)=>l.jsx("div",{className:"relative group",style:{zIndex:O===se.id?999999:He-jt},children:l.jsx(TO,{playbook:se,isInActiveDeck:xt.has(se.id),activeDeck:H??void 0,isInCollection:!0,onDragStart:I,onDragEnd:F,onCardClick:go,onMouseEnter:()=>zn(se.id),onMouseLeave:()=>zn(null),warnings:J.playbookWarnings.get(se.id)})},se.id)),Ie.map((se,jt)=>l.jsx("div",{className:"relative group",style:{zIndex:O===se.id?999999:He-Pe.length-jt},children:l.jsx($O,{credential:se,isInActiveDeck:hn.has(se.id),activeDeck:H??void 0,isInCollection:!0,onDragStart:z,onDragEnd:F,onMouseEnter:()=>zn(se.id),onMouseLeave:()=>zn(null),onCardClick:Fa,warnings:J.credentialWarnings.get(se.id)})},se.id)),ie.map((se,jt)=>{var vo;return l.jsx("div",{className:"relative group",style:{zIndex:O===se.id?999999:He-Pe.length-Ie.length-jt},children:l.jsx(EO,{service:se,onDragStart:V,onDragEnd:F,isInActiveDeck:((vo=H==null?void 0:H.services)==null?void 0:vo.some(yo=>yo.id===se.id))||!1,onCardClick:fs,isInCollection:!0,onMouseEnter:()=>zn(se.id),onMouseLeave:()=>zn(null),activeDeck:H??void 0,warnings:J.serviceWarnings.get(se.id)})},se.id)})]})})]})]})]})}),l.jsxs("div",{className:"fixed inset-0 pointer-events-none z-0",children:[l.jsx("div",{className:"absolute top-20 left-20 w-96 h-96 bg-cyan-500/10 rounded-full blur-3xl animate-float"}),l.jsx("div",{className:"absolute bottom-20 right-20 w-96 h-96 bg-pink-500/10 rounded-full blur-3xl animate-float",style:{animationDelay:"-1s"}}),l.jsx("div",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-96 h-96 bg-purple-500/5 rounded-full blur-3xl animate-float",style:{animationDelay:"-2s"}})]}),l.jsx(L4,{type:"mcp",open:i,onOpenChange:a}),l.jsx(eD,{service:c,isOpen:d,onClose:()=>f(!1)}),l.jsx(U4,{open:g,onOpenChange:v}),l.jsx(H4,{credentialId:b,open:y,onOpenChange:m}),l.jsx(q4,{open:h,onOpenChange:x}),l.jsx(V4,{playbookId:_,open:T,onOpenChange:$})]})}const _s=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:xe("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));_s.displayName="Card";const So=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:xe("flex flex-col space-y-1.5 p-6",e),...t}));So.displayName="CardHeader";const ko=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));ko.displayName="CardTitle";const Au=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:xe("text-sm text-muted-foreground",e),...t}));Au.displayName="CardDescription";const Ss=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:xe("p-6 pt-0",e),...t}));Ss.displayName="CardContent";const zD=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:xe("flex items-center p-6 pt-0",e),...t}));zD.displayName="CardFooter";function LD(){return l.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gray-50",children:l.jsx(_s,{className:"w-full max-w-md mx-4",children:l.jsxs(Ss,{className:"pt-6",children:[l.jsxs("div",{className:"flex mb-4 gap-2",children:[l.jsx(K1,{className:"h-8 w-8 text-red-500"}),l.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"404 Page Not Found"})]}),l.jsx("p",{className:"mt-4 text-sm text-gray-600",children:"Did you forget to add the page to the router?"})]})})})}function FD(){const[e]=nR(),[t,r]=w.useState("loading"),[n,s]=w.useState("Authenticating...");return w.useEffect(()=>{(async()=>{try{const i=new URL(window.location.href),a=i.searchParams.get("success"),c=i.searchParams.get("error");a==="true"?(r("success"),s("Authentication successful! This window will close automatically."),setTimeout(()=>{window.close()},2e3)):a==="false"?(r("error"),s(`OAuth Error: ${c||"Authentication failed"}`)):(r("error"),s("Invalid OAuth callback - please try again"))}catch(i){r("error"),s(i instanceof Error?i.message:"Authentication failed")}})()},[e]),l.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:l.jsxs("div",{className:"text-center space-y-4",children:[t==="loading"&&l.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto"}),t==="success"&&l.jsx("div",{className:"text-green-500 text-4xl",children:"✓"}),t==="error"&&l.jsx("div",{className:"text-red-500 text-4xl",children:"✗"}),l.jsx("h1",{className:"text-xl font-semibold",children:n}),t==="error"&&l.jsx("button",{onClick:()=>window.close(),className:"px-4 py-2 bg-primary text-primary-foreground rounded hover:bg-primary/90",children:"Close Window"})]})})}function Ai(e){const t=()=>{throw new Error(`Invalid url to pass to open(): ${e}`)};let r;try{r=new URL(e)}catch{t()}return r.protocol!=="https:"&&r.protocol!=="http:"&&t(),r.hostname!==encodeURIComponent(r.hostname)&&t(),r.username&&(r.username=encodeURIComponent(r.username)),r.password&&(r.password=encodeURIComponent(r.password)),r.pathname=r.pathname.slice(0,1)+encodeURIComponent(r.pathname.slice(1)).replace(/%2f/ig,"/"),r.search=r.search.slice(0,1)+Array.from(r.searchParams.entries()).map(UD).join("&"),r.hash=r.hash.slice(0,1)+encodeURIComponent(r.hash.slice(1)),r.href}function UD([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:""}`}var wx=class{constructor(e,t={}){Ln(this,"serverUrl");Ln(this,"storageKeyPrefix");Ln(this,"serverUrlHash");Ln(this,"clientName");Ln(this,"clientUri");Ln(this,"callbackUrl");Ln(this,"preventAutoAuth");Ln(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=Ai(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 Ai(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(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,r),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(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,r),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(),r=`${this.storageKeyPrefix}:state_${t}`,n={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(r,JSON.stringify(n)),e.searchParams.set("state",t);const s=e.toString(),o=Ai(s);return localStorage.setItem(this.getKey("last_auth_url"),o),o}async redirectToAuthorization(e){if(this.preventAutoAuth)return;const t=await this.prepareAuthorizationUrl(e),r="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const n=window.open(t,`mcp_auth_${this.serverUrlHash}`,r);this.onPopupWindow&&this.onPopupWindow(t,r,n),!n||n.closed||typeof n.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(n.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(n){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,n)}}getLastAttemptedAuthUrl(){const e=localStorage.getItem(this.getKey("last_auth_url"));return e?Ai(e):null}clearStorage(){const e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,r=[];let n=0;for(let o=0;o<localStorage.length;o++){const i=localStorage.key(o);if(i){if(i.startsWith(e))r.push(i);else if(i.startsWith(t))try{const a=localStorage.getItem(i);a&&JSON.parse(a).serverUrlHash===this.serverUrlHash&&r.push(i)}catch(a){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,a)}}}return[...new Set(r)].forEach(o=>{localStorage.removeItem(o),n++}),n}hashString(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(16)}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}};const qD=Object.freeze({status:"aborted"});function W(e,t,r){function n(a,c){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,c);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=c}const s=(r==null?void 0:r.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function i(a){var c;const u=r!=null&&r.Parent?new o:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var c,u;return r!=null&&r.Parent&&a instanceof r.Parent?!0:(u=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:u.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class Yl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const WE={};function no(e){return WE}function VD(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function HD(e,t){return typeof t=="bigint"?t.toString():t}function Ov(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mv(e){return e==null}function Dv(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function KD(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return o%i/10**s}function et(e,t,r){Object.defineProperty(e,t,{get(){{const n=r();return e[t]=n,n}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Rf(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ja(e){return JSON.stringify(e)}const ZE=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Nd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const BD=Ov(()=>{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 jd(e){if(Nd(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(Nd(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const WD=new Set(["string","number","symbol"]);function vc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function li(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(n._zod.parent=e),n}function de(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 ZD(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const GD={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 QD(e,t){const r={},n=e._zod.def;for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(r[s]=n.shape[s])}return li(e,{...e._zod.def,shape:r,checks:[]})}function JD(e,t){const r={...e._zod.def.shape},n=e._zod.def;for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete r[s]}return li(e,{...e._zod.def,shape:r,checks:[]})}function YD(e,t){if(!jd(t))throw new Error("Invalid input to extend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Rf(this,"shape",n),n},checks:[]};return li(e,r)}function XD(e,t){return li(e,{...e._zod.def,get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Rf(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function ez(e,t,r){const n=t._zod.def.shape,s={...n};if(r)for(const o in r){if(!(o in n))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=e?new e({type:"optional",innerType:n[o]}):n[o])}else for(const o in n)s[o]=e?new e({type:"optional",innerType:n[o]}):n[o];return li(t,{...t._zod.def,shape:s,checks:[]})}function tz(e,t,r){const n=t._zod.def.shape,s={...n};if(r)for(const o in r){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=new e({type:"nonoptional",innerType:n[o]}))}else for(const o in n)s[o]=new e({type:"nonoptional",innerType:n[o]});return li(t,{...t._zod.def,shape:s,checks:[]})}function kl(e,t=0){var r;for(let n=t;n<e.issues.length;n++)if(((r=e.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function Io(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ou(e){return typeof e=="string"?e:e==null?void 0:e.message}function so(e,t,r){var s,o,i,a,c,u;const n={...e,path:e.path??[]};if(!e.message){const d=ou((i=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:i.call(o,e))??ou((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??ou((c=r.customError)==null?void 0:c.call(r,e))??ou((u=r.localeError)==null?void 0:u.call(r,e))??"Invalid input";n.message=d}return delete n.inst,delete n.continue,t!=null&&t.reportInput||delete n.input,n}function zv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Xl(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const GE=(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,HD,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},QE=W("$ZodError",GE),JE=W("$ZodError",GE,{Parent:Error});function rz(e,t=r=>r.message){const r={},n=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}function nz(e,t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>s({issues:a}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(e),n}const sz=e=>(t,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Yl;if(i.issues.length){const a=new((s==null?void 0:s.Err)??e)(i.issues.map(c=>so(c,o,no())));throw ZE(a,s==null?void 0:s.callee),a}return i.value},oz=e=>async(t,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((s==null?void 0:s.Err)??e)(i.issues.map(c=>so(c,o,no())));throw ZE(a,s==null?void 0:s.callee),a}return i.value},YE=e=>(t,r,n)=>{const s=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new Yl;return o.issues.length?{success:!1,error:new(e??QE)(o.issues.map(i=>so(i,s,no())))}:{success:!0,data:o.value}},XE=YE(JE),eN=e=>async(t,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(i=>so(i,s,no())))}:{success:!0,data:o.value}},iz=eN(JE),az=/^[cC][^\s-]{8,}$/,lz=/^[0-9a-z]+$/,cz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uz=/^[0-9a-vA-V]{20}$/,dz=/^[A-Za-z0-9]{27}$/,fz=/^[a-zA-Z0-9_-]{21}$/,hz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pz=/^([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})$/,xx=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)$/,mz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function vz(){return new RegExp(gz,"u")}const yz=/^(?:(?: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])$/,wz=/^(([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})$/,xz=/^((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])$/,bz=/^(([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])$/,_z=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tN=/^[A-Za-z0-9_-]*$/,Sz=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,kz=/^\+(?:[0-9]){6,14}[0-9]$/,rN="(?:(?:\\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])))",Cz=new RegExp(`^${rN}$`);function nN(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 Ez(e){return new RegExp(`^${nN(e)}$`)}function Nz(e){const t=nN({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${rN}T(?:${n})$`)}const jz=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}$`)},$z=/^\d+$/,Pz=/^-?\d+(?:\.\d+)?/i,Tz=/true|false/i,Rz=/null/i,Iz=/^[^A-Z]*$/,Az=/^[^a-z]*$/,wr=W("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),sN={number:"number",bigint:"bigint",object:"date"},oN=W("$ZodCheckLessThan",(e,t)=>{wr.init(e,t);const r=sN[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),iN=W("$ZodCheckGreaterThan",(e,t)=>{wr.init(e,t);const r=sN[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Oz=W("$ZodCheckMultipleOf",(e,t)=>{wr.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):KD(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Mz=W("$ZodCheckNumberFormat",(e,t)=>{var i;wr.init(e,t),t.format=t.format||"float64";const r=(i=t.format)==null?void 0:i.includes("int"),n=r?"int":"number",[s,o]=GD[t.format];e._zod.onattach.push(a=>{const c=a._zod.bag;c.format=t.format,c.minimum=s,c.maximum=o,r&&(c.pattern=$z)}),e._zod.check=a=>{const c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:t.format,code:"invalid_type",input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}c<s&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),c>o&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:o,inst:e})}}),Dz=W("$ZodCheckMaxLength",(e,t)=>{var r;wr.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!Mv(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const s=n.value;if(s.length<=t.maximum)return;const i=zv(s);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),zz=W("$ZodCheckMinLength",(e,t)=>{var r;wr.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!Mv(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const s=n.value;if(s.length>=t.minimum)return;const i=zv(s);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Lz=W("$ZodCheckLengthEquals",(e,t)=>{var r;wr.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!Mv(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=n=>{const s=n.value,o=s.length;if(o===t.length)return;const i=zv(s),a=o>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),If=W("$ZodCheckStringFormat",(e,t)=>{var r,n;wr.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Fz=W("$ZodCheckRegex",(e,t)=>{If.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Uz=W("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Iz),If.init(e,t)}),qz=W("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Az),If.init(e,t)}),Vz=W("$ZodCheckIncludes",(e,t)=>{wr.init(e,t);const r=vc(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Hz=W("$ZodCheckStartsWith",(e,t)=>{wr.init(e,t);const r=new RegExp(`^${vc(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Kz=W("$ZodCheckEndsWith",(e,t)=>{wr.init(e,t);const r=new RegExp(`.*${vc(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Bz=W("$ZodCheckOverwrite",(e,t)=>{wr.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Wz{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 n=t.split(`
374
- `).filter(i=>i),s=Math.min(...n.map(i=>i.length-i.trimStart().length)),o=n.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(const i of o)this.content.push(i)}compile(){const t=Function,r=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...r,s.join(`
375
- `))}}const Zz={major:4,minor:0,patch:0},Ze=W("$ZodType",(e,t)=>{var s;var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Zz;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,c)=>{let u=kl(i),d;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const g=i.issues.length,v=f._zod.check(i);if(v instanceof Promise&&(c==null?void 0:c.async)===!1)throw new Yl;if(d||v instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await v,i.issues.length!==g&&(u||(u=kl(i,g)))});else{if(i.issues.length===g)continue;u||(u=kl(i,g))}}return d?d.then(()=>i):i};e._zod.run=(i,a)=>{const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Yl;return c.then(u=>o(u,n,a))}return o(c,n,a)}}e["~standard"]={validate:o=>{var i;try{const a=XE(e,o);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return iz(e,o).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),Lv=W("$ZodString",(e,t)=>{var r;Ze.init(e,t),e._zod.pattern=[...((r=e==null?void 0:e._zod.bag)==null?void 0:r.patterns)??[]].pop()??jz(e._zod.bag),e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),st=W("$ZodStringFormat",(e,t)=>{If.init(e,t),Lv.init(e,t)}),Gz=W("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=pz),st.init(e,t)}),Qz=W("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=xx(n))}else t.pattern??(t.pattern=xx());st.init(e,t)}),Jz=W("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=mz),st.init(e,t)}),Yz=W("$ZodURL",(e,t)=>{st.init(e,t),e._zod.check=r=>{try{const n=r.value,s=new URL(n),o=s.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Sz.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),!n.endsWith("/")&&o.endsWith("/")?r.value=o.slice(0,-1):r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Xz=W("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=vz()),st.init(e,t)}),eL=W("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=fz),st.init(e,t)}),tL=W("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=az),st.init(e,t)}),rL=W("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=lz),st.init(e,t)}),nL=W("$ZodULID",(e,t)=>{t.pattern??(t.pattern=cz),st.init(e,t)}),sL=W("$ZodXID",(e,t)=>{t.pattern??(t.pattern=uz),st.init(e,t)}),oL=W("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=dz),st.init(e,t)}),iL=W("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Nz(t)),st.init(e,t)}),aL=W("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Cz),st.init(e,t)}),lL=W("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ez(t)),st.init(e,t)}),cL=W("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=hz),st.init(e,t)}),uL=W("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=yz),st.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),dL=W("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=wz),st.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),fL=W("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=xz),st.init(e,t)}),hL=W("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=bz),st.init(e,t),e._zod.check=r=>{const[n,s]=r.value.split("/");try{if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function aN(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const pL=W("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=_z),st.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{aN(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function mL(e){if(!tN.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return aN(r)}const gL=W("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=tN),st.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{mL(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),vL=W("$ZodE164",(e,t)=>{t.pattern??(t.pattern=kz),st.init(e,t)});function yL(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const s=JSON.parse(atob(n));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const wL=W("$ZodJWT",(e,t)=>{st.init(e,t),e._zod.check=r=>{yL(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),lN=W("$ZodNumber",(e,t)=>{Ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??Pz,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),r}}),xL=W("$ZodNumber",(e,t)=>{Mz.init(e,t),lN.init(e,t)}),bL=W("$ZodBoolean",(e,t)=>{Ze.init(e,t),e._zod.pattern=Tz,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),_L=W("$ZodNull",(e,t)=>{Ze.init(e,t),e._zod.pattern=Rz,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const s=r.value;return s===null||r.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),r}}),SL=W("$ZodAny",(e,t)=>{Ze.init(e,t),e._zod.parse=r=>r}),kL=W("$ZodUnknown",(e,t)=>{Ze.init(e,t),e._zod.parse=r=>r}),CL=W("$ZodNever",(e,t)=>{Ze.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function bx(e,t,r){e.issues.length&&t.issues.push(...Io(r,e.issues)),t.value[r]=e.value}const EL=W("$ZodArray",(e,t)=>{Ze.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);const o=[];for(let i=0;i<s.length;i++){const a=s[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?o.push(c.then(u=>bx(u,r,i))):bx(c,r,i)}return o.length?Promise.all(o).then(()=>r):r}});function iu(e,t,r){e.issues.length&&t.issues.push(...Io(r,e.issues)),t.value[r]=e.value}function _x(e,t,r,n){e.issues.length?n[r]===void 0?r in n?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...Io(r,e.issues)):e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}const NL=W("$ZodObject",(e,t)=>{Ze.init(e,t);const r=Ov(()=>{const f=Object.keys(t.shape);for(const v of f)if(!(t.shape[v]instanceof Ze))throw new Error(`Invalid element at key "${v}": expected a Zod schema`);const g=ZD(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(g)}});et(e._zod,"propValues",()=>{const f=t.shape,g={};for(const v in f){const b=f[v]._zod;if(b.values){g[v]??(g[v]=new Set);for(const p of b.values)g[v].add(p)}}return g});const n=f=>{const g=new Wz(["shape","payload","ctx"]),v=r.value,b=h=>{const x=Ja(h);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};g.write("const input = payload.value;");const p=Object.create(null);let y=0;for(const h of v.keys)p[h]=`key_${y++}`;g.write("const newResult = {}");for(const h of v.keys)if(v.optionalKeys.has(h)){const x=p[h];g.write(`const ${x} = ${b(h)};`);const _=Ja(h);g.write(`
376
- if (${x}.issues.length) {
377
- if (input[${_}] === undefined) {
378
- if (${_} in input) {
379
- newResult[${_}] = undefined;
380
- }
381
- } else {
382
- payload.issues = payload.issues.concat(
383
- ${x}.issues.map((iss) => ({
384
- ...iss,
385
- path: iss.path ? [${_}, ...iss.path] : [${_}],
386
- }))
387
- );
388
- }
389
- } else if (${x}.value === undefined) {
390
- if (${_} in input) newResult[${_}] = undefined;
391
- } else {
392
- newResult[${_}] = ${x}.value;
393
- }
394
- `)}else{const x=p[h];g.write(`const ${x} = ${b(h)};`),g.write(`
395
- if (${x}.issues.length) payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
396
- ...iss,
397
- path: iss.path ? [${Ja(h)}, ...iss.path] : [${Ja(h)}]
398
- })));`),g.write(`newResult[${Ja(h)}] = ${x}.value`)}g.write("payload.value = newResult;"),g.write("return payload;");const m=g.compile();return(h,x)=>m(f,h,x)};let s;const o=Nd,i=!WE.jitless,c=i&&BD.value,u=t.catchall;let d;e._zod.parse=(f,g)=>{d??(d=r.value);const v=f.value;if(!o(v))return f.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),f;const b=[];if(i&&c&&(g==null?void 0:g.async)===!1&&g.jitless!==!0)s||(s=n(t.shape)),f=s(f,g);else{f.value={};const x=d.shape;for(const _ of d.keys){const C=x[_],T=C._zod.run({value:v[_],issues:[]},g),$=C._zod.optin==="optional"&&C._zod.optout==="optional";T instanceof Promise?b.push(T.then(O=>$?_x(O,f,_,v):iu(O,f,_))):$?_x(T,f,_,v):iu(T,f,_)}}if(!u)return b.length?Promise.all(b).then(()=>f):f;const p=[],y=d.keySet,m=u._zod,h=m.def.type;for(const x of Object.keys(v)){if(y.has(x))continue;if(h==="never"){p.push(x);continue}const _=m.run({value:v[x],issues:[]},g);_ instanceof Promise?b.push(_.then(C=>iu(C,f,x))):iu(_,f,x)}return p.length&&f.issues.push({code:"unrecognized_keys",keys:p,input:v,inst:e}),b.length?Promise.all(b).then(()=>f):f}});function Sx(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(o=>so(o,n,no())))}),t}const cN=W("$ZodUnion",(e,t)=>{Ze.init(e,t),et(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),et(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),et(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),et(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>Dv(n.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let s=!1;const o=[];for(const i of t.options){const a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)o.push(a),s=!0;else{if(a.issues.length===0)return a;o.push(a)}}return s?Promise.all(o).then(i=>Sx(i,r,e,n)):Sx(o,r,e,n)}}),jL=W("$ZodDiscriminatedUnion",(e,t)=>{cN.init(e,t);const r=e._zod.parse;et(e._zod,"propValues",()=>{const s={};for(const o of t.options){const i=o._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[a,c]of Object.entries(i)){s[a]||(s[a]=new Set);for(const u of c)s[a].add(u)}}return s});const n=Ov(()=>{const s=t.options,o=new Map;for(const i of s){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 c of a){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,i)}}return o});e._zod.parse=(s,o)=>{const i=s.value;if(!Nd(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),s;const a=n.value.get(i==null?void 0:i[t.discriminator]);return a?a._zod.run(s,o):t.unionFallback?r(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),s)}}),$L=W("$ZodIntersection",(e,t)=>{Ze.init(e,t),e._zod.parse=(r,n)=>{const s=r.value,o=t.left._zod.run({value:s,issues:[]},n),i=t.right._zod.run({value:s,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([c,u])=>kx(r,c,u)):kx(r,o,i)}});function km(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(jd(e)&&jd(t)){const r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),s={...e,...t};for(const o of n){const i=km(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const s=e[n],o=t[n],i=km(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function kx(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),kl(e))return e;const n=km(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const PL=W("$ZodRecord",(e,t)=>{Ze.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!jd(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const o=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;r.value={};for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const u=t.valueType._zod.run({value:s[c],issues:[]},n);u instanceof Promise?o.push(u.then(d=>{d.issues.length&&r.issues.push(...Io(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...Io(c,u.issues)),r.value[c]=u.value)}let a;for(const c in s)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a})}else{r.value={};for(const i of Reflect.ownKeys(s)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>so(u,n,no())),input:i,path:[i],inst:e}),r.value[a.value]=a.value;continue}const c=t.valueType._zod.run({value:s[i],issues:[]},n);c instanceof Promise?o.push(c.then(u=>{u.issues.length&&r.issues.push(...Io(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...Io(i,c.issues)),r.value[a.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}}),TL=W("$ZodEnum",(e,t)=>{Ze.init(e,t);const r=VD(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(n=>WD.has(typeof n)).map(n=>typeof n=="string"?vc(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:r,input:o,inst:e}),n}}),RL=W("$ZodLiteral",(e,t)=>{Ze.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?vc(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,n)=>{const s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),IL=W("$ZodTransform",(e,t)=>{Ze.init(e,t),e._zod.parse=(r,n)=>{const s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new Yl;return r.value=s,r}}),AL=W("$ZodOptional",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",e._zod.optout="optional",et(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),et(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Dv(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(r,n):r.value===void 0?r:t.innerType._zod.run(r,n)}),OL=W("$ZodNullable",(e,t)=>{Ze.init(e,t),et(e._zod,"optin",()=>t.innerType._zod.optin),et(e._zod,"optout",()=>t.innerType._zod.optout),et(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Dv(r.source)}|null)$`):void 0}),et(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ML=W("$ZodDefault",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",et(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=t.defaultValue,r;const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Cx(o,t)):Cx(s,t)}});function Cx(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const DL=W("$ZodPrefault",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",et(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),zL=W("$ZodNonOptional",(e,t)=>{Ze.init(e,t),et(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Ex(o,e)):Ex(s,e)}});function Ex(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 LL=W("$ZodCatch",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",et(e._zod,"optout",()=>t.innerType._zod.optout),et(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>so(i,n,no()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(o=>so(o,n,no()))},input:r.value}),r.issues=[]),r)}}),FL=W("$ZodPipe",(e,t)=>{Ze.init(e,t),et(e._zod,"values",()=>t.in._zod.values),et(e._zod,"optin",()=>t.in._zod.optin),et(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,n)=>{const s=t.in._zod.run(r,n);return s instanceof Promise?s.then(o=>Nx(o,t,n)):Nx(s,t,n)}});function Nx(e,t,r){return kl(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}const UL=W("$ZodReadonly",(e,t)=>{Ze.init(e,t),et(e._zod,"propValues",()=>t.innerType._zod.propValues),et(e._zod,"values",()=>t.innerType._zod.values),et(e._zod,"optin",()=>t.innerType._zod.optin),et(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(jx):jx(s)}});function jx(e){return e.value=Object.freeze(e.value),e}const qL=W("$ZodCustom",(e,t)=>{wr.init(e,t),Ze.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then(o=>$x(o,r,n,e));$x(s,r,n,e)}});function $x(e,t,r,n){if(!e){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),t.issues.push(Xl(s))}}class VL{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function HL(){return new VL}const au=HL();function KL(e,t){return new e({type:"string",...de(t)})}function BL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...de(t)})}function Px(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...de(t)})}function WL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...de(t)})}function ZL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...de(t)})}function GL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...de(t)})}function QL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...de(t)})}function uN(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...de(t)})}function JL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...de(t)})}function YL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...de(t)})}function XL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...de(t)})}function e3(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...de(t)})}function t3(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...de(t)})}function r3(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...de(t)})}function n3(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...de(t)})}function s3(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...de(t)})}function o3(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...de(t)})}function i3(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...de(t)})}function a3(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...de(t)})}function l3(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...de(t)})}function c3(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...de(t)})}function u3(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...de(t)})}function d3(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...de(t)})}function f3(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...de(t)})}function h3(e,t){return new e({type:"string",format:"date",check:"string_format",...de(t)})}function p3(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...de(t)})}function m3(e,t){return new e({type:"string",format:"duration",check:"string_format",...de(t)})}function g3(e,t){return new e({type:"number",checks:[],...de(t)})}function v3(e,t){return new e({type:"number",coerce:!0,checks:[],...de(t)})}function y3(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...de(t)})}function w3(e,t){return new e({type:"boolean",...de(t)})}function x3(e,t){return new e({type:"null",...de(t)})}function b3(e){return new e({type:"any"})}function _3(e){return new e({type:"unknown"})}function S3(e,t){return new e({type:"never",...de(t)})}function Tx(e,t){return new oN({check:"less_than",...de(t),value:e,inclusive:!1})}function Lh(e,t){return new oN({check:"less_than",...de(t),value:e,inclusive:!0})}function Rx(e,t){return new iN({check:"greater_than",...de(t),value:e,inclusive:!1})}function Fh(e,t){return new iN({check:"greater_than",...de(t),value:e,inclusive:!0})}function Ix(e,t){return new Oz({check:"multiple_of",...de(t),value:e})}function dN(e,t){return new Dz({check:"max_length",...de(t),maximum:e})}function $d(e,t){return new zz({check:"min_length",...de(t),minimum:e})}function fN(e,t){return new Lz({check:"length_equals",...de(t),length:e})}function k3(e,t){return new Fz({check:"string_format",format:"regex",...de(t),pattern:e})}function C3(e){return new Uz({check:"string_format",format:"lowercase",...de(e)})}function E3(e){return new qz({check:"string_format",format:"uppercase",...de(e)})}function N3(e,t){return new Vz({check:"string_format",format:"includes",...de(t),includes:e})}function j3(e,t){return new Hz({check:"string_format",format:"starts_with",...de(t),prefix:e})}function $3(e,t){return new Kz({check:"string_format",format:"ends_with",...de(t),suffix:e})}function yc(e){return new Bz({check:"overwrite",tx:e})}function P3(e){return yc(t=>t.normalize(e))}function T3(){return yc(e=>e.trim())}function R3(){return yc(e=>e.toLowerCase())}function I3(){return yc(e=>e.toUpperCase())}function A3(e,t,r){return new e({type:"array",element:t,...de(r)})}function O3(e,t,r){const n=de(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function M3(e,t,r){return new e({type:"custom",check:"custom",fn:t,...de(r)})}const D3=W("ZodISODateTime",(e,t)=>{iL.init(e,t),ft.init(e,t)});function hN(e){return f3(D3,e)}const z3=W("ZodISODate",(e,t)=>{aL.init(e,t),ft.init(e,t)});function L3(e){return h3(z3,e)}const F3=W("ZodISOTime",(e,t)=>{lL.init(e,t),ft.init(e,t)});function U3(e){return p3(F3,e)}const q3=W("ZodISODuration",(e,t)=>{cL.init(e,t),ft.init(e,t)});function V3(e){return m3(q3,e)}const H3=(e,t)=>{QE.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>nz(e,r)},flatten:{value:r=>rz(e,r)},addIssue:{value:r=>e.issues.push(r)},addIssues:{value:r=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},Af=W("ZodError",H3,{Parent:Error}),K3=sz(Af),B3=oz(Af),W3=YE(Af),Z3=eN(Af),ot=W("ZodType",(e,t)=>(Ze.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>li(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>K3(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>W3(e,r,n),e.parseAsync=async(r,n)=>B3(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Z3(e,r,n),e.spa=e.safeParseAsync,e.refine=(r,n)=>e.check(UF(r,n)),e.superRefine=r=>e.check(qF(r)),e.overwrite=r=>e.check(yc(r)),e.optional=()=>lt(e),e.nullable=()=>Mx(e),e.nullish=()=>lt(Mx(e)),e.nonoptional=r=>IF(e,r),e.array=()=>ee(e),e.or=r=>it([e,r]),e.and=r=>Uv(e,r),e.transform=r=>Em(e,wN(r)),e.default=r=>PF(e,r),e.prefault=r=>RF(e,r),e.catch=r=>OF(e,r),e.pipe=r=>Em(e,r),e.readonly=()=>zF(e),e.describe=r=>{const n=e.clone();return au.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){var r;return(r=au.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return au.get(e);const n=e.clone();return au.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),pN=W("_ZodString",(e,t)=>{Lv.init(e,t),ot.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(k3(...n)),e.includes=(...n)=>e.check(N3(...n)),e.startsWith=(...n)=>e.check(j3(...n)),e.endsWith=(...n)=>e.check($3(...n)),e.min=(...n)=>e.check($d(...n)),e.max=(...n)=>e.check(dN(...n)),e.length=(...n)=>e.check(fN(...n)),e.nonempty=(...n)=>e.check($d(1,...n)),e.lowercase=n=>e.check(C3(n)),e.uppercase=n=>e.check(E3(n)),e.trim=()=>e.check(T3()),e.normalize=(...n)=>e.check(P3(...n)),e.toLowerCase=()=>e.check(R3()),e.toUpperCase=()=>e.check(I3())}),G3=W("ZodString",(e,t)=>{Lv.init(e,t),pN.init(e,t),e.email=r=>e.check(BL(Q3,r)),e.url=r=>e.check(uN(mN,r)),e.jwt=r=>e.check(d3(fF,r)),e.emoji=r=>e.check(JL(Y3,r)),e.guid=r=>e.check(Px(Ax,r)),e.uuid=r=>e.check(WL(lu,r)),e.uuidv4=r=>e.check(ZL(lu,r)),e.uuidv6=r=>e.check(GL(lu,r)),e.uuidv7=r=>e.check(QL(lu,r)),e.nanoid=r=>e.check(YL(X3,r)),e.guid=r=>e.check(Px(Ax,r)),e.cuid=r=>e.check(XL(eF,r)),e.cuid2=r=>e.check(e3(tF,r)),e.ulid=r=>e.check(t3(rF,r)),e.base64=r=>e.check(l3(cF,r)),e.base64url=r=>e.check(c3(uF,r)),e.xid=r=>e.check(r3(nF,r)),e.ksuid=r=>e.check(n3(sF,r)),e.ipv4=r=>e.check(s3(oF,r)),e.ipv6=r=>e.check(o3(iF,r)),e.cidrv4=r=>e.check(i3(aF,r)),e.cidrv6=r=>e.check(a3(lF,r)),e.e164=r=>e.check(u3(dF,r)),e.datetime=r=>e.check(hN(r)),e.date=r=>e.check(L3(r)),e.time=r=>e.check(U3(r)),e.duration=r=>e.check(V3(r))});function A(e){return KL(G3,e)}const ft=W("ZodStringFormat",(e,t)=>{st.init(e,t),pN.init(e,t)}),Q3=W("ZodEmail",(e,t)=>{Jz.init(e,t),ft.init(e,t)}),Ax=W("ZodGUID",(e,t)=>{Gz.init(e,t),ft.init(e,t)}),lu=W("ZodUUID",(e,t)=>{Qz.init(e,t),ft.init(e,t)}),mN=W("ZodURL",(e,t)=>{Yz.init(e,t),ft.init(e,t)});function J3(e){return uN(mN,e)}const Y3=W("ZodEmoji",(e,t)=>{Xz.init(e,t),ft.init(e,t)}),X3=W("ZodNanoID",(e,t)=>{eL.init(e,t),ft.init(e,t)}),eF=W("ZodCUID",(e,t)=>{tL.init(e,t),ft.init(e,t)}),tF=W("ZodCUID2",(e,t)=>{rL.init(e,t),ft.init(e,t)}),rF=W("ZodULID",(e,t)=>{nL.init(e,t),ft.init(e,t)}),nF=W("ZodXID",(e,t)=>{sL.init(e,t),ft.init(e,t)}),sF=W("ZodKSUID",(e,t)=>{oL.init(e,t),ft.init(e,t)}),oF=W("ZodIPv4",(e,t)=>{uL.init(e,t),ft.init(e,t)}),iF=W("ZodIPv6",(e,t)=>{dL.init(e,t),ft.init(e,t)}),aF=W("ZodCIDRv4",(e,t)=>{fL.init(e,t),ft.init(e,t)}),lF=W("ZodCIDRv6",(e,t)=>{hL.init(e,t),ft.init(e,t)}),cF=W("ZodBase64",(e,t)=>{pL.init(e,t),ft.init(e,t)}),uF=W("ZodBase64URL",(e,t)=>{gL.init(e,t),ft.init(e,t)}),dF=W("ZodE164",(e,t)=>{vL.init(e,t),ft.init(e,t)}),fF=W("ZodJWT",(e,t)=>{wL.init(e,t),ft.init(e,t)}),Fv=W("ZodNumber",(e,t)=>{lN.init(e,t),ot.init(e,t),e.gt=(n,s)=>e.check(Rx(n,s)),e.gte=(n,s)=>e.check(Fh(n,s)),e.min=(n,s)=>e.check(Fh(n,s)),e.lt=(n,s)=>e.check(Tx(n,s)),e.lte=(n,s)=>e.check(Lh(n,s)),e.max=(n,s)=>e.check(Lh(n,s)),e.int=n=>e.check(Ox(n)),e.safe=n=>e.check(Ox(n)),e.positive=n=>e.check(Rx(0,n)),e.nonnegative=n=>e.check(Fh(0,n)),e.negative=n=>e.check(Tx(0,n)),e.nonpositive=n=>e.check(Lh(0,n)),e.multipleOf=(n,s)=>e.check(Ix(n,s)),e.step=(n,s)=>e.check(Ix(n,s)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Fe(e){return g3(Fv,e)}const hF=W("ZodNumberFormat",(e,t)=>{xL.init(e,t),Fv.init(e,t)});function Ox(e){return y3(hF,e)}const pF=W("ZodBoolean",(e,t)=>{bL.init(e,t),ot.init(e,t)});function Ye(e){return w3(pF,e)}const mF=W("ZodNull",(e,t)=>{_L.init(e,t),ot.init(e,t)});function gF(e){return x3(mF,e)}const vF=W("ZodAny",(e,t)=>{SL.init(e,t),ot.init(e,t)});function yF(){return b3(vF)}const wF=W("ZodUnknown",(e,t)=>{kL.init(e,t),ot.init(e,t)});function ut(){return _3(wF)}const xF=W("ZodNever",(e,t)=>{CL.init(e,t),ot.init(e,t)});function bF(e){return S3(xF,e)}const _F=W("ZodArray",(e,t)=>{EL.init(e,t),ot.init(e,t),e.element=t.element,e.min=(r,n)=>e.check($d(r,n)),e.nonempty=r=>e.check($d(1,r)),e.max=(r,n)=>e.check(dN(r,n)),e.length=(r,n)=>e.check(fN(r,n)),e.unwrap=()=>e.element});function ee(e,t){return A3(_F,e,t)}const gN=W("ZodObject",(e,t)=>{NL.init(e,t),ot.init(e,t),et(e,"shape",()=>t.shape),e.keyof=()=>$r(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ut()}),e.loose=()=>e.clone({...e._zod.def,catchall:ut()}),e.strict=()=>e.clone({...e._zod.def,catchall:bF()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>YD(e,r),e.merge=r=>XD(e,r),e.pick=r=>QD(e,r),e.omit=r=>JD(e,r),e.partial=(...r)=>ez(xN,e,r[0]),e.required=(...r)=>tz(bN,e,r[0])});function te(e,t){const r={type:"object",get shape(){return Rf(this,"shape",{...e}),this.shape},...de(t)};return new gN(r)}function Dt(e,t){return new gN({type:"object",get shape(){return Rf(this,"shape",{...e}),this.shape},catchall:ut(),...de(t)})}const vN=W("ZodUnion",(e,t)=>{cN.init(e,t),ot.init(e,t),e.options=t.options});function it(e,t){return new vN({type:"union",options:e,...de(t)})}const SF=W("ZodDiscriminatedUnion",(e,t)=>{vN.init(e,t),jL.init(e,t)});function yN(e,t,r){return new SF({type:"union",options:t,discriminator:e,...de(r)})}const kF=W("ZodIntersection",(e,t)=>{$L.init(e,t),ot.init(e,t)});function Uv(e,t){return new kF({type:"intersection",left:e,right:t})}const CF=W("ZodRecord",(e,t)=>{PL.init(e,t),ot.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function tt(e,t,r){return new CF({type:"record",keyType:e,valueType:t,...de(r)})}const Cm=W("ZodEnum",(e,t)=>{TL.init(e,t),ot.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{const o={};for(const i of n)if(r.has(i))o[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Cm({...t,checks:[],...de(s),entries:o})},e.exclude=(n,s)=>{const o={...t.entries};for(const i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new Cm({...t,checks:[],...de(s),entries:o})}});function $r(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Cm({type:"enum",entries:r,...de(t)})}const EF=W("ZodLiteral",(e,t)=>{RL.init(e,t),ot.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function he(e,t){return new EF({type:"literal",values:Array.isArray(e)?e:[e],...de(t)})}const NF=W("ZodTransform",(e,t)=>{IL.init(e,t),ot.init(e,t),e._zod.parse=(r,n)=>{r.addIssue=o=>{if(typeof o=="string")r.issues.push(Xl(o,r.value,t));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),r.issues.push(Xl(i))}};const s=t.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});function wN(e){return new NF({type:"transform",transform:e})}const xN=W("ZodOptional",(e,t)=>{AL.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lt(e){return new xN({type:"optional",innerType:e})}const jF=W("ZodNullable",(e,t)=>{OL.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Mx(e){return new jF({type:"nullable",innerType:e})}const $F=W("ZodDefault",(e,t)=>{ML.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function PF(e,t){return new $F({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const TF=W("ZodPrefault",(e,t)=>{DL.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function RF(e,t){return new TF({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const bN=W("ZodNonOptional",(e,t)=>{zL.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function IF(e,t){return new bN({type:"nonoptional",innerType:e,...de(t)})}const AF=W("ZodCatch",(e,t)=>{LL.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function OF(e,t){return new AF({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const MF=W("ZodPipe",(e,t)=>{FL.init(e,t),ot.init(e,t),e.in=t.in,e.out=t.out});function Em(e,t){return new MF({type:"pipe",in:e,out:t})}const DF=W("ZodReadonly",(e,t)=>{UL.init(e,t),ot.init(e,t)});function zF(e){return new DF({type:"readonly",innerType:e})}const _N=W("ZodCustom",(e,t)=>{qL.init(e,t),ot.init(e,t)});function LF(e){const t=new wr({check:"custom"});return t._zod.check=e,t}function FF(e,t){return O3(_N,e??(()=>!0),t)}function UF(e,t={}){return M3(_N,e,t)}function qF(e){const t=LF(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Xl(n,r.value,t._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),r.issues.push(Xl(s))}},e(r.value,r)));return t}function SN(e,t){return Em(wN(e),t)}const VF={custom:"custom"};function HF(e){return v3(Fv,e)}const Of="2025-11-25",KF=[Of,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Co="io.modelcontextprotocol/related-task",Mf="2.0",Nt=FF(e=>e!==null&&(typeof e=="object"||typeof e=="function")),kN=it([A(),Fe().int()]),CN=A();Dt({ttl:Fe().optional(),pollInterval:Fe().optional()});const BF=te({ttl:Fe().optional()}),WF=te({taskId:A()}),qv=Dt({progressToken:kN.optional(),[Co]:WF.optional()}),Pr=te({_meta:qv.optional()}),wc=Pr.extend({task:BF.optional()}),ZF=e=>wc.safeParse(e).success,Ut=te({method:A(),params:Pr.loose().optional()}),qr=te({_meta:qv.optional()}),Vr=te({method:A(),params:qr.loose().optional()}),qt=Dt({_meta:qv.optional()}),Df=it([A(),Fe().int()]),EN=te({jsonrpc:he(Mf),id:Df,...Ut.shape}).strict(),Nm=e=>EN.safeParse(e).success,NN=te({jsonrpc:he(Mf),...Vr.shape}).strict(),GF=e=>NN.safeParse(e).success,Vv=te({jsonrpc:he(Mf),id:Df,result:qt}).strict(),ll=e=>Vv.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 Hv=te({jsonrpc:he(Mf),id:Df.optional(),error:te({code:Fe().int(),message:A(),data:ut().optional()})}).strict(),QF=e=>Hv.safeParse(e).success,Ou=it([EN,NN,Vv,Hv]);it([Vv,Hv]);const Oi=qt.strict(),JF=qr.extend({requestId:Df.optional(),reason:A().optional()}),Kv=Vr.extend({method:he("notifications/cancelled"),params:JF}),YF=te({src:A(),mimeType:A().optional(),sizes:ee(A()).optional(),theme:$r(["light","dark"]).optional()}),xc=te({icons:ee(YF).optional()}),ba=te({name:A(),title:A().optional()}),jN=ba.extend({...ba.shape,...xc.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),XF=Uv(te({applyDefaults:Ye().optional()}),tt(A(),ut())),eU=SN(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Uv(te({form:XF.optional(),url:Nt.optional()}),tt(A(),ut()).optional())),tU=Dt({list:Nt.optional(),cancel:Nt.optional(),requests:Dt({sampling:Dt({createMessage:Nt.optional()}).optional(),elicitation:Dt({create:Nt.optional()}).optional()}).optional()}),rU=Dt({list:Nt.optional(),cancel:Nt.optional(),requests:Dt({tools:Dt({call:Nt.optional()}).optional()}).optional()}),nU=te({experimental:tt(A(),Nt).optional(),sampling:te({context:Nt.optional(),tools:Nt.optional()}).optional(),elicitation:eU.optional(),roots:te({listChanged:Ye().optional()}).optional(),tasks:tU.optional(),extensions:tt(A(),Nt).optional()}),sU=Pr.extend({protocolVersion:A(),capabilities:nU,clientInfo:jN}),oU=Ut.extend({method:he("initialize"),params:sU}),iU=te({experimental:tt(A(),Nt).optional(),logging:Nt.optional(),completions:Nt.optional(),prompts:te({listChanged:Ye().optional()}).optional(),resources:te({subscribe:Ye().optional(),listChanged:Ye().optional()}).optional(),tools:te({listChanged:Ye().optional()}).optional(),tasks:rU.optional(),extensions:tt(A(),Nt).optional()}),$N=qt.extend({protocolVersion:A(),capabilities:iU,serverInfo:jN,instructions:A().optional()}),PN=Vr.extend({method:he("notifications/initialized"),params:qr.optional()}),aU=e=>PN.safeParse(e).success,Bv=Ut.extend({method:he("ping"),params:Pr.optional()}),lU=te({progress:Fe(),total:lt(Fe()),message:lt(A())}),cU=te({...qr.shape,...lU.shape,progressToken:kN}),Wv=Vr.extend({method:he("notifications/progress"),params:cU}),uU=Pr.extend({cursor:CN.optional()}),bc=Ut.extend({params:uU.optional()}),_c=qt.extend({nextCursor:CN.optional()}),dU=$r(["working","input_required","completed","failed","cancelled"]),Sc=te({taskId:A(),status:dU,ttl:it([Fe(),gF()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:lt(Fe()),statusMessage:lt(A())}),ec=qt.extend({task:Sc}),fU=qr.merge(Sc),Pd=Vr.extend({method:he("notifications/tasks/status"),params:fU}),Zv=Ut.extend({method:he("tasks/get"),params:Pr.extend({taskId:A()})}),Gv=qt.merge(Sc),Qv=Ut.extend({method:he("tasks/result"),params:Pr.extend({taskId:A()})});qt.loose();const Jv=bc.extend({method:he("tasks/list")}),Yv=_c.extend({tasks:ee(Sc)}),Xv=Ut.extend({method:he("tasks/cancel"),params:Pr.extend({taskId:A()})}),hU=qt.merge(Sc),TN=te({uri:A(),mimeType:lt(A()),_meta:tt(A(),ut()).optional()}),RN=TN.extend({text:A()}),ey=A().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),IN=TN.extend({blob:ey}),kc=$r(["user","assistant"]),Ma=te({audience:ee(kc).optional(),priority:Fe().min(0).max(1).optional(),lastModified:hN({offset:!0}).optional()}),AN=te({...ba.shape,...xc.shape,uri:A(),description:lt(A()),mimeType:lt(A()),size:lt(Fe()),annotations:Ma.optional(),_meta:lt(Dt({}))}),pU=te({...ba.shape,...xc.shape,uriTemplate:A(),description:lt(A()),mimeType:lt(A()),annotations:Ma.optional(),_meta:lt(Dt({}))}),mU=bc.extend({method:he("resources/list")}),Td=_c.extend({resources:ee(AN)}),gU=bc.extend({method:he("resources/templates/list")}),ON=_c.extend({resourceTemplates:ee(pU)}),ty=Pr.extend({uri:A()}),vU=ty,yU=Ut.extend({method:he("resources/read"),params:vU}),ry=qt.extend({contents:ee(it([RN,IN]))}),MN=Vr.extend({method:he("notifications/resources/list_changed"),params:qr.optional()}),wU=ty,xU=Ut.extend({method:he("resources/subscribe"),params:wU}),bU=ty,_U=Ut.extend({method:he("resources/unsubscribe"),params:bU}),SU=qr.extend({uri:A()}),kU=Vr.extend({method:he("notifications/resources/updated"),params:SU}),CU=te({name:A(),description:lt(A()),required:lt(Ye())}),EU=te({...ba.shape,...xc.shape,description:lt(A()),arguments:lt(ee(CU)),_meta:lt(Dt({}))}),NU=bc.extend({method:he("prompts/list")}),Rd=_c.extend({prompts:ee(EU)}),jU=Pr.extend({name:A(),arguments:tt(A(),A()).optional()}),$U=Ut.extend({method:he("prompts/get"),params:jU}),ny=te({type:he("text"),text:A(),annotations:Ma.optional(),_meta:tt(A(),ut()).optional()}),sy=te({type:he("image"),data:ey,mimeType:A(),annotations:Ma.optional(),_meta:tt(A(),ut()).optional()}),oy=te({type:he("audio"),data:ey,mimeType:A(),annotations:Ma.optional(),_meta:tt(A(),ut()).optional()}),PU=te({type:he("tool_use"),name:A(),id:A(),input:tt(A(),ut()),_meta:tt(A(),ut()).optional()}),TU=te({type:he("resource"),resource:it([RN,IN]),annotations:Ma.optional(),_meta:tt(A(),ut()).optional()}),RU=AN.extend({type:he("resource_link")}),iy=it([ny,sy,oy,RU,TU]),IU=te({role:kc,content:iy}),ay=qt.extend({description:A().optional(),messages:ee(IU)}),DN=Vr.extend({method:he("notifications/prompts/list_changed"),params:qr.optional()}),AU=te({title:A().optional(),readOnlyHint:Ye().optional(),destructiveHint:Ye().optional(),idempotentHint:Ye().optional(),openWorldHint:Ye().optional()}),OU=te({taskSupport:$r(["required","optional","forbidden"]).optional()}),zN=te({...ba.shape,...xc.shape,description:A().optional(),inputSchema:te({type:he("object"),properties:tt(A(),Nt).optional(),required:ee(A()).optional()}).catchall(ut()),outputSchema:te({type:he("object"),properties:tt(A(),Nt).optional(),required:ee(A()).optional()}).catchall(ut()).optional(),annotations:AU.optional(),execution:OU.optional(),_meta:tt(A(),ut()).optional()}),MU=bc.extend({method:he("tools/list")}),ly=_c.extend({tools:ee(zN)}),Cc=qt.extend({content:ee(iy).default([]),structuredContent:tt(A(),ut()).optional(),isError:Ye().optional()});Cc.or(qt.extend({toolResult:ut()}));const DU=wc.extend({name:A(),arguments:tt(A(),ut()).optional()}),zU=Ut.extend({method:he("tools/call"),params:DU}),LN=Vr.extend({method:he("notifications/tools/list_changed"),params:qr.optional()}),LU=te({autoRefresh:Ye().default(!0),debounceMs:Fe().int().nonnegative().default(300)}),FN=$r(["debug","info","notice","warning","error","critical","alert","emergency"]),FU=Pr.extend({level:FN}),UU=Ut.extend({method:he("logging/setLevel"),params:FU}),qU=qr.extend({level:FN,logger:A().optional(),data:ut()}),VU=Vr.extend({method:he("notifications/message"),params:qU}),HU=te({name:A().optional()}),KU=te({hints:ee(HU).optional(),costPriority:Fe().min(0).max(1).optional(),speedPriority:Fe().min(0).max(1).optional(),intelligencePriority:Fe().min(0).max(1).optional()}),BU=te({mode:$r(["auto","required","none"]).optional()}),WU=te({type:he("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:ee(iy).default([]),structuredContent:te({}).loose().optional(),isError:Ye().optional(),_meta:tt(A(),ut()).optional()}),ZU=yN("type",[ny,sy,oy]),Id=yN("type",[ny,sy,oy,PU,WU]),GU=te({role:kc,content:it([Id,ee(Id)]),_meta:tt(A(),ut()).optional()}),QU=wc.extend({messages:ee(GU),modelPreferences:KU.optional(),systemPrompt:A().optional(),includeContext:$r(["none","thisServer","allServers"]).optional(),temperature:Fe().optional(),maxTokens:Fe().int(),stopSequences:ee(A()).optional(),metadata:Nt.optional(),tools:ee(zN).optional(),toolChoice:BU.optional()}),UN=Ut.extend({method:he("sampling/createMessage"),params:QU}),qN=qt.extend({model:A(),stopReason:lt($r(["endTurn","stopSequence","maxTokens"]).or(A())),role:kc,content:ZU}),VN=qt.extend({model:A(),stopReason:lt($r(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:kc,content:it([Id,ee(Id)])}),JU=te({type:he("boolean"),title:A().optional(),description:A().optional(),default:Ye().optional()}),YU=te({type:he("string"),title:A().optional(),description:A().optional(),minLength:Fe().optional(),maxLength:Fe().optional(),format:$r(["email","uri","date","date-time"]).optional(),default:A().optional()}),XU=te({type:$r(["number","integer"]),title:A().optional(),description:A().optional(),minimum:Fe().optional(),maximum:Fe().optional(),default:Fe().optional()}),e5=te({type:he("string"),title:A().optional(),description:A().optional(),enum:ee(A()),default:A().optional()}),t5=te({type:he("string"),title:A().optional(),description:A().optional(),oneOf:ee(te({const:A(),title:A()})),default:A().optional()}),r5=te({type:he("string"),title:A().optional(),description:A().optional(),enum:ee(A()),enumNames:ee(A()).optional(),default:A().optional()}),n5=it([e5,t5]),s5=te({type:he("array"),title:A().optional(),description:A().optional(),minItems:Fe().optional(),maxItems:Fe().optional(),items:te({type:he("string"),enum:ee(A())}),default:ee(A()).optional()}),o5=te({type:he("array"),title:A().optional(),description:A().optional(),minItems:Fe().optional(),maxItems:Fe().optional(),items:te({anyOf:ee(te({const:A(),title:A()}))}),default:ee(A()).optional()}),i5=it([s5,o5]),a5=it([r5,n5,i5]),l5=it([a5,JU,YU,XU]),c5=wc.extend({mode:he("form").optional(),message:A(),requestedSchema:te({type:he("object"),properties:tt(A(),l5),required:ee(A()).optional()})}),u5=wc.extend({mode:he("url"),message:A(),elicitationId:A(),url:A().url()}),d5=it([c5,u5]),HN=Ut.extend({method:he("elicitation/create"),params:d5}),f5=qr.extend({elicitationId:A()}),h5=Vr.extend({method:he("notifications/elicitation/complete"),params:f5}),KN=qt.extend({action:$r(["accept","decline","cancel"]),content:SN(e=>e===null?void 0:e,tt(A(),it([A(),Fe(),Ye(),ee(A())])).optional())}),p5=te({type:he("ref/resource"),uri:A()}),m5=te({type:he("ref/prompt"),name:A()}),g5=Pr.extend({ref:it([m5,p5]),argument:te({name:A(),value:A()}),context:te({arguments:tt(A(),A()).optional()}).optional()}),v5=Ut.extend({method:he("completion/complete"),params:g5}),BN=qt.extend({completion:Dt({values:ee(A()).max(100),total:lt(Fe().int()),hasMore:lt(Ye())})}),y5=te({uri:A().startsWith("file://"),name:A().optional(),_meta:tt(A(),ut()).optional()}),w5=Ut.extend({method:he("roots/list"),params:Pr.optional()}),x5=qt.extend({roots:ee(y5)}),b5=Vr.extend({method:he("notifications/roots/list_changed"),params:qr.optional()});it([Bv,oU,v5,UU,$U,NU,mU,gU,yU,xU,_U,zU,MU,Zv,Qv,Jv,Xv]);it([Kv,Wv,PN,b5,Pd]);it([Oi,qN,VN,KN,x5,Gv,Yv,ec]);it([Bv,UN,HN,w5,Zv,Qv,Jv,Xv]);it([Kv,Wv,VU,kU,MN,LN,DN,Pd,h5]);it([Oi,$N,BN,ay,Rd,Td,ON,ry,Cc,ly,Gv,Yv,ec]);class ye extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===_e.UrlElicitationRequired&&n){const s=n;if(s.elicitations)return new _5(s.elicitations,r)}return new ye(t,r,n)}}class _5 extends ye{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(_e.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}}class Dx extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function Uh(e){}function WN(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=Uh,onError:r=Uh,onRetry:n=Uh,onComment:s}=e;let o="",i=!0,a,c="",u="";function d(p){const y=i?p.replace(/^\xEF\xBB\xBF/,""):p,[m,h]=S5(`${o}${y}`);for(const x of m)f(x);o=h,i=!1}function f(p){if(p===""){v();return}if(p.startsWith(":")){s&&s(p.slice(p.startsWith(": ")?2:1));return}const y=p.indexOf(":");if(y!==-1){const m=p.slice(0,y),h=p[y+1]===" "?2:1,x=p.slice(y+h);g(m,x,p);return}g(p,"",p)}function g(p,y,m){switch(p){case"event":u=y;break;case"data":c=`${c}${y}
399
- `;break;case"id":a=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new Dx(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:m}));break;default:r(new Dx(`Unknown field "${p.length>20?`${p.slice(0,20)}…`:p}"`,{type:"unknown-field",field:p,value:y,line:m}));break}}function v(){c.length>0&&t({id:a,event:u||void 0,data:c.endsWith(`
400
- `)?c.slice(0,-1):c}),a=void 0,c="",u=""}function b(p={}){o&&p.consume&&f(o),i=!0,a=void 0,c="",u="",o=""}return{feed:d,reset:b}}function S5(e){const t=[];let r="",n=0;for(;n<e.length;){const s=e.indexOf("\r",n),o=e.indexOf(`
401
- `,n);let i=-1;if(s!==-1&&o!==-1?i=Math.min(s,o):s!==-1?s===e.length-1?i=-1:i=s:o!==-1&&(i=o),i===-1){r=e.slice(n);break}else{const a=e.slice(n,i);t.push(a),n=i+1,e[n-1]==="\r"&&e[n]===`
402
- `&&n++}}return[t,r]}class zx extends Event{constructor(t,r){var n,s;super(t),this.code=(n=r==null?void 0:r.code)!=null?n:void 0,this.message=(s=r==null?void 0:r.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,r,n){return n(Lx(this),r)}[Symbol.for("Deno.customInspect")](t,r){return t(Lx(this),r)}}function k5(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function jm(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(jm).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${jm(e.cause)}`:e.message:`${e}`}function Lx(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var ZN=e=>{throw TypeError(e)},cy=(e,t,r)=>t.has(e)||ZN("Cannot "+r),Te=(e,t,r)=>(cy(e,t,"read from private field"),r?r.call(e):t.get(e)),bt=(e,t,r)=>t.has(e)?ZN("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),rt=(e,t,r,n)=>(cy(e,t,"write to private field"),t.set(e,r),r),qn=(e,t,r)=>(cy(e,t,"access private method"),r),dr,Eo,yi,Mu,Ad,Cl,Mi,El,Ns,wi,Wi,xi,cl,Zr,$m,Pm,Tm,Fx,Rm,Im,ul,Am,Om;class Du extends EventTarget{constructor(t,r){var n,s;super(),bt(this,Zr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,bt(this,dr),bt(this,Eo),bt(this,yi),bt(this,Mu),bt(this,Ad),bt(this,Cl),bt(this,Mi),bt(this,El,null),bt(this,Ns),bt(this,wi),bt(this,Wi,null),bt(this,xi,null),bt(this,cl,null),bt(this,Pm,async o=>{var i;Te(this,wi).reset();const{body:a,redirected:c,status:u,headers:d}=o;if(u===204){qn(this,Zr,ul).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?rt(this,yi,new URL(o.url)):rt(this,yi,void 0),u!==200){qn(this,Zr,ul).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){qn(this,Zr,ul).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Te(this,dr)===this.CLOSED)return;rt(this,dr,this.OPEN);const f=new Event("open");if((i=Te(this,cl))==null||i.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){qn(this,Zr,ul).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const g=new TextDecoder,v=a.getReader();let b=!0;do{const{done:p,value:y}=await v.read();y&&Te(this,wi).feed(g.decode(y,{stream:!p})),p&&(b=!1,Te(this,wi).reset(),qn(this,Zr,Am).call(this))}while(b)}),bt(this,Tm,o=>{rt(this,Ns,void 0),!(o.name==="AbortError"||o.type==="aborted")&&qn(this,Zr,Am).call(this,jm(o))}),bt(this,Rm,o=>{typeof o.id=="string"&&rt(this,El,o.id);const i=new MessageEvent(o.event||"message",{data:o.data,origin:Te(this,yi)?Te(this,yi).origin:Te(this,Eo).origin,lastEventId:o.id||""});Te(this,xi)&&(!o.event||o.event==="message")&&Te(this,xi).call(this,i),this.dispatchEvent(i)}),bt(this,Im,o=>{rt(this,Cl,o)}),bt(this,Om,()=>{rt(this,Mi,void 0),Te(this,dr)===this.CONNECTING&&qn(this,Zr,$m).call(this)});try{if(t instanceof URL)rt(this,Eo,t);else if(typeof t=="string")rt(this,Eo,new URL(t,C5()));else throw new Error("Invalid URL")}catch{throw k5("An invalid or illegal string was specified")}rt(this,wi,WN({onEvent:Te(this,Rm),onRetry:Te(this,Im)})),rt(this,dr,this.CONNECTING),rt(this,Cl,3e3),rt(this,Ad,(n=r==null?void 0:r.fetch)!=null?n:globalThis.fetch),rt(this,Mu,(s=r==null?void 0:r.withCredentials)!=null?s:!1),qn(this,Zr,$m).call(this)}get readyState(){return Te(this,dr)}get url(){return Te(this,Eo).href}get withCredentials(){return Te(this,Mu)}get onerror(){return Te(this,Wi)}set onerror(t){rt(this,Wi,t)}get onmessage(){return Te(this,xi)}set onmessage(t){rt(this,xi,t)}get onopen(){return Te(this,cl)}set onopen(t){rt(this,cl,t)}addEventListener(t,r,n){const s=r;super.addEventListener(t,s,n)}removeEventListener(t,r,n){const s=r;super.removeEventListener(t,s,n)}close(){Te(this,Mi)&&clearTimeout(Te(this,Mi)),Te(this,dr)!==this.CLOSED&&(Te(this,Ns)&&Te(this,Ns).abort(),rt(this,dr,this.CLOSED),rt(this,Ns,void 0))}}dr=new WeakMap,Eo=new WeakMap,yi=new WeakMap,Mu=new WeakMap,Ad=new WeakMap,Cl=new WeakMap,Mi=new WeakMap,El=new WeakMap,Ns=new WeakMap,wi=new WeakMap,Wi=new WeakMap,xi=new WeakMap,cl=new WeakMap,Zr=new WeakSet,$m=function(){rt(this,dr,this.CONNECTING),rt(this,Ns,new AbortController),Te(this,Ad)(Te(this,Eo),qn(this,Zr,Fx).call(this)).then(Te(this,Pm)).catch(Te(this,Tm))},Pm=new WeakMap,Tm=new WeakMap,Fx=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Te(this,El)?{"Last-Event-ID":Te(this,El)}:void 0},cache:"no-store",signal:(e=Te(this,Ns))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},Rm=new WeakMap,Im=new WeakMap,ul=function(e,t){var r;Te(this,dr)!==this.CLOSED&&rt(this,dr,this.CLOSED);const n=new zx("error",{code:t,message:e});(r=Te(this,Wi))==null||r.call(this,n),this.dispatchEvent(n)},Am=function(e,t){var r;if(Te(this,dr)===this.CLOSED)return;rt(this,dr,this.CONNECTING);const n=new zx("error",{code:t,message:e});(r=Te(this,Wi))==null||r.call(this,n),this.dispatchEvent(n),rt(this,Mi,setTimeout(Te(this,Om),Te(this,Cl)))},Om=new WeakMap,Du.CONNECTING=0,Du.OPEN=1,Du.CLOSED=2;function C5(){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 Od(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function GN(e=fetch,t){return t?async(r,n)=>{const s={...t,...n,headers:n!=null&&n.headers?{...Od(t.headers),...Od(n.headers)}:t.headers};return e(r,s)}:e}let uy;uy=globalThis.crypto;async function E5(e){return(await uy).getRandomValues(new Uint8Array(e))}async function N5(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const n=await E5(e);for(let s=0;s<e;s++){const o=n[s]%t.length;r+=t[o]}return r}async function j5(e){return await N5(e)}async function $5(e){const t=await(await uy).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function P5(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await j5(e),r=await $5(t);return{code_verifier:t,code_challenge:r}}const Ot=J3().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:VF.custom,message:"URL must be parseable",fatal:!0}),qD}).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"}),T5=Dt({resource:A().url(),authorization_servers:ee(Ot).optional(),jwks_uri:A().url().optional(),scopes_supported:ee(A()).optional(),bearer_methods_supported:ee(A()).optional(),resource_signing_alg_values_supported:ee(A()).optional(),resource_name:A().optional(),resource_documentation:A().optional(),resource_policy_uri:A().url().optional(),resource_tos_uri:A().url().optional(),tls_client_certificate_bound_access_tokens:Ye().optional(),authorization_details_types_supported:ee(A()).optional(),dpop_signing_alg_values_supported:ee(A()).optional(),dpop_bound_access_tokens_required:Ye().optional()}),QN=Dt({issuer:A(),authorization_endpoint:Ot,token_endpoint:Ot,registration_endpoint:Ot.optional(),scopes_supported:ee(A()).optional(),response_types_supported:ee(A()),response_modes_supported:ee(A()).optional(),grant_types_supported:ee(A()).optional(),token_endpoint_auth_methods_supported:ee(A()).optional(),token_endpoint_auth_signing_alg_values_supported:ee(A()).optional(),service_documentation:Ot.optional(),revocation_endpoint:Ot.optional(),revocation_endpoint_auth_methods_supported:ee(A()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ee(A()).optional(),introspection_endpoint:A().optional(),introspection_endpoint_auth_methods_supported:ee(A()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ee(A()).optional(),code_challenge_methods_supported:ee(A()).optional(),client_id_metadata_document_supported:Ye().optional()}),R5=Dt({issuer:A(),authorization_endpoint:Ot,token_endpoint:Ot,userinfo_endpoint:Ot.optional(),jwks_uri:Ot,registration_endpoint:Ot.optional(),scopes_supported:ee(A()).optional(),response_types_supported:ee(A()),response_modes_supported:ee(A()).optional(),grant_types_supported:ee(A()).optional(),acr_values_supported:ee(A()).optional(),subject_types_supported:ee(A()),id_token_signing_alg_values_supported:ee(A()),id_token_encryption_alg_values_supported:ee(A()).optional(),id_token_encryption_enc_values_supported:ee(A()).optional(),userinfo_signing_alg_values_supported:ee(A()).optional(),userinfo_encryption_alg_values_supported:ee(A()).optional(),userinfo_encryption_enc_values_supported:ee(A()).optional(),request_object_signing_alg_values_supported:ee(A()).optional(),request_object_encryption_alg_values_supported:ee(A()).optional(),request_object_encryption_enc_values_supported:ee(A()).optional(),token_endpoint_auth_methods_supported:ee(A()).optional(),token_endpoint_auth_signing_alg_values_supported:ee(A()).optional(),display_values_supported:ee(A()).optional(),claim_types_supported:ee(A()).optional(),claims_supported:ee(A()).optional(),service_documentation:A().optional(),claims_locales_supported:ee(A()).optional(),ui_locales_supported:ee(A()).optional(),claims_parameter_supported:Ye().optional(),request_parameter_supported:Ye().optional(),request_uri_parameter_supported:Ye().optional(),require_request_uri_registration:Ye().optional(),op_policy_uri:Ot.optional(),op_tos_uri:Ot.optional(),client_id_metadata_document_supported:Ye().optional()}),I5=te({...R5.shape,...QN.pick({code_challenge_methods_supported:!0}).shape}),A5=te({access_token:A(),id_token:A().optional(),token_type:A(),expires_in:HF().optional(),scope:A().optional(),refresh_token:A().optional()}).strip(),O5=te({error:A(),error_description:A().optional(),error_uri:A().optional()}),Ux=Ot.optional().or(he("").transform(()=>{})),M5=te({redirect_uris:ee(Ot),token_endpoint_auth_method:A().optional(),grant_types:ee(A()).optional(),response_types:ee(A()).optional(),client_name:A().optional(),client_uri:Ot.optional(),logo_uri:Ux,scope:A().optional(),contacts:ee(A()).optional(),tos_uri:Ux,policy_uri:A().optional(),jwks_uri:Ot.optional(),jwks:yF().optional(),software_id:A().optional(),software_version:A().optional(),software_statement:A().optional()}).strip(),D5=te({client_id:A(),client_secret:A().optional(),client_id_issued_at:Fe().optional(),client_secret_expires_at:Fe().optional()}).strip(),z5=M5.merge(D5);te({error:A(),error_description:A().optional()}).strip();te({token:A(),token_type_hint:A().optional()}).strip();function L5(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function F5({requestedResource:e,configuredResource:t}){const r=typeof e=="string"?new URL(e):new URL(e.href),n=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;const s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return s.startsWith(o)}class Rt extends Error{constructor(t,r){super(t),this.errorUri=r,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 Mm extends Rt{}Mm.errorCode="invalid_request";class Md extends Rt{}Md.errorCode="invalid_client";class Dd extends Rt{}Dd.errorCode="invalid_grant";class zd extends Rt{}zd.errorCode="unauthorized_client";class Dm extends Rt{}Dm.errorCode="unsupported_grant_type";class zm extends Rt{}zm.errorCode="invalid_scope";class Lm extends Rt{}Lm.errorCode="access_denied";class _a extends Rt{}_a.errorCode="server_error";class Fm extends Rt{}Fm.errorCode="temporarily_unavailable";class Um extends Rt{}Um.errorCode="unsupported_response_type";class qm extends Rt{}qm.errorCode="unsupported_token_type";class Vm extends Rt{}Vm.errorCode="invalid_token";class Hm extends Rt{}Hm.errorCode="method_not_allowed";class Km extends Rt{}Km.errorCode="too_many_requests";class Ld extends Rt{}Ld.errorCode="invalid_client_metadata";class Bm extends Rt{}Bm.errorCode="insufficient_scope";class Wm extends Rt{}Wm.errorCode="invalid_target";const U5={[Mm.errorCode]:Mm,[Md.errorCode]:Md,[Dd.errorCode]:Dd,[zd.errorCode]:zd,[Dm.errorCode]:Dm,[zm.errorCode]:zm,[Lm.errorCode]:Lm,[_a.errorCode]:_a,[Fm.errorCode]:Fm,[Um.errorCode]:Um,[qm.errorCode]:qm,[Vm.errorCode]:Vm,[Hm.errorCode]:Hm,[Km.errorCode]:Km,[Ld.errorCode]:Ld,[Bm.errorCode]:Bm,[Wm.errorCode]:Wm};class _r extends Error{constructor(t){super(t??"Unauthorized")}}function q5(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const qh="code",Vh="S256";function V5(e,t){const r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&q5(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?r?"client_secret_basic":"none":r&&t.includes("client_secret_basic")?"client_secret_basic":r&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":r?"client_secret_post":"none"}function H5(e,t,r,n){const{client_id:s,client_secret:o}=t;switch(e){case"client_secret_basic":K5(s,o,r);return;case"client_secret_post":B5(s,o,n);return;case"none":W5(s,n);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function K5(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}function B5(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function W5(e,t){t.set("client_id",e)}async function JN(e){const t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{const n=O5.parse(JSON.parse(r)),{error:s,error_description:o,error_uri:i}=n,a=U5[s]||_a;return new a(o||"",i)}catch(n){const s=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new _a(s)}}async function nn(e,t){var r,n;try{return await Hh(e,t)}catch(s){if(s instanceof Md||s instanceof zd)return await((r=e.invalidateCredentials)==null?void 0:r.call(e,"all")),await Hh(e,t);if(s instanceof Dd)return await((n=e.invalidateCredentials)==null?void 0:n.call(e,"tokens")),await Hh(e,t);throw s}}async function Hh(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:s,fetchFn:o}){var x,_,C,T,$;const i=await((x=e.discoveryState)==null?void 0:x.call(e));let a,c,u,d=s;if(!d&&(i!=null&&i.resourceMetadataUrl)&&(d=new URL(i.resourceMetadataUrl)),i!=null&&i.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await XN(c,{fetchFn:o}),!a)try{a=await YN(t,{resourceMetadataUrl:d},o)}catch{}(u!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await((_=e.saveDiscoveryState)==null?void 0:_.call(e,{authorizationServerUrl:String(c),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:a,authorizationServerMetadata:u}))}else{const O=await e9(t,{resourceMetadataUrl:d,fetchFn:o});c=O.authorizationServerUrl,u=O.authorizationServerMetadata,a=O.resourceMetadata,await((C=e.saveDiscoveryState)==null?void 0:C.call(e,{authorizationServerUrl:String(c),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:a,authorizationServerMetadata:u}))}const f=await G5(t,e,a),g=n||((T=a==null?void 0:a.scopes_supported)==null?void 0:T.join(" "))||e.clientMetadata.scope;let v=await Promise.resolve(e.clientInformation());if(!v){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const O=(u==null?void 0:u.client_id_metadata_document_supported)===!0,M=e.clientMetadataUrl;if(M&&!Z5(M))throw new Ld(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${M}`);if(O&&M)v={client_id:M},await(($=e.saveClientInformation)==null?void 0:$.call(e,v));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const j=await o9(c,{metadata:u,clientMetadata:e.clientMetadata,scope:g,fetchFn:o});await e.saveClientInformation(j),v=j}}const b=!e.redirectUrl;if(r!==void 0||b){const O=await s9(e,c,{metadata:u,resource:f,authorizationCode:r,fetchFn:o});return await e.saveTokens(O),"AUTHORIZED"}const p=await e.tokens();if(p!=null&&p.refresh_token)try{const O=await n9(c,{metadata:u,clientInformation:v,refreshToken:p.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:o});return await e.saveTokens(O),"AUTHORIZED"}catch(O){if(!(!(O instanceof Rt)||O instanceof _a))throw O}const y=e.state?await e.state():void 0,{authorizationUrl:m,codeVerifier:h}=await t9(c,{metadata:u,clientInformation:v,state:y,redirectUrl:e.redirectUrl,scope:g,resource:f});return await e.saveCodeVerifier(h),await e.redirectToAuthorization(m),"REDIRECT"}function Z5(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function G5(e,t,r){const n=L5(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r==null?void 0:r.resource);if(r){if(!F5({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Fd(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};const s=Kh(e,"resource_metadata")||void 0;let o;if(s)try{o=new URL(s)}catch{}const i=Kh(e,"scope")||void 0,a=Kh(e,"error")||void 0;return{resourceMetadataUrl:o,scope:i,error:a}}function Kh(e,t){const r=e.headers.get("WWW-Authenticate");if(!r)return null;const n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),s=r.match(n);return s?s[1]||s[2]:null}async function YN(e,t,r=fetch){var s,o;const n=await Y5(e,"oauth-protected-resource",r,{protocolVersion:t==null?void 0:t.protocolVersion,metadataUrl:t==null?void 0:t.resourceMetadataUrl});if(!n||n.status===404)throw await((s=n==null?void 0:n.body)==null?void 0:s.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await((o=n.body)==null?void 0:o.cancel()),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return T5.parse(await n.json())}async function dy(e,t,r=fetch){try{return await r(e,{headers:t})}catch(n){if(n instanceof TypeError)return t?dy(e,void 0,r):void 0;throw n}}function Q5(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function qx(e,t,r=fetch){return await dy(e,{"MCP-Protocol-Version":t},r)}function J5(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function Y5(e,t,r,n){const s=new URL(e),o=(n==null?void 0:n.protocolVersion)??Of;let i;if(n!=null&&n.metadataUrl)i=new URL(n.metadataUrl);else{const c=Q5(t,s.pathname);i=new URL(c,(n==null?void 0:n.metadataServerUrl)??s),i.search=s.search}let a=await qx(i,o,r);if(!(n!=null&&n.metadataUrl)&&J5(a,s.pathname)){const c=new URL(`/.well-known/${t}`,s);a=await qx(c,o,r)}return a}function X5(e){const t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let s=t.pathname;return s.endsWith("/")&&(s=s.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${s}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${s}`,t.origin),type:"oidc"}),n.push({url:new URL(`${s}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}async function XN(e,{fetchFn:t=fetch,protocolVersion:r=Of}={}){var o;const n={"MCP-Protocol-Version":r,Accept:"application/json"},s=X5(e);for(const{url:i,type:a}of s){const c=await dy(i,n,t);if(c){if(!c.ok){if(await((o=c.body)==null?void 0:o.cancel()),c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return a==="oauth"?QN.parse(await c.json()):I5.parse(await c.json())}}}async function e9(e,t){let r,n;try{r=await YN(e,{resourceMetadataUrl:t==null?void 0:t.resourceMetadataUrl},t==null?void 0:t.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",e)));const s=await XN(n,{fetchFn:t==null?void 0:t.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:s,resourceMetadata:r}}async function t9(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:s,state:o,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(qh))throw new Error(`Incompatible auth server: does not support response type ${qh}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Vh))throw new Error(`Incompatible auth server: does not support code challenge method ${Vh}`)}else a=new URL("/authorize",e);const c=await P5(),u=c.code_verifier,d=c.code_challenge;return a.searchParams.set("response_type",qh),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",Vh),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),s&&a.searchParams.set("scope",s),s!=null&&s.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",i.href),{authorizationUrl:a,codeVerifier:u}}function r9(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function ej(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:s,resource:o,fetchFn:i}){const a=t!=null&&t.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(o&&r.set("resource",o.href),s)await s(c,r,a,t);else if(n){const d=(t==null?void 0:t.token_endpoint_auth_methods_supported)??[],f=V5(n,d);H5(f,n,c,r)}const u=await(i??fetch)(a,{method:"POST",headers:c,body:r});if(!u.ok)throw await JN(u);return A5.parse(await u.json())}async function n9(e,{metadata:t,clientInformation:r,refreshToken:n,resource:s,addClientAuthentication:o,fetchFn:i}){const a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await ej(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:o,resource:s,fetchFn:i});return{refresh_token:n,...c}}async function s9(e,t,{metadata:r,resource:n,authorizationCode:s,fetchFn:o}={}){const i=e.clientMetadata.scope;let a;if(e.prepareTokenRequest&&(a=await e.prepareTokenRequest(i)),!a){if(!s)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=r9(s,u,e.redirectUrl)}const c=await e.clientInformation();return ej(t,{metadata:r,tokenRequestParams:a,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:o})}async function o9(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:s}){let o;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(t.registration_endpoint)}else o=new URL("/register",e);const i=await(s??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await JN(i);return z5.parse(await i.json())}class i9 extends Error{constructor(t,r,n){super(`SSE error: ${r}`),this.code=t,this.event=n}}class a9{constructor(t,r){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r==null?void 0:r.eventSourceInit,this._requestInit=r==null?void 0:r.requestInit,this._authProvider=r==null?void 0:r.authProvider,this._fetch=r==null?void 0:r.fetch,this._fetchWithInit=GN(r==null?void 0:r.fetch,r==null?void 0:r.requestInit)}async _authThenStart(){var r;if(!this._authProvider)throw new _r("No auth provider");let t;try{t=await nn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(r=this.onerror)==null||r.call(this,n),n}if(t!=="AUTHORIZED")throw new _r;return await this._startOrAuth()}async _commonHeaders(){var n;const t={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(t.Authorization=`Bearer ${s.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const r=Od((n=this._requestInit)==null?void 0:n.headers);return new Headers({...t,...r})}_startOrAuth(){var r;const t=((r=this==null?void 0:this._eventSourceInit)==null?void 0:r.fetch)??this._fetch??fetch;return new Promise((n,s)=>{this._eventSource=new Du(this._url.href,{...this._eventSourceInit,fetch:async(o,i)=>{const a=await this._commonHeaders();a.set("Accept","text/event-stream");const c=await t(o,{...i,headers:a});if(c.status===401&&c.headers.has("www-authenticate")){const{resourceMetadataUrl:u,scope:d}=Fd(c);this._resourceMetadataUrl=u,this._scope=d}return c}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var a;if(o.code===401&&this._authProvider){this._authThenStart().then(n,s);return}const i=new i9(o.code,o.message,o);s(i),(a=this.onerror)==null||a.call(this,i)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var a;const i=o;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(c){s(c),(a=this.onerror)==null||a.call(this,c),this.close();return}n()}),this._eventSource.onmessage=o=>{var c,u;const i=o;let a;try{a=Ou.parse(JSON.parse(i.data))}catch(d){(c=this.onerror)==null||c.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 _r("No auth provider");if(await nn(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new _r("Failed to authorize")}async close(){var t,r,n;(t=this._abortController)==null||t.abort(),(r=this._eventSource)==null||r.close(),(n=this.onclose)==null||n.call(this)}async send(t){var r,n,s;if(!this._endpoint)throw new Error("Not connected");try{const o=await this._commonHeaders();o.set("content-type","application/json");const i={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(t),signal:(r=this._abortController)==null?void 0:r.signal},a=await(this._fetch??fetch)(this._endpoint,i);if(!a.ok){const c=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){const{resourceMetadataUrl:u,scope:d}=Fd(a);if(this._resourceMetadataUrl=u,this._scope=d,await nn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new _r;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}await((n=a.body)==null?void 0:n.cancel())}catch(o){throw(s=this.onerror)==null||s.call(this,o),o}}setProtocolVersion(t){this._protocolVersion=t}}class l9 extends TransformStream{constructor({onError:t,onRetry:r,onComment:n}={}){let s;super({start(o){s=WN({onEvent:i=>{o.enqueue(i)},onError(i){t==="terminate"?o.error(i):typeof t=="function"&&t(i)},onRetry:r,onComment:n})},transform(o){s.feed(o)}})}}const c9={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class hi extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}}class u9{constructor(t,r){this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r==null?void 0:r.requestInit,this._authProvider=r==null?void 0:r.authProvider,this._fetch=r==null?void 0:r.fetch,this._fetchWithInit=GN(r==null?void 0:r.fetch,r==null?void 0:r.requestInit),this._sessionId=r==null?void 0:r.sessionId,this._reconnectionOptions=(r==null?void 0:r.reconnectionOptions)??c9}async _authThenStart(){var r;if(!this._authProvider)throw new _r("No auth provider");let t;try{t=await nn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(r=this.onerror)==null||r.call(this,n),n}if(t!=="AUTHORIZED")throw new _r;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var n;const t={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(t.Authorization=`Bearer ${s.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const r=Od((n=this._requestInit)==null?void 0:n.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){var n,s,o;const{resumptionToken:r}=t;try{const i=await this._commonHeaders();i.set("Accept","text/event-stream"),r&&i.set("last-event-id",r);const a=await(this._fetch??fetch)(this._url,{method:"GET",headers:i,signal:(n=this._abortController)==null?void 0:n.signal});if(!a.ok){if(await((s=a.body)==null?void 0:s.cancel()),a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new hi(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,t,!0)}catch(i){throw(o=this.onerror)==null||o.call(this,i),i}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,s=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,t),s)}_scheduleReconnection(t,r=0){var o;const n=this._reconnectionOptions.maxRetries;if(r>=n){(o=this.onerror)==null||o.call(this,new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}const s=this._getNextReconnectionDelay(r);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,r+1)})},s)}_handleSseStream(t,r,n){if(!t)return;const{onresumptiontoken:s,replayMessageId:o}=r;let i,a=!1,c=!1;(async()=>{var d,f,g,v;try{const b=t.pipeThrough(new TextDecoderStream).pipeThrough(new l9({onRetry:m=>{this._serverRetryMs=m}})).getReader();for(;;){const{value:m,done:h}=await b.read();if(h)break;if(m.id&&(i=m.id,a=!0,s==null||s(m.id)),!!m.data&&(!m.event||m.event==="message"))try{const x=Ou.parse(JSON.parse(m.data));ll(x)&&(c=!0,o!==void 0&&(x.id=o)),(d=this.onmessage)==null||d.call(this,x)}catch(x){(f=this.onerror)==null||f.call(this,x)}}(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:s,replayMessageId:o},0)}catch(b){if((g=this.onerror)==null||g.call(this,new Error(`SSE stream disconnected: ${b}`)),(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:s,replayMessageId:o},0)}catch(m){(v=this.onerror)==null||v.call(this,new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}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 _r("No auth provider");if(await nn(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new _r("Failed to authorize")}async close(){var t,r;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(t=this._abortController)==null||t.abort(),(r=this.onclose)==null||r.call(this)}async send(t,r){var n,s,o,i,a,c;try{const{resumptionToken:u,onresumptiontoken:d}=r||{};if(u){this._startOrAuthSse({resumptionToken:u,replayMessageId:Nm(t)?t.id:void 0}).catch(h=>{var x;return(x=this.onerror)==null?void 0:x.call(this,h)});return}const f=await this._commonHeaders();f.set("content-type","application/json"),f.set("accept","application/json, text/event-stream");const g={...this._requestInit,method:"POST",headers:f,body:JSON.stringify(t),signal:(n=this._abortController)==null?void 0:n.signal},v=await(this._fetch??fetch)(this._url,g),b=v.headers.get("mcp-session-id");if(b&&(this._sessionId=b),!v.ok){const h=await v.text().catch(()=>null);if(v.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new hi(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:x,scope:_}=Fd(v);if(this._resourceMetadataUrl=x,this._scope=_,await nn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new _r;return this._hasCompletedAuthFlow=!0,this.send(t)}if(v.status===403&&this._authProvider){const{resourceMetadataUrl:x,scope:_,error:C}=Fd(v);if(C==="insufficient_scope"){const T=v.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===T)throw new hi(403,"Server returned 403 after trying upscoping");if(_&&(this._scope=_),x&&(this._resourceMetadataUrl=x),this._lastUpscopingHeader=T??void 0,await nn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new _r;return this.send(t)}}throw new hi(v.status,`Error POSTing to endpoint: ${h}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,v.status===202){await((s=v.body)==null?void 0:s.cancel()),aU(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(h=>{var x;return(x=this.onerror)==null?void 0:x.call(this,h)});return}const y=(Array.isArray(t)?t:[t]).filter(h=>"method"in h&&"id"in h&&h.id!==void 0).length>0,m=v.headers.get("content-type");if(y)if(m!=null&&m.includes("text/event-stream"))this._handleSseStream(v.body,{onresumptiontoken:d},!1);else if(m!=null&&m.includes("application/json")){const h=await v.json(),x=Array.isArray(h)?h.map(_=>Ou.parse(_)):[Ou.parse(h)];for(const _ of x)(o=this.onmessage)==null||o.call(this,_)}else throw await((i=v.body)==null?void 0:i.cancel()),new hi(-1,`Unexpected content type: ${m}`);else await((a=v.body)==null?void 0:a.cancel())}catch(u){throw(c=this.onerror)==null||c.call(this,u),u}}get sessionId(){return this._sessionId}async terminateSession(){var t,r,n;if(this._sessionId)try{const s=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:s,signal:(t=this._abortController)==null?void 0:t.signal},i=await(this._fetch??fetch)(this._url,o);if(await((r=i.body)==null?void 0:r.cancel()),!i.ok&&i.status!==405)throw new hi(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(s){throw(n=this.onerror)==null||n.call(this,s),s}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,r){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:r==null?void 0:r.onresumptiontoken})}}function zf(e){return!!e._zod}function ks(e,t){return zf(e)?XE(e,t):e.safeParse(t)}function tj(e){var r,n;if(!e)return;let t;if(zf(e)?t=(n=(r=e._zod)==null?void 0:r.def)==null?void 0:n.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function d9(e){var s;if(zf(e)){const i=(s=e._zod)==null?void 0:s.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 r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}const n=e.value;if(n!==void 0)return n}function wo(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Vx(e){const t=tj(e),r=t==null?void 0:t.method;if(!r)throw new Error("Schema is missing a method literal");const n=d9(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Hx(e,t){const r=ks(e,t);if(!r.success)throw r.error;return r.data}const f9=6e4;class h9{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(Kv,r=>{this._oncancel(r)}),this.setNotificationHandler(Wv,r=>{this._onprogress(r)}),this.setRequestHandler(Bv,r=>({})),this._taskStore=t==null?void 0:t.taskStore,this._taskMessageQueue=t==null?void 0:t.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Zv,async(r,n)=>{const s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new ye(_e.InvalidParams,"Failed to retrieve task: Task not found");return{...s}}),this.setRequestHandler(Qv,async(r,n)=>{const s=async()=>{var a;const o=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(c.type==="response"||c.type==="error"){const u=c.message,d=u.id,f=this._requestResolvers.get(d);if(f)if(this._requestResolvers.delete(d),c.type==="response")f(u);else{const g=u,v=new ye(g.error.code,g.error.message,g.error.data);f(v)}else{const g=c.type==="response"?"Response":"Error";this._onerror(new Error(`${g} handler missing for request ${d}`))}continue}await((a=this._transport)==null?void 0:a.send(c.message,{relatedRequestId:n.requestId}))}}const i=await this._taskStore.getTask(o,n.sessionId);if(!i)throw new ye(_e.InvalidParams,`Task not found: ${o}`);if(!wo(i.status))return await this._waitForTaskUpdate(o,n.signal),await s();if(wo(i.status)){const c=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...c,_meta:{...c._meta,[Co]:{taskId:o}}}}return await s()};return await s()}),this.setRequestHandler(Jv,async(r,n)=>{var s;try{const{tasks:o,nextCursor:i}=await this._taskStore.listTasks((s=r.params)==null?void 0:s.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new ye(_e.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Xv,async(r,n)=>{try{const s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new ye(_e.InvalidParams,`Task not found: ${r.params.taskId}`);if(wo(s.status))throw new ye(_e.InvalidParams,`Cannot cancel task in terminal status: ${s.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);const o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new ye(_e.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(s){throw s instanceof ye?s:new ye(_e.InvalidRequest,`Failed to cancel task: ${s instanceof Error?s.message:String(s)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;const r=this._requestHandlerAbortControllers.get(t.params.requestId);r==null||r.abort(t.params.reason)}_setupTimeout(t,r,n,s,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:s})}_resetTimeout(t){const r=this._timeoutInfo.get(t);if(!r)return!1;const n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),ye.fromError(_e.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){const r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var o,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 r=(o=this.transport)==null?void 0:o.onclose;this._transport.onclose=()=>{r==null||r(),this._onclose()};const n=(i=this.transport)==null?void 0:i.onerror;this._transport.onerror=c=>{n==null||n(c),this._onerror(c)};const s=(a=this._transport)==null?void 0:a.onmessage;this._transport.onmessage=(c,u)=>{s==null||s(c,u),ll(c)||QF(c)?this._onresponse(c):Nm(c)?this._onrequest(c,u):GF(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var n;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();for(const s of this._requestHandlerAbortControllers.values())s.abort();this._requestHandlerAbortControllers.clear();const r=ye.fromError(_e.ConnectionClosed,"Connection closed");this._transport=void 0,(n=this.onclose)==null||n.call(this);for(const s of t.values())s(r)}_onerror(t){var r;(r=this.onerror)==null||r.call(this,t)}_onnotification(t){const r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){var d,f,g,v;const n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,s=this._transport,o=(g=(f=(d=t.params)==null?void 0:d._meta)==null?void 0:f[Co])==null?void 0:g.taskId;if(n===void 0){const b={jsonrpc:"2.0",id:t.id,error:{code:_e.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:b,timestamp:Date.now()},s==null?void 0:s.sessionId).catch(p=>this._onerror(new Error(`Failed to enqueue error response: ${p}`))):s==null||s.send(b).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);const a=ZF(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,s==null?void 0:s.sessionId):void 0,u={signal:i.signal,sessionId:s==null?void 0:s.sessionId,_meta:(v=t.params)==null?void 0:v._meta,sendNotification:async b=>{if(i.signal.aborted)return;const p={relatedRequestId:t.id};o&&(p.relatedTask={taskId:o}),await this.notification(b,p)},sendRequest:async(b,p,y)=>{var x;if(i.signal.aborted)throw new ye(_e.ConnectionClosed,"Request was cancelled");const m={...y,relatedRequestId:t.id};o&&!m.relatedTask&&(m.relatedTask={taskId:o});const h=((x=m.relatedTask)==null?void 0:x.taskId)??o;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(b,p,m)},authInfo:r==null?void 0:r.authInfo,requestId:t.id,requestInfo:r==null?void 0:r.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:a==null?void 0:a.ttl,closeSSEStream:r==null?void 0:r.closeSSEStream,closeStandaloneSSEStream:r==null?void 0:r.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async b=>{if(i.signal.aborted)return;const p={result:b,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:p,timestamp:Date.now()},s==null?void 0:s.sessionId):await(s==null?void 0:s.send(p))},async b=>{if(i.signal.aborted)return;const p={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(b.code)?b.code:_e.InternalError,message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:p,timestamp:Date.now()},s==null?void 0:s.sessionId):await(s==null?void 0:s.send(p))}).catch(b=>this._onerror(new Error(`Failed to send response: ${b}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:r,...n}=t.params,s=Number(r),o=this._progressHandlers.get(s);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(s),a=this._timeoutInfo.get(s);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(c){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),i(c);return}o(n)}_onresponse(t){const r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),ll(t))n(t);else{const i=new ye(t.error.code,t.error.message,t.error.data);n(i)}return}const s=this._responseHandlers.get(r);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(ll(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"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),ll(t))s(t);else{const i=ye.fromError(t.error.code,t.error.message,t.error.data);s(i)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)==null?void 0:t.close())}async*requestStream(t,r,n){var i,a;const{task:s}=n??{};if(!s){try{yield{type:"result",result:await this.request(t,r,n)}}catch(c){yield{type:"error",error:c instanceof ye?c:new ye(_e.InternalError,String(c))}}return}let o;try{const c=await this.request(t,ec,n);if(c.task)o=c.task.taskId,yield{type:"taskCreated",task:c.task};else throw new ye(_e.InternalError,"Task creation did not return a task");for(;;){const u=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:u},wo(u.status)){u.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:u.status==="failed"?yield{type:"error",error:new ye(_e.InternalError,`Task ${o} failed`)}:u.status==="cancelled"&&(yield{type:"error",error:new ye(_e.InternalError,`Task ${o} was cancelled`)});return}if(u.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}const d=u.pollInterval??((i=this._options)==null?void 0:i.defaultTaskPollInterval)??1e3;await new Promise(f=>setTimeout(f,d)),(a=n==null?void 0:n.signal)==null||a.throwIfAborted()}}catch(c){yield{type:"error",error:c instanceof ye?c:new ye(_e.InternalError,String(c))}}}request(t,r,n){const{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,d)=>{var h,x,_,C,T;const f=$=>{d($)};if(!this._transport){f(new Error("Not connected"));return}if(((h=this._options)==null?void 0:h.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch($){f($);return}(x=n==null?void 0:n.signal)==null||x.throwIfAborted();const g=this._requestMessageId++,v={...t,jsonrpc:"2.0",id:g};n!=null&&n.onprogress&&(this._progressHandlers.set(g,n.onprogress),v.params={...t.params,_meta:{...((_=t.params)==null?void 0:_._meta)||{},progressToken:g}}),a&&(v.params={...v.params,task:a}),c&&(v.params={...v.params,_meta:{...((C=v.params)==null?void 0:C._meta)||{},[Co]:c}});const b=$=>{var M;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(M=this._transport)==null||M.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String($)}},{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(U=>this._onerror(new Error(`Failed to send cancellation: ${U}`)));const O=$ instanceof ye?$:new ye(_e.RequestTimeout,String($));d(O)};this._responseHandlers.set(g,$=>{var O;if(!((O=n==null?void 0:n.signal)!=null&&O.aborted)){if($ instanceof Error)return d($);try{const M=ks(r,$.result);M.success?u(M.data):d(M.error)}catch(M){d(M)}}}),(T=n==null?void 0:n.signal)==null||T.addEventListener("abort",()=>{var $;b(($=n==null?void 0:n.signal)==null?void 0:$.reason)});const p=(n==null?void 0:n.timeout)??f9,y=()=>b(ye.fromError(_e.RequestTimeout,"Request timed out",{timeout:p}));this._setupTimeout(g,p,n==null?void 0:n.maxTotalTimeout,y,(n==null?void 0:n.resetTimeoutOnProgress)??!1);const m=c==null?void 0:c.taskId;if(m){const $=O=>{const M=this._responseHandlers.get(g);M?M(O):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,$),this._enqueueTaskMessage(m,{type:"request",message:v,timestamp:Date.now()}).catch(O=>{this._cleanupTimeout(g),d(O)})}else this._transport.send(v,{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch($=>{this._cleanupTimeout(g),d($)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Gv,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Yv,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},hU,r)}async notification(t,r){var a,c,u,d;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const n=(a=r==null?void 0:r.relatedTask)==null?void 0:a.taskId;if(n){const f={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((c=t.params)==null?void 0:c._meta)||{},[Co]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:f,timestamp:Date.now()});return}if((((u=this._options)==null?void 0:u.debouncedNotificationMethods)??[]).includes(t.method)&&!t.params&&!(r!=null&&r.relatedRequestId)&&!(r!=null&&r.relatedTask)){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var g,v;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let f={...t,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(f={...f,params:{...f.params,_meta:{...((g=f.params)==null?void 0:g._meta)||{},[Co]:r.relatedTask}}}),(v=this._transport)==null||v.send(f,r).catch(b=>this._onerror(b))});return}let i={...t,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(i={...i,params:{...i.params,_meta:{...((d=i.params)==null?void 0:d._meta)||{},[Co]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){const n=Vx(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,o)=>{const i=Hx(t,s);return Promise.resolve(r(i,o))})}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,r){const n=Vx(t);this._notificationHandlers.set(n,s=>{const o=Hx(t,s);return Promise.resolve(r(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){var o;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const s=(o=this._options)==null?void 0:o.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,s)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){const n=await this._taskMessageQueue.dequeueAll(t,r);for(const s of n)if(s.type==="request"&&Nm(s.message)){const o=s.message.id,i=this._requestResolvers.get(o);i?(i(new ye(_e.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){var s,o;let n=((s=this._options)==null?void 0:s.defaultTaskPollInterval)??1e3;try{const i=await((o=this._taskStore)==null?void 0:o.getTask(t));i!=null&&i.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,a)=>{if(r.aborted){a(new ye(_e.InvalidRequest,"Request cancelled"));return}const c=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(c),a(new ye(_e.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){const n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async s=>{if(!t)throw new Error("No request provided");return await n.createTask(s,t.id,{method:t.method,params:t.params},r)},getTask:async s=>{const o=await n.getTask(s,r);if(!o)throw new ye(_e.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(s,o,i)=>{await n.storeTaskResult(s,o,i,r);const a=await n.getTask(s,r);if(a){const c=Pd.parse({method:"notifications/tasks/status",params:a});await this.notification(c),wo(a.status)&&this._cleanupTaskProgressHandler(s)}},getTaskResult:s=>n.getTaskResult(s,r),updateTaskStatus:async(s,o,i)=>{const a=await n.getTask(s,r);if(!a)throw new ye(_e.InvalidParams,`Task "${s}" not found - it may have been cleaned up`);if(wo(a.status))throw new ye(_e.InvalidParams,`Cannot update task "${s}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(s,o,i,r);const c=await n.getTask(s,r);if(c){const u=Pd.parse({method:"notifications/tasks/status",params:c});await this.notification(u),wo(c.status)&&this._cleanupTaskProgressHandler(s)}},listTasks:s=>n.listTasks(s,r)}}}function Kx(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function p9(e,t){const r={...e};for(const n in t){const s=n,o=t[s];if(o===void 0)continue;const i=r[s];Kx(i)&&Kx(o)?r[s]={...i,...o}:r[s]=o}return r}var Zm={exports:{}},rj={},an={},Sa={},Ec={},je={},tc={};(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 r extends t{constructor(h){if(super(),!e.IDENTIFIER.test(h))throw new Error("CodeGen: name must be a valid identifier");this.str=h}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(h){super(),this._items=typeof h=="string"?[h]:h}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const h=this._items[0];return h===""||h==='""'}get str(){var h;return(h=this._str)!==null&&h!==void 0?h:this._str=this._items.reduce((x,_)=>`${x}${_}`,"")}get names(){var h;return(h=this._names)!==null&&h!==void 0?h:this._names=this._items.reduce((x,_)=>(_ instanceof r&&(x[_.str]=(x[_.str]||0)+1),x),{})}}e._Code=n,e.nil=new n("");function s(m,...h){const x=[m[0]];let _=0;for(;_<h.length;)a(x,h[_]),x.push(m[++_]);return new n(x)}e._=s;const o=new n("+");function i(m,...h){const x=[v(m[0])];let _=0;for(;_<h.length;)x.push(o),a(x,h[_]),x.push(o,v(m[++_]));return c(x),new n(x)}e.str=i;function a(m,h){h instanceof n?m.push(...h._items):h instanceof r?m.push(h):m.push(f(h))}e.addCodeArg=a;function c(m){let h=1;for(;h<m.length-1;){if(m[h]===o){const x=u(m[h-1],m[h+1]);if(x!==void 0){m.splice(h-1,3,x);continue}m[h++]="+"}h++}}function u(m,h){if(h==='""')return m;if(m==='""')return h;if(typeof m=="string")return h instanceof r||m[m.length-1]!=='"'?void 0:typeof h!="string"?`${m.slice(0,-1)}${h}"`:h[0]==='"'?m.slice(0,-1)+h.slice(1):void 0;if(typeof h=="string"&&h[0]==='"'&&!(m instanceof r))return`"${m}${h.slice(1)}`}function d(m,h){return h.emptyStr()?m:m.emptyStr()?h:i`${m}${h}`}e.strConcat=d;function f(m){return typeof m=="number"||typeof m=="boolean"||m===null?m:v(Array.isArray(m)?m.join(","):m)}function g(m){return new n(v(m))}e.stringify=g;function v(m){return JSON.stringify(m).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=v;function b(m){return typeof m=="string"&&e.IDENTIFIER.test(m)?new n(`.${m}`):s`[${m}]`}e.getProperty=b;function p(m){if(typeof m=="string"&&e.IDENTIFIER.test(m))return new n(`${m}`);throw new Error(`CodeGen: invalid export name: ${m}, use explicit $id name mapping`)}e.getEsmExportName=p;function y(m){return new n(m.toString())}e.regexpCode=y})(tc);var Gm={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=tc;class r extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var n;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{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=s;class o 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=o;const i=(0,t._)`\n`;class a extends s{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 o(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 g=this.toName(u),{prefix:v}=g,b=(f=d.key)!==null&&f!==void 0?f:d.ref;let p=this._values[v];if(p){const h=p.get(b);if(h)return h}else p=this._values[v]=new Map;p.set(b,g);const y=this._scope[v]||(this._scope[v]=[]),m=y.length;return y[m]=d.ref,g.setValue(d,{property:v,itemIndex:m}),g}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,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},d,f)}_reduceValues(u,d,f={},g){let v=t.nil;for(const b in u){const p=u[b];if(!p)continue;const y=f[b]=f[b]||new Map;p.forEach(m=>{if(y.has(m))return;y.set(m,n.Started);let h=d(m);if(h){const x=this.opts.es5?e.varKinds.var:e.varKinds.const;v=(0,t._)`${v}${x} ${m} = ${h};${this.opts._n}`}else if(h=g==null?void 0:g(m))v=(0,t._)`${v}${h}${this.opts._n}`;else throw new r(m);y.set(m,n.Completed)})}return v}}e.ValueScope=a})(Gm);(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=tc,r=Gm;var n=tc;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=Gm;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.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 o{optimizeNodes(){return this}optimizeNames(S,E){return this}}class i extends o{constructor(S,E,D){super(),this.varKind=S,this.name=E,this.rhs=D}render({es5:S,_n:E}){const D=S?r.varKinds.var:this.varKind,K=this.rhs===void 0?"":` = ${this.rhs}`;return`${D} ${this.name}${K};`+E}optimizeNames(S,E){if(S[this.name.str])return this.rhs&&(this.rhs=P(this.rhs,S,E)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends o{constructor(S,E,D){super(),this.lhs=S,this.rhs=E,this.sideEffects=D}render({_n:S}){return`${this.lhs} = ${this.rhs};`+S}optimizeNames(S,E){if(!(this.lhs instanceof t.Name&&!S[this.lhs.str]&&!this.sideEffects))return this.rhs=P(this.rhs,S,E),this}get names(){const S=this.lhs instanceof t.Name?{}:{...this.lhs.names};return L(S,this.rhs)}}class c extends a{constructor(S,E,D,K){super(S,D,K),this.op=E}render({_n:S}){return`${this.lhs} ${this.op}= ${this.rhs};`+S}}class u extends o{constructor(S){super(),this.label=S,this.names={}}render({_n:S}){return`${this.label}:`+S}}class d extends o{constructor(S){super(),this.label=S,this.names={}}render({_n:S}){return`break${this.label?` ${this.label}`:""};`+S}}class f extends o{constructor(S){super(),this.error=S}render({_n:S}){return`throw ${this.error};`+S}get names(){return this.error.names}}class g extends o{constructor(S){super(),this.code=S}render({_n:S}){return`${this.code};`+S}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(S,E){return this.code=P(this.code,S,E),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class v extends o{constructor(S=[]){super(),this.nodes=S}render(S){return this.nodes.reduce((E,D)=>E+D.render(S),"")}optimizeNodes(){const{nodes:S}=this;let E=S.length;for(;E--;){const D=S[E].optimizeNodes();Array.isArray(D)?S.splice(E,1,...D):D?S[E]=D:S.splice(E,1)}return S.length>0?this:void 0}optimizeNames(S,E){const{nodes:D}=this;let K=D.length;for(;K--;){const Z=D[K];Z.optimizeNames(S,E)||(B(S,Z.names),D.splice(K,1))}return D.length>0?this:void 0}get names(){return this.nodes.reduce((S,E)=>k(S,E.names),{})}}class b extends v{render(S){return"{"+S._n+super.render(S)+"}"+S._n}}class p extends v{}class y extends b{}y.kind="else";class m extends b{constructor(S,E){super(E),this.condition=S}render(S){let E=`if(${this.condition})`+super.render(S);return this.else&&(E+="else "+this.else.render(S)),E}optimizeNodes(){super.optimizeNodes();const S=this.condition;if(S===!0)return this.nodes;let E=this.else;if(E){const D=E.optimizeNodes();E=this.else=Array.isArray(D)?new y(D):D}if(E)return S===!1?E instanceof m?E:E.nodes:this.nodes.length?this:new m(H(S),E instanceof m?[E]:E.nodes);if(!(S===!1||!this.nodes.length))return this}optimizeNames(S,E){var D;if(this.else=(D=this.else)===null||D===void 0?void 0:D.optimizeNames(S,E),!!(super.optimizeNames(S,E)||this.else))return this.condition=P(this.condition,S,E),this}get names(){const S=super.names;return L(S,this.condition),this.else&&k(S,this.else.names),S}}m.kind="if";class h extends b{}h.kind="for";class x extends h{constructor(S){super(),this.iteration=S}render(S){return`for(${this.iteration})`+super.render(S)}optimizeNames(S,E){if(super.optimizeNames(S,E))return this.iteration=P(this.iteration,S,E),this}get names(){return k(super.names,this.iteration.names)}}class _ extends h{constructor(S,E,D,K){super(),this.varKind=S,this.name=E,this.from=D,this.to=K}render(S){const E=S.es5?r.varKinds.var:this.varKind,{name:D,from:K,to:Z}=this;return`for(${E} ${D}=${K}; ${D}<${Z}; ${D}++)`+super.render(S)}get names(){const S=L(super.names,this.from);return L(S,this.to)}}class C extends h{constructor(S,E,D,K){super(),this.loop=S,this.varKind=E,this.name=D,this.iterable=K}render(S){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(S)}optimizeNames(S,E){if(super.optimizeNames(S,E))return this.iterable=P(this.iterable,S,E),this}get names(){return k(super.names,this.iterable.names)}}class T extends b{constructor(S,E,D){super(),this.name=S,this.args=E,this.async=D}render(S){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(S)}}T.kind="func";class $ extends v{render(S){return"return "+super.render(S)}}$.kind="return";class O extends b{render(S){let E="try"+super.render(S);return this.catch&&(E+=this.catch.render(S)),this.finally&&(E+=this.finally.render(S)),E}optimizeNodes(){var S,E;return super.optimizeNodes(),(S=this.catch)===null||S===void 0||S.optimizeNodes(),(E=this.finally)===null||E===void 0||E.optimizeNodes(),this}optimizeNames(S,E){var D,K;return super.optimizeNames(S,E),(D=this.catch)===null||D===void 0||D.optimizeNames(S,E),(K=this.finally)===null||K===void 0||K.optimizeNames(S,E),this}get names(){const S=super.names;return this.catch&&k(S,this.catch.names),this.finally&&k(S,this.finally.names),S}}class M extends b{constructor(S){super(),this.error=S}render(S){return`catch(${this.error})`+super.render(S)}}M.kind="catch";class U extends b{render(S){return"finally"+super.render(S)}}U.kind="finally";class j{constructor(S,E={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...E,_n:E.lines?`
403
- `:""},this._extScope=S,this._scope=new r.Scope({parent:S}),this._nodes=[new p]}toString(){return this._root.render(this.opts)}name(S){return this._scope.name(S)}scopeName(S){return this._extScope.name(S)}scopeValue(S,E){const D=this._extScope.value(S,E);return(this._values[D.prefix]||(this._values[D.prefix]=new Set)).add(D),D}getScopeValue(S,E){return this._extScope.getValue(S,E)}scopeRefs(S){return this._extScope.scopeRefs(S,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(S,E,D,K){const Z=this._scope.toName(E);return D!==void 0&&K&&(this._constants[Z.str]=D),this._leafNode(new i(S,Z,D)),Z}const(S,E,D){return this._def(r.varKinds.const,S,E,D)}let(S,E,D){return this._def(r.varKinds.let,S,E,D)}var(S,E,D){return this._def(r.varKinds.var,S,E,D)}assign(S,E,D){return this._leafNode(new a(S,E,D))}add(S,E){return this._leafNode(new c(S,e.operators.ADD,E))}code(S){return typeof S=="function"?S():S!==t.nil&&this._leafNode(new g(S)),this}object(...S){const E=["{"];for(const[D,K]of S)E.length>1&&E.push(","),E.push(D),(D!==K||this.opts.es5)&&(E.push(":"),(0,t.addCodeArg)(E,K));return E.push("}"),new t._Code(E)}if(S,E,D){if(this._blockNode(new m(S)),E&&D)this.code(E).else().code(D).endIf();else if(E)this.code(E).endIf();else if(D)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(S){return this._elseNode(new m(S))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(m,y)}_for(S,E){return this._blockNode(S),E&&this.code(E).endFor(),this}for(S,E){return this._for(new x(S),E)}forRange(S,E,D,K,Z=this.opts.es5?r.varKinds.var:r.varKinds.let){const ce=this._scope.toName(S);return this._for(new _(Z,ce,E,D),()=>K(ce))}forOf(S,E,D,K=r.varKinds.const){const Z=this._scope.toName(S);if(this.opts.es5){const ce=E instanceof t.Name?E:this.var("_arr",E);return this.forRange("_i",0,(0,t._)`${ce}.length`,re=>{this.var(Z,(0,t._)`${ce}[${re}]`),D(Z)})}return this._for(new C("of",K,Z,E),()=>D(Z))}forIn(S,E,D,K=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(S,(0,t._)`Object.keys(${E})`,D);const Z=this._scope.toName(S);return this._for(new C("in",K,Z,E),()=>D(Z))}endFor(){return this._endBlockNode(h)}label(S){return this._leafNode(new u(S))}break(S){return this._leafNode(new d(S))}return(S){const E=new $;if(this._blockNode(E),this.code(S),E.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode($)}try(S,E,D){if(!E&&!D)throw new Error('CodeGen: "try" without "catch" and "finally"');const K=new O;if(this._blockNode(K),this.code(S),E){const Z=this.name("e");this._currNode=K.catch=new M(Z),E(Z)}return D&&(this._currNode=K.finally=new U,this.code(D)),this._endBlockNode(M,U)}throw(S){return this._leafNode(new f(S))}block(S,E){return this._blockStarts.push(this._nodes.length),S&&this.code(S).endBlock(E),this}endBlock(S){const E=this._blockStarts.pop();if(E===void 0)throw new Error("CodeGen: not in self-balancing block");const D=this._nodes.length-E;if(D<0||S!==void 0&&D!==S)throw new Error(`CodeGen: wrong number of nodes: ${D} vs ${S} expected`);return this._nodes.length=E,this}func(S,E=t.nil,D,K){return this._blockNode(new T(S,E,D)),K&&this.code(K).endFunc(),this}endFunc(){return this._endBlockNode(T)}optimize(S=1){for(;S-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(S){return this._currNode.nodes.push(S),this}_blockNode(S){this._currNode.nodes.push(S),this._nodes.push(S)}_endBlockNode(S,E){const D=this._currNode;if(D instanceof S||E&&D instanceof E)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${E?`${S.kind}/${E.kind}`:S.kind}"`)}_elseNode(S){const E=this._currNode;if(!(E instanceof m))throw new Error('CodeGen: "else" without "if"');return this._currNode=E.else=S,this}get _root(){return this._nodes[0]}get _currNode(){const S=this._nodes;return S[S.length-1]}set _currNode(S){const E=this._nodes;E[E.length-1]=S}}e.CodeGen=j;function k(N,S){for(const E in S)N[E]=(N[E]||0)+(S[E]||0);return N}function L(N,S){return S instanceof t._CodeOrName?k(N,S.names):N}function P(N,S,E){if(N instanceof t.Name)return D(N);if(!K(N))return N;return new t._Code(N._items.reduce((Z,ce)=>(ce instanceof t.Name&&(ce=D(ce)),ce instanceof t._Code?Z.push(...ce._items):Z.push(ce),Z),[]));function D(Z){const ce=E[Z.str];return ce===void 0||S[Z.str]!==1?Z:(delete S[Z.str],ce)}function K(Z){return Z instanceof t._Code&&Z._items.some(ce=>ce instanceof t.Name&&S[ce.str]===1&&E[ce.str]!==void 0)}}function B(N,S){for(const E in S)N[E]=(N[E]||0)-(S[E]||0)}function H(N){return typeof N=="boolean"||typeof N=="number"||N===null?!N:(0,t._)`!${F(N)}`}e.not=H;const G=I(e.operators.AND);function q(...N){return N.reduce(G)}e.and=q;const V=I(e.operators.OR);function z(...N){return N.reduce(V)}e.or=z;function I(N){return(S,E)=>S===t.nil?E:E===t.nil?S:(0,t._)`${F(S)} ${N} ${F(E)}`}function F(N){return N instanceof t.Name?N:(0,t._)`(${N})`}})(je);var oe={};Object.defineProperty(oe,"__esModule",{value:!0});oe.checkStrictMode=oe.getErrorPath=oe.Type=oe.useFunc=oe.setEvaluated=oe.evaluatedPropsToName=oe.mergeEvaluated=oe.eachItem=oe.unescapeJsonPointer=oe.escapeJsonPointer=oe.escapeFragment=oe.unescapeFragment=oe.schemaRefOrVal=oe.schemaHasRulesButRef=oe.schemaHasRules=oe.checkUnknownRules=oe.alwaysValidSchema=oe.toHash=void 0;const Ke=je,m9=tc;function g9(e){const t={};for(const r of e)t[r]=!0;return t}oe.toHash=g9;function v9(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(nj(e,t),!sj(t,e.self.RULES.all))}oe.alwaysValidSchema=v9;function nj(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;const s=n.RULES.keywords;for(const o in t)s[o]||aj(e,`unknown keyword: "${o}"`)}oe.checkUnknownRules=nj;function sj(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return!0;return!1}oe.schemaHasRules=sj;function y9(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}oe.schemaHasRulesButRef=y9;function w9({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ke._)`${r}`}return(0,Ke._)`${e}${t}${(0,Ke.getProperty)(n)}`}oe.schemaRefOrVal=w9;function x9(e){return oj(decodeURIComponent(e))}oe.unescapeFragment=x9;function b9(e){return encodeURIComponent(fy(e))}oe.escapeFragment=b9;function fy(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}oe.escapeJsonPointer=fy;function oj(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}oe.unescapeJsonPointer=oj;function _9(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)}oe.eachItem=_9;function Bx({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,o,i,a)=>{const c=i===void 0?o:i instanceof Ke.Name?(o instanceof Ke.Name?e(s,o,i):t(s,o,i),i):o instanceof Ke.Name?(t(s,i,o),o):r(o,i);return a===Ke.Name&&!(c instanceof Ke.Name)?n(s,c):c}}oe.mergeEvaluated={props:Bx({mergeNames:(e,t,r)=>e.if((0,Ke._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Ke._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Ke._)`${r} || {}`).code((0,Ke._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Ke._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,Ke._)`${r} || {}`),hy(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:ij}),items:Bx({mergeNames:(e,t,r)=>e.if((0,Ke._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Ke._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Ke._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,Ke._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function ij(e,t){if(t===!0)return e.var("props",!0);const r=e.var("props",(0,Ke._)`{}`);return t!==void 0&&hy(e,r,t),r}oe.evaluatedPropsToName=ij;function hy(e,t,r){Object.keys(r).forEach(n=>e.assign((0,Ke._)`${t}${(0,Ke.getProperty)(n)}`,!0))}oe.setEvaluated=hy;const Wx={};function S9(e,t){return e.scopeValue("func",{ref:t,code:Wx[t.code]||(Wx[t.code]=new m9._Code(t.code))})}oe.useFunc=S9;var Qm;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Qm||(oe.Type=Qm={}));function k9(e,t,r){if(e instanceof Ke.Name){const n=t===Qm.Num;return r?n?(0,Ke._)`"[" + ${e} + "]"`:(0,Ke._)`"['" + ${e} + "']"`:n?(0,Ke._)`"/" + ${e}`:(0,Ke._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ke.getProperty)(e).toString():"/"+fy(e)}oe.getErrorPath=k9;function aj(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}oe.checkStrictMode=aj;var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});const Bt=je,C9={data:new Bt.Name("data"),valCxt:new Bt.Name("valCxt"),instancePath:new Bt.Name("instancePath"),parentData:new Bt.Name("parentData"),parentDataProperty:new Bt.Name("parentDataProperty"),rootData:new Bt.Name("rootData"),dynamicAnchors:new Bt.Name("dynamicAnchors"),vErrors:new Bt.Name("vErrors"),errors:new Bt.Name("errors"),this:new Bt.Name("this"),self:new Bt.Name("self"),scope:new Bt.Name("scope"),json:new Bt.Name("json"),jsonPos:new Bt.Name("jsonPos"),jsonLen:new Bt.Name("jsonLen"),jsonPart:new Bt.Name("jsonPart")};Dn.default=C9;(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=je,r=oe,n=Dn;e.keywordError={message:({keyword:y})=>(0,t.str)`must pass "${y}" keyword validation`},e.keyword$DataError={message:({keyword:y,schemaType:m})=>m?(0,t.str)`"${y}" keyword must be ${m} ($data)`:(0,t.str)`"${y}" keyword is invalid ($data)`};function s(y,m=e.keywordError,h,x){const{it:_}=y,{gen:C,compositeRule:T,allErrors:$}=_,O=f(y,m,h);x??(T||$)?c(C,O):u(_,(0,t._)`[${O}]`)}e.reportError=s;function o(y,m=e.keywordError,h){const{it:x}=y,{gen:_,compositeRule:C,allErrors:T}=x,$=f(y,m,h);c(_,$),C||T||u(x,n.default.vErrors)}e.reportExtraError=o;function i(y,m){y.assign(n.default.errors,m),y.if((0,t._)`${n.default.vErrors} !== null`,()=>y.if(m,()=>y.assign((0,t._)`${n.default.vErrors}.length`,m),()=>y.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:y,keyword:m,schemaValue:h,data:x,errsCount:_,it:C}){if(_===void 0)throw new Error("ajv implementation error");const T=y.name("err");y.forRange("i",_,n.default.errors,$=>{y.const(T,(0,t._)`${n.default.vErrors}[${$}]`),y.if((0,t._)`${T}.instancePath === undefined`,()=>y.assign((0,t._)`${T}.instancePath`,(0,t.strConcat)(n.default.instancePath,C.errorPath))),y.assign((0,t._)`${T}.schemaPath`,(0,t.str)`${C.errSchemaPath}/${m}`),C.opts.verbose&&(y.assign((0,t._)`${T}.schema`,h),y.assign((0,t._)`${T}.data`,x))})}e.extendErrors=a;function c(y,m){const h=y.const("err",m);y.if((0,t._)`${n.default.vErrors} === null`,()=>y.assign(n.default.vErrors,(0,t._)`[${h}]`),(0,t._)`${n.default.vErrors}.push(${h})`),y.code((0,t._)`${n.default.errors}++`)}function u(y,m){const{gen:h,validateName:x,schemaEnv:_}=y;_.$async?h.throw((0,t._)`new ${y.ValidationError}(${m})`):(h.assign((0,t._)`${x}.errors`,m),h.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(y,m,h){const{createErrors:x}=y.it;return x===!1?(0,t._)`{}`:g(y,m,h)}function g(y,m,h={}){const{gen:x,it:_}=y,C=[v(_,h),b(y,h)];return p(y,m,C),x.object(...C)}function v({errorPath:y},{instancePath:m}){const h=m?(0,t.str)`${y}${(0,r.getErrorPath)(m,r.Type.Str)}`:y;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,h)]}function b({keyword:y,it:{errSchemaPath:m}},{schemaPath:h,parentSchema:x}){let _=x?m:(0,t.str)`${m}/${y}`;return h&&(_=(0,t.str)`${_}${(0,r.getErrorPath)(h,r.Type.Str)}`),[d.schemaPath,_]}function p(y,{params:m,message:h},x){const{keyword:_,data:C,schemaValue:T,it:$}=y,{opts:O,propertyName:M,topSchemaRef:U,schemaPath:j}=$;x.push([d.keyword,_],[d.params,typeof m=="function"?m(y):m||(0,t._)`{}`]),O.messages&&x.push([d.message,typeof h=="function"?h(y):h]),O.verbose&&x.push([d.schema,T],[d.parentSchema,(0,t._)`${U}${j}`],[n.default.data,C]),M&&x.push([d.propertyName,M])}})(Ec);Object.defineProperty(Sa,"__esModule",{value:!0});Sa.boolOrEmptySchema=Sa.topBoolOrEmptySchema=void 0;const E9=Ec,N9=je,j9=Dn,$9={message:"boolean schema is false"};function P9(e){const{gen:t,schema:r,validateName:n}=e;r===!1?lj(e,!1):typeof r=="object"&&r.$async===!0?t.return(j9.default.data):(t.assign((0,N9._)`${n}.errors`,null),t.return(!0))}Sa.topBoolOrEmptySchema=P9;function T9(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),lj(e)):r.var(t,!0)}Sa.boolOrEmptySchema=T9;function lj(e,t){const{gen:r,data:n}=e,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,E9.reportError)(s,$9,void 0,t)}var St={},ri={};Object.defineProperty(ri,"__esModule",{value:!0});ri.getRules=ri.isJSONType=void 0;const R9=["string","number","integer","boolean","null","object","array"],I9=new Set(R9);function A9(e){return typeof e=="string"&&I9.has(e)}ri.isJSONType=A9;function O9(){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:{}}}ri.getRules=O9;var es={};Object.defineProperty(es,"__esModule",{value:!0});es.shouldUseRule=es.shouldUseGroup=es.schemaHasRulesForType=void 0;function M9({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&cj(e,n)}es.schemaHasRulesForType=M9;function cj(e,t){return t.rules.some(r=>uj(e,r))}es.shouldUseGroup=cj;function uj(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}es.shouldUseRule=uj;Object.defineProperty(St,"__esModule",{value:!0});St.reportTypeError=St.checkDataTypes=St.checkDataType=St.coerceAndCheckDataType=St.getJSONTypes=St.getSchemaTypes=St.DataType=void 0;const D9=ri,z9=es,L9=Ec,Ce=je,dj=oe;var Zi;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Zi||(St.DataType=Zi={}));function F9(e){const t=fj(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}St.getSchemaTypes=F9;function fj(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(D9.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}St.getJSONTypes=fj;function U9(e,t){const{gen:r,data:n,opts:s}=e,o=q9(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&(0,z9.schemaHasRulesForType)(e,t[0]));if(i){const a=py(t,n,s.strictNumbers,Zi.Wrong);r.if(a,()=>{o.length?V9(e,t,o):my(e)})}return i}St.coerceAndCheckDataType=U9;const hj=new Set(["string","number","integer","boolean","null"]);function q9(e,t){return t?e.filter(r=>hj.has(r)||t==="array"&&r==="array"):[]}function V9(e,t,r){const{gen:n,data:s,opts:o}=e,i=n.let("dataType",(0,Ce._)`typeof ${s}`),a=n.let("coerced",(0,Ce._)`undefined`);o.coerceTypes==="array"&&n.if((0,Ce._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,Ce._)`${s}[0]`).assign(i,(0,Ce._)`typeof ${s}`).if(py(t,s,o.strictNumbers),()=>n.assign(a,s))),n.if((0,Ce._)`${a} !== undefined`);for(const u of r)(hj.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),my(e),n.endIf(),n.if((0,Ce._)`${a} !== undefined`,()=>{n.assign(s,a),H9(e,a)});function c(u){switch(u){case"string":n.elseIf((0,Ce._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,Ce._)`"" + ${s}`).elseIf((0,Ce._)`${s} === null`).assign(a,(0,Ce._)`""`);return;case"number":n.elseIf((0,Ce._)`${i} == "boolean" || ${s} === null
404
- || (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,Ce._)`+${s}`);return;case"integer":n.elseIf((0,Ce._)`${i} === "boolean" || ${s} === null
405
- || (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,Ce._)`+${s}`);return;case"boolean":n.elseIf((0,Ce._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,Ce._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Ce._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Ce._)`${i} === "string" || ${i} === "number"
406
- || ${i} === "boolean" || ${s} === null`).assign(a,(0,Ce._)`[${s}]`)}}}function H9({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,Ce._)`${t} !== undefined`,()=>e.assign((0,Ce._)`${t}[${r}]`,n))}function Jm(e,t,r,n=Zi.Correct){const s=n===Zi.Correct?Ce.operators.EQ:Ce.operators.NEQ;let o;switch(e){case"null":return(0,Ce._)`${t} ${s} null`;case"array":o=(0,Ce._)`Array.isArray(${t})`;break;case"object":o=(0,Ce._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i((0,Ce._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return(0,Ce._)`typeof ${t} ${s} ${e}`}return n===Zi.Correct?o:(0,Ce.not)(o);function i(a=Ce.nil){return(0,Ce.and)((0,Ce._)`typeof ${t} == "number"`,a,r?(0,Ce._)`isFinite(${t})`:Ce.nil)}}St.checkDataType=Jm;function py(e,t,r,n){if(e.length===1)return Jm(e[0],t,r,n);let s;const o=(0,dj.toHash)(e);if(o.array&&o.object){const i=(0,Ce._)`typeof ${t} != "object"`;s=o.null?i:(0,Ce._)`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=Ce.nil;o.number&&delete o.integer;for(const i in o)s=(0,Ce.and)(s,Jm(i,t,r,n));return s}St.checkDataTypes=py;const K9={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Ce._)`{type: ${e}}`:(0,Ce._)`{type: ${t}}`};function my(e){const t=B9(e);(0,L9.reportError)(t,K9)}St.reportTypeError=my;function B9(e){const{gen:t,data:r,schema:n}=e,s=(0,dj.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}var Lf={};Object.defineProperty(Lf,"__esModule",{value:!0});Lf.assignDefaults=void 0;const pi=je,W9=oe;function Z9(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)Zx(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>Zx(e,o,s.default))}Lf.assignDefaults=Z9;function Zx(e,t,r){const{gen:n,compositeRule:s,data:o,opts:i}=e;if(r===void 0)return;const a=(0,pi._)`${o}${(0,pi.getProperty)(t)}`;if(s){(0,W9.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,pi._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,pi._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,pi._)`${a} = ${(0,pi.stringify)(r)}`)}var jn={},$e={};Object.defineProperty($e,"__esModule",{value:!0});$e.validateUnion=$e.validateArray=$e.usePattern=$e.callValidateCode=$e.schemaProperties=$e.allSchemaProperties=$e.noPropertyInData=$e.propertyInData=$e.isOwnProperty=$e.hasPropFunc=$e.reportMissingProp=$e.checkMissingProp=$e.checkReportMissingProp=void 0;const Je=je,gy=oe,gs=Dn,G9=oe;function Q9(e,t){const{gen:r,data:n,it:s}=e;r.if(yy(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Je._)`${t}`},!0),e.error()})}$e.checkReportMissingProp=Q9;function J9({gen:e,data:t,it:{opts:r}},n,s){return(0,Je.or)(...n.map(o=>(0,Je.and)(yy(e,t,o,r.ownProperties),(0,Je._)`${s} = ${o}`)))}$e.checkMissingProp=J9;function Y9(e,t){e.setParams({missingProperty:t},!0),e.error()}$e.reportMissingProp=Y9;function pj(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Je._)`Object.prototype.hasOwnProperty`})}$e.hasPropFunc=pj;function vy(e,t,r){return(0,Je._)`${pj(e)}.call(${t}, ${r})`}$e.isOwnProperty=vy;function X9(e,t,r,n){const s=(0,Je._)`${t}${(0,Je.getProperty)(r)} !== undefined`;return n?(0,Je._)`${s} && ${vy(e,t,r)}`:s}$e.propertyInData=X9;function yy(e,t,r,n){const s=(0,Je._)`${t}${(0,Je.getProperty)(r)} === undefined`;return n?(0,Je.or)(s,(0,Je.not)(vy(e,t,r))):s}$e.noPropertyInData=yy;function mj(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}$e.allSchemaProperties=mj;function e6(e,t){return mj(t).filter(r=>!(0,gy.alwaysValidSchema)(e,t[r]))}$e.schemaProperties=e6;function t6({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},a,c,u){const d=u?(0,Je._)`${e}, ${t}, ${n}${s}`:t,f=[[gs.default.instancePath,(0,Je.strConcat)(gs.default.instancePath,o)],[gs.default.parentData,i.parentData],[gs.default.parentDataProperty,i.parentDataProperty],[gs.default.rootData,gs.default.rootData]];i.opts.dynamicRef&&f.push([gs.default.dynamicAnchors,gs.default.dynamicAnchors]);const g=(0,Je._)`${d}, ${r.object(...f)}`;return c!==Je.nil?(0,Je._)`${a}.call(${c}, ${g})`:(0,Je._)`${a}(${g})`}$e.callValidateCode=t6;const r6=(0,Je._)`new RegExp`;function n6({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Je._)`${s.code==="new RegExp"?r6:(0,G9.useFunc)(e,s)}(${r}, ${n})`})}$e.usePattern=n6;function s6(e){const{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){const a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){const c=t.const("len",(0,Je._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:gy.Type.Num},o),t.if((0,Je.not)(o),a)})}}$e.validateArray=s6;function o6(e){const{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,gy.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;const i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{const d=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,Je._)`${i} || ${a}`),e.mergeValidEvaluated(d,a)||t.if((0,Je.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}$e.validateUnion=o6;Object.defineProperty(jn,"__esModule",{value:!0});jn.validateKeywordUsage=jn.validSchemaType=jn.funcKeywordCode=jn.macroKeywordCode=void 0;const tr=je,No=Dn,i6=$e,a6=Ec;function l6(e,t){const{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),c=gj(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);const u=r.name("valid");e.subschema({schema:a,schemaPath:tr.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}jn.macroKeywordCode=l6;function c6(e,t){var r;const{gen:n,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=e;d6(c,t);const u=!a&&t.compile?t.compile.call(c.self,o,i,c):t.validate,d=gj(n,s,u),f=n.let("valid");e.block$data(f,g),e.ok((r=t.valid)!==null&&r!==void 0?r:f);function g(){if(t.errors===!1)p(),t.modifying&&Gx(e),y(()=>e.error());else{const m=t.async?v():b();t.modifying&&Gx(e),y(()=>u6(e,m))}}function v(){const m=n.let("ruleErrs",null);return n.try(()=>p((0,tr._)`await `),h=>n.assign(f,!1).if((0,tr._)`${h} instanceof ${c.ValidationError}`,()=>n.assign(m,(0,tr._)`${h}.errors`),()=>n.throw(h))),m}function b(){const m=(0,tr._)`${d}.errors`;return n.assign(m,null),p(tr.nil),m}function p(m=t.async?(0,tr._)`await `:tr.nil){const h=c.opts.passContext?No.default.this:No.default.self,x=!("compile"in t&&!a||t.schema===!1);n.assign(f,(0,tr._)`${m}${(0,i6.callValidateCode)(e,d,h,x)}`,t.modifying)}function y(m){var h;n.if((0,tr.not)((h=t.valid)!==null&&h!==void 0?h:f),m)}}jn.funcKeywordCode=c6;function Gx(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,tr._)`${n.parentData}[${n.parentDataProperty}]`))}function u6(e,t){const{gen:r}=e;r.if((0,tr._)`Array.isArray(${t})`,()=>{r.assign(No.default.vErrors,(0,tr._)`${No.default.vErrors} === null ? ${t} : ${No.default.vErrors}.concat(${t})`).assign(No.default.errors,(0,tr._)`${No.default.vErrors}.length`),(0,a6.extendErrors)(e)},()=>e.error())}function d6({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function gj(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,tr.stringify)(r)})}function f6(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}jn.validSchemaType=f6;function h6({schema:e,opts:t,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");const i=s.dependencies;if(i!=null&&i.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[o])){const c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}jn.validateKeywordUsage=h6;var Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.extendSubschemaMode=Js.extendSubschemaData=Js.getSubschema=void 0;const En=je,vj=oe;function p6(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,En._)`${e.schemaPath}${(0,En.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,En._)`${e.schemaPath}${(0,En.getProperty)(t)}${(0,En.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,vj.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Js.getSubschema=p6;function m6(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:a}=t;if(r!==void 0){const{errorPath:u,dataPathArr:d,opts:f}=t,g=a.let("data",(0,En._)`${t.data}${(0,En.getProperty)(r)}`,!0);c(g),e.errorPath=(0,En.str)`${u}${(0,vj.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,En._)`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(s!==void 0){const u=s instanceof En.Name?s:a.let("data",s,!0);c(u),i!==void 0&&(e.propertyName=i)}o&&(e.dataTypes=o);function c(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=m6;function g6(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}Js.extendSubschemaMode=g6;var Mt={},yj=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r},wj={exports:{}},Fs=wj.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};zu(t,n,s,e,"",e)};Fs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Fs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Fs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Fs.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 zu(e,t,r,n,s,o,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,i,a,c,u);for(var d in n){var f=n[d];if(Array.isArray(f)){if(d in Fs.arrayKeywords)for(var g=0;g<f.length;g++)zu(e,t,r,f[g],s+"/"+d+"/"+g,o,s,d,n,g)}else if(d in Fs.propsKeywords){if(f&&typeof f=="object")for(var v in f)zu(e,t,r,f[v],s+"/"+d+"/"+v6(v),o,s,d,n,v)}else(d in Fs.keywords||e.allKeys&&!(d in Fs.skipKeywords))&&zu(e,t,r,f,s+"/"+d,o,s,d,n)}r(n,s,o,i,a,c,u)}}function v6(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var y6=wj.exports;Object.defineProperty(Mt,"__esModule",{value:!0});Mt.getSchemaRefs=Mt.resolveUrl=Mt.normalizeId=Mt._getFullPath=Mt.getFullPath=Mt.inlineRef=void 0;const w6=oe,x6=yj,b6=y6,_6=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function S6(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Ym(e):t?xj(e)<=t:!1}Mt.inlineRef=S6;const k6=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ym(e){for(const t in e){if(k6.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(Ym)||typeof r=="object"&&Ym(r))return!0}return!1}function xj(e){let t=0;for(const r in e){if(r==="$ref")return 1/0;if(t++,!_6.has(r)&&(typeof e[r]=="object"&&(0,w6.eachItem)(e[r],n=>t+=xj(n)),t===1/0))return 1/0}return t}function bj(e,t="",r){r!==!1&&(t=Gi(t));const n=e.parse(t);return _j(e,n)}Mt.getFullPath=bj;function _j(e,t){return e.serialize(t).split("#")[0]+"#"}Mt._getFullPath=_j;const C6=/#\/?$/;function Gi(e){return e?e.replace(C6,""):""}Mt.normalizeId=Gi;function E6(e,t,r){return r=Gi(r),e.resolve(t,r)}Mt.resolveUrl=E6;const N6=/^[a-z_][-a-z0-9._]*$/i;function j6(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=Gi(e[r]||t),o={"":s},i=bj(n,s,!1),a={},c=new Set;return b6(e,{allKeys:!0},(f,g,v,b)=>{if(b===void 0)return;const p=i+g;let y=o[b];typeof f[r]=="string"&&(y=m.call(this,f[r])),h.call(this,f.$anchor),h.call(this,f.$dynamicAnchor),o[g]=y;function m(x){const _=this.opts.uriResolver.resolve;if(x=Gi(y?_(y,x):x),c.has(x))throw d(x);c.add(x);let C=this.refs[x];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?u(f,C.schema,x):x!==Gi(p)&&(x[0]==="#"?(u(f,a[x],x),a[x]=f):this.refs[x]=p),x}function h(x){if(typeof x=="string"){if(!N6.test(x))throw new Error(`invalid anchor "${x}"`);m.call(this,`#${x}`)}}}),a;function u(f,g,v){if(g!==void 0&&!x6(f,g))throw d(v)}function d(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Mt.getSchemaRefs=j6;Object.defineProperty(an,"__esModule",{value:!0});an.getData=an.KeywordCxt=an.validateFunctionCode=void 0;const Sj=Sa,Qx=St,wy=es,Ud=St,$6=Lf,Nl=jn,Bh=Js,fe=je,we=Dn,P6=Mt,ts=oe,Ya=Ec;function T6(e){if(Ej(e)&&(Nj(e),Cj(e))){A6(e);return}kj(e,()=>(0,Sj.topBoolOrEmptySchema)(e))}an.validateFunctionCode=T6;function kj({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0,fe._)`${we.default.data}, ${we.default.valCxt}`,n.$async,()=>{e.code((0,fe._)`"use strict"; ${Jx(r,s)}`),I6(e,s),e.code(o)}):e.func(t,(0,fe._)`${we.default.data}, ${R6(s)}`,n.$async,()=>e.code(Jx(r,s)).code(o))}function R6(e){return(0,fe._)`{${we.default.instancePath}="", ${we.default.parentData}, ${we.default.parentDataProperty}, ${we.default.rootData}=${we.default.data}${e.dynamicRef?(0,fe._)`, ${we.default.dynamicAnchors}={}`:fe.nil}}={}`}function I6(e,t){e.if(we.default.valCxt,()=>{e.var(we.default.instancePath,(0,fe._)`${we.default.valCxt}.${we.default.instancePath}`),e.var(we.default.parentData,(0,fe._)`${we.default.valCxt}.${we.default.parentData}`),e.var(we.default.parentDataProperty,(0,fe._)`${we.default.valCxt}.${we.default.parentDataProperty}`),e.var(we.default.rootData,(0,fe._)`${we.default.valCxt}.${we.default.rootData}`),t.dynamicRef&&e.var(we.default.dynamicAnchors,(0,fe._)`${we.default.valCxt}.${we.default.dynamicAnchors}`)},()=>{e.var(we.default.instancePath,(0,fe._)`""`),e.var(we.default.parentData,(0,fe._)`undefined`),e.var(we.default.parentDataProperty,(0,fe._)`undefined`),e.var(we.default.rootData,we.default.data),t.dynamicRef&&e.var(we.default.dynamicAnchors,(0,fe._)`{}`)})}function A6(e){const{schema:t,opts:r,gen:n}=e;kj(e,()=>{r.$comment&&t.$comment&&$j(e),L6(e),n.let(we.default.vErrors,null),n.let(we.default.errors,0),r.unevaluated&&O6(e),jj(e),q6(e)})}function O6(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,fe._)`${r}.evaluated`),t.if((0,fe._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,fe._)`${e.evaluated}.props`,(0,fe._)`undefined`)),t.if((0,fe._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,fe._)`${e.evaluated}.items`,(0,fe._)`undefined`))}function Jx(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,fe._)`/*# sourceURL=${r} */`:fe.nil}function M6(e,t){if(Ej(e)&&(Nj(e),Cj(e))){D6(e,t);return}(0,Sj.boolOrEmptySchema)(e,t)}function Cj({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function Ej(e){return typeof e.schema!="boolean"}function D6(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&$j(e),F6(e),U6(e);const o=n.const("_errs",we.default.errors);jj(e,o),n.var(t,(0,fe._)`${o} === ${we.default.errors}`)}function Nj(e){(0,ts.checkUnknownRules)(e),z6(e)}function jj(e,t){if(e.opts.jtd)return Yx(e,[],!1,t);const r=(0,Qx.getSchemaTypes)(e.schema),n=(0,Qx.coerceAndCheckDataType)(e,r);Yx(e,r,!n,t)}function z6(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,ts.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function L6(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ts.checkStrictMode)(e,"default is ignored in the schema root")}function F6(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,P6.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function U6(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function $j({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){const o=r.$comment;if(s.$comment===!0)e.code((0,fe._)`${we.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){const i=(0,fe.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,fe._)`${we.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function q6(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0,fe._)`${we.default.errors} === 0`,()=>t.return(we.default.data),()=>t.throw((0,fe._)`new ${s}(${we.default.vErrors})`)):(t.assign((0,fe._)`${n}.errors`,we.default.vErrors),o.unevaluated&&V6(e),t.return((0,fe._)`${we.default.errors} === 0`))}function V6({gen:e,evaluated:t,props:r,items:n}){r instanceof fe.Name&&e.assign((0,fe._)`${t}.props`,r),n instanceof fe.Name&&e.assign((0,fe._)`${t}.items`,n)}function Yx(e,t,r,n){const{gen:s,schema:o,data:i,allErrors:a,opts:c,self:u}=e,{RULES:d}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,ts.schemaHasRulesButRef)(o,d))){s.block(()=>Rj(e,"$ref",d.all.$ref.definition));return}c.jtd||H6(e,t),s.block(()=>{for(const g of d.rules)f(g);f(d.post)});function f(g){(0,wy.shouldUseGroup)(o,g)&&(g.type?(s.if((0,Ud.checkDataType)(g.type,i,c.strictNumbers)),Xx(e,g),t.length===1&&t[0]===g.type&&r&&(s.else(),(0,Ud.reportTypeError)(e)),s.endIf()):Xx(e,g),a||s.if((0,fe._)`${we.default.errors} === ${n||0}`))}}function Xx(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,$6.assignDefaults)(e,t.type),r.block(()=>{for(const o of t.rules)(0,wy.shouldUseRule)(n,o)&&Rj(e,o.keyword,o.definition,t.type)})}function H6(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(K6(e,t),e.opts.allowUnionTypes||B6(e,t),W6(e,e.dataTypes))}function K6(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Pj(e.dataTypes,r)||xy(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),G6(e,t)}}function B6(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&xy(e,"use allowUnionTypes to allow union type keyword")}function W6(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,wy.shouldUseRule)(e.schema,s)){const{type:o}=s.definition;o.length&&!o.some(i=>Z6(t,i))&&xy(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function Z6(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Pj(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function G6(e,t){const r=[];for(const n of e.dataTypes)Pj(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function xy(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,ts.checkStrictMode)(e,t,e.opts.strictTypes)}class Tj{constructor(t,r,n){if((0,Nl.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ts.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Ij(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Nl.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",we.default.errors))}result(t,r,n){this.failResult((0,fe.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,fe.not)(t),void 0,r)}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:r}=this;this.fail((0,fe._)`${r} !== undefined && (${(0,fe.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Ya.reportExtraError:Ya.reportError)(this,this.def.error,r)}$dataError(){(0,Ya.reportError)(this,this.def.$dataError||Ya.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ya.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=fe.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=fe.nil,r=fe.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:o,def:i}=this;n.if((0,fe.or)((0,fe._)`${s} === undefined`,r)),t!==fe.nil&&n.assign(t,!0),(o.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==fe.nil&&n.assign(t,!1)),n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,fe.or)(i(),a());function i(){if(n.length){if(!(r instanceof fe.Name))throw new Error("ajv implementation error");const c=Array.isArray(n)?n:[n];return(0,fe._)`${(0,Ud.checkDataTypes)(c,r,o.opts.strictNumbers,Ud.DataType.Wrong)}`}return fe.nil}function a(){if(s.validateSchema){const c=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,fe._)`!${c}(${r})`}return fe.nil}}subschema(t,r){const n=(0,Bh.getSubschema)(this.it,t);(0,Bh.extendSubschemaData)(n,this.it,t),(0,Bh.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return M6(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=ts.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=ts.mergeEvaluated.items(s,t.items,n.items,r)))}mergeValidEvaluated(t,r){const{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(t,fe.Name)),!0}}an.KeywordCxt=Tj;function Rj(e,t,r,n){const s=new Tj(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,Nl.funcKeywordCode)(s,r):"macro"in r?(0,Nl.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,Nl.funcKeywordCode)(s,r)}const Q6=/^\/(?:[^~]|~0|~1)*$/,J6=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ij(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return we.default.rootData;if(e[0]==="/"){if(!Q6.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=we.default.rootData}else{const u=J6.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);const d=+u[1];if(s=u[2],s==="#"){if(d>=t)throw new Error(c("property/index",d));return n[t-d]}if(d>t)throw new Error(c("data",d));if(o=r[t-d],!s)return o}let i=o;const a=s.split("/");for(const u of a)u&&(o=(0,fe._)`${o}${(0,fe.getProperty)((0,ts.unescapeJsonPointer)(u))}`,i=(0,fe._)`${i} && ${o}`);return i;function c(u,d){return`Cannot access ${u} ${d} levels up, current level is ${t}`}}an.getData=Ij;var Nc={};Object.defineProperty(Nc,"__esModule",{value:!0});class Y6 extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}Nc.default=Y6;var Da={};Object.defineProperty(Da,"__esModule",{value:!0});const Wh=Mt;class X6 extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Wh.resolveUrl)(t,r,n),this.missingSchema=(0,Wh.normalizeId)((0,Wh.getFullPath)(t,this.missingRef))}}Da.default=X6;var hr={};Object.defineProperty(hr,"__esModule",{value:!0});hr.resolveSchema=hr.getCompilingSchema=hr.resolveRef=hr.compileSchema=hr.SchemaEnv=void 0;const Kr=je,e8=Nc,xo=Dn,rn=Mt,eb=oe,t8=an;class Ff{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,rn.normalizeId)(n==null?void 0:n[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n==null?void 0:n.$async,this.refs={}}}hr.SchemaEnv=Ff;function by(e){const t=Aj.call(this,e);if(t)return t;const r=(0,rn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new Kr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let a;e.$async&&(a=i.scopeValue("Error",{ref:e8.default,code:(0,Kr._)`require("ajv/dist/runtime/validation_error").default`}));const c=i.scopeName("validate");e.validateName=c;const u={gen:i,allErrors:this.opts.allErrors,data:xo.default.data,parentData:xo.default.parentData,parentDataProperty:xo.default.parentDataProperty,dataNames:[xo.default.data],dataPathArr:[Kr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Kr.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Kr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Kr._)`""`,opts:this.opts,self:this};let d;try{this._compilations.add(e),(0,t8.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);const f=i.toString();d=`${i.scopeRefs(xo.default.scope)}return ${f}`,this.opts.code.process&&(d=this.opts.code.process(d,e));const v=new Function(`${xo.default.self}`,`${xo.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{ref:v}),v.errors=null,v.schema=e.schema,v.schemaEnv=e,e.$async&&(v.$async=!0),this.opts.code.source===!0&&(v.source={validateName:c,validateCode:f,scopeValues:i._values}),this.opts.unevaluated){const{props:b,items:p}=u;v.evaluated={props:b instanceof Kr.Name?void 0:b,items:p instanceof Kr.Name?void 0:p,dynamicProps:b instanceof Kr.Name,dynamicItems:p instanceof Kr.Name},v.source&&(v.source.evaluated=(0,Kr.stringify)(v.evaluated))}return e.validate=v,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)}}hr.compileSchema=by;function r8(e,t,r){var n;r=(0,rn.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let o=o8.call(this,e,r);if(o===void 0){const i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new Ff({schema:i,schemaId:a,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=n8.call(this,o)}hr.resolveRef=r8;function n8(e){return(0,rn.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:by.call(this,e)}function Aj(e){for(const t of this._compilations)if(s8(t,e))return t}hr.getCompilingSchema=Aj;function s8(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function o8(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Uf.call(this,e,t)}function Uf(e,t){const r=this.opts.uriResolver.parse(t),n=(0,rn._getFullPath)(this.opts.uriResolver,r);let s=(0,rn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Zh.call(this,r,e);const o=(0,rn.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){const a=Uf.call(this,e,i);return typeof(a==null?void 0:a.schema)!="object"?void 0:Zh.call(this,r,a)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||by.call(this,i),o===(0,rn.normalizeId)(t)){const{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(s=(0,rn.resolveUrl)(this.opts.uriResolver,s,u)),new Ff({schema:a,schemaId:c,root:e,baseId:s})}return Zh.call(this,r,i)}}hr.resolveSchema=Uf;const i8=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Zh(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const c=r[(0,eb.unescapeFragment)(a)];if(c===void 0)return;r=c;const u=typeof r=="object"&&r[this.opts.schemaId];!i8.has(a)&&u&&(t=(0,rn.resolveUrl)(this.opts.uriResolver,t,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,eb.schemaHasRulesButRef)(r,this.RULES)){const a=(0,rn.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Uf.call(this,n,a)}const{schemaId:i}=this.opts;if(o=o||new Ff({schema:r,schemaId:i,root:n,baseId:t}),o.schema!==o.root.schema)return o}const a8="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",l8="Meta-schema for $data reference (JSON AnySchema extension proposal)",c8="object",u8=["$data"],d8={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},f8=!1,h8={$id:a8,description:l8,type:c8,required:u8,properties:d8,additionalProperties:f8};var _y={},qf={exports:{}};const p8={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 m8={HEX:p8};const{HEX:g8}=m8,v8=/^(?:(?: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 Oj(e){if(Dj(e,".")<3)return{host:e,isIPV4:!1};const t=e.match(v8)||[],[r]=t;return r?{host:w8(r,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function tb(e,t=!1){let r="",n=!0;for(const s of e){if(g8[s]===void 0)return;s!=="0"&&n===!0&&(n=!1),n||(r+=s)}return t&&r.length===0&&(r="0"),r}function y8(e){let t=0;const r={error:!1,address:"",zone:""},n=[],s=[];let o=!1,i=!1,a=!1;function c(){if(s.length){if(o===!1){const u=tb(s);if(u!==void 0)n.push(u);else return r.error=!0,!1}s.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),!c())break;if(t++,n.push(":"),t>7){r.error=!0;break}u-1>=0&&e[u-1]===":"&&(i=!0);continue}else if(d==="%"){if(!c())break;o=!0}else{s.push(d);continue}}return s.length&&(o?r.zone=s.join(""):a?n.push(s.join("")):n.push(tb(s))),r.address=n.join(""),r}function Mj(e){if(Dj(e,":")<2)return{host:e,isIPV6:!1};const t=y8(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,escapedHost:n,isIPV6:!0}}}function w8(e,t){let r="",n=!0;const s=e.length;for(let o=0;o<s;o++){const i=e[o];i==="0"&&n?(o+1<=s&&e[o+1]===t||o+1===s)&&(r+=i,n=!1):(i===t?n=!0:n=!1,r+=i)}return r}function Dj(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}const rb=/^\.\.?\//u,nb=/^\/\.(?:\/|$)/u,sb=/^\/\.\.(?:\/|$)/u,x8=/^\/?(?:.|\n)*?(?=\/|$)/u;function b8(e){const t=[];for(;e.length;)if(e.match(rb))e=e.replace(rb,"");else if(e.match(nb))e=e.replace(nb,"/");else if(e.match(sb))e=e.replace(sb,"/"),t.pop();else if(e==="."||e==="..")e="";else{const r=e.match(x8);if(r){const n=r[0];e=e.slice(n.length),t.push(n)}else throw new Error("Unexpected dot segment condition")}return t.join("")}function _8(e,t){const r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function S8(e){const t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);const n=Oj(r);if(n.isIPV4)r=n.host;else{const s=Mj(n.host);s.isIPV6===!0?r=`[${s.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}var k8={recomposeAuthority:S8,normalizeComponentEncoding:_8,removeDotSegments:b8,normalizeIPv4:Oj,normalizeIPv6:Mj};const C8=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,E8=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function zj(e){return typeof e.secure=="boolean"?e.secure:String(e.scheme).toLowerCase()==="wss"}function Lj(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Fj(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 N8(e){return e.secure=zj(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function j8(e){if((e.port===(zj(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,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function $8(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(E8);if(r){const n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];const s=`${n}:${t.nid||e.nid}`,o=Sy[s];e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function P8(e,t){const r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,o=Sy[s];o&&(e=o.serialize(e,t));const i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function T8(e,t){const r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!C8.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function R8(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t}const Uj={scheme:"http",domainHost:!0,parse:Lj,serialize:Fj},I8={scheme:"https",domainHost:Uj.domainHost,parse:Lj,serialize:Fj},Lu={scheme:"ws",domainHost:!0,parse:N8,serialize:j8},A8={scheme:"wss",domainHost:Lu.domainHost,parse:Lu.parse,serialize:Lu.serialize},O8={scheme:"urn",parse:$8,serialize:P8,skipNormalize:!0},M8={scheme:"urn:uuid",parse:T8,serialize:R8,skipNormalize:!0},Sy={http:Uj,https:I8,ws:Lu,wss:A8,urn:O8,"urn:uuid":M8};var D8=Sy;const{normalizeIPv6:z8,normalizeIPv4:L8,removeDotSegments:dl,recomposeAuthority:F8,normalizeComponentEncoding:cu}=k8,ky=D8;function U8(e,t){return typeof e=="string"?e=$n(cs(e,t),t):typeof e=="object"&&(e=cs($n(e,t),t)),e}function q8(e,t,r){const n=Object.assign({scheme:"null"},r),s=qj(cs(e,n),cs(t,n),n,!0);return $n(s,{...n,skipEscape:!0})}function qj(e,t,r,n){const s={};return n||(e=cs($n(e,r),r),t=cs($n(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=dl(t.path||""),s.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=dl(t.path||""),s.query=t.query):(t.path?(t.path.charAt(0)==="/"?s.path=dl(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?s.path="/"+t.path:e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path,s.path=dl(s.path)),s.query=t.query):(s.path=e.path,t.query!==void 0?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function V8(e,t,r){return typeof e=="string"?(e=unescape(e),e=$n(cu(cs(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=$n(cu(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=$n(cu(cs(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=$n(cu(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function $n(e,t){const r={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:""},n=Object.assign({},t),s=[],o=ky[(n.scheme||r.scheme||"").toLowerCase()];o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&s.push(r.scheme,":");const i=F8(r);if(i!==void 0&&(n.reference!=="suffix"&&s.push("//"),s.push(i),r.path&&r.path.charAt(0)!=="/"&&s.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=dl(a)),i===void 0&&(a=a.replace(/^\/\//u,"/%2F")),s.push(a)}return r.query!==void 0&&s.push("?",r.query),r.fragment!==void 0&&s.push("#",r.fragment),s.join("")}const H8=Array.from({length:127},(e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)));function K8(e){let t=0;for(let r=0,n=e.length;r<n;++r)if(t=e.charCodeAt(r),t>126||H8[t])return!0;return!1}const B8=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function cs(e,t){const r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=e.indexOf("%")!==-1;let o=!1;r.reference==="suffix"&&(e=(r.scheme?r.scheme+":":"")+"//"+e);const i=e.match(B8);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host){const c=L8(n.host);if(c.isIPV4===!1){const u=z8(c.host);n.host=u.host.toLowerCase(),o=u.isIPV6}else n.host=c.host,o=!0}n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");const a=ky[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&K8(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!a||a&&!a.skipNormalize)&&(s&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),s&&n.host!==void 0&&(n.host=unescape(n.host)),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}const Cy={SCHEMES:ky,normalize:U8,resolve:q8,resolveComponents:qj,equal:V8,serialize:$n,parse:cs};qf.exports=Cy;qf.exports.default=Cy;qf.exports.fastUri=Cy;var W8=qf.exports;Object.defineProperty(_y,"__esModule",{value:!0});const Vj=W8;Vj.code='require("ajv/dist/runtime/uri").default';_y.default=Vj;(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=an;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=je;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=Nc,s=Da,o=ri,i=hr,a=je,c=Mt,u=St,d=oe,f=h8,g=_y,v=(z,I)=>new RegExp(z,I);v.code="new RegExp";const b=["removeAdditional","useDefaults","coerceTypes"],p=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={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."},m={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},h=200;function x(z){var I,F,N,S,E,D,K,Z,ce,re,X,ve,Le,gt,Y,me,J,Me,ie,Ie,Pe,He,fn,Tr,hn;const xt=z.strict,ds=(I=z.code)===null||I===void 0?void 0:I.optimize,mo=ds===!0||ds===void 0?1:ds||0,fs=(N=(F=z.code)===null||F===void 0?void 0:F.regExp)!==null&&N!==void 0?N:v,go=(S=z.uriResolver)!==null&&S!==void 0?S:g.default;return{strictSchema:(D=(E=z.strictSchema)!==null&&E!==void 0?E:xt)!==null&&D!==void 0?D:!0,strictNumbers:(Z=(K=z.strictNumbers)!==null&&K!==void 0?K:xt)!==null&&Z!==void 0?Z:!0,strictTypes:(re=(ce=z.strictTypes)!==null&&ce!==void 0?ce:xt)!==null&&re!==void 0?re:"log",strictTuples:(ve=(X=z.strictTuples)!==null&&X!==void 0?X:xt)!==null&&ve!==void 0?ve:"log",strictRequired:(gt=(Le=z.strictRequired)!==null&&Le!==void 0?Le:xt)!==null&&gt!==void 0?gt:!1,code:z.code?{...z.code,optimize:mo,regExp:fs}:{optimize:mo,regExp:fs},loopRequired:(Y=z.loopRequired)!==null&&Y!==void 0?Y:h,loopEnum:(me=z.loopEnum)!==null&&me!==void 0?me:h,meta:(J=z.meta)!==null&&J!==void 0?J:!0,messages:(Me=z.messages)!==null&&Me!==void 0?Me:!0,inlineRefs:(ie=z.inlineRefs)!==null&&ie!==void 0?ie:!0,schemaId:(Ie=z.schemaId)!==null&&Ie!==void 0?Ie:"$id",addUsedSchema:(Pe=z.addUsedSchema)!==null&&Pe!==void 0?Pe:!0,validateSchema:(He=z.validateSchema)!==null&&He!==void 0?He:!0,validateFormats:(fn=z.validateFormats)!==null&&fn!==void 0?fn:!0,unicodeRegExp:(Tr=z.unicodeRegExp)!==null&&Tr!==void 0?Tr:!0,int32range:(hn=z.int32range)!==null&&hn!==void 0?hn:!0,uriResolver:go}}class _{constructor(I={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,I=this.opts={...I,...x(I)};const{es5:F,lines:N}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:p,es5:F,lines:N}),this.logger=k(I.logger);const S=I.validateFormats;I.validateFormats=!1,this.RULES=(0,o.getRules)(),C.call(this,y,I,"NOT SUPPORTED"),C.call(this,m,I,"DEPRECATED","warn"),this._metaOpts=U.call(this),I.formats&&O.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),I.keywords&&M.call(this,I.keywords),typeof I.meta=="object"&&this.addMetaSchema(I.meta),$.call(this),I.validateFormats=S}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:I,meta:F,schemaId:N}=this.opts;let S=f;N==="id"&&(S={...f},S.id=S.$id,delete S.$id),F&&I&&this.addMetaSchema(S,S[N],!1)}defaultMeta(){const{meta:I,schemaId:F}=this.opts;return this.opts.defaultMeta=typeof I=="object"?I[F]||I:void 0}validate(I,F){let N;if(typeof I=="string"){if(N=this.getSchema(I),!N)throw new Error(`no schema with key or ref "${I}"`)}else N=this.compile(I);const S=N(F);return"$async"in N||(this.errors=N.errors),S}compile(I,F){const N=this._addSchema(I,F);return N.validate||this._compileSchemaEnv(N)}compileAsync(I,F){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:N}=this.opts;return S.call(this,I,F);async function S(re,X){await E.call(this,re.$schema);const ve=this._addSchema(re,X);return ve.validate||D.call(this,ve)}async function E(re){re&&!this.getSchema(re)&&await S.call(this,{$ref:re},!0)}async function D(re){try{return this._compileSchemaEnv(re)}catch(X){if(!(X instanceof s.default))throw X;return K.call(this,X),await Z.call(this,X.missingSchema),D.call(this,re)}}function K({missingSchema:re,missingRef:X}){if(this.refs[re])throw new Error(`AnySchema ${re} is loaded but ${X} cannot be resolved`)}async function Z(re){const X=await ce.call(this,re);this.refs[re]||await E.call(this,X.$schema),this.refs[re]||this.addSchema(X,re,F)}async function ce(re){const X=this._loading[re];if(X)return X;try{return await(this._loading[re]=N(re))}finally{delete this._loading[re]}}}addSchema(I,F,N,S=this.opts.validateSchema){if(Array.isArray(I)){for(const D of I)this.addSchema(D,void 0,N,S);return this}let E;if(typeof I=="object"){const{schemaId:D}=this.opts;if(E=I[D],E!==void 0&&typeof E!="string")throw new Error(`schema ${D} must be string`)}return F=(0,c.normalizeId)(F||E),this._checkUnique(F),this.schemas[F]=this._addSchema(I,N,F,S,!0),this}addMetaSchema(I,F,N=this.opts.validateSchema){return this.addSchema(I,F,!0,N),this}validateSchema(I,F){if(typeof I=="boolean")return!0;let N;if(N=I.$schema,N!==void 0&&typeof N!="string")throw new Error("$schema must be a string");if(N=N||this.opts.defaultMeta||this.defaultMeta(),!N)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const S=this.validate(N,I);if(!S&&F){const E="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(E);else throw new Error(E)}return S}getSchema(I){let F;for(;typeof(F=T.call(this,I))=="string";)I=F;if(F===void 0){const{schemaId:N}=this.opts,S=new i.SchemaEnv({schema:{},schemaId:N});if(F=i.resolveSchema.call(this,S,I),!F)return;this.refs[I]=F}return F.validate||this._compileSchemaEnv(F)}removeSchema(I){if(I instanceof RegExp)return this._removeAllSchemas(this.schemas,I),this._removeAllSchemas(this.refs,I),this;switch(typeof I){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const F=T.call(this,I);return typeof F=="object"&&this._cache.delete(F.schema),delete this.schemas[I],delete this.refs[I],this}case"object":{const F=I;this._cache.delete(F);let N=I[this.opts.schemaId];return N&&(N=(0,c.normalizeId)(N),delete this.schemas[N],delete this.refs[N]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(I){for(const F of I)this.addKeyword(F);return this}addKeyword(I,F){let N;if(typeof I=="string")N=I,typeof F=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),F.keyword=N);else if(typeof I=="object"&&F===void 0){if(F=I,N=F.keyword,Array.isArray(N)&&!N.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(P.call(this,N,F),!F)return(0,d.eachItem)(N,E=>B.call(this,E)),this;G.call(this,F);const S={...F,type:(0,u.getJSONTypes)(F.type),schemaType:(0,u.getJSONTypes)(F.schemaType)};return(0,d.eachItem)(N,S.type.length===0?E=>B.call(this,E,S):E=>S.type.forEach(D=>B.call(this,E,S,D))),this}getKeyword(I){const F=this.RULES.all[I];return typeof F=="object"?F.definition:!!F}removeKeyword(I){const{RULES:F}=this;delete F.keywords[I],delete F.all[I];for(const N of F.rules){const S=N.rules.findIndex(E=>E.keyword===I);S>=0&&N.rules.splice(S,1)}return this}addFormat(I,F){return typeof F=="string"&&(F=new RegExp(F)),this.formats[I]=F,this}errorsText(I=this.errors,{separator:F=", ",dataVar:N="data"}={}){return!I||I.length===0?"No errors":I.map(S=>`${N}${S.instancePath} ${S.message}`).reduce((S,E)=>S+F+E)}$dataMetaSchema(I,F){const N=this.RULES.all;I=JSON.parse(JSON.stringify(I));for(const S of F){const E=S.split("/").slice(1);let D=I;for(const K of E)D=D[K];for(const K in N){const Z=N[K];if(typeof Z!="object")continue;const{$data:ce}=Z.definition,re=D[K];ce&&re&&(D[K]=V(re))}}return I}_removeAllSchemas(I,F){for(const N in I){const S=I[N];(!F||F.test(N))&&(typeof S=="string"?delete I[N]:S&&!S.meta&&(this._cache.delete(S.schema),delete I[N]))}}_addSchema(I,F,N,S=this.opts.validateSchema,E=this.opts.addUsedSchema){let D;const{schemaId:K}=this.opts;if(typeof I=="object")D=I[K];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof I!="boolean")throw new Error("schema must be object or boolean")}let Z=this._cache.get(I);if(Z!==void 0)return Z;N=(0,c.normalizeId)(D||N);const ce=c.getSchemaRefs.call(this,I,N);return Z=new i.SchemaEnv({schema:I,schemaId:K,meta:F,baseId:N,localRefs:ce}),this._cache.set(Z.schema,Z),E&&!N.startsWith("#")&&(N&&this._checkUnique(N),this.refs[N]=Z),S&&this.validateSchema(I,!0),Z}_checkUnique(I){if(this.schemas[I]||this.refs[I])throw new Error(`schema with key or id "${I}" already exists`)}_compileSchemaEnv(I){if(I.meta?this._compileMetaSchema(I):i.compileSchema.call(this,I),!I.validate)throw new Error("ajv implementation error");return I.validate}_compileMetaSchema(I){const F=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,I)}finally{this.opts=F}}}_.ValidationError=n.default,_.MissingRefError=s.default,e.default=_;function C(z,I,F,N="error"){for(const S in z){const E=S;E in I&&this.logger[N](`${F}: option ${S}. ${z[E]}`)}}function T(z){return z=(0,c.normalizeId)(z),this.schemas[z]||this.refs[z]}function $(){const z=this.opts.schemas;if(z)if(Array.isArray(z))this.addSchema(z);else for(const I in z)this.addSchema(z[I],I)}function O(){for(const z in this.opts.formats){const I=this.opts.formats[z];I&&this.addFormat(z,I)}}function M(z){if(Array.isArray(z)){this.addVocabulary(z);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const I in z){const F=z[I];F.keyword||(F.keyword=I),this.addKeyword(F)}}function U(){const z={...this.opts};for(const I of b)delete z[I];return z}const j={log(){},warn(){},error(){}};function k(z){if(z===!1)return j;if(z===void 0)return console;if(z.log&&z.warn&&z.error)return z;throw new Error("logger must implement log, warn and error methods")}const L=/^[a-z_$][a-z0-9_$:-]*$/i;function P(z,I){const{RULES:F}=this;if((0,d.eachItem)(z,N=>{if(F.keywords[N])throw new Error(`Keyword ${N} is already defined`);if(!L.test(N))throw new Error(`Keyword ${N} has invalid name`)}),!!I&&I.$data&&!("code"in I||"validate"in I))throw new Error('$data keyword must have "code" or "validate" function')}function B(z,I,F){var N;const S=I==null?void 0:I.post;if(F&&S)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:E}=this;let D=S?E.post:E.rules.find(({type:Z})=>Z===F);if(D||(D={type:F,rules:[]},E.rules.push(D)),E.keywords[z]=!0,!I)return;const K={keyword:z,definition:{...I,type:(0,u.getJSONTypes)(I.type),schemaType:(0,u.getJSONTypes)(I.schemaType)}};I.before?H.call(this,D,K,I.before):D.rules.push(K),E.all[z]=K,(N=I.implements)===null||N===void 0||N.forEach(Z=>this.addKeyword(Z))}function H(z,I,F){const N=z.rules.findIndex(S=>S.keyword===F);N>=0?z.rules.splice(N,0,I):(z.rules.push(I),this.logger.warn(`rule ${F} is not defined`))}function G(z){let{metaSchema:I}=z;I!==void 0&&(z.$data&&this.opts.$data&&(I=V(I)),z.validateSchema=this.compile(I,!0))}const q={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function V(z){return{anyOf:[z,q]}}})(rj);var Ey={},Ny={},jy={};Object.defineProperty(jy,"__esModule",{value:!0});const Z8={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};jy.default=Z8;var ni={};Object.defineProperty(ni,"__esModule",{value:!0});ni.callRef=ni.getValidate=void 0;const G8=Da,ob=$e,cr=je,mi=Dn,ib=hr,uu=oe,Q8={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&s===u.baseId)return f();const d=ib.resolveRef.call(c,u,s,r);if(d===void 0)throw new G8.default(n.opts.uriResolver,s,r);if(d instanceof ib.SchemaEnv)return g(d);return v(d);function f(){if(o===u)return Fu(e,i,o,o.$async);const b=t.scopeValue("root",{ref:u});return Fu(e,(0,cr._)`${b}.validate`,u,u.$async)}function g(b){const p=Hj(e,b);Fu(e,p,b,b.$async)}function v(b){const p=t.scopeValue("schema",a.code.source===!0?{ref:b,code:(0,cr.stringify)(b)}:{ref:b}),y=t.name("valid"),m=e.subschema({schema:b,dataTypes:[],schemaPath:cr.nil,topSchemaRef:p,errSchemaPath:r},y);e.mergeEvaluated(m),e.ok(y)}}};function Hj(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,cr._)`${r.scopeValue("wrapper",{ref:t})}.validate`}ni.getValidate=Hj;function Fu(e,t,r,n){const{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:c}=o,u=c.passContext?mi.default.this:cr.nil;n?d():f();function d(){if(!a.$async)throw new Error("async schema referenced by sync schema");const b=s.let("valid");s.try(()=>{s.code((0,cr._)`await ${(0,ob.callValidateCode)(e,t,u)}`),v(t),i||s.assign(b,!0)},p=>{s.if((0,cr._)`!(${p} instanceof ${o.ValidationError})`,()=>s.throw(p)),g(p),i||s.assign(b,!1)}),e.ok(b)}function f(){e.result((0,ob.callValidateCode)(e,t,u),()=>v(t),()=>g(t))}function g(b){const p=(0,cr._)`${b}.errors`;s.assign(mi.default.vErrors,(0,cr._)`${mi.default.vErrors} === null ? ${p} : ${mi.default.vErrors}.concat(${p})`),s.assign(mi.default.errors,(0,cr._)`${mi.default.vErrors}.length`)}function v(b){var p;if(!o.opts.unevaluated)return;const y=(p=r==null?void 0:r.validate)===null||p===void 0?void 0:p.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(o.props=uu.mergeEvaluated.props(s,y.props,o.props));else{const m=s.var("props",(0,cr._)`${b}.evaluated.props`);o.props=uu.mergeEvaluated.props(s,m,o.props,cr.Name)}if(o.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(o.items=uu.mergeEvaluated.items(s,y.items,o.items));else{const m=s.var("items",(0,cr._)`${b}.evaluated.items`);o.items=uu.mergeEvaluated.items(s,m,o.items,cr.Name)}}}ni.callRef=Fu;ni.default=Q8;Object.defineProperty(Ny,"__esModule",{value:!0});const J8=jy,Y8=ni,X8=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",J8.default,Y8.default];Ny.default=X8;var $y={},Py={};Object.defineProperty(Py,"__esModule",{value:!0});const qd=je,vs=qd.operators,Vd={maximum:{okStr:"<=",ok:vs.LTE,fail:vs.GT},minimum:{okStr:">=",ok:vs.GTE,fail:vs.LT},exclusiveMaximum:{okStr:"<",ok:vs.LT,fail:vs.GTE},exclusiveMinimum:{okStr:">",ok:vs.GT,fail:vs.LTE}},eq={message:({keyword:e,schemaCode:t})=>(0,qd.str)`must be ${Vd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,qd._)`{comparison: ${Vd[e].okStr}, limit: ${t}}`},tq={keyword:Object.keys(Vd),type:"number",schemaType:"number",$data:!0,error:eq,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,qd._)`${r} ${Vd[t].fail} ${n} || isNaN(${r})`)}};Py.default=tq;var Ty={};Object.defineProperty(Ty,"__esModule",{value:!0});const jl=je,rq={message:({schemaCode:e})=>(0,jl.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,jl._)`{multipleOf: ${e}}`},nq={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:rq,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?(0,jl._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,jl._)`${i} !== parseInt(${i})`;e.fail$data((0,jl._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Ty.default=nq;var Ry={},Iy={};Object.defineProperty(Iy,"__esModule",{value:!0});function Kj(e){const t=e.length;let r=0,n=0,s;for(;n<t;)r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t&&(s=e.charCodeAt(n),(s&64512)===56320&&n++);return r}Iy.default=Kj;Kj.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(Ry,"__esModule",{value:!0});const jo=je,sq=oe,oq=Iy,iq={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,jo.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,jo._)`{limit: ${e}}`},aq={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:iq,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?jo.operators.GT:jo.operators.LT,i=s.opts.unicode===!1?(0,jo._)`${r}.length`:(0,jo._)`${(0,sq.useFunc)(e.gen,oq.default)}(${r})`;e.fail$data((0,jo._)`${i} ${o} ${n}`)}};Ry.default=aq;var Ay={};Object.defineProperty(Ay,"__esModule",{value:!0});const lq=$e,Hd=je,cq={message:({schemaCode:e})=>(0,Hd.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Hd._)`{pattern: ${e}}`},uq={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:cq,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:o}=e,i=o.opts.unicodeRegExp?"u":"",a=r?(0,Hd._)`(new RegExp(${s}, ${i}))`:(0,lq.usePattern)(e,n);e.fail$data((0,Hd._)`!${a}.test(${t})`)}};Ay.default=uq;var Oy={};Object.defineProperty(Oy,"__esModule",{value:!0});const $l=je,dq={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,$l.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,$l._)`{limit: ${e}}`},fq={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:dq,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?$l.operators.GT:$l.operators.LT;e.fail$data((0,$l._)`Object.keys(${r}).length ${s} ${n}`)}};Oy.default=fq;var My={};Object.defineProperty(My,"__esModule",{value:!0});const Xa=$e,Pl=je,hq=oe,pq={message:({params:{missingProperty:e}})=>(0,Pl.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Pl._)`{missingProperty: ${e}}`},mq={keyword:"required",type:"object",schemaType:"array",$data:!0,error:pq,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&r.length===0)return;const c=r.length>=a.loopRequired;if(i.allErrors?u():d(),a.strictRequired){const v=e.parentSchema.properties,{definedProperties:b}=e.it;for(const p of r)if((v==null?void 0:v[p])===void 0&&!b.has(p)){const y=i.schemaEnv.baseId+i.errSchemaPath,m=`required property "${p}" is not defined at "${y}" (strictRequired)`;(0,hq.checkStrictMode)(i,m,i.opts.strictRequired)}}function u(){if(c||o)e.block$data(Pl.nil,f);else for(const v of r)(0,Xa.checkReportMissingProp)(e,v)}function d(){const v=t.let("missing");if(c||o){const b=t.let("valid",!0);e.block$data(b,()=>g(v,b)),e.ok(b)}else t.if((0,Xa.checkMissingProp)(e,r,v)),(0,Xa.reportMissingProp)(e,v),t.else()}function f(){t.forOf("prop",n,v=>{e.setParams({missingProperty:v}),t.if((0,Xa.noPropertyInData)(t,s,v,a.ownProperties),()=>e.error())})}function g(v,b){e.setParams({missingProperty:v}),t.forOf(v,n,()=>{t.assign(b,(0,Xa.propertyInData)(t,s,v,a.ownProperties)),t.if((0,Pl.not)(b),()=>{e.error(),t.break()})},Pl.nil)}}};My.default=mq;var Dy={};Object.defineProperty(Dy,"__esModule",{value:!0});const Tl=je,gq={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,Tl.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Tl._)`{limit: ${e}}`},vq={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:gq,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Tl.operators.GT:Tl.operators.LT;e.fail$data((0,Tl._)`${r}.length ${s} ${n}`)}};Dy.default=vq;var zy={},jc={};Object.defineProperty(jc,"__esModule",{value:!0});const Bj=yj;Bj.code='require("ajv/dist/runtime/equal").default';jc.default=Bj;Object.defineProperty(zy,"__esModule",{value:!0});const Gh=St,It=je,yq=oe,wq=jc,xq={message:({params:{i:e,j:t}})=>(0,It.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,It._)`{i: ${e}, j: ${t}}`},bq={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:xq,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!n&&!s)return;const c=t.let("valid"),u=o.items?(0,Gh.getSchemaTypes)(o.items):[];e.block$data(c,d,(0,It._)`${i} === false`),e.ok(c);function d(){const b=t.let("i",(0,It._)`${r}.length`),p=t.let("j");e.setParams({i:b,j:p}),t.assign(c,!0),t.if((0,It._)`${b} > 1`,()=>(f()?g:v)(b,p))}function f(){return u.length>0&&!u.some(b=>b==="object"||b==="array")}function g(b,p){const y=t.name("item"),m=(0,Gh.checkDataTypes)(u,y,a.opts.strictNumbers,Gh.DataType.Wrong),h=t.const("indices",(0,It._)`{}`);t.for((0,It._)`;${b}--;`,()=>{t.let(y,(0,It._)`${r}[${b}]`),t.if(m,(0,It._)`continue`),u.length>1&&t.if((0,It._)`typeof ${y} == "string"`,(0,It._)`${y} += "_"`),t.if((0,It._)`typeof ${h}[${y}] == "number"`,()=>{t.assign(p,(0,It._)`${h}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,It._)`${h}[${y}] = ${b}`)})}function v(b,p){const y=(0,yq.useFunc)(t,wq.default),m=t.name("outer");t.label(m).for((0,It._)`;${b}--;`,()=>t.for((0,It._)`${p} = ${b}; ${p}--;`,()=>t.if((0,It._)`${y}(${r}[${b}], ${r}[${p}])`,()=>{e.error(),t.assign(c,!1).break(m)})))}}};zy.default=bq;var Ly={};Object.defineProperty(Ly,"__esModule",{value:!0});const Xm=je,_q=oe,Sq=jc,kq={message:"must be equal to constant",params:({schemaCode:e})=>(0,Xm._)`{allowedValue: ${e}}`},Cq={keyword:"const",$data:!0,error:kq,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,Xm._)`!${(0,_q.useFunc)(t,Sq.default)}(${r}, ${s})`):e.fail((0,Xm._)`${o} !== ${r}`)}};Ly.default=Cq;var Fy={};Object.defineProperty(Fy,"__esModule",{value:!0});const fl=je,Eq=oe,Nq=jc,jq={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,fl._)`{allowedValues: ${e}}`},$q={keyword:"enum",schemaType:"array",$data:!0,error:jq,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:i}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const a=s.length>=i.opts.loopEnum;let c;const u=()=>c??(c=(0,Eq.useFunc)(t,Nq.default));let d;if(a||n)d=t.let("valid"),e.block$data(d,f);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const v=t.const("vSchema",o);d=(0,fl.or)(...s.map((b,p)=>g(v,p)))}e.pass(d);function f(){t.assign(d,!1),t.forOf("v",o,v=>t.if((0,fl._)`${u()}(${r}, ${v})`,()=>t.assign(d,!0).break()))}function g(v,b){const p=s[b];return typeof p=="object"&&p!==null?(0,fl._)`${u()}(${r}, ${v}[${b}])`:(0,fl._)`${r} === ${p}`}}};Fy.default=$q;Object.defineProperty($y,"__esModule",{value:!0});const Pq=Py,Tq=Ty,Rq=Ry,Iq=Ay,Aq=Oy,Oq=My,Mq=Dy,Dq=zy,zq=Ly,Lq=Fy,Fq=[Pq.default,Tq.default,Rq.default,Iq.default,Aq.default,Oq.default,Mq.default,Dq.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},zq.default,Lq.default];$y.default=Fq;var Uy={},za={};Object.defineProperty(za,"__esModule",{value:!0});za.validateAdditionalItems=void 0;const $o=je,eg=oe,Uq={message:({params:{len:e}})=>(0,$o.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,$o._)`{limit: ${e}}`},qq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Uq,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,eg.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Wj(e,n)}};function Wj(e,t){const{gen:r,schema:n,data:s,keyword:o,it:i}=e;i.items=!0;const a=r.const("len",(0,$o._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,$o._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,eg.alwaysValidSchema)(i,n)){const u=r.var("valid",(0,$o._)`${a} <= ${t.length}`);r.if((0,$o.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,d=>{e.subschema({keyword:o,dataProp:d,dataPropType:eg.Type.Num},u),i.allErrors||r.if((0,$o.not)(u),()=>r.break())})}}za.validateAdditionalItems=Wj;za.default=qq;var qy={},La={};Object.defineProperty(La,"__esModule",{value:!0});La.validateTuple=void 0;const ab=je,Uu=oe,Vq=$e,Hq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Zj(e,"additionalItems",t);r.items=!0,!(0,Uu.alwaysValidSchema)(r,t)&&e.ok((0,Vq.validateArray)(e))}};function Zj(e,t,r=e.schema){const{gen:n,parentSchema:s,data:o,keyword:i,it:a}=e;d(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Uu.mergeEvaluated.items(n,r.length,a.items));const c=n.name("valid"),u=n.const("len",(0,ab._)`${o}.length`);r.forEach((f,g)=>{(0,Uu.alwaysValidSchema)(a,f)||(n.if((0,ab._)`${u} > ${g}`,()=>e.subschema({keyword:i,schemaProp:g,dataProp:g},c)),e.ok(c))});function d(f){const{opts:g,errSchemaPath:v}=a,b=r.length,p=b===f.minItems&&(b===f.maxItems||f[t]===!1);if(g.strictTuples&&!p){const y=`"${i}" is ${b}-tuple, but minItems or maxItems/${t} are not specified or different at path "${v}"`;(0,Uu.checkStrictMode)(a,y,g.strictTuples)}}}La.validateTuple=Zj;La.default=Hq;Object.defineProperty(qy,"__esModule",{value:!0});const Kq=La,Bq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Kq.validateTuple)(e,"items")};qy.default=Bq;var Vy={};Object.defineProperty(Vy,"__esModule",{value:!0});const lb=je,Wq=oe,Zq=$e,Gq=za,Qq={message:({params:{len:e}})=>(0,lb.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,lb._)`{limit: ${e}}`},Jq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Qq,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,Wq.alwaysValidSchema)(n,t)&&(s?(0,Gq.validateAdditionalItems)(e,s):e.ok((0,Zq.validateArray)(e)))}};Vy.default=Jq;var Hy={};Object.defineProperty(Hy,"__esModule",{value:!0});const Ir=je,du=oe,Yq={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}}`},Xq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Yq,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;let i,a;const{minContains:c,maxContains:u}=n;o.opts.next?(i=c===void 0?1:c,a=u):i=1;const d=t.const("len",(0,Ir._)`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,du.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,du.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,du.alwaysValidSchema)(o,r)){let p=(0,Ir._)`${d} >= ${i}`;a!==void 0&&(p=(0,Ir._)`${p} && ${d} <= ${a}`),e.pass(p);return}o.items=!0;const f=t.name("valid");a===void 0&&i===1?v(f,()=>t.if(f,()=>t.break())):i===0?(t.let(f,!0),a!==void 0&&t.if((0,Ir._)`${s}.length > 0`,g)):(t.let(f,!1),g()),e.result(f,()=>e.reset());function g(){const p=t.name("_valid"),y=t.let("count",0);v(p,()=>t.if(p,()=>b(y)))}function v(p,y){t.forRange("i",0,d,m=>{e.subschema({keyword:"contains",dataProp:m,dataPropType:du.Type.Num,compositeRule:!0},p),y()})}function b(p){t.code((0,Ir._)`${p}++`),a===void 0?t.if((0,Ir._)`${p} >= ${i}`,()=>t.assign(f,!0).break()):(t.if((0,Ir._)`${p} > ${a}`,()=>t.assign(f,!1).break()),i===1?t.assign(f,!0):t.if((0,Ir._)`${p} >= ${i}`,()=>t.assign(f,!0)))}}};Hy.default=Xq;var Gj={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=je,r=oe,n=$e;e.error={message:({params:{property:c,depsCount:u,deps:d}})=>{const f=u===1?"property":"properties";return(0,t.str)`must have ${f} ${d} when property ${c} is present`},params:({params:{property:c,depsCount:u,deps:d,missingProperty:f}})=>(0,t._)`{property: ${c},
407
- missingProperty: ${f},
408
- depsCount: ${u},
409
- deps: ${d}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){const[u,d]=o(c);i(c,u),a(c,d)}};function o({schema:c}){const u={},d={};for(const f in c){if(f==="__proto__")continue;const g=Array.isArray(c[f])?u:d;g[f]=c[f]}return[u,d]}function i(c,u=c.schema){const{gen:d,data:f,it:g}=c;if(Object.keys(u).length===0)return;const v=d.let("missing");for(const b in u){const p=u[b];if(p.length===0)continue;const y=(0,n.propertyInData)(d,f,b,g.opts.ownProperties);c.setParams({property:b,depsCount:p.length,deps:p.join(", ")}),g.allErrors?d.if(y,()=>{for(const m of p)(0,n.checkReportMissingProp)(c,m)}):(d.if((0,t._)`${y} && (${(0,n.checkMissingProp)(c,p,v)})`),(0,n.reportMissingProp)(c,v),d.else())}}e.validatePropertyDeps=i;function a(c,u=c.schema){const{gen:d,data:f,keyword:g,it:v}=c,b=d.name("valid");for(const p in u)(0,r.alwaysValidSchema)(v,u[p])||(d.if((0,n.propertyInData)(d,f,p,v.opts.ownProperties),()=>{const y=c.subschema({keyword:g,schemaProp:p},b);c.mergeValidEvaluated(y,b)},()=>d.var(b,!0)),c.ok(b))}e.validateSchemaDeps=a,e.default=s})(Gj);var Ky={};Object.defineProperty(Ky,"__esModule",{value:!0});const Qj=je,eV=oe,tV={message:"property name must be valid",params:({params:e})=>(0,Qj._)`{propertyName: ${e.propertyName}}`},rV={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:tV,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,eV.alwaysValidSchema)(s,r))return;const o=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if((0,Qj.not)(o),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(o)}};Ky.default=rV;var Vf={};Object.defineProperty(Vf,"__esModule",{value:!0});const fu=$e,Br=je,nV=Dn,hu=oe,sV={message:"must NOT have additional properties",params:({params:e})=>(0,Br._)`{additionalProperty: ${e.additionalProperty}}`},oV={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:sV,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=e;if(!o)throw new Error("ajv implementation error");const{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,hu.alwaysValidSchema)(i,r))return;const u=(0,fu.allSchemaProperties)(n.properties),d=(0,fu.allSchemaProperties)(n.patternProperties);f(),e.ok((0,Br._)`${o} === ${nV.default.errors}`);function f(){t.forIn("key",s,y=>{!u.length&&!d.length?b(y):t.if(g(y),()=>b(y))})}function g(y){let m;if(u.length>8){const h=(0,hu.schemaRefOrVal)(i,n.properties,"properties");m=(0,fu.isOwnProperty)(t,h,y)}else u.length?m=(0,Br.or)(...u.map(h=>(0,Br._)`${y} === ${h}`)):m=Br.nil;return d.length&&(m=(0,Br.or)(m,...d.map(h=>(0,Br._)`${(0,fu.usePattern)(e,h)}.test(${y})`))),(0,Br.not)(m)}function v(y){t.code((0,Br._)`delete ${s}[${y}]`)}function b(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){v(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,hu.alwaysValidSchema)(i,r)){const m=t.name("valid");c.removeAdditional==="failing"?(p(y,m,!1),t.if((0,Br.not)(m),()=>{e.reset(),v(y)})):(p(y,m),a||t.if((0,Br.not)(m),()=>t.break()))}}function p(y,m,h){const x={keyword:"additionalProperties",dataProp:y,dataPropType:hu.Type.Str};h===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,m)}}};Vf.default=oV;var By={};Object.defineProperty(By,"__esModule",{value:!0});const iV=an,cb=$e,Qh=oe,ub=Vf,aV={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&ub.default.code(new iV.KeywordCxt(o,ub.default,"additionalProperties"));const i=(0,cb.allSchemaProperties)(r);for(const f of i)o.definedProperties.add(f);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=Qh.mergeEvaluated.props(t,(0,Qh.toHash)(i),o.props));const a=i.filter(f=>!(0,Qh.alwaysValidSchema)(o,r[f]));if(a.length===0)return;const c=t.name("valid");for(const f of a)u(f)?d(f):(t.if((0,cb.propertyInData)(t,s,f,o.opts.ownProperties)),d(f),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(c);function u(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function d(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};By.default=aV;var Wy={};Object.defineProperty(Wy,"__esModule",{value:!0});const db=$e,pu=je,fb=oe,hb=oe,lV={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:i}=o,a=(0,db.allSchemaProperties)(r),c=a.filter(p=>(0,fb.alwaysValidSchema)(o,r[p]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;const u=i.strictSchema&&!i.allowMatchingProperties&&s.properties,d=t.name("valid");o.props!==!0&&!(o.props instanceof pu.Name)&&(o.props=(0,hb.evaluatedPropsToName)(t,o.props));const{props:f}=o;g();function g(){for(const p of a)u&&v(p),o.allErrors?b(p):(t.var(d,!0),b(p),t.if(d))}function v(p){for(const y in u)new RegExp(p).test(y)&&(0,fb.checkStrictMode)(o,`property ${y} matches pattern ${p} (use allowMatchingProperties)`)}function b(p){t.forIn("key",n,y=>{t.if((0,pu._)`${(0,db.usePattern)(e,p)}.test(${y})`,()=>{const m=c.includes(p);m||e.subschema({keyword:"patternProperties",schemaProp:p,dataProp:y,dataPropType:hb.Type.Str},d),o.opts.unevaluated&&f!==!0?t.assign((0,pu._)`${f}[${y}]`,!0):!m&&!o.allErrors&&t.if((0,pu.not)(d),()=>t.break())})})}}};Wy.default=lV;var Zy={};Object.defineProperty(Zy,"__esModule",{value:!0});const cV=oe,uV={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,cV.alwaysValidSchema)(n,r)){e.fail();return}const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Zy.default=uV;var Gy={};Object.defineProperty(Gy,"__esModule",{value:!0});const dV=$e,fV={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:dV.validateUnion,error:{message:"must match a schema in anyOf"}};Gy.default=fV;var Qy={};Object.defineProperty(Qy,"__esModule",{value:!0});const qu=je,hV=oe,pV={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,qu._)`{passingSchemas: ${e.passing}}`},mV={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:pV,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const o=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((d,f)=>{let g;(0,hV.alwaysValidSchema)(s,d)?t.var(c,!0):g=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,qu._)`${c} && ${i}`).assign(i,!1).assign(a,(0,qu._)`[${a}, ${f}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,f),g&&e.mergeEvaluated(g,qu.Name)})})}}};Qy.default=mV;var Jy={};Object.defineProperty(Jy,"__esModule",{value:!0});const gV=oe,vV={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((o,i)=>{if((0,gV.alwaysValidSchema)(n,o))return;const a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};Jy.default=vV;var Yy={};Object.defineProperty(Yy,"__esModule",{value:!0});const Kd=je,Jj=oe,yV={message:({params:e})=>(0,Kd.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Kd._)`{failingKeyword: ${e.ifClause}}`},wV={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:yV,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Jj.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=pb(n,"then"),o=pb(n,"else");if(!s&&!o)return;const i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),s&&o){const d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,u("then",d),u("else",d))}else s?t.if(a,u("then")):t.if((0,Kd.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){const d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function u(d,f){return()=>{const g=e.subschema({keyword:d},a);t.assign(i,a),e.mergeValidEvaluated(g,i),f?t.assign(f,(0,Kd._)`${d}`):e.setParams({ifClause:d})}}}};function pb(e,t){const r=e.schema[t];return r!==void 0&&!(0,Jj.alwaysValidSchema)(e,r)}Yy.default=wV;var Xy={};Object.defineProperty(Xy,"__esModule",{value:!0});const xV=oe,bV={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,xV.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Xy.default=bV;Object.defineProperty(Uy,"__esModule",{value:!0});const _V=za,SV=qy,kV=La,CV=Vy,EV=Hy,NV=Gj,jV=Ky,$V=Vf,PV=By,TV=Wy,RV=Zy,IV=Gy,AV=Qy,OV=Jy,MV=Yy,DV=Xy;function zV(e=!1){const t=[RV.default,IV.default,AV.default,OV.default,MV.default,DV.default,jV.default,$V.default,NV.default,PV.default,TV.default];return e?t.push(SV.default,CV.default):t.push(_V.default,kV.default),t.push(EV.default),t}Uy.default=zV;var e0={},t0={};Object.defineProperty(t0,"__esModule",{value:!0});const vt=je,LV={message:({schemaCode:e})=>(0,vt.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,vt._)`{format: ${e}}`},FV={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:LV,code(e,t){const{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:f}=a;if(!c.validateFormats)return;s?g():v();function g(){const b=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),p=r.const("fDef",(0,vt._)`${b}[${i}]`),y=r.let("fType"),m=r.let("format");r.if((0,vt._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>r.assign(y,(0,vt._)`${p}.type || "string"`).assign(m,(0,vt._)`${p}.validate`),()=>r.assign(y,(0,vt._)`"string"`).assign(m,p)),e.fail$data((0,vt.or)(h(),x()));function h(){return c.strictSchema===!1?vt.nil:(0,vt._)`${i} && !${m}`}function x(){const _=d.$async?(0,vt._)`(${p}.async ? await ${m}(${n}) : ${m}(${n}))`:(0,vt._)`${m}(${n})`,C=(0,vt._)`(typeof ${m} == "function" ? ${_} : ${m}.test(${n}))`;return(0,vt._)`${m} && ${m} !== true && ${y} === ${t} && !${C}`}}function v(){const b=f.formats[o];if(!b){h();return}if(b===!0)return;const[p,y,m]=x(b);p===t&&e.pass(_());function h(){if(c.strictSchema===!1){f.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function x(C){const T=C instanceof RegExp?(0,vt.regexpCode)(C):c.code.formats?(0,vt._)`${c.code.formats}${(0,vt.getProperty)(o)}`:void 0,$=r.scopeValue("formats",{key:o,ref:C,code:T});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,vt._)`${$}.validate`]:["string",C,$]}function _(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!d.$async)throw new Error("async format in sync schema");return(0,vt._)`await ${m}(${n})`}return typeof y=="function"?(0,vt._)`${m}(${n})`:(0,vt._)`${m}.test(${n})`}}}};t0.default=FV;Object.defineProperty(e0,"__esModule",{value:!0});const UV=t0,qV=[UV.default];e0.default=qV;var ka={};Object.defineProperty(ka,"__esModule",{value:!0});ka.contentVocabulary=ka.metadataVocabulary=void 0;ka.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ka.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Ey,"__esModule",{value:!0});const VV=Ny,HV=$y,KV=Uy,BV=e0,mb=ka,WV=[VV.default,HV.default,(0,KV.default)(),BV.default,mb.metadataVocabulary,mb.contentVocabulary];Ey.default=WV;var r0={},Hf={};Object.defineProperty(Hf,"__esModule",{value:!0});Hf.DiscrError=void 0;var gb;(function(e){e.Tag="tag",e.Mapping="mapping"})(gb||(Hf.DiscrError=gb={}));Object.defineProperty(r0,"__esModule",{value:!0});const bi=je,tg=Hf,vb=hr,ZV=Da,GV=oe,QV={message:({params:{discrError:e,tagName:t}})=>e===tg.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,bi._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},JV={keyword:"discriminator",type:"object",schemaType:"object",error:QV,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),u=t.const("tag",(0,bi._)`${r}${(0,bi.getProperty)(a)}`);t.if((0,bi._)`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:tg.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function d(){const v=g();t.if(!1);for(const b in v)t.elseIf((0,bi._)`${u} === ${b}`),t.assign(c,f(v[b]));t.else(),e.error(!1,{discrError:tg.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function f(v){const b=t.name("valid"),p=e.subschema({keyword:"oneOf",schemaProp:v},b);return e.mergeEvaluated(p,bi.Name),b}function g(){var v;const b={},p=m(s);let y=!0;for(let _=0;_<i.length;_++){let C=i[_];if(C!=null&&C.$ref&&!(0,GV.schemaHasRulesButRef)(C,o.self.RULES)){const $=C.$ref;if(C=vb.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,$),C instanceof vb.SchemaEnv&&(C=C.schema),C===void 0)throw new ZV.default(o.opts.uriResolver,o.baseId,$)}const T=(v=C==null?void 0:C.properties)===null||v===void 0?void 0:v[a];if(typeof T!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(p||m(C)),h(T,_)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return b;function m({required:_}){return Array.isArray(_)&&_.includes(a)}function h(_,C){if(_.const)x(_.const,C);else if(_.enum)for(const T of _.enum)x(T,C);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(_,C){if(typeof _!="string"||_ in b)throw new Error(`discriminator: "${a}" values must be unique strings`);b[_]=C}}}};r0.default=JV;const YV="http://json-schema.org/draft-07/schema#",XV="http://json-schema.org/draft-07/schema#",eH="Core schema meta-schema",tH={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:[]}},rH=["object","boolean"],nH={$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:"#"}},sH={$schema:YV,$id:XV,title:eH,definitions:tH,type:rH,properties:nH,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 r=rj,n=Ey,s=r0,o=sH,i=["/properties"],a="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(b=>this.addVocabulary(b)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const b=this.opts.$data?this.$dataMetaSchema(o,i):o;this.addMetaSchema(b,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=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=an;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=je;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=Nc;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var g=Da;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(Zm,Zm.exports);var Yj=Zm.exports;const oH=Bd(Yj);var rg={exports:{}},Xj={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(j,k){return{validate:j,compare:k}}e.fullFormats={date:t(o,i),time:t(c(!0),u),"date-time":t(g(!0),v),"iso-time":t(c(),d),"iso-date-time":t(g(),b),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:m,"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:U,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:x,int32:{type:"number",validate:T},int64:{type:"number",validate:$},float:{type:"number",validate:O},double:{type:"number",validate:O},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,v),"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,b),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 r(j){return j%4===0&&(j%100!==0||j%400===0)}const n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(j){const k=n.exec(j);if(!k)return!1;const L=+k[1],P=+k[2],B=+k[3];return P>=1&&P<=12&&B>=1&&B<=(P===2&&r(L)?29:s[P])}function i(j,k){if(j&&k)return j>k?1:j<k?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(j){return function(L){const P=a.exec(L);if(!P)return!1;const B=+P[1],H=+P[2],G=+P[3],q=P[4],V=P[5]==="-"?-1:1,z=+(P[6]||0),I=+(P[7]||0);if(z>23||I>59||j&&!q)return!1;if(B<=23&&H<=59&&G<60)return!0;const F=H-I*V,N=B-z*V-(F<0?1:0);return(N===23||N===-1)&&(F===59||F===-1)&&G<61}}function u(j,k){if(!(j&&k))return;const L=new Date("2020-01-01T"+j).valueOf(),P=new Date("2020-01-01T"+k).valueOf();if(L&&P)return L-P}function d(j,k){if(!(j&&k))return;const L=a.exec(j),P=a.exec(k);if(L&&P)return j=L[1]+L[2]+L[3],k=P[1]+P[2]+P[3],j>k?1:j<k?-1:0}const f=/t|\s/i;function g(j){const k=c(j);return function(P){const B=P.split(f);return B.length===2&&o(B[0])&&k(B[1])}}function v(j,k){if(!(j&&k))return;const L=new Date(j).valueOf(),P=new Date(k).valueOf();if(L&&P)return L-P}function b(j,k){if(!(j&&k))return;const[L,P]=j.split(f),[B,H]=k.split(f),G=i(L,B);if(G!==void 0)return G||u(P,H)}const p=/\/|:/,y=/^(?:[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 m(j){return p.test(j)&&y.test(j)}const h=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function x(j){return h.lastIndex=0,h.test(j)}const _=-2147483648,C=2**31-1;function T(j){return Number.isInteger(j)&&j<=C&&j>=_}function $(j){return Number.isInteger(j)}function O(){return!0}const M=/[^\\]\\Z/;function U(j){if(M.test(j))return!1;try{return new RegExp(j),!0}catch{return!1}}})(Xj);var e$={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=Yj,r=je,n=r.operators,s={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},o={message:({keyword:a,schemaCode:c})=>(0,r.str)`should be ${s[a].okStr} ${c}`,params:({keyword:a,schemaCode:c})=>(0,r._)`{comparison: ${s[a].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(s),type:"string",schemaType:"string",$data:!0,error:o,code(a){const{gen:c,data:u,schemaCode:d,keyword:f,it:g}=a,{opts:v,self:b}=g;if(!v.validateFormats)return;const p=new t.KeywordCxt(g,b.RULES.all.format.definition,"format");p.$data?y():m();function y(){const x=c.scopeValue("formats",{ref:b.formats,code:v.code.formats}),_=c.const("fmt",(0,r._)`${x}[${p.schemaCode}]`);a.fail$data((0,r.or)((0,r._)`typeof ${_} != "object"`,(0,r._)`${_} instanceof RegExp`,(0,r._)`typeof ${_}.compare != "function"`,h(_)))}function m(){const x=p.schema,_=b.formats[x];if(!_||_===!0)return;if(typeof _!="object"||_ instanceof RegExp||typeof _.compare!="function")throw new Error(`"${f}": format "${x}" does not define "compare" function`);const C=c.scopeValue("formats",{key:x,ref:_,code:v.code.formats?(0,r._)`${v.code.formats}${(0,r.getProperty)(x)}`:void 0});a.fail$data(h(C))}function h(x){return(0,r._)`${x}.compare(${u}, ${d}) ${s[f].fail} 0`}},dependencies:["format"]};const i=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=i})(e$);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=Xj,n=e$,s=je,o=new s.Name("fullFormats"),i=new s.Name("fastFormats"),a=(u,d={keywords:!0})=>{if(Array.isArray(d))return c(u,d,r.fullFormats,o),u;const[f,g]=d.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,o],v=d.formats||r.formatNames;return c(u,v,f,g),d.keywords&&(0,n.default)(u),u};a.get=(u,d="full")=>{const g=(d==="fast"?r.fastFormats:r.fullFormats)[u];if(!g)throw new Error(`Unknown format "${u}"`);return g};function c(u,d,f,g){var v,b;(v=(b=u.opts.code).formats)!==null&&v!==void 0||(b.formats=(0,s._)`require("ajv-formats/dist/formats").${g}`);for(const p of d)u.addFormat(p,f[p])}e.exports=t=a,Object.defineProperty(t,"__esModule",{value:!0}),t.default=a})(rg,rg.exports);var iH=rg.exports;const aH=Bd(iH);function lH(){const e=new oH({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return aH(e),e}class cH{constructor(t){this._ajv=t??lH()}getValidator(t){const r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}class uH{constructor(t){this._client=t}async*callToolStream(t,r=Cc,n){const s=this._client,o={...n,task:(n==null?void 0:n.task)??(s.isToolTask(t.name)?{}:void 0)},i=s.requestStream({method:"tools/call",params:t},r,o),a=s.getToolOutputValidator(t.name);for await(const c of i){if(c.type==="result"&&a){const u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new ye(_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 ye(_e.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof ye){yield{type:"error",error:d};return}yield{type:"error",error:new ye(_e.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield c}}async getTask(t,r){return this._client.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._client.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._client.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._client.cancelTask({taskId:t},r)}requestStream(t,r,n){return this._client.requestStream(t,r,n)}}function dH(e,t,r){var n;if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!((n=e.tools)!=null&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break}}function fH(e,t,r){var n,s;if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!((n=e.sampling)!=null&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!((s=e.elicitation)!=null&&s.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break}}function Vu(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){const r=t,n=e.properties;for(const s of Object.keys(n)){const o=n[s];r[s]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(r[s]=o.default),r[s]!==void 0&&Vu(o,r[s])}}if(Array.isArray(e.anyOf))for(const r of e.anyOf)typeof r!="boolean"&&Vu(r,t);if(Array.isArray(e.oneOf))for(const r of e.oneOf)typeof r!="boolean"&&Vu(r,t)}}function hH(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};const t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}class pH extends h9{constructor(t,r){super(r),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=(r==null?void 0:r.capabilities)??{},this._jsonSchemaValidator=(r==null?void 0:r.jsonSchemaValidator)??new cH,r!=null&&r.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){var r,n,s,o,i,a;t.tools&&((n=(r=this._serverCapabilities)==null?void 0:r.tools)!=null&&n.listChanged)&&this._setupListChangedHandler("tools",LN,t.tools,async()=>(await this.listTools()).tools),t.prompts&&((o=(s=this._serverCapabilities)==null?void 0:s.prompts)!=null&&o.listChanged)&&this._setupListChangedHandler("prompts",DN,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&((a=(i=this._serverCapabilities)==null?void 0:i.resources)!=null&&a.listChanged)&&this._setupListChangedHandler("resources",MN,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new uH(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=p9(this._capabilities,t)}setRequestHandler(t,r){var a;const n=tj(t),s=n==null?void 0:n.method;if(!s)throw new Error("Schema is missing a method literal");let o;if(zf(s)){const c=s,u=(a=c._zod)==null?void 0:a.def;o=(u==null?void 0:u.value)??c.value}else{const c=s,u=c._def;o=(u==null?void 0:u.value)??c.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");const i=o;if(i==="elicitation/create"){const c=async(u,d)=>{var x,_;const f=ks(HN,u);if(!f.success){const C=f.error instanceof Error?f.error.message:String(f.error);throw new ye(_e.InvalidParams,`Invalid elicitation request: ${C}`)}const{params:g}=f.data;g.mode=g.mode??"form";const{supportsFormMode:v,supportsUrlMode:b}=hH(this._capabilities.elicitation);if(g.mode==="form"&&!v)throw new ye(_e.InvalidParams,"Client does not support form-mode elicitation requests");if(g.mode==="url"&&!b)throw new ye(_e.InvalidParams,"Client does not support URL-mode elicitation requests");const p=await Promise.resolve(r(u,d));if(g.task){const C=ks(ec,p);if(!C.success){const T=C.error instanceof Error?C.error.message:String(C.error);throw new ye(_e.InvalidParams,`Invalid task creation result: ${T}`)}return C.data}const y=ks(KN,p);if(!y.success){const C=y.error instanceof Error?y.error.message:String(y.error);throw new ye(_e.InvalidParams,`Invalid elicitation result: ${C}`)}const m=y.data,h=g.mode==="form"?g.requestedSchema:void 0;if(g.mode==="form"&&m.action==="accept"&&m.content&&h&&(_=(x=this._capabilities.elicitation)==null?void 0:x.form)!=null&&_.applyDefaults)try{Vu(h,m.content)}catch{}return m};return super.setRequestHandler(t,c)}if(i==="sampling/createMessage"){const c=async(u,d)=>{const f=ks(UN,u);if(!f.success){const m=f.error instanceof Error?f.error.message:String(f.error);throw new ye(_e.InvalidParams,`Invalid sampling request: ${m}`)}const{params:g}=f.data,v=await Promise.resolve(r(u,d));if(g.task){const m=ks(ec,v);if(!m.success){const h=m.error instanceof Error?m.error.message:String(m.error);throw new ye(_e.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}const p=g.tools||g.toolChoice?VN:qN,y=ks(p,v);if(!y.success){const m=y.error instanceof Error?y.error.message:String(y.error);throw new ye(_e.InvalidParams,`Invalid sampling result: ${m}`)}return y.data};return super.setRequestHandler(t,c)}return super.setRequestHandler(t,r)}assertCapability(t,r){var n;if(!((n=this._serverCapabilities)!=null&&n[t]))throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(await super.connect(t),t.sessionId===void 0)try{const n=await this.request({method:"initialize",params:{protocolVersion:Of,capabilities:this._capabilities,clientInfo:this._clientInfo}},$N,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!KF.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var r,n,s,o,i;switch(t){case"logging/setLevel":if(!((r=this._serverCapabilities)!=null&&r.logging))throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!((n=this._serverCapabilities)!=null&&n.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(!((s=this._serverCapabilities)!=null&&s.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(!((o=this._serverCapabilities)!=null&&o.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 r;switch(t){case"notifications/roots/list_changed":if(!((r=this._capabilities.roots)!=null&&r.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 r,n;dH((n=(r=this._serverCapabilities)==null?void 0:r.tasks)==null?void 0:n.requests,t,"Server")}assertTaskHandlerCapability(t){var r;this._capabilities&&fH((r=this._capabilities.tasks)==null?void 0:r.requests,t,"Client")}async ping(t){return this.request({method:"ping"},Oi,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},BN,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Oi,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},ay,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Rd,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},Td,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},ON,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},ry,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Oi,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Oi,r)}async callTool(t,r=Cc,n){if(this.isToolTaskRequired(t.name))throw new ye(_e.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const s=await this.request({method:"tools/call",params:t},r,n),o=this.getToolOutputValidator(t.name);if(o){if(!s.structuredContent&&!s.isError)throw new ye(_e.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(s.structuredContent)try{const i=o(s.structuredContent);if(!i.valid)throw new ye(_e.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof ye?i:new ye(_e.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return s}isToolTask(t){var r,n,s,o;return(o=(s=(n=(r=this._serverCapabilities)==null?void 0:r.tasks)==null?void 0:n.requests)==null?void 0:s.tools)!=null&&o.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const n of t){if(n.outputSchema){const o=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,o)}const s=(r=n.execution)==null?void 0:r.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(n.name),s==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){const n=await this.request({method:"tools/list",params:t},ly,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(t,r,n,s){const o=LU.safeParse(n);if(!o.success)throw new Error(`Invalid ${t} listChanged options: ${o.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);const{autoRefresh:i,debounceMs:a}=o.data,{onChanged:c}=n,u=async()=>{if(!i){c(null,null);return}try{const f=await s();c(null,f)}catch(f){const g=f instanceof Error?f:new Error(String(f));c(g,null)}},d=()=>{if(a){const f=this._listChangedDebounceTimers.get(t);f&&clearTimeout(f);const g=setTimeout(u,a);this._listChangedDebounceTimers.set(t,g)}else u()};this.setNotificationHandler(r,d)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function el(e,t){if(!e)throw new Error(t)}var yb=3e3,mH=5e3,Jh=5*60*1e3;function gH(e){const{url:t,clientName:r,clientUri:n,callbackUrl:s=typeof window<"u"?Ai(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:o="mcp:auth",clientConfig:i={},customHeaders:a={},autoRetry:c=!1,autoReconnect:u=yb,transportType:d="auto",preventAutoAuth:f=!1,onPopupWindow:g}=e,[v,b]=w.useState("discovering"),[p,y]=w.useState([]),[m,h]=w.useState([]),[x,_]=w.useState([]),[C,T]=w.useState([]),[$,O]=w.useState(void 0),[M,U]=w.useState([]),[j,k]=w.useState(void 0),L=w.useRef(null),P=w.useRef(null),B=w.useRef(null),H=w.useRef(!1),G=w.useRef(!0),q=w.useRef(0),V=w.useRef(null),z=w.useRef(v),I=w.useRef(u),F=w.useRef(null);w.useEffect(()=>{z.current=v,I.current=u},[v,u]);const N=w.useCallback((Y,me,...J)=>{const Me=J.length>0?`${me} ${J.map(ie=>JSON.stringify(ie)).join(" ")}`:me;console[Y](`[useMcp] ${Me}`),G.current&&U(ie=>[...ie.slice(-100),{level:Y,message:Me,timestamp:Date.now()}])},[]),S=w.useCallback(async(Y=!1)=>{Y||N("info","Disconnecting..."),H.current=!1,V.current&&clearTimeout(V.current),V.current=null;const me=P.current;if(L.current=null,P.current=null,G.current&&!Y&&(b("discovering"),y([]),h([]),_([]),T([]),O(void 0),k(void 0)),me)try{await me.close(),Y||N("debug","Transport closed")}catch(J){Y||N("warn","Error closing transport:",J)}},[N]),E=w.useCallback((Y,me)=>{var J;if(N("error",Y,me??""),G.current){b("failed"),O(Y);const Me=(J=B.current)==null?void 0:J.getLastAttemptedAuthUrl();Me&&(k(Me),N("info","Manual authentication URL may be available.",Me))}H.current=!1},[N]),D=w.useCallback(async()=>{if(H.current){N("debug","Connection attempt already in progress.");return}if(!G.current){N("debug","Connect called after unmount, aborting.");return}H.current=!0,q.current+=1,O(void 0),k(void 0),F.current=null,b("discovering"),N("info",`Connecting attempt #${q.current} to ${t}...`),B.current||(B.current=new wx(t,{storageKeyPrefix:o,clientName:r,clientUri:n,callbackUrl:s,preventAutoAuth:f,onPopupWindow:g}),N("debug","BrowserOAuthClientProvider initialized in connect.")),L.current||(L.current=new pH({name:i.name||"use-mcp-react-client",version:i.version||"0.1.0"},{capabilities:{}}),N("debug","MCP Client initialized in connect."));const Y=async J=>{N("info",`Attempting connection with ${J.toUpperCase()} transport...`),z.current!=="authenticating"&&b("connecting");let Me;try{el(B.current,"Auth Provider must be initialized"),el(L.current,"Client must be initialized"),P.current&&(await P.current.close().catch(He=>N("warn",`Error closing previous transport: ${He.message}`)),P.current=null);const ie={authProvider:B.current,requestInit:{headers:{Accept:"application/json, text/event-stream",...a}}},Ie=Ai(t),Pe=new URL(Ie);N("debug",`Creating ${J.toUpperCase()} transport for URL: ${Pe.toString()}`),N("debug","Transport options:",{authProvider:!!B.current,headers:a,url:Pe.toString()}),J==="http"?(N("debug","Creating StreamableHTTPClientTransport..."),Me=new u9(Pe,ie),N("debug","StreamableHTTPClientTransport created successfully")):(N("debug","Creating SSEClientTransport..."),Me=new a9(Pe,ie),N("debug","SSEClientTransport created successfully")),P.current=Me,N("debug",`${J.toUpperCase()} transport created and assigned to ref.`)}catch(ie){return E(`Failed to create ${J.toUpperCase()} transport: ${ie instanceof Error?ie.message:String(ie)}`,ie instanceof Error?ie:void 0),"failed"}Me.onmessage=ie=>{var Ie,Pe;N("debug",`[Transport] Received: ${JSON.stringify(ie)}`),(Pe=(Ie=L.current)==null?void 0:Ie.handleMessage)==null||Pe.call(Ie,ie)},Me.onerror=ie=>{N("warn",`Transport error event (${J.toUpperCase()}):`,ie),N("debug","Error details:",{message:ie.message,stack:ie.stack,name:ie.name,cause:ie.cause}),E(`Transport error (${J.toUpperCase()}): ${ie.message}`,ie)},Me.onclose=()=>{if(!G.current||H.current)return;N("info",`Transport connection closed (${F.current||"unknown"} type).`);const ie=z.current,Ie=I.current;if(ie==="ready"&&Ie){const Pe=typeof Ie=="number"?Ie:yb;N("info",`Attempting to reconnect in ${Pe}ms...`),b("connecting"),setTimeout(()=>{G.current&&D()},Pe)}else ie!=="failed"&&ie!=="authenticating"&&E("Connection closed unexpectedly.")};try{N("info",`Connecting client via ${J.toUpperCase()}...`),N("debug","About to call client.connect() with transport instance"),N("debug",`Transport instance type: ${Me.constructor.name}`),await L.current.connect(Me),N("info",`Client connected via ${J.toUpperCase()}. Loading tools, resources, and prompts...`),F.current=J,b("loading");const ie=await L.current.request({method:"tools/list"},ly);let Ie={resources:[],resourceTemplates:[]};try{Ie=await L.current.request({method:"resources/list"},Td)}catch(He){N("debug","Server does not support resources/list method",He)}let Pe={prompts:[]};try{Pe=await L.current.request({method:"prompts/list"},Rd)}catch(He){N("debug","Server does not support prompts/list method",He)}if(G.current){y(ie.tools),h(Ie.resources),_(Array.isArray(Ie.resourceTemplates)?Ie.resourceTemplates:[]),T(Pe.prompts);const He=[`Loaded ${ie.tools.length} tools`];return(Ie.resources.length>0||Ie.resourceTemplates&&Ie.resourceTemplates.length>0)&&(He.push(`${Ie.resources.length} resources`),Array.isArray(Ie.resourceTemplates)&&Ie.resourceTemplates.length>0&&He.push(`${Ie.resourceTemplates.length} resource templates`)),Pe.prompts.length>0&&He.push(`${Pe.prompts.length} prompts`),N("info",He.join(", ")+"."),b("ready"),q.current=0,"success"}else return"failed"}catch(ie){N("debug",`Client connect error via ${J.toUpperCase()}:`,ie),N("debug","Connect error details:",{message:ie instanceof Error?ie.message:String(ie),stack:ie instanceof Error?ie.stack:"N/A",name:ie instanceof Error?ie.name:"Unknown",cause:ie instanceof Error?ie.cause:void 0});const Ie=ie instanceof Error?ie:new Error(String(ie)),Pe=Ie.message,He=Pe.includes("404")||Pe.includes("Not Found"),fn=Pe.includes("405")||Pe.includes("Method Not Allowed"),Tr=Pe==="Failed to fetch"||Pe==="NetworkError when attempting to fetch resource."||Pe==="Load failed";if(J==="http"&&(He||fn||Tr))return N("warn",`HTTP transport failed (${Tr?"CORS":He?"404":"405"}).`),"fallback";if(Ie instanceof _r||Pe.includes("Unauthorized")||Pe.includes("401")){N("info","Authentication required."),el(B.current,"Auth Provider not available for auth flow");const hn=await B.current.tokens();if(f&&!hn)return N("info","Authentication required but auto-auth prevented. User action needed."),b("pending_auth"),"auth_redirect";z.current!=="authenticating"&&z.current!=="pending_auth"&&(b("authenticating"),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{},Jh));try{const xt=await nn(B.current,{serverUrl:t});if(!G.current)return"failed";if(xt==="AUTHORIZED")return N("info","Authentication successful via existing token or refresh. Re-attempting connection..."),V.current&&clearTimeout(V.current),H.current=!1,D(),"failed";if(xt==="REDIRECT")return N("info","Redirecting for authentication. Waiting for callback..."),"auth_redirect"}catch(xt){return G.current&&(V.current&&clearTimeout(V.current),E(`Failed to initiate authentication: ${xt instanceof Error?xt.message:String(xt)}`,xt instanceof Error?xt:void 0)),"failed"}}return E(`Failed to connect via ${J.toUpperCase()}: ${Pe}`,Ie),"failed"}};let me="failed";if(console.log({transportType:d}),d==="sse")N("debug","Using SSE-only transport mode"),me=await Y("sse");else if(d==="http")N("debug","Using HTTP-only transport mode"),me=await Y("http");else{N("debug","Using auto transport mode (HTTP with SSE fallback)");const J=await Y("http");if(J==="fallback"&&G.current&&z.current!=="authenticating"){N("info","HTTP failed, attempting SSE fallback...");const Me=await Y("sse");me=Me,Me==="failed"&&G.current}else me=J}(me==="success"||me==="failed")&&(H.current=!1),N("debug",`Connection sequence finished with status: ${me}`)},[N,E,S,nn,t,o,r,n,s,i.name,i.version]),K=w.useCallback(async(Y,me)=>{if(z.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${v}). Cannot call tool "${Y}".`);N("info",`Calling tool: ${Y}`,me);try{const J=await L.current.request({method:"tools/call",params:{name:Y,arguments:me}},Cc);return N("info",`Tool "${Y}" call successful:`,J),J}catch(J){N("error",`Error calling tool "${Y}": ${J instanceof Error?J.message:String(J)}`,J);const Me=J instanceof Error?J:new Error(String(J));if(Me instanceof _r||Me.message.includes("Unauthorized")||Me.message.includes("401")){N("warn","Tool call unauthorized, attempting re-authentication..."),b("authenticating"),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{},Jh);try{el(B.current,"Auth Provider not available for tool re-auth");const ie=await nn(B.current,{serverUrl:t});if(!G.current)return;ie==="AUTHORIZED"?(N("info","Re-authentication successful. Retrying tool call is recommended, or reconnecting."),V.current&&clearTimeout(V.current),H.current=!1,D()):ie==="REDIRECT"&&N("info","Redirecting for re-authentication for tool call.")}catch(ie){if(!G.current)return;V.current&&clearTimeout(V.current),E(`Re-authentication failed: ${ie instanceof Error?ie.message:String(ie)}`,ie instanceof Error?ie:void 0)}}if(z.current!=="authenticating")throw J;return}},[v,t,N,E,D]),Z=w.useCallback(()=>{z.current==="failed"?(N("info","Retry requested..."),D()):N("warn",`Retry called but state is not 'failed' (state: ${z.current}). Ignoring.`)},[N,D]),ce=w.useCallback(async()=>{var me;N("info","Manual authentication requested...");const Y=z.current;if(Y==="failed")N("info","Attempting to reconnect and authenticate via retry..."),Z();else if(Y==="pending_auth"){N("info","Proceeding with authentication from pending state..."),b("authenticating"),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{},Jh);try{el(B.current,"Auth Provider not available for manual auth");const J=await nn(B.current,{serverUrl:t});if(!G.current)return;J==="AUTHORIZED"?(N("info","Manual authentication successful. Re-attempting connection..."),V.current&&clearTimeout(V.current),H.current=!1,D()):J==="REDIRECT"&&N("info","Redirecting for manual authentication. Waiting for callback...")}catch(J){if(!G.current)return;V.current&&clearTimeout(V.current),E(`Manual authentication failed: ${J instanceof Error?J.message:String(J)}`,J instanceof Error?J:void 0)}}else if(Y==="authenticating"){N("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const J=(me=B.current)==null?void 0:me.getLastAttemptedAuthUrl();J&&!j&&(k(J),N("info","Manual authentication URL retrieved:",J))}else N("info",`Client not in a state requiring manual authentication trigger (state: ${Y}). If needed, try disconnecting and reconnecting.`)},[N,Z,j,t,E,D]),re=w.useCallback(()=>{if(B.current){const Y=B.current.clearStorage();N("info",`Cleared ${Y} item(s) from localStorage for ${t}.`),k(void 0),S()}else N("warn","Auth provider not initialized, cannot clear storage.")},[t,N,S]),X=w.useCallback(async()=>{if(z.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${v}). Cannot list resources.`);N("info","Listing resources...");try{const Y=await L.current.request({method:"resources/list"},Td);G.current&&(h(Y.resources),_(Array.isArray(Y.resourceTemplates)?Y.resourceTemplates:[]),N("info",`Listed ${Y.resources.length} resources, ${Array.isArray(Y.resourceTemplates)?Y.resourceTemplates.length:0} resource templates.`))}catch(Y){throw N("error",`Error listing resources: ${Y instanceof Error?Y.message:String(Y)}`,Y),Y}},[v,N]),ve=w.useCallback(async Y=>{if(z.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${v}). Cannot read resource "${Y}".`);N("info",`Reading resource: ${Y}`);try{const me=await L.current.request({method:"resources/read",params:{uri:Y}},ry);return N("info",`Resource "${Y}" read successfully`),me}catch(me){throw N("error",`Error reading resource "${Y}": ${me instanceof Error?me.message:String(me)}`,me),me}},[v,N]),Le=w.useCallback(async()=>{if(z.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${v}). Cannot list prompts.`);N("info","Listing prompts...");try{const Y=await L.current.request({method:"prompts/list"},Rd);G.current&&(T(Y.prompts),N("info",`Listed ${Y.prompts.length} prompts.`))}catch(Y){throw N("error",`Error listing prompts: ${Y instanceof Error?Y.message:String(Y)}`,Y),Y}},[v,N]),gt=w.useCallback(async(Y,me)=>{if(z.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${v}). Cannot get prompt "${Y}".`);N("info",`Getting prompt: ${Y}`,me);try{const J=await L.current.request({method:"prompts/get",params:{name:Y,arguments:me}},ay);return N("info",`Prompt "${Y}" retrieved successfully`),J}catch(J){throw N("error",`Error getting prompt "${Y}": ${J instanceof Error?J.message:String(J)}`,J),J}},[v,N]);return w.useEffect(()=>{const Y=me=>{var J;me.origin===window.location.origin&&((J=me.data)==null?void 0:J.type)==="mcp_auth_callback"&&(N("info","Received auth callback message.",me.data),V.current&&clearTimeout(V.current),me.data.success?(N("info","Authentication successful via popup. Reconnecting client..."),H.current=!1,D()):E(`Authentication failed in callback: ${me.data.error||"Unknown reason."}`))};return window.addEventListener("message",Y),N("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Y),N("debug","Auth callback message listener removed."),V.current&&clearTimeout(V.current)}},[N,E,D]),w.useEffect(()=>(G.current=!0,N("debug","useMcp mounted, initiating connection."),q.current=0,(!B.current||B.current.serverUrl!==t)&&(B.current=new wx(t,{storageKeyPrefix:o,clientName:r,clientUri:n,callbackUrl:s,preventAutoAuth:f,onPopupWindow:g}),N("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),D(),()=>{G.current=!1,N("debug","useMcp unmounting, disconnecting."),S(!0)}),[t,o,s,r,n,i.name,i.version,D,S]),w.useEffect(()=>{let Y=null;if(v==="failed"&&c&&q.current>0){const me=typeof c=="number"?c:mH;N("info",`Connection failed, auto-retrying in ${me}ms...`),Y=setTimeout(()=>{G.current&&z.current==="failed"&&Z()},me)}return()=>{Y&&clearTimeout(Y)}},[v,c,Z,N]),{state:v,tools:p,resources:m,resourceTemplates:x,prompts:C,error:$,log:M,authUrl:j,callTool:K,listResources:X,readResource:ve,listPrompts:Le,getPrompt:gt,retry:Z,disconnect:S,authenticate:ce,clearStorage:re}}function vH({service:e,autoConnect:t=!1,onConnected:r,onError:n}){const{toast:s}=ir(),{state:o,tools:i,resources:a,prompts:c,error:u,authUrl:d,callTool:f,readResource:g,listResources:v,getPrompt:b,listPrompts:p,retry:y,disconnect:m,authenticate:h,clearStorage:x}=gH({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}),_=o==="ready",C=o==="connecting"||o==="loading",T=o==="authenticating"||o==="pending_auth",$=o==="failed";return yn.useEffect(()=>{_&&r&&(r(),s({title:"Connected to MCP service",description:`Successfully connected to ${e.name}`}))},[_,r,e.name,s]),yn.useEffect(()=>{$&&u&&n&&(n(u),s({title:"MCP connection failed",description:u,variant:"destructive"}))},[$,u,n,s]),{isConnected:_,isConnecting:C,isAuthenticating:T,hasError:$,error:u,tools:i,resources:a,prompts:c,connect:()=>{y()},disconnect:m,retry:y,authenticate:h,callTool:async(L,P)=>{try{return await f(L,P)}catch(B){const H=B instanceof Error?B.message:"Unknown error";throw s({title:"Tool call failed",description:H,variant:"destructive"}),B}},readResource:async L=>{try{return await g(L)}catch(P){const B=P instanceof Error?P.message:"Unknown error";throw s({title:"Resource read failed",description:B,variant:"destructive"}),P}},listResources:async()=>{try{await v()}catch(L){const P=L instanceof Error?L.message:"Unknown error";throw s({title:"Resource listing failed",description:P,variant:"destructive"}),L}},getPrompt:async(L,P)=>{try{return await b(L,P)}catch(B){const H=B instanceof Error?B.message:"Unknown error";throw s({title:"Prompt retrieval failed",description:H,variant:"destructive"}),B}},listPrompts:async()=>{try{await p()}catch(L){const P=L instanceof Error?L.message:"Unknown error";throw s({title:"Prompt listing failed",description:P,variant:"destructive"}),L}},authUrl:d,clearStorage:x}}function yH(){const[e,t]=w.useState("https://api.githubcopilot.com/mcp"),[r,n]=w.useState("get_me"),[s,o]=w.useState("{}"),[i,a]=w.useState(""),c={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:g,error:v,tools:b,resources:p,prompts:y,connect:m,disconnect:h,retry:x,authenticate:_,callTool:C,authUrl:T,clearStorage:$}=vH({service:c,autoConnect:!1,onConnected:()=>{console.log("Connected to test MCP service")},onError:j=>{console.error("Test MCP service error:",j)}}),M=d?{status:"connecting",icon:qw,color:"text-yellow-500"}:f?{status:"authenticating",icon:Jc,color:"text-blue-500"}:u?{status:"connected",icon:am,color:"text-green-500"}:g?{status:"error",icon:Fw,color:"text-red-500"}:{status:"disconnected",icon:Fw,color:"text-gray-500"},U=async()=>{try{let j={};s.trim()&&(j=JSON.parse(s));const k=await C(r,j);a(JSON.stringify(k,null,2))}catch(j){a(`Error: ${j instanceof Error?j.message:"Unknown error"}`)}};return l.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[l.jsxs("div",{className:"text-center",children:[l.jsx("h1",{className:"text-3xl font-bold mb-2",children:"use-mcp Integration Test"}),l.jsx("p",{className:"text-muted-foreground",children:"Testing the new use-mcp library integration with OAuth support"})]}),l.jsxs(_s,{children:[l.jsxs(So,{children:[l.jsxs(ko,{className:"flex items-center gap-2",children:[l.jsx(M.icon,{className:`w-5 h-5 ${M.color}`}),"Connection Status: ",M.status]}),l.jsx(Au,{children:"Current connection state and available actions"})]}),l.jsxs(Ss,{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(Oe,{children:"Service URL"}),l.jsx(Be,{value:e,onChange:j=>t(j.target.value),placeholder:"Enter MCP service URL"})]}),l.jsxs("div",{className:"flex gap-2",children:[!u&&!d&&l.jsx(le,{onClick:m,children:"Connect"}),u&&l.jsx(le,{onClick:h,variant:"outline",children:"Disconnect"}),g&&l.jsxs(le,{onClick:x,variant:"outline",children:[l.jsx(qw,{className:"w-4 h-4 mr-1"}),"Retry"]}),T&&!u&&l.jsxs(le,{onClick:_,variant:"outline",children:[l.jsx(Jc,{className:"w-4 h-4 mr-1"}),"Authenticate"]})]})]}),v&&l.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[l.jsx(K1,{className:"w-4 h-4 text-destructive"}),l.jsx("span",{className:"text-sm text-destructive",children:v})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[l.jsxs(_s,{children:[l.jsx(So,{children:l.jsxs(ko,{className:"flex items-center gap-2",children:[l.jsx(vd,{className:"w-4 h-4"}),"Tools (",b.length,")"]})}),l.jsx(Ss,{children:b.length===0?l.jsx("p",{className:"text-sm text-muted-foreground",children:u?"No tools available":"Connect to see tools"}):l.jsxs("div",{className:"space-y-2",children:[b.slice(0,5).map((j,k)=>l.jsx("div",{className:"text-sm",children:l.jsx(mn,{variant:"outline",className:"text-xs",children:j.name})},k)),b.length>5&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",b.length-5," more tools"]})]})})]}),l.jsxs(_s,{children:[l.jsx(So,{children:l.jsxs(ko,{children:["Resources (",p.length,")"]})}),l.jsx(Ss,{children:l.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${p.length} resources available`:"Connect to see resources"})})]}),l.jsxs(_s,{children:[l.jsx(So,{children:l.jsxs(ko,{children:["Prompts (",y.length,")"]})}),l.jsx(Ss,{children:l.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${y.length} prompts available`:"Connect to see prompts"})})]})]}),u&&l.jsxs(_s,{children:[l.jsxs(So,{children:[l.jsx(ko,{children:"Test Tool Call"}),l.jsx(Au,{children:"Test calling a tool on the connected MCP service"})]}),l.jsxs(Ss,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"toolName",children:"Tool Name"}),l.jsx(Be,{id:"toolName",value:r,onChange:j=>n(j.target.value),placeholder:"e.g., get_me"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"toolArgs",children:"Arguments (JSON)"}),l.jsx(Be,{id:"toolArgs",value:s,onChange:j=>o(j.target.value),placeholder:'{"key": "value"}'})]})]}),l.jsxs(le,{onClick:U,disabled:!u,children:[l.jsx(Q2,{className:"w-4 h-4 mr-1"}),"Call Tool"]}),i&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{children:"Result"}),l.jsx(Zn,{value:i,readOnly:!0,rows:10,className:"font-mono text-sm"})]})]})]}),T&&l.jsxs(_s,{children:[l.jsxs(So,{children:[l.jsxs(ko,{className:"flex items-center gap-2",children:[l.jsx(Jc,{className:"w-4 h-4"}),"OAuth Authentication"]}),l.jsx(Au,{children:"This service requires OAuth authentication"})]}),l.jsxs(Ss,{className:"space-y-4",children:[l.jsx("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-md",children:l.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.'})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(le,{onClick:_,variant:"outline",children:[l.jsx(Jc,{className:"w-4 h-4 mr-1"}),"Start OAuth Flow"]}),l.jsx(le,{onClick:$,variant:"outline",children:"Clear OAuth Data"})]})]})]})]})}function wH(){return l.jsxs(iR,{children:[l.jsx(Wc,{path:"/",component:DD}),l.jsx(Wc,{path:"/oauth/callback",component:FD}),l.jsx(Wc,{path:"/mcp-test",component:yH}),l.jsx(Wc,{component:LD})]})}function xH(){return l.jsx(NR,{client:qR,children:l.jsxs(wO,{children:[l.jsx(OI,{}),l.jsx(wH,{})]})})}US(document.getElementById("root")).render(l.jsx(w.StrictMode,{children:l.jsx(xH,{})}));